Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator test fixes for Python 3.12 version upgrade #109

Merged
merged 6 commits into from
Dec 11, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 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]
kc611 marked this conversation as resolved.
Show resolved Hide resolved


class Simulator:
Expand Down Expand Up @@ -327,8 +330,13 @@ def op_FOR_ITER(self, inst):
try:
ind = next(tos)
except StopIteration:
self.stack.pop()
self.branch = True
if PYVERSION in ((3, 11),):
self.stack.pop()
elif PYVERSION in ((3, 12),):
self.stack.append(None)
else:
raise NotImplementedError(PYVERSION)
else:
self.branch = False
self.stack.append(ind)
Expand Down Expand Up @@ -427,3 +435,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()
kc611 marked this conversation as resolved.
Show resolved Hide resolved

kc611 marked this conversation as resolved.
Show resolved Hide resolved
def op_COPY(self, inst):
assert inst.argval > 0
self.stack.append(self.stack[-inst.argval])
Loading