diff --git a/numba_rvsdg/core/utils.py b/numba_rvsdg/core/utils.py index 08940db..3dbf6ba 100644 --- a/numba_rvsdg/core/utils.py +++ b/numba_rvsdg/core/utils.py @@ -1,7 +1,10 @@ import logging +import sys _logger = logging.getLogger(__name__) +PYVERSION = sys.version_info[:2] + class _LogWrap: def __init__(self, fn): # type: ignore diff --git a/numba_rvsdg/tests/simulator.py b/numba_rvsdg/tests/simulator.py index 16e9e77..7e0ff3d 100644 --- a/numba_rvsdg/tests/simulator.py +++ b/numba_rvsdg/tests/simulator.py @@ -8,6 +8,7 @@ RegionBlock, SyntheticBlock, ) +from numba_rvsdg.core.utils import PYVERSION import builtins @@ -327,8 +328,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) @@ -427,3 +433,18 @@ 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() + + if PYVERSION in ((3, 12),): + + def op_END_FOR(self, inst): + self.stack.pop() + self.stack.pop() + + else: + + def op_END_FOR(self, inst): + raise NotImplementedError(PYVERSION) + + def op_COPY(self, inst): + assert inst.argval > 0 + self.stack.append(self.stack[-inst.argval])