1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
From 38eeb99dc3c2d359169c2b645f7d4462c9fcb520 Mon Sep 17 00:00:00 2001
Origin: https://github.com/numba/numba/pull/8590
From: Siu Kwan Lam <1929845+sklam@users.noreply.github.com>
Date: Wed, 9 Nov 2022 16:58:32 -0600
Subject: [PATCH 04/14] Fix test_flow_control for py3.11
---
numba/core/controlflow.py | 7 +++++++
numba/tests/test_flow_control.py | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/numba/core/controlflow.py b/numba/core/controlflow.py
index 70fc5e799ec..9085a9d7bab 100644
--- a/numba/core/controlflow.py
+++ b/numba/core/controlflow.py
@@ -927,6 +927,11 @@ def _op_ABSOLUTE_JUMP_IF(self, inst):
op_JUMP_IF_FALSE = _op_ABSOLUTE_JUMP_IF
op_JUMP_IF_TRUE = _op_ABSOLUTE_JUMP_IF
+ op_POP_JUMP_FORWARD_IF_FALSE = _op_ABSOLUTE_JUMP_IF
+ op_POP_JUMP_BACKWARD_IF_FALSE = _op_ABSOLUTE_JUMP_IF
+ op_POP_JUMP_FORWARD_IF_TRUE = _op_ABSOLUTE_JUMP_IF
+ op_POP_JUMP_BACKWARD_IF_TRUE = _op_ABSOLUTE_JUMP_IF
+
def _op_ABSOLUTE_JUMP_OR_POP(self, inst):
self.jump(inst.get_jump_target())
self.jump(inst.next, pops=1)
@@ -943,6 +948,8 @@ def op_JUMP_FORWARD(self, inst):
self.jump(inst.get_jump_target())
self._force_new_block = True
+ op_JUMP_BACKWARD = op_JUMP_FORWARD
+
def op_RETURN_VALUE(self, inst):
self._curblock.terminating = True
self._force_new_block = True
diff --git a/numba/tests/test_flow_control.py b/numba/tests/test_flow_control.py
index e3fb514a166..1a5bf966a94 100644
--- a/numba/tests/test_flow_control.py
+++ b/numba/tests/test_flow_control.py
@@ -4,7 +4,7 @@
from numba.core.controlflow import CFGraph, ControlFlowAnalysis
from numba.core.compiler import compile_isolated, Flags
from numba.core import types
-from numba.core.bytecode import FunctionIdentity, ByteCode
+from numba.core.bytecode import FunctionIdentity, ByteCode, _fix_LOAD_GLOBAL_arg
from numba.core.utils import PYVERSION
from numba.tests.support import TestCase
@@ -1116,7 +1116,7 @@ def _scan_namedblocks(self, bc, cfa):
for inst in bc:
# Find LOAD_GLOBAL that refers to "SET_BLOCK_<name>"
if inst.opname == 'LOAD_GLOBAL':
- gv = bc.co_names[inst.arg]
+ gv = bc.co_names[_fix_LOAD_GLOBAL_arg(inst.arg)]
if gv.startswith(prefix):
name = gv[len(prefix):]
# Find the block where this instruction resides
|