diff --git a/numba_cuda/numba/cuda/core/byteflow.py b/numba_cuda/numba/cuda/core/byteflow.py index 46eef06f9..82e535048 100644 --- a/numba_cuda/numba/cuda/core/byteflow.py +++ b/numba_cuda/numba/cuda/core/byteflow.py @@ -1835,11 +1835,11 @@ def op_MAKE_FUNCTION(self, state, inst, MAKE_CLOSURE=False): else: raise NotImplementedError(PYVERSION) code = state.pop() - closure = annotations = kwdefaults = defaults = None + closure = annotations = annotate = kwdefaults = defaults = None if PYVERSION in ((3, 13), (3, 14)): assert inst.arg is None # SET_FUNCTION_ATTRIBUTE is responsible for setting - # closure, annotations, kwdefaults and defaults. + # closure, annotations, annotate, kwdefaults and defaults. else: if inst.arg & 0x8: closure = state.pop() @@ -1856,6 +1856,7 @@ def op_MAKE_FUNCTION(self, state, inst, MAKE_CLOSURE=False): code=code, closure=closure, annotations=annotations, + annotate=annotate, kwdefaults=kwdefaults, defaults=defaults, res=res, @@ -1866,19 +1867,23 @@ def op_SET_FUNCTION_ATTRIBUTE(self, state, inst): assert PYVERSION in ((3, 13), (3, 14)) make_func_stack = state.pop() data = state.pop() - if inst.arg == 0x1: + if inst.arg & 0x01: # 0x01 a tuple of default values for positional-only and # positional-or-keyword parameters in positional order state.set_function_attribute(make_func_stack, defaults=data) - elif inst.arg & 0x2: + elif inst.arg & 0x02: # 0x02 a tuple of strings containing parameters’ annotations state.set_function_attribute(make_func_stack, kwdefaults=data) - elif inst.arg & 0x4: + elif inst.arg & 0x04: # 0x04 a tuple of strings containing parameters’ annotations state.set_function_attribute(make_func_stack, annotations=data) - elif inst.arg == 0x8: + elif inst.arg & 0x08: # 0x08 a tuple containing cells for free variables, making a closure state.set_function_attribute(make_func_stack, closure=data) + elif inst.arg & 0x10: + # In 3.14 a new flag was added it has the value 0x10/16 + # Numba report: https://github.com/numba/numba/issues/10319 + state.set_function_attribute(make_func_stack, annotate=data) else: raise AssertionError("unreachable") state.push(make_func_stack) diff --git a/numba_cuda/numba/cuda/core/interpreter.py b/numba_cuda/numba/cuda/core/interpreter.py index 2db457e7a..ae652d62c 100644 --- a/numba_cuda/numba/cuda/core/interpreter.py +++ b/numba_cuda/numba/cuda/core/interpreter.py @@ -3504,10 +3504,21 @@ def op_YIELD_VALUE(self, inst, value, res): return self.store(inst, res) def op_MAKE_FUNCTION( - self, inst, name, code, closure, annotations, kwdefaults, defaults, res + self, + inst, + name, + code, + closure, + annotations, + annotate, + kwdefaults, + defaults, + res, ): # annotations are ignored by numba but useful for static analysis # re. https://github.com/numba/numba/issues/7269 + # annotate is ignored too + # re. https://github.com/numba/numba/pull/10321 if kwdefaults is not None: msg = "op_MAKE_FUNCTION with kwdefaults is not implemented" raise NotImplementedError(msg)