Skip to content

Commit

Permalink
Simulator test fixes for Python 3.12 version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kc611 committed Nov 23, 2023
1 parent 6d90d14 commit 66cb4d0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion numba_rvsdg/tests/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
)

import builtins
import sys

PYVERSION = sys.version_info[:2]


class Simulator:
Expand Down Expand Up @@ -327,8 +330,11 @@ def op_FOR_ITER(self, inst):
try:
ind = next(tos)
except StopIteration:
self.stack.pop()
self.branch = True
if PYVERSION <= (3, 11):
self.stack.pop()
else:
self.stack.append(None)
else:
self.branch = False
self.stack.append(ind)
Expand Down Expand Up @@ -427,3 +433,11 @@ def op_POP_JUMP_FORWARD_IF_NONE(self, inst):
def op_POP_JUMP_BACKWARD_IF_NONE(self, inst):
self.branch = self.stack[-1] is None
self.stack.pop()

def op_END_FOR(self, inst):
self.stack.pop()
self.stack.pop()

def op_COPY(self, inst):
assert inst.argval > 0
self.stack.append(self.stack[-inst.argval])

0 comments on commit 66cb4d0

Please sign in to comment.