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
|
From: Siu Kwan Lam <1929845+sklam@users.noreply.github.com>
Origin: https://github.com/numba/numba/pull/8545
Date: Wed, 14 Sep 2022 16:07:28 -0500
Subject: Partially support MAKE_FUNCTION
Not sure why MakeFunctionToJitFunction is picking up the <listcomp> in the failing test:
- numba.tests.test_looplifting.TestLoopLiftingInAction.test_lift_listcomp_block0
---
numba/core/byteflow.py | 5 ++++-
numba/core/ir_utils.py | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/numba/core/byteflow.py b/numba/core/byteflow.py
index e467a17..388efb7 100644
--- a/numba/core/byteflow.py
+++ b/numba/core/byteflow.py
@@ -1183,7 +1183,10 @@ class TraceRunner(object):
op_BINARY_XOR = _binaryop
def op_MAKE_FUNCTION(self, state, inst, MAKE_CLOSURE=False):
- name = state.pop()
+ if PYVERSION >= (3, 11):
+ name = None
+ else:
+ name = state.pop()
code = state.pop()
closure = annotations = kwdefaults = defaults = None
if PYVERSION < (3, 6):
diff --git a/numba/core/ir_utils.py b/numba/core/ir_utils.py
index 9d58bc5..6cd644c 100644
--- a/numba/core/ir_utils.py
+++ b/numba/core/ir_utils.py
@@ -1717,6 +1717,8 @@ def _create_function_from_code_obj(fcode, func_env, func_arg, func_clo, glbls):
* func_clo - string for the closure args
* glbls - the function globals
"""
+ # in py3.11, func_arg contains '.'
+ func_arg = func_arg.replace('.', '_')
sanitized_co_name = fcode.co_name.replace('<', '_').replace('>', '_')
func_text = (f"def closure():\n{func_env}\n"
f"\tdef {sanitized_co_name}({func_arg}):\n"
|