after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def op_LOAD_CONST(self, inst, res): value = self.code_consts[inst.arg] if isinstance(value, tuple): st = [] for x in value: nm = "$const_%s" % str(x) val_const = ir.Const(x, loc=self.loc) target = self.store(val_const, name=nm, redefine=True) st.append(target) const = ir.Expr.build_tuple(st, loc=self.loc) else: const = ir.Const(value, loc=self.loc) self.store(const, res)
def op_LOAD_CONST(self, inst, res): value = self.code_consts[inst.arg] const = ir.Const(value, loc=self.loc) self.store(const, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_BEGIN_FINALLY(self, inst, temps): # The *temps* are the exception variables const_none = ir.Const(None, loc=self.loc) for tmp in temps: # Set to None for now self.store(const_none, name=tmp) self._exception_vars.add(tmp)
def op_BEGIN_FINALLY(self, inst, state): "no-op" none = ir.Const(None, loc=self.loc) self.store(value=none, name=state)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_BUILD_CONST_KEY_MAP(self, inst, keys, keytmps, values, res): # Unpack the constant key-tuple and reused build_map which takes # a sequence of (key, value) pair. keyvar = self.get(keys) # TODO: refactor this pattern. occurred several times. for inst in self.current_block.body: if isinstance(inst, ir.Assign) and inst.target is keyvar: self.current_block.remove(inst) # scan up the block looking for the values, remove them # and find their name strings named_items = [] for x in inst.value.items: for y in self.current_block.body[::-1]: if x == y.target: self.current_block.remove(y) named_items.append(y.value.value) break keytup = named_items break assert len(keytup) == len(values) keyconsts = [ir.Const(value=x, loc=self.loc) for x in keytup] for kval, tmp in zip(keyconsts, keytmps): self.store(kval, tmp) items = list(zip(map(self.get, keytmps), map(self.get, values))) expr = ir.Expr.build_map(items=items, size=2, loc=self.loc) self.store(expr, res)
def op_BUILD_CONST_KEY_MAP(self, inst, keys, keytmps, values, res): # Unpack the constant key-tuple and reused build_map which takes # a sequence of (key, value) pair. keyvar = self.get(keys) # TODO: refactor this pattern. occurred several times. for inst in self.current_block.body: if isinstance(inst, ir.Assign) and inst.target is keyvar: self.current_block.remove(inst) keytup = inst.value.value break assert len(keytup) == len(values) keyconsts = [ir.Const(value=x, loc=self.loc) for x in keytup] for kval, tmp in zip(keyconsts, keytmps): self.store(kval, tmp) items = list(zip(map(self.get, keytmps), map(self.get, values))) expr = ir.Expr.build_map(items=items, size=2, loc=self.loc) self.store(expr, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_POP_BLOCK(self, inst, kind=None): if kind is None: self.syntax_blocks.pop() elif kind == "try": self._insert_try_block_end()
def op_POP_BLOCK(self, inst): self.syntax_blocks.pop()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_COMPARE_OP(self, inst, lhs, rhs, res): op = dis.cmp_op[inst.arg] if op == "in" or op == "not in": lhs, rhs = rhs, lhs if op == "not in": self._binop("in", lhs, rhs, res) tmp = self.get(res) out = ir.Expr.unary("not", value=tmp, loc=self.loc) self.store(out, res) elif op == "exception match": gv_fn = ir.Global( "exception_match", eh.exception_match, loc=self.loc, ) exc_match_name = "$exc_match" self.store(value=gv_fn, name=exc_match_name, redefine=True) lhs = self.get(lhs) rhs = self.get(rhs) exc = ir.Expr.call( self.get(exc_match_name), args=(lhs, rhs), kws=(), loc=self.loc, ) self.store(exc, res) else: self._binop(op, lhs, rhs, res)
def op_COMPARE_OP(self, inst, lhs, rhs, res): op = dis.cmp_op[inst.arg] if op == "in" or op == "not in": lhs, rhs = rhs, lhs if op == "not in": self._binop("in", lhs, rhs, res) tmp = self.get(res) out = ir.Expr.unary("not", value=tmp, loc=self.loc) self.store(out, res) else: self._binop(op, lhs, rhs, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_RAISE_VARARGS(self, inst, exc): if exc is not None: exc = self.get(exc) tryblk = self.dfainfo.active_try_block if tryblk is not None: # In a try block stmt = ir.TryRaise(exception=exc, loc=self.loc) self.current_block.append(stmt) self._insert_try_block_end() self.current_block.append(ir.Jump(tryblk["end"], loc=self.loc)) else: # Not in a try block stmt = ir.Raise(exception=exc, loc=self.loc) self.current_block.append(stmt)
def op_RAISE_VARARGS(self, inst, exc): if exc is not None: exc = self.get(exc) stmt = ir.Raise(exception=exc, loc=self.loc) self.current_block.append(stmt)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_MAKE_FUNCTION( self, inst, name, code, closure, annotations, kwdefaults, defaults, res ): if annotations != None: raise NotImplementedError( "op_MAKE_FUNCTION with annotations is not implemented" ) if kwdefaults != None: raise NotImplementedError("op_MAKE_FUNCTION with kwdefaults is not implemented") if defaults: if isinstance(defaults, tuple): defaults = tuple([self.get(name) for name in defaults]) else: defaults = self.get(defaults) assume_code_const = self.definitions[code][0] if not isinstance(assume_code_const, ir.Const): msg = ( "Unsupported use of closure. " "Probably caused by complex control-flow constructs; " "e.g. try-except" ) raise errors.UnsupportedError(msg, loc=self.loc) fcode = assume_code_const.value if name: name = self.get(name) if closure: closure = self.get(closure) expr = ir.Expr.make_function(name, fcode, closure, defaults, self.loc) self.store(expr, res)
def op_MAKE_FUNCTION( self, inst, name, code, closure, annotations, kwdefaults, defaults, res ): if annotations != None: raise NotImplementedError( "op_MAKE_FUNCTION with annotations is not implemented" ) if kwdefaults != None: raise NotImplementedError("op_MAKE_FUNCTION with kwdefaults is not implemented") if defaults: if isinstance(defaults, tuple): defaults = tuple([self.get(name) for name in defaults]) else: defaults = self.get(defaults) fcode = self.definitions[code][0].value if name: name = self.get(name) if closure: closure = self.get(closure) expr = ir.Expr.make_function(name, fcode, closure, defaults, self.loc) self.store(expr, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def op_CALL_FUNCTION_KW(self, inst, func, args, names, res): func = self.get(func) args = [self.get(x) for x in args] # Find names const names = self.get(names) for inst in self.current_block.body: if isinstance(inst, ir.Assign) and inst.target is names: self.current_block.remove(inst) # scan up the block looking for the values, remove them # and find their name strings named_items = [] for x in inst.value.items: for y in self.current_block.body[::-1]: if x == y.target: self.current_block.remove(y) named_items.append(y.value.value) break keys = named_items break nkeys = len(keys) posvals = args[:-nkeys] kwvals = args[-nkeys:] keyvalues = list(zip(keys, kwvals)) expr = ir.Expr.call(func, posvals, keyvalues, loc=self.loc) self.store(expr, res)
def op_CALL_FUNCTION_KW(self, inst, func, args, names, res): func = self.get(func) args = [self.get(x) for x in args] # Find names const names = self.get(names) for inst in self.current_block.body: if isinstance(inst, ir.Assign) and inst.target is names: self.current_block.remove(inst) keys = inst.value.value break nkeys = len(keys) posvals = args[:-nkeys] kwvals = args[-nkeys:] keyvalues = list(zip(keys, kwvals)) expr = ir.Expr.call(func, posvals, keyvalues, loc=self.loc) self.store(expr, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def dump(self, file=None): from numba.six import StringIO nofile = file is None # Avoid early bind of sys.stdout as default value file = file or StringIO() for offset, block in sorted(self.blocks.items()): print("label %s:" % (offset,), file=file) block.dump(file=file) if nofile: text = file.getvalue() if config.HIGHLIGHT_DUMPS: try: import pygments except ImportError: msg = "Please install pygments to see highlighted dumps" raise ValueError(msg) else: from pygments import highlight from pygments.lexers import DelphiLexer as lexer from pygments.formatters import Terminal256Formatter print(highlight(text, lexer(), Terminal256Formatter())) else: print(text)
def dump(self, file=None): # Avoid early bind of sys.stdout as default value file = file or sys.stdout for offset, block in sorted(self.blocks.items()): print("label %s:" % (offset,), file=file) block.dump(file=file)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def render_dot(self, filename_prefix="numba_ir", include_ir=True): """Render the CFG of the IR with GraphViz DOT via the ``graphviz`` python binding. Returns ------- g : graphviz.Digraph Use `g.view()` to open the graph in the default PDF application. """ try: import graphviz as gv except ImportError: raise ImportError( "The feature requires `graphviz` but it is not available. " "Please install with `pip install graphviz`" ) g = gv.Digraph( filename="{}{}.dot".format( filename_prefix, self.func_id.unique_name, ) ) # Populate the nodes for k, blk in self.blocks.items(): with StringIO() as sb: blk.dump(sb) label = sb.getvalue() if include_ir: label = "".join( [" {}\l".format(x) for x in label.splitlines()], ) label = "block {}\l".format(k) + label g.node(str(k), label=label, shape="rect") else: label = "{}\l".format(k) g.node(str(k), label=label, shape="circle") # Populate the edges for src, blk in self.blocks.items(): for dst in blk.terminator.get_targets(): g.edge(str(src), str(dst)) return g
def render_dot(self, filename_prefix="numba_ir"): """Render the CFG of the IR with GraphViz DOT via the ``graphviz`` python binding. Returns ------- g : graphviz.Digraph Use `g.view()` to open the graph in the default PDF application. """ try: import graphviz as gv except ImportError: raise ImportError( "The feature requires `graphviz` but it is not available. " "Please install with `pip install graphviz`" ) g = gv.Digraph( filename="{}{}.dot".format( filename_prefix, self.func_id.unique_name, ) ) # Populate the nodes for k, blk in self.blocks.items(): with StringIO() as sb: blk.dump(sb) label = sb.getvalue() label = "".join( [" {}\l".format(x) for x in label.splitlines()], ) label = "block {}\l".format(k) + label g.node(str(k), label=label, shape="rect") # Populate the edges for src, blk in self.blocks.items(): for dst in blk.terminator.get_targets(): g.edge(str(src), str(dst)) return g
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def visit_vars_inner(node, callback, cbdata): if isinstance(node, ir.Var): return callback(node, cbdata) elif isinstance(node, list): return [visit_vars_inner(n, callback, cbdata) for n in node] elif isinstance(node, tuple): return tuple([visit_vars_inner(n, callback, cbdata) for n in node]) elif isinstance(node, ir.Expr): # if node.op in ['binop', 'inplace_binop']: # lhs = node.lhs.name # rhs = node.rhs.name # node.lhs.name = callback, cbdata.get(lhs, lhs) # node.rhs.name = callback, cbdata.get(rhs, rhs) for arg in node._kws.keys(): node._kws[arg] = visit_vars_inner(node._kws[arg], callback, cbdata) elif isinstance(node, ir.Yield): node.value = visit_vars_inner(node.value, callback, cbdata) return node
def visit_vars_inner(node, callback, cbdata): if isinstance(node, ir.Var): return callback(node, cbdata) elif isinstance(node, list): return [visit_vars_inner(n, callback, cbdata) for n in node] elif isinstance(node, tuple): return tuple([visit_vars_inner(n, callback, cbdata) for n in node]) elif isinstance(node, ir.Expr): # if node.op in ['binop', 'inplace_binop']: # lhs = node.lhs.name # rhs = node.rhs.name # node.lhs.name = callback, cbdata.get(lhs, lhs) # node.rhs.name = callback, cbdata.get(rhs, rhs) for arg in node._kws.keys(): node._kws[arg] = visit_vars_inner(node._kws[arg], callback, cbdata) return node
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def find_topo_order(blocks, cfg=None): """find topological order of blocks such that true branches are visited first (e.g. for_break test in test_dataflow). """ if cfg is None: cfg = compute_cfg_from_blocks(blocks) post_order = [] seen = set() def _dfs_rec(node): if node not in seen: seen.add(node) succs = cfg._succs[node] last_inst = blocks[node].body[-1] if isinstance(last_inst, ir.Branch): succs = [last_inst.falsebr, last_inst.truebr] for dest in succs: if (node, dest) not in cfg._back_edges: _dfs_rec(dest) post_order.append(node) _dfs_rec(cfg.entry_point()) post_order.reverse() return post_order
def find_topo_order(blocks, cfg=None): """find topological order of blocks such that true branches are visited first (e.g. for_break test in test_dataflow). """ if cfg == None: cfg = compute_cfg_from_blocks(blocks) post_order = [] seen = set() def _dfs_rec(node): if node not in seen: seen.add(node) succs = cfg._succs[node] last_inst = blocks[node].body[-1] if isinstance(last_inst, ir.Branch): succs = [last_inst.falsebr, last_inst.truebr] for dest in succs: if (node, dest) not in cfg._back_edges: _dfs_rec(dest) post_order.append(node) _dfs_rec(cfg.entry_point()) post_order.reverse() return post_order
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def merge_adjacent_blocks(blocks): cfg = compute_cfg_from_blocks(blocks) # merge adjacent blocks removed = set() for label in list(blocks.keys()): if label in removed: continue block = blocks[label] succs = list(cfg.successors(label)) while True: if len(succs) != 1: break next_label = succs[0][0] if next_label in removed: break preds = list(cfg.predecessors(next_label)) succs = list(cfg.successors(next_label)) if len(preds) != 1 or preds[0][0] != label: break next_block = blocks[next_label] # XXX: commented out since scope objects are not consistent # throughout the compiler. for example, pieces of code are compiled # and inlined on the fly without proper scope merge. # if block.scope != next_block.scope: # break # merge block.body.pop() # remove Jump block.body += next_block.body del blocks[next_label] removed.add(next_label) label = next_label
def merge_adjacent_blocks(blocks): cfg = compute_cfg_from_blocks(blocks) # merge adjacent blocks removed = set() for label in list(blocks.keys()): if label in removed: continue block = blocks[label] succs = list(cfg.successors(label)) while True: if len(succs) != 1: break next_label = succs[0][0] if next_label in removed: break preds = list(cfg.predecessors(next_label)) succs = list(cfg.successors(next_label)) if len(preds) != 1 or preds[0][0] != label: break next_block = blocks[next_label] # XXX: commented out since scope objects are not consistent # thoughout the compiler. for example, pieces of code are compiled # and inlined on the fly without proper scope merge. # if block.scope != next_block.scope: # break # merge block.body.pop() # remove Jump block.body += next_block.body del blocks[next_label] removed.add(next_label) label = next_label
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def convert_code_obj_to_function(code_obj, caller_ir): """ Converts a code object from a `make_function.code` attr in the IR into a python function, caller_ir is the FunctionIR of the caller and is used for the resolution of freevars. """ fcode = code_obj.code nfree = len(fcode.co_freevars) # try and resolve freevars if they are consts in the caller's IR # these can be baked into the new function freevars = [] for x in fcode.co_freevars: # not using guard here to differentiate between multiple definition and # non-const variable try: freevar_def = caller_ir.get_definition(x) except KeyError: msg = ( "Cannot capture a constant value for variable '%s' as there " "are multiple definitions present." % x ) raise TypingError(msg, loc=code_obj.loc) if isinstance(freevar_def, ir.Const): freevars.append(freevar_def.value) else: msg = ( "Cannot capture the non-constant value associated with " "variable '%s' in a function that will escape." % x ) raise TypingError(msg, loc=code_obj.loc) func_env = "\n".join([" c_%d = %s" % (i, x) for i, x in enumerate(freevars)]) func_clo = ",".join(["c_%d" % i for i in range(nfree)]) co_varnames = list(fcode.co_varnames) # This is horrible. The code object knows about the number of args present # it also knows the name of the args but these are bundled in with other # vars in `co_varnames`. The make_function IR node knows what the defaults # are, they are defined in the IR as consts. The following finds the total # number of args (args + kwargs with defaults), finds the default values # and infers the number of "kwargs with defaults" from this and then infers # the number of actual arguments from that. n_kwargs = 0 n_allargs = fcode.co_argcount kwarg_defaults = caller_ir.get_definition(code_obj.defaults) if kwarg_defaults is not None: if isinstance(kwarg_defaults, tuple): d = [caller_ir.get_definition(x).value for x in kwarg_defaults] kwarg_defaults_tup = tuple(d) else: d = [caller_ir.get_definition(x).value for x in kwarg_defaults.items] kwarg_defaults_tup = tuple(d) n_kwargs = len(kwarg_defaults_tup) nargs = n_allargs - n_kwargs func_arg = ",".join(["%s" % (co_varnames[i]) for i in range(nargs)]) if n_kwargs: kw_const = [ "%s = %s" % (co_varnames[i + nargs], kwarg_defaults_tup[i]) for i in range(n_kwargs) ] func_arg += ", " func_arg += ", ".join(kw_const) # globals are the same as those in the caller glbls = caller_ir.func_id.func.__globals__ # create the function and return it return _create_function_from_code_obj(fcode, func_env, func_arg, func_clo, glbls)
def convert_code_obj_to_function(code_obj, caller_ir): """ Converts a code object from a `make_function.code` attr in the IR into a python function, caller_ir is the FunctionIR of the caller and is used for the resolution of freevars. """ fcode = code_obj.code nfree = len(fcode.co_freevars) # try and resolve freevars if they are consts in the caller's IR # these can be baked into the new function freevars = [] for x in fcode.co_freevars: # not using guard here to differentiate between multiple definition and # non-const variable try: freevar_def = caller_ir.get_definition(x) except KeyError: msg = ( "Cannot capture a constant value for variable '%s' as there " "are multiple definitions present." % x ) raise TypingError(msg, loc=code_obj.loc) if isinstance(freevar_def, ir.Const): freevars.append(freevar_def.value) else: msg = ( "Cannot capture the non-constant value associated with " "variable '%s' in a function that will escape." % x ) raise TypingError(msg, loc=code_obj.loc) func_env = "\n".join([" c_%d = %s" % (i, x) for i, x in enumerate(freevars)]) func_clo = ",".join(["c_%d" % i for i in range(nfree)]) co_varnames = list(fcode.co_varnames) # This is horrible. The code object knows about the number of args present # it also knows the name of the args but these are bundled in with other # vars in `co_varnames`. The make_function IR node knows what the defaults # are, they are defined in the IR as consts. The following finds the total # number of args (args + kwargs with defaults), finds the default values # and infers the number of "kwargs with defaults" from this and then infers # the number of actual arguments from that. n_kwargs = 0 n_allargs = fcode.co_argcount kwarg_defaults = caller_ir.get_definition(code_obj.defaults) if kwarg_defaults is not None: if isinstance(kwarg_defaults, tuple): d = [caller_ir.get_definition(x).value for x in kwarg_defaults] kwarg_defaults_tup = tuple(d) else: kwarg_defaults_tup = kwarg_defaults.value n_kwargs = len(kwarg_defaults_tup) nargs = n_allargs - n_kwargs func_arg = ",".join(["%s" % (co_varnames[i]) for i in range(nargs)]) if n_kwargs: kw_const = [ "%s = %s" % (co_varnames[i + nargs], kwarg_defaults_tup[i]) for i in range(n_kwargs) ] func_arg += ", " func_arg += ", ".join(kw_const) # globals are the same as those in the caller glbls = caller_ir.func_id.func.__globals__ # create the function and return it return _create_function_from_code_obj(fcode, func_env, func_arg, func_clo, glbls)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def impl_extend(l, iterable): if not isinstance(l, types.ListType): return if not isinstance(iterable, types.IterableType): raise TypingError("extend argument must be iterable") def select_impl(): if isinstance(iterable, types.ListType): def impl(l, iterable): # guard against l.extend(l) if l is iterable: iterable = iterable.copy() for i in iterable: l.append(i) return impl else: def impl(l, iterable): for i in iterable: l.append(i) return impl if l.is_precise(): # Handle the precise case. return select_impl() else: # Handle the imprecise case, try to 'guess' the underlying type of the # values in the iterable. if hasattr(iterable, "dtype"): # tuples and arrays ty = iterable.dtype elif hasattr(iterable, "item_type"): # lists ty = iterable.item_type elif hasattr(iterable, "yield_type"): # iterators and generators ty = iterable.yield_type else: raise TypingError( "unable to extend list, iterable is missing " "either *dtype*, *item_type* or *yield_type*." ) l = l.refine(ty) # Create the signature that we wanted this impl to have sig = typing.signature(types.void, l, iterable) return sig, select_impl()
def impl_extend(l, iterable): if not isinstance(l, types.ListType): return if not isinstance(iterable, types.IterableType): raise TypingError("extend argument must be iterable") def select_impl(): if isinstance(iterable, types.ListType): def impl(l, iterable): # guard against l.extend(l) if l is iterable: iterable = iterable.copy() for i in iterable: l.append(i) return impl else: def impl(l, iterable): for i in iterable: l.append(i) return impl if l.is_precise(): # Handle the precise case. return select_impl() else: # Handle the imprecise case, try to 'guess' the underlying type of the # values in the iterable. if hasattr(iterable, "dtype"): # tuples and arrays ty = iterable.dtype elif hasattr(iterable, "item_type"): # lists ty = iterable.item_type else: raise TypingError( "unable to extend list, iterable is missing " "either *dtype* or *item_type*" ) l = l.refine(ty) # Create the signature that we wanted this impl to have sig = typing.signature(types.void, l, iterable) return sig, select_impl()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def impl_copy(l): itemty = l.item_type if isinstance(l, types.ListType): def impl(l): newl = new_list(itemty, len(l)) for i in l: newl.append(i) return newl return impl
def impl_copy(l): if isinstance(l, types.ListType): def impl(l): return l[:] return impl
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def impl(l): newl = new_list(itemty, len(l)) for i in l: newl.append(i) return newl
def impl(l): return l[:]
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def compare_helper(this, other, accepted): if not isinstance(this, types.ListType): return if not isinstance(other, types.ListType): return lambda this, other: False def impl(this, other): return compare(this, other) in accepted return impl
def compare_helper(this, other, accepted): if not isinstance(this, types.ListType): return if not isinstance(other, types.ListType): raise TypingError("list can only be compared to list") def impl(this, other): return compare(this, other) in accepted return impl
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def return_exception(self, exc_class, exc_args=None, loc=None): """Propagate exception to the caller.""" self.call_conv.return_user_exc( self.builder, exc_class, exc_args, loc=loc, func_name=self.func_ir.func_id.func_name, )
def return_exception(self, exc_class, exc_args=None, loc=None): self.call_conv.return_user_exc( self.builder, exc_class, exc_args, loc=loc, func_name=self.func_ir.func_id.func_name, )
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def lower(self): # Emit the Env into the module self.emit_environment_object() if self.generator_info is None: self.genlower = None self.lower_normal_function(self.fndesc) else: self.genlower = self.GeneratorLower(self) self.gentype = self.genlower.gentype self.genlower.lower_init_func(self) self.genlower.lower_next_func(self) if self.gentype.has_finalizer: self.genlower.lower_finalize_func(self) if config.DUMP_LLVM: print(("LLVM DUMP %s" % self.fndesc).center(80, "-")) if config.HIGHLIGHT_DUMPS: try: from pygments import highlight from pygments.lexers import LlvmLexer as lexer from pygments.formatters import Terminal256Formatter print( highlight( self.module.__repr__(), lexer(), Terminal256Formatter(style="solarized-light"), ) ) except ImportError: msg = "Please install pygments to see highlighted dumps" raise ValueError(msg) else: print(self.module) print("=" * 80) # Special optimization to remove NRT on functions that do not need it. if self.context.enable_nrt and self.generator_info is None: removerefctpass.remove_unnecessary_nrt_usage( self.function, context=self.context, fndesc=self.fndesc ) # Run target specific post lowering transformation self.context.post_lowering(self.module, self.library) # Materialize LLVM Module self.library.add_ir_module(self.module)
def lower(self): # Emit the Env into the module self.emit_environment_object() if self.generator_info is None: self.genlower = None self.lower_normal_function(self.fndesc) else: self.genlower = self.GeneratorLower(self) self.gentype = self.genlower.gentype self.genlower.lower_init_func(self) self.genlower.lower_next_func(self) if self.gentype.has_finalizer: self.genlower.lower_finalize_func(self) if config.DUMP_LLVM: print(("LLVM DUMP %s" % self.fndesc).center(80, "-")) print(self.module) print("=" * 80) # Special optimization to remove NRT on functions that do not need it. if self.context.enable_nrt and self.generator_info is None: removerefctpass.remove_unnecessary_nrt_usage( self.function, context=self.context, fndesc=self.fndesc ) # Run target specific post lowering transformation self.context.post_lowering(self.module, self.library) # Materialize LLVM Module self.library.add_ir_module(self.module)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def lower_block(self, block): """ Lower the given block. """ self.pre_block(block) for inst in block.body: self.loc = inst.loc defaulterrcls = partial(LoweringError, loc=self.loc) with new_error_context( 'lowering "{inst}" at {loc}', inst=inst, loc=self.loc, errcls_=defaulterrcls ): self.lower_inst(inst) self.post_block(block)
def lower_block(self, block): """ Lower the given block. """ self.pre_block(block) for inst in block.body: self.loc = inst.loc defaulterrcls = partial(LoweringError, loc=self.loc) with new_error_context( 'lowering "{inst}" at {loc}', inst=inst, loc=self.loc, errcls_=defaulterrcls ): self.lower_inst(inst)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def lower_inst(self, inst): # Set debug location for all subsequent LL instructions self.debuginfo.mark_location(self.builder, self.loc) self.debug_print(str(inst)) if isinstance(inst, ir.Assign): ty = self.typeof(inst.target.name) val = self.lower_assign(ty, inst) self.storevar(val, inst.target.name) elif isinstance(inst, ir.Branch): cond = self.loadvar(inst.cond.name) tr = self.blkmap[inst.truebr] fl = self.blkmap[inst.falsebr] condty = self.typeof(inst.cond.name) pred = self.context.cast(self.builder, cond, condty, types.boolean) assert pred.type == Type.int(1), "cond is not i1: %s" % pred.type self.builder.cbranch(pred, tr, fl) elif isinstance(inst, ir.Jump): target = self.blkmap[inst.target] self.builder.branch(target) elif isinstance(inst, ir.Return): if self.generator_info: # StopIteration self.genlower.return_from_generator(self) return val = self.loadvar(inst.value.name) oty = self.typeof(inst.value.name) ty = self.fndesc.restype if isinstance(ty, types.Optional): # If returning an optional type self.call_conv.return_optional_value(self.builder, ty, oty, val) return if ty != oty: val = self.context.cast(self.builder, val, oty, ty) retval = self.context.get_return_value(self.builder, ty, val) self.call_conv.return_value(self.builder, retval) elif isinstance(inst, ir.StaticSetItem): signature = self.fndesc.calltypes[inst] assert signature is not None try: impl = self.context.get_function("static_setitem", signature) except NotImplementedError: return self.lower_setitem( inst.target, inst.index_var, inst.value, signature ) else: target = self.loadvar(inst.target.name) value = self.loadvar(inst.value.name) valuety = self.typeof(inst.value.name) value = self.context.cast(self.builder, value, valuety, signature.args[2]) return impl(self.builder, (target, inst.index, value)) elif isinstance(inst, ir.Print): self.lower_print(inst) elif isinstance(inst, ir.SetItem): signature = self.fndesc.calltypes[inst] assert signature is not None return self.lower_setitem(inst.target, inst.index, inst.value, signature) elif isinstance(inst, ir.StoreMap): signature = self.fndesc.calltypes[inst] assert signature is not None return self.lower_setitem(inst.dct, inst.key, inst.value, signature) elif isinstance(inst, ir.DelItem): target = self.loadvar(inst.target.name) index = self.loadvar(inst.index.name) targetty = self.typeof(inst.target.name) indexty = self.typeof(inst.index.name) signature = self.fndesc.calltypes[inst] assert signature is not None op = operator.delitem fnop = self.context.typing_context.resolve_value_type(op) callsig = fnop.get_call_type( self.context.typing_context, signature.args, {}, ) impl = self.context.get_function(fnop, callsig) assert targetty == signature.args[0] index = self.context.cast(self.builder, index, indexty, signature.args[1]) return impl(self.builder, (target, index)) elif isinstance(inst, ir.Del): self.delvar(inst.value) elif isinstance(inst, ir.SetAttr): target = self.loadvar(inst.target.name) value = self.loadvar(inst.value.name) signature = self.fndesc.calltypes[inst] targetty = self.typeof(inst.target.name) valuety = self.typeof(inst.value.name) assert signature is not None assert signature.args[0] == targetty impl = self.context.get_setattr(inst.attr, signature) # Convert argument to match value = self.context.cast(self.builder, value, valuety, signature.args[1]) return impl(self.builder, (target, value)) elif isinstance(inst, ir.StaticRaise): self.lower_static_raise(inst) elif isinstance(inst, ir.StaticTryRaise): self.lower_static_try_raise(inst) else: for _class, func in lower_extensions.items(): if isinstance(inst, _class): func(self, inst) return raise NotImplementedError(type(inst))
def lower_inst(self, inst): # Set debug location for all subsequent LL instructions self.debuginfo.mark_location(self.builder, self.loc) self.debug_print(str(inst)) if isinstance(inst, ir.Assign): ty = self.typeof(inst.target.name) val = self.lower_assign(ty, inst) self.storevar(val, inst.target.name) elif isinstance(inst, ir.Branch): cond = self.loadvar(inst.cond.name) tr = self.blkmap[inst.truebr] fl = self.blkmap[inst.falsebr] condty = self.typeof(inst.cond.name) pred = self.context.cast(self.builder, cond, condty, types.boolean) assert pred.type == Type.int(1), "cond is not i1: %s" % pred.type self.builder.cbranch(pred, tr, fl) elif isinstance(inst, ir.Jump): target = self.blkmap[inst.target] self.builder.branch(target) elif isinstance(inst, ir.Return): if self.generator_info: # StopIteration self.genlower.return_from_generator(self) return val = self.loadvar(inst.value.name) oty = self.typeof(inst.value.name) ty = self.fndesc.restype if isinstance(ty, types.Optional): # If returning an optional type self.call_conv.return_optional_value(self.builder, ty, oty, val) return if ty != oty: val = self.context.cast(self.builder, val, oty, ty) retval = self.context.get_return_value(self.builder, ty, val) self.call_conv.return_value(self.builder, retval) elif isinstance(inst, ir.StaticSetItem): signature = self.fndesc.calltypes[inst] assert signature is not None try: impl = self.context.get_function("static_setitem", signature) except NotImplementedError: return self.lower_setitem( inst.target, inst.index_var, inst.value, signature ) else: target = self.loadvar(inst.target.name) value = self.loadvar(inst.value.name) valuety = self.typeof(inst.value.name) value = self.context.cast(self.builder, value, valuety, signature.args[2]) return impl(self.builder, (target, inst.index, value)) elif isinstance(inst, ir.Print): self.lower_print(inst) elif isinstance(inst, ir.SetItem): signature = self.fndesc.calltypes[inst] assert signature is not None return self.lower_setitem(inst.target, inst.index, inst.value, signature) elif isinstance(inst, ir.StoreMap): signature = self.fndesc.calltypes[inst] assert signature is not None return self.lower_setitem(inst.dct, inst.key, inst.value, signature) elif isinstance(inst, ir.DelItem): target = self.loadvar(inst.target.name) index = self.loadvar(inst.index.name) targetty = self.typeof(inst.target.name) indexty = self.typeof(inst.index.name) signature = self.fndesc.calltypes[inst] assert signature is not None op = operator.delitem fnop = self.context.typing_context.resolve_value_type(op) callsig = fnop.get_call_type( self.context.typing_context, signature.args, {}, ) impl = self.context.get_function(fnop, callsig) assert targetty == signature.args[0] index = self.context.cast(self.builder, index, indexty, signature.args[1]) return impl(self.builder, (target, index)) elif isinstance(inst, ir.Del): self.delvar(inst.value) elif isinstance(inst, ir.SetAttr): target = self.loadvar(inst.target.name) value = self.loadvar(inst.value.name) signature = self.fndesc.calltypes[inst] targetty = self.typeof(inst.target.name) valuety = self.typeof(inst.value.name) assert signature is not None assert signature.args[0] == targetty impl = self.context.get_setattr(inst.attr, signature) # Convert argument to match value = self.context.cast(self.builder, value, valuety, signature.args[1]) return impl(self.builder, (target, value)) elif isinstance(inst, ir.StaticRaise): self.lower_static_raise(inst) else: for _class, func in lower_extensions.items(): if isinstance(inst, _class): func(self, inst) return raise NotImplementedError(type(inst))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def lower_expr(self, resty, expr): if expr.op == "binop": return self.lower_binop(resty, expr, expr.fn) elif expr.op == "inplace_binop": lty = self.typeof(expr.lhs.name) if lty.mutable: return self.lower_binop(resty, expr, expr.fn) else: # inplace operators on non-mutable types reuse the same # definition as the corresponding copying operators.) return self.lower_binop(resty, expr, expr.immutable_fn) elif expr.op == "unary": val = self.loadvar(expr.value.name) typ = self.typeof(expr.value.name) func_ty = self.context.typing_context.resolve_value_type(expr.fn) # Get function signature = self.fndesc.calltypes[expr] impl = self.context.get_function(func_ty, signature) # Convert argument to match val = self.context.cast(self.builder, val, typ, signature.args[0]) res = impl(self.builder, [val]) res = self.context.cast(self.builder, res, signature.return_type, resty) return res elif expr.op == "call": res = self.lower_call(resty, expr) return res elif expr.op == "pair_first": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) res = self.context.pair_first(self.builder, val, ty) self.incref(resty, res) return res elif expr.op == "pair_second": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) res = self.context.pair_second(self.builder, val, ty) self.incref(resty, res) return res elif expr.op in ("getiter", "iternext"): val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) signature = self.fndesc.calltypes[expr] impl = self.context.get_function(expr.op, signature) [fty] = signature.args castval = self.context.cast(self.builder, val, ty, fty) res = impl(self.builder, (castval,)) res = self.context.cast(self.builder, res, signature.return_type, resty) return res elif expr.op == "exhaust_iter": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) # Unpack optional if isinstance(ty, types.Optional): val = self.context.cast(self.builder, val, ty, ty.type) ty = ty.type # If we have a tuple, we needn't do anything # (and we can't iterate over the heterogeneous ones). if isinstance(ty, types.BaseTuple): assert ty == resty self.incref(ty, val) return val itemty = ty.iterator_type.yield_type tup = self.context.get_constant_undef(resty) pairty = types.Pair(itemty, types.boolean) getiter_sig = typing.signature(ty.iterator_type, ty) getiter_impl = self.context.get_function("getiter", getiter_sig) iternext_sig = typing.signature(pairty, ty.iterator_type) iternext_impl = self.context.get_function("iternext", iternext_sig) iterobj = getiter_impl(self.builder, (val,)) # We call iternext() as many times as desired (`expr.count`). for i in range(expr.count): pair = iternext_impl(self.builder, (iterobj,)) is_valid = self.context.pair_second(self.builder, pair, pairty) with cgutils.if_unlikely(self.builder, self.builder.not_(is_valid)): self.return_exception(ValueError, loc=self.loc) item = self.context.pair_first(self.builder, pair, pairty) tup = self.builder.insert_value(tup, item, i) # Call iternext() once more to check that the iterator # is exhausted. pair = iternext_impl(self.builder, (iterobj,)) is_valid = self.context.pair_second(self.builder, pair, pairty) with cgutils.if_unlikely(self.builder, is_valid): self.return_exception(ValueError, loc=self.loc) self.decref(ty.iterator_type, iterobj) return tup elif expr.op == "getattr": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) if isinstance(resty, types.BoundFunction): # if we are getting out a method, assume we have typed this # properly and just build a bound function object casted = self.context.cast(self.builder, val, ty, resty.this) res = self.context.get_bound_function(self.builder, casted, resty.this) self.incref(resty, res) return res else: impl = self.context.get_getattr(ty, expr.attr) attrty = self.context.typing_context.resolve_getattr(ty, expr.attr) if impl is None: # ignore the attribute return self.context.get_dummy_value() else: res = impl(self.context, self.builder, ty, val, expr.attr) # Cast the attribute type to the expected output type res = self.context.cast(self.builder, res, attrty, resty) return res elif expr.op == "static_getitem": signature = typing.signature( resty, self.typeof(expr.value.name), _lit_or_omitted(expr.index), ) try: # Both get_function() and the returned implementation can # raise NotImplementedError if the types aren't supported impl = self.context.get_function("static_getitem", signature) return impl(self.builder, (self.loadvar(expr.value.name), expr.index)) except NotImplementedError: if expr.index_var is None: raise # Fall back on the generic getitem() implementation # for this type. signature = self.fndesc.calltypes[expr] return self.lower_getitem( resty, expr, expr.value, expr.index_var, signature ) elif expr.op == "typed_getitem": signature = typing.signature( resty, self.typeof(expr.value.name), self.typeof(expr.index.name), ) impl = self.context.get_function("typed_getitem", signature) return impl( self.builder, (self.loadvar(expr.value.name), self.loadvar(expr.index.name)) ) elif expr.op == "getitem": signature = self.fndesc.calltypes[expr] return self.lower_getitem(resty, expr, expr.value, expr.index, signature) elif expr.op == "build_tuple": itemvals = [self.loadvar(i.name) for i in expr.items] itemtys = [self.typeof(i.name) for i in expr.items] castvals = [ self.context.cast(self.builder, val, fromty, toty) for val, toty, fromty in zip(itemvals, resty, itemtys) ] tup = self.context.make_tuple(self.builder, resty, castvals) self.incref(resty, tup) return tup elif expr.op == "build_list": itemvals = [self.loadvar(i.name) for i in expr.items] itemtys = [self.typeof(i.name) for i in expr.items] castvals = [ self.context.cast(self.builder, val, fromty, resty.dtype) for val, fromty in zip(itemvals, itemtys) ] return self.context.build_list(self.builder, resty, castvals) elif expr.op == "build_set": # Insert in reverse order, as Python does items = expr.items[::-1] itemvals = [self.loadvar(i.name) for i in items] itemtys = [self.typeof(i.name) for i in items] castvals = [ self.context.cast(self.builder, val, fromty, resty.dtype) for val, fromty in zip(itemvals, itemtys) ] return self.context.build_set(self.builder, resty, castvals) elif expr.op == "build_map": items = expr.items keys, values = [], [] key_types, value_types = [], [] for k, v in items: key = self.loadvar(k.name) keytype = self.typeof(k.name) val = self.loadvar(v.name) valtype = self.typeof(v.name) keys.append(key) values.append(val) key_types.append(keytype) value_types.append(valtype) return self.context.build_map( self.builder, resty, list(zip(key_types, value_types)), list(zip(keys, values)), ) elif expr.op == "cast": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) castval = self.context.cast(self.builder, val, ty, resty) self.incref(resty, castval) return castval elif expr.op in self.context.special_ops: res = self.context.special_ops[expr.op](self, expr) return res raise NotImplementedError(expr)
def lower_expr(self, resty, expr): if expr.op == "binop": return self.lower_binop(resty, expr, expr.fn) elif expr.op == "inplace_binop": lty = self.typeof(expr.lhs.name) if lty.mutable: return self.lower_binop(resty, expr, expr.fn) else: # inplace operators on non-mutable types reuse the same # definition as the corresponding copying operators.) return self.lower_binop(resty, expr, expr.immutable_fn) elif expr.op == "unary": val = self.loadvar(expr.value.name) typ = self.typeof(expr.value.name) func_ty = self.context.typing_context.resolve_value_type(expr.fn) # Get function signature = self.fndesc.calltypes[expr] impl = self.context.get_function(func_ty, signature) # Convert argument to match val = self.context.cast(self.builder, val, typ, signature.args[0]) res = impl(self.builder, [val]) res = self.context.cast(self.builder, res, signature.return_type, resty) return res elif expr.op == "call": res = self.lower_call(resty, expr) return res elif expr.op == "pair_first": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) res = self.context.pair_first(self.builder, val, ty) self.incref(resty, res) return res elif expr.op == "pair_second": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) res = self.context.pair_second(self.builder, val, ty) self.incref(resty, res) return res elif expr.op in ("getiter", "iternext"): val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) signature = self.fndesc.calltypes[expr] impl = self.context.get_function(expr.op, signature) [fty] = signature.args castval = self.context.cast(self.builder, val, ty, fty) res = impl(self.builder, (castval,)) res = self.context.cast(self.builder, res, signature.return_type, resty) return res elif expr.op == "exhaust_iter": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) # Unpack optional if isinstance(ty, types.Optional): val = self.context.cast(self.builder, val, ty, ty.type) ty = ty.type # If we have a tuple, we needn't do anything # (and we can't iterate over the heterogeneous ones). if isinstance(ty, types.BaseTuple): assert ty == resty self.incref(ty, val) return val itemty = ty.iterator_type.yield_type tup = self.context.get_constant_undef(resty) pairty = types.Pair(itemty, types.boolean) getiter_sig = typing.signature(ty.iterator_type, ty) getiter_impl = self.context.get_function("getiter", getiter_sig) iternext_sig = typing.signature(pairty, ty.iterator_type) iternext_impl = self.context.get_function("iternext", iternext_sig) iterobj = getiter_impl(self.builder, (val,)) # We call iternext() as many times as desired (`expr.count`). for i in range(expr.count): pair = iternext_impl(self.builder, (iterobj,)) is_valid = self.context.pair_second(self.builder, pair, pairty) with cgutils.if_unlikely(self.builder, self.builder.not_(is_valid)): self.return_exception(ValueError, loc=self.loc) item = self.context.pair_first(self.builder, pair, pairty) tup = self.builder.insert_value(tup, item, i) # Call iternext() once more to check that the iterator # is exhausted. pair = iternext_impl(self.builder, (iterobj,)) is_valid = self.context.pair_second(self.builder, pair, pairty) with cgutils.if_unlikely(self.builder, is_valid): self.return_exception(ValueError, loc=self.loc) self.decref(ty.iterator_type, iterobj) return tup elif expr.op == "getattr": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) if isinstance(resty, types.BoundFunction): # if we are getting out a method, assume we have typed this # properly and just build a bound function object casted = self.context.cast(self.builder, val, ty, resty.this) res = self.context.get_bound_function(self.builder, casted, resty.this) self.incref(resty, res) return res else: impl = self.context.get_getattr(ty, expr.attr) attrty = self.context.typing_context.resolve_getattr(ty, expr.attr) if impl is None: # ignore the attribute return self.context.get_dummy_value() else: res = impl(self.context, self.builder, ty, val, expr.attr) # Cast the attribute type to the expected output type res = self.context.cast(self.builder, res, attrty, resty) return res elif expr.op == "static_getitem": signature = typing.signature( resty, self.typeof(expr.value.name), _lit_or_omitted(expr.index), ) try: # Both get_function() and the returned implementation can # raise NotImplementedError if the types aren't supported impl = self.context.get_function("static_getitem", signature) return impl(self.builder, (self.loadvar(expr.value.name), expr.index)) except NotImplementedError: if expr.index_var is None: raise # Fall back on the generic getitem() implementation # for this type. signature = self.fndesc.calltypes[expr] return self.lower_getitem( resty, expr, expr.value, expr.index_var, signature ) elif expr.op == "getitem": signature = self.fndesc.calltypes[expr] return self.lower_getitem(resty, expr, expr.value, expr.index, signature) elif expr.op == "build_tuple": itemvals = [self.loadvar(i.name) for i in expr.items] itemtys = [self.typeof(i.name) for i in expr.items] castvals = [ self.context.cast(self.builder, val, fromty, toty) for val, toty, fromty in zip(itemvals, resty, itemtys) ] tup = self.context.make_tuple(self.builder, resty, castvals) self.incref(resty, tup) return tup elif expr.op == "build_list": itemvals = [self.loadvar(i.name) for i in expr.items] itemtys = [self.typeof(i.name) for i in expr.items] castvals = [ self.context.cast(self.builder, val, fromty, resty.dtype) for val, fromty in zip(itemvals, itemtys) ] return self.context.build_list(self.builder, resty, castvals) elif expr.op == "build_set": # Insert in reverse order, as Python does items = expr.items[::-1] itemvals = [self.loadvar(i.name) for i in items] itemtys = [self.typeof(i.name) for i in items] castvals = [ self.context.cast(self.builder, val, fromty, resty.dtype) for val, fromty in zip(itemvals, itemtys) ] return self.context.build_set(self.builder, resty, castvals) elif expr.op == "build_map": items = expr.items keys, values = [], [] key_types, value_types = [], [] for k, v in items: key = self.loadvar(k.name) keytype = self.typeof(k.name) val = self.loadvar(v.name) valtype = self.typeof(v.name) keys.append(key) values.append(val) key_types.append(keytype) value_types.append(valtype) return self.context.build_map( self.builder, resty, list(zip(key_types, value_types)), list(zip(keys, values)), ) elif expr.op == "cast": val = self.loadvar(expr.value.name) ty = self.typeof(expr.value.name) castval = self.context.cast(self.builder, val, ty, resty) self.incref(resty, castval) return castval elif expr.op in self.context.special_ops: res = self.context.special_ops[expr.op](self, expr) return res raise NotImplementedError(expr)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def pre_block(self, block): from numba.unsafe import eh super(Lower, self).pre_block(block) # Detect if we are in a TRY block by looking for a call to # `eh.exception_check`. for call in block.find_exprs(op="call"): defn = ir_utils.guard( ir_utils.get_definition, self.func_ir, call.func, ) if defn is not None and isinstance(defn, ir.Global): if defn.value is eh.exception_check: if isinstance(block.terminator, ir.Branch): targetblk = self.blkmap[block.terminator.truebr] # NOTE: This hacks in an attribute for call_conv to # pick up. This hack is no longer needed when # all old-style implementations are gone. self.builder._in_try_block = {"target": targetblk} break
def pre_block(self, block): """ Called before lowering a block. """
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __init__(self, func, identity=None, cache=False, targetoptions={}): if cache: raise TypeError("caching is not supported") for opt in targetoptions: if opt == "nopython": warnings.warn("nopython kwarg for cuda target is redundant", RuntimeWarning) else: fmt = "cuda vectorize target does not support option: '%s'" raise KeyError(fmt % opt) self.py_func = func self.identity = parse_identity(identity) # { arg_dtype: (return_dtype), cudakernel } self.kernelmap = OrderedDict()
def __init__(self, func, identity=None, cache=False, targetoptions={}): if cache: raise TypeError("caching is not supported") assert not targetoptions self.py_func = func self.identity = parse_identity(identity) # { arg_dtype: (return_dtype), cudakernel } self.kernelmap = OrderedDict()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _replace_parallel_functions(self, blocks): """ Replace functions with their parallel implementation in replace_functions_map if available. The implementation code is inlined to enable more optimization. """ swapped = self.swapped from numba.inline_closurecall import inline_closure_call work_list = list(blocks.items()) while work_list: label, block = work_list.pop() for i, instr in enumerate(block.body): if isinstance(instr, ir.Assign): lhs = instr.target lhs_typ = self.typemap[lhs.name] expr = instr.value if isinstance(expr, ir.Expr) and expr.op == "call": # Try and inline known calls with their parallel implementations def replace_func(): func_def = get_definition(self.func_ir, expr.func) callname = find_callname(self.func_ir, expr) repl_func = replace_functions_map.get(callname, None) if ( repl_func is None and len(callname) == 2 and isinstance(callname[1], ir.Var) and isinstance( self.typemap[callname[1].name], types.npytypes.Array ) ): repl_func = replace_functions_ndarray.get(callname[0], None) if repl_func is not None: # Add the array that the method is on to the arg list. expr.args.insert(0, callname[1]) require(repl_func != None) typs = tuple(self.typemap[x.name] for x in expr.args) try: new_func = repl_func(lhs_typ, *typs) except: new_func = None require(new_func != None) g = copy.copy(self.func_ir.func_id.func.__globals__) g["numba"] = numba g["np"] = numpy g["math"] = math # if the function being inlined has a function # checking the inputs, find it and add it to globals check = replace_functions_checkers_map.get(callname, None) if check is not None: g[check.name] = check.func # inline the parallel implementation new_blocks, _ = inline_closure_call( self.func_ir, g, block, i, new_func, self.typingctx, typs, self.typemap, self.calltypes, work_list, ) call_table = get_call_table( new_blocks, topological_ordering=False ) # find the prange in the new blocks and record it for use in diagnostics for call in call_table: for k, v in call.items(): if v[0] == "internal_prange": swapped[k] = [ callname, repl_func.__name__, func_def, block.body[i].loc, ] break return True if guard(replace_func): break elif ( isinstance(expr, ir.Expr) and expr.op == "getattr" and expr.attr == "dtype" ): # Replace getattr call "A.dtype" with numpy.dtype(<actual type>). # This helps remove superfluous dependencies from parfor. typ = self.typemap[expr.value.name] if isinstance(typ, types.npytypes.Array): # Convert A.dtype to four statements. # 1) Get numpy global. # 2) Create var for known type of array as string # constant. e.g. 'float64' # 3) Get dtype function from numpy module. # 4) Create var for numpy.dtype(var from #2). # Create var for numpy module. dtype = typ.dtype scope = block.scope loc = instr.loc g_np_var = ir.Var(scope, mk_unique_var("$np_g_var"), loc) self.typemap[g_np_var.name] = types.misc.Module(numpy) g_np = ir.Global("np", numpy, loc) g_np_assign = ir.Assign(g_np, g_np_var, loc) # Create var for the inferred type of the array # e.g., 'float64' dtype_str = str(dtype) if dtype_str == "bool": dtype_str = "bool_" typ_var = ir.Var(scope, mk_unique_var("$np_typ_var"), loc) self.typemap[typ_var.name] = types.StringLiteral(dtype_str) typ_var_assign = ir.Assign( ir.Const(dtype_str, loc), typ_var, loc ) # Get the dtype function from the numpy module. dtype_attr_var = ir.Var( scope, mk_unique_var("$dtype_attr_var"), loc ) temp = find_template(numpy.dtype) tfunc = numba.types.Function(temp) tfunc.get_call_type( self.typingctx, (self.typemap[typ_var.name],), {} ) self.typemap[dtype_attr_var.name] = types.functions.Function( temp ) dtype_attr_getattr = ir.Expr.getattr(g_np_var, "dtype", loc) dtype_attr_assign = ir.Assign( dtype_attr_getattr, dtype_attr_var, loc ) # Call numpy.dtype on the statically coded type two steps above. dtype_var = ir.Var(scope, mk_unique_var("$dtype_var"), loc) self.typemap[dtype_var.name] = types.npytypes.DType(dtype) dtype_getattr = ir.Expr.call(dtype_attr_var, [typ_var], (), loc) dtype_assign = ir.Assign(dtype_getattr, dtype_var, loc) self.calltypes[dtype_getattr] = signature( self.typemap[dtype_var.name], self.typemap[typ_var.name] ) # The original A.dtype rhs is replaced with result of this call. instr.value = dtype_var # Add statements to body of the code. block.body.insert(0, dtype_assign) block.body.insert(0, dtype_attr_assign) block.body.insert(0, typ_var_assign) block.body.insert(0, g_np_assign) break
def _replace_parallel_functions(self, blocks): """ Replace functions with their parallel implementation in replace_functions_map if available. The implementation code is inlined to enable more optimization. """ swapped = self.swapped from numba.inline_closurecall import inline_closure_call work_list = list(blocks.items()) while work_list: label, block = work_list.pop() for i, instr in enumerate(block.body): if isinstance(instr, ir.Assign): lhs = instr.target lhs_typ = self.typemap[lhs.name] expr = instr.value if isinstance(expr, ir.Expr) and expr.op == "call": # Try and inline known calls with their parallel implementations def replace_func(): func_def = get_definition(self.func_ir, expr.func) callname = find_callname(self.func_ir, expr) repl_func = replace_functions_map.get(callname, None) require(repl_func != None) typs = tuple(self.typemap[x.name] for x in expr.args) try: new_func = repl_func(lhs_typ, *typs) except: new_func = None require(new_func != None) g = copy.copy(self.func_ir.func_id.func.__globals__) g["numba"] = numba g["np"] = numpy g["math"] = math # if the function being inlined has a function # checking the inputs, find it and add it to globals check = replace_functions_checkers_map.get(callname, None) if check is not None: g[check.name] = check.func # inline the parallel implementation new_blocks, _ = inline_closure_call( self.func_ir, g, block, i, new_func, self.typingctx, typs, self.typemap, self.calltypes, work_list, ) call_table = get_call_table( new_blocks, topological_ordering=False ) # find the prange in the new blocks and record it for use in diagnostics for call in call_table: for k, v in call.items(): if v[0] == "internal_prange": swapped[k] = [ callname, repl_func.__name__, func_def, block.body[i].loc, ] break return True if guard(replace_func): break elif ( isinstance(expr, ir.Expr) and expr.op == "getattr" and expr.attr == "dtype" ): # Replace getattr call "A.dtype" with numpy.dtype(<actual type>). # This helps remove superfluous dependencies from parfor. typ = self.typemap[expr.value.name] if isinstance(typ, types.npytypes.Array): # Convert A.dtype to four statements. # 1) Get numpy global. # 2) Create var for known type of array as string # constant. e.g. 'float64' # 3) Get dtype function from numpy module. # 4) Create var for numpy.dtype(var from #2). # Create var for numpy module. dtype = typ.dtype scope = block.scope loc = instr.loc g_np_var = ir.Var(scope, mk_unique_var("$np_g_var"), loc) self.typemap[g_np_var.name] = types.misc.Module(numpy) g_np = ir.Global("np", numpy, loc) g_np_assign = ir.Assign(g_np, g_np_var, loc) # Create var for the inferred type of the array # e.g., 'float64' dtype_str = str(dtype) if dtype_str == "bool": dtype_str = "bool_" typ_var = ir.Var(scope, mk_unique_var("$np_typ_var"), loc) self.typemap[typ_var.name] = types.StringLiteral(dtype_str) typ_var_assign = ir.Assign( ir.Const(dtype_str, loc), typ_var, loc ) # Get the dtype function from the numpy module. dtype_attr_var = ir.Var( scope, mk_unique_var("$dtype_attr_var"), loc ) temp = find_template(numpy.dtype) tfunc = numba.types.Function(temp) tfunc.get_call_type( self.typingctx, (self.typemap[typ_var.name],), {} ) self.typemap[dtype_attr_var.name] = types.functions.Function( temp ) dtype_attr_getattr = ir.Expr.getattr(g_np_var, "dtype", loc) dtype_attr_assign = ir.Assign( dtype_attr_getattr, dtype_attr_var, loc ) # Call numpy.dtype on the statically coded type two steps above. dtype_var = ir.Var(scope, mk_unique_var("$dtype_var"), loc) self.typemap[dtype_var.name] = types.npytypes.DType(dtype) dtype_getattr = ir.Expr.call(dtype_attr_var, [typ_var], (), loc) dtype_assign = ir.Assign(dtype_getattr, dtype_var, loc) self.calltypes[dtype_getattr] = signature( self.typemap[dtype_var.name], self.typemap[typ_var.name] ) # The original A.dtype rhs is replaced with result of this call. instr.value = dtype_var # Add statements to body of the code. block.body.insert(0, dtype_assign) block.body.insert(0, dtype_attr_assign) block.body.insert(0, typ_var_assign) block.body.insert(0, g_np_assign) break
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def replace_func(): func_def = get_definition(self.func_ir, expr.func) callname = find_callname(self.func_ir, expr) repl_func = replace_functions_map.get(callname, None) if ( repl_func is None and len(callname) == 2 and isinstance(callname[1], ir.Var) and isinstance(self.typemap[callname[1].name], types.npytypes.Array) ): repl_func = replace_functions_ndarray.get(callname[0], None) if repl_func is not None: # Add the array that the method is on to the arg list. expr.args.insert(0, callname[1]) require(repl_func != None) typs = tuple(self.typemap[x.name] for x in expr.args) try: new_func = repl_func(lhs_typ, *typs) except: new_func = None require(new_func != None) g = copy.copy(self.func_ir.func_id.func.__globals__) g["numba"] = numba g["np"] = numpy g["math"] = math # if the function being inlined has a function # checking the inputs, find it and add it to globals check = replace_functions_checkers_map.get(callname, None) if check is not None: g[check.name] = check.func # inline the parallel implementation new_blocks, _ = inline_closure_call( self.func_ir, g, block, i, new_func, self.typingctx, typs, self.typemap, self.calltypes, work_list, ) call_table = get_call_table(new_blocks, topological_ordering=False) # find the prange in the new blocks and record it for use in diagnostics for call in call_table: for k, v in call.items(): if v[0] == "internal_prange": swapped[k] = [callname, repl_func.__name__, func_def, block.body[i].loc] break return True
def replace_func(): func_def = get_definition(self.func_ir, expr.func) callname = find_callname(self.func_ir, expr) repl_func = replace_functions_map.get(callname, None) require(repl_func != None) typs = tuple(self.typemap[x.name] for x in expr.args) try: new_func = repl_func(lhs_typ, *typs) except: new_func = None require(new_func != None) g = copy.copy(self.func_ir.func_id.func.__globals__) g["numba"] = numba g["np"] = numpy g["math"] = math # if the function being inlined has a function # checking the inputs, find it and add it to globals check = replace_functions_checkers_map.get(callname, None) if check is not None: g[check.name] = check.func # inline the parallel implementation new_blocks, _ = inline_closure_call( self.func_ir, g, block, i, new_func, self.typingctx, typs, self.typemap, self.calltypes, work_list, ) call_table = get_call_table(new_blocks, topological_ordering=False) # find the prange in the new blocks and record it for use in diagnostics for call in call_table: for k, v in call.items(): if v[0] == "internal_prange": swapped[k] = [callname, repl_func.__name__, func_def, block.body[i].loc] break return True
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def run(self): """run parfor conversion pass: replace Numpy calls with Parfors when possible and optimize the IR.""" # run array analysis, a pre-requisite for parfor translation remove_dels(self.func_ir.blocks) self.array_analysis.run(self.func_ir.blocks) # run stencil translation to parfor if self.options.stencil: stencil_pass = StencilPass( self.func_ir, self.typemap, self.calltypes, self.array_analysis, self.typingctx, self.flags, ) stencil_pass.run() if self.options.setitem: self._convert_setitem(self.func_ir.blocks) if self.options.numpy: self._convert_numpy(self.func_ir.blocks) if self.options.reduction: self._convert_reduce(self.func_ir.blocks) if self.options.prange: self._convert_loop(self.func_ir.blocks) # setup diagnostics now parfors are found self.diagnostics.setup(self.func_ir, self.options.fusion) dprint_func_ir(self.func_ir, "after parfor pass") # simplify CFG of parfor body loops since nested parfors with extra # jumps can be created with prange conversion simplify_parfor_body_CFG(self.func_ir.blocks) # simplify before fusion simplify(self.func_ir, self.typemap, self.calltypes) # need two rounds of copy propagation to enable fusion of long sequences # of parfors like test_fuse_argmin (some PYTHONHASHSEED values since # apply_copies_parfor depends on set order for creating dummy assigns) simplify(self.func_ir, self.typemap, self.calltypes) if self.options.fusion: self.func_ir._definitions = build_definitions(self.func_ir.blocks) self.array_analysis.equiv_sets = dict() self.array_analysis.run(self.func_ir.blocks) # reorder statements to maximize fusion # push non-parfors down maximize_fusion( self.func_ir, self.func_ir.blocks, self.typemap, up_direction=False ) dprint_func_ir(self.func_ir, "after maximize fusion down") self.fuse_parfors(self.array_analysis, self.func_ir.blocks) # push non-parfors up maximize_fusion(self.func_ir, self.func_ir.blocks, self.typemap) dprint_func_ir(self.func_ir, "after maximize fusion up") # try fuse again after maximize self.fuse_parfors(self.array_analysis, self.func_ir.blocks) dprint_func_ir(self.func_ir, "after fusion") # simplify again simplify(self.func_ir, self.typemap, self.calltypes) # push function call variables inside parfors so gufunc function # wouldn't need function variables as argument push_call_vars(self.func_ir.blocks, {}, {}) # simplify again simplify(self.func_ir, self.typemap, self.calltypes) dprint_func_ir(self.func_ir, "after optimization") if config.DEBUG_ARRAY_OPT >= 1: print("variable types: ", sorted(self.typemap.items())) print("call types: ", self.calltypes) if config.DEBUG_ARRAY_OPT >= 3: for block_label, block in self.func_ir.blocks.items(): new_block = [] scope = block.scope for stmt in block.body: new_block.append(stmt) if isinstance(stmt, ir.Assign): loc = stmt.loc lhs = stmt.target rhs = stmt.value lhs_typ = self.typemap[lhs.name] print( "Adding print for assignment to ", lhs.name, lhs_typ, type(lhs_typ), ) if lhs_typ in types.number_domain or isinstance( lhs_typ, types.Literal ): str_var = ir.Var(scope, mk_unique_var("str_var"), loc) self.typemap[str_var.name] = types.StringLiteral(lhs.name) lhs_const = ir.Const(lhs.name, loc) str_assign = ir.Assign(lhs_const, str_var, loc) new_block.append(str_assign) str_print = ir.Print([str_var], None, loc) self.calltypes[str_print] = signature( types.none, self.typemap[str_var.name] ) new_block.append(str_print) ir_print = ir.Print([lhs], None, loc) self.calltypes[ir_print] = signature(types.none, lhs_typ) new_block.append(ir_print) block.body = new_block # run post processor again to generate Del nodes post_proc = postproc.PostProcessor(self.func_ir) post_proc.run() if self.func_ir.is_generator: fix_generator_types(self.func_ir.generator_info, self.return_type, self.typemap) if sequential_parfor_lowering: lower_parfor_sequential( self.typingctx, self.func_ir, self.typemap, self.calltypes ) else: # prepare for parallel lowering # add parfor params to parfors here since lowering is destructive # changing the IR after this is not allowed parfor_ids, parfors = get_parfor_params( self.func_ir.blocks, self.options.fusion, self.nested_fusion_info ) for p in parfors: numba.parfor.get_parfor_reductions( self.func_ir, p, p.params, self.calltypes ) if config.DEBUG_ARRAY_OPT_STATS: name = self.func_ir.func_id.func_qualname n_parfors = len(parfor_ids) if n_parfors > 0: after_fusion = ( "After fusion" if self.options.fusion else "With fusion disabled" ) print( ("{}, function {} has {} parallel for-loop(s) #{}.").format( after_fusion, name, n_parfors, parfor_ids ) ) else: print("Function {} has no Parfor.".format(name)) return
def run(self): """run parfor conversion pass: replace Numpy calls with Parfors when possible and optimize the IR.""" # run array analysis, a pre-requisite for parfor translation remove_dels(self.func_ir.blocks) self.array_analysis.run(self.func_ir.blocks) # run stencil translation to parfor if self.options.stencil: stencil_pass = StencilPass( self.func_ir, self.typemap, self.calltypes, self.array_analysis, self.typingctx, self.flags, ) stencil_pass.run() if self.options.setitem: self._convert_setitem(self.func_ir.blocks) if self.options.numpy: self._convert_numpy(self.func_ir.blocks) if self.options.reduction: self._convert_reduce(self.func_ir.blocks) if self.options.prange: self._convert_loop(self.func_ir.blocks) # setup diagnostics now parfors are found self.diagnostics.setup(self.func_ir, self.options.fusion) dprint_func_ir(self.func_ir, "after parfor pass") # simplify CFG of parfor body loops since nested parfors with extra # jumps can be created with prange conversion simplify_parfor_body_CFG(self.func_ir.blocks) # simplify before fusion simplify(self.func_ir, self.typemap, self.calltypes) # need two rounds of copy propagation to enable fusion of long sequences # of parfors like test_fuse_argmin (some PYTHONHASHSEED values since # apply_copies_parfor depends on set order for creating dummy assigns) simplify(self.func_ir, self.typemap, self.calltypes) if self.options.fusion: self.func_ir._definitions = build_definitions(self.func_ir.blocks) self.array_analysis.equiv_sets = dict() self.array_analysis.run(self.func_ir.blocks) # reorder statements to maximize fusion # push non-parfors down maximize_fusion( self.func_ir, self.func_ir.blocks, self.typemap, up_direction=False ) dprint_func_ir(self.func_ir, "after maximize fusion down") self.fuse_parfors(self.array_analysis, self.func_ir.blocks) # push non-parfors up maximize_fusion(self.func_ir, self.func_ir.blocks, self.typemap) dprint_func_ir(self.func_ir, "after maximize fusion up") # try fuse again after maximize self.fuse_parfors(self.array_analysis, self.func_ir.blocks) dprint_func_ir(self.func_ir, "after fusion") # simplify again simplify(self.func_ir, self.typemap, self.calltypes) # push function call variables inside parfors so gufunc function # wouldn't need function variables as argument push_call_vars(self.func_ir.blocks, {}, {}) # simplify again simplify(self.func_ir, self.typemap, self.calltypes) dprint_func_ir(self.func_ir, "after optimization") if config.DEBUG_ARRAY_OPT >= 1: print("variable types: ", sorted(self.typemap.items())) print("call types: ", self.calltypes) # run post processor again to generate Del nodes post_proc = postproc.PostProcessor(self.func_ir) post_proc.run() if self.func_ir.is_generator: fix_generator_types(self.func_ir.generator_info, self.return_type, self.typemap) if sequential_parfor_lowering: lower_parfor_sequential( self.typingctx, self.func_ir, self.typemap, self.calltypes ) else: # prepare for parallel lowering # add parfor params to parfors here since lowering is destructive # changing the IR after this is not allowed parfor_ids, parfors = get_parfor_params( self.func_ir.blocks, self.options.fusion, self.nested_fusion_info ) for p in parfors: numba.parfor.get_parfor_reductions( self.func_ir, p, p.params, self.calltypes ) if config.DEBUG_ARRAY_OPT_STATS: name = self.func_ir.func_id.func_qualname n_parfors = len(parfor_ids) if n_parfors > 0: after_fusion = ( "After fusion" if self.options.fusion else "With fusion disabled" ) print( ("{}, function {} has {} parallel for-loop(s) #{}.").format( after_fusion, name, n_parfors, parfor_ids ) ) else: print("Function {} has no Parfor.".format(name)) return
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _break_constant(self, const, loc): """ Break down constant exception. """ if isinstance(const, tuple): # it's a tuple(exception class, args) if not self._is_exception_type(const[0]): msg = "Encountered unsupported exception constant %r" raise errors.UnsupportedError(msg % (const[0],), loc) return const[0], tuple(const[1]) elif self._is_exception_type(const): return const, None else: if isinstance(const, str): msg = "Directly raising a string constant as an exception is not supported." else: msg = "Encountered unsupported constant type used for exception" raise errors.UnsupportedError(msg, loc)
def _break_constant(self, const): """ Break down constant exception. """ if isinstance(const, tuple): # it's a tuple(exception class, args) if not self._is_exception_type(const[0]): raise NotImplementedError("unsupported exception constant %r" % (const[0],)) return const[0], tuple(const[1]) elif self._is_exception_type(const): return const, None else: raise NotImplementedError("unsupported exception constant %r" % (const,))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def match(self, func_ir, block, typemap, calltypes): self.raises = raises = {} self.tryraises = tryraises = {} self.block = block # Detect all raise statements and find which ones can be # rewritten for inst in block.find_insts((ir.Raise, ir.TryRaise)): if inst.exception is None: # re-reraise exc_type, exc_args = None, None else: # raise <something> => find the definition site for <something> const = func_ir.infer_constant(inst.exception) loc = inst.exception.loc exc_type, exc_args = self._break_constant(const, loc) if isinstance(inst, ir.Raise): raises[inst] = exc_type, exc_args elif isinstance(inst, ir.TryRaise): tryraises[inst] = exc_type, exc_args else: raise ValueError("unexpected: {}".format(type(inst))) return (len(raises) + len(tryraises)) > 0
def match(self, func_ir, block, typemap, calltypes): self.raises = raises = {} self.block = block # Detect all raise statements and find which ones can be # rewritten for inst in block.find_insts(ir.Raise): if inst.exception is None: # re-reraise exc_type, exc_args = None, None else: # raise <something> => find the definition site for <something> const = func_ir.infer_constant(inst.exception) exc_type, exc_args = self._break_constant(const) raises[inst] = exc_type, exc_args return len(raises) > 0
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def apply(self): """ Rewrite all matching setitems as static_setitems. """ new_block = self.block.copy() new_block.clear() for inst in self.block.body: if inst in self.raises: exc_type, exc_args = self.raises[inst] new_inst = ir.StaticRaise(exc_type, exc_args, inst.loc) new_block.append(new_inst) elif inst in self.tryraises: exc_type, exc_args = self.tryraises[inst] new_inst = ir.StaticTryRaise(exc_type, exc_args, inst.loc) new_block.append(new_inst) else: new_block.append(inst) return new_block
def apply(self): """ Rewrite all matching setitems as static_setitems. """ new_block = self.block.copy() new_block.clear() for inst in self.block.body: if inst in self.raises: exc_type, exc_args = self.raises[inst] new_inst = ir.StaticRaise(exc_type, exc_args, inst.loc) new_block.append(new_inst) else: new_block.append(inst) return new_block
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def hsail_atomic_add_tuple(context, builder, sig, args): aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype if indty == types.intp: indices = [inds] # just a single integer indty = [indty] else: indices = cgutils.unpack_tuple(builder, inds, count=len(indty)) indices = [ context.cast(builder, i, t, types.intp) for t, i in zip(indty, indices) ] if dtype != valty: raise TypeError("expecting %s but got %s" % (dtype, valty)) if aryty.ndim != len(indty): raise TypeError( "indexing %d-D array with %d-D index" % (aryty.ndim, len(indty)) ) lary = context.make_array(aryty)(context, builder, ary) ptr = cgutils.get_item_pointer(context, builder, aryty, lary, indices) return builder.atomic_rmw("add", ptr, val, ordering="monotonic")
def hsail_atomic_add_tuple(context, builder, sig, args): aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype if indty == types.intp: indices = [inds] # just a single integer indty = [indty] else: indices = cgutils.unpack_tuple(builder, inds, count=len(indty)) indices = [ context.cast(builder, i, t, types.intp) for t, i in zip(indty, indices) ] if dtype != valty: raise TypeError("expecting %s but got %s" % (dtype, valty)) if aryty.ndim != len(indty): raise TypeError( "indexing %d-D array with %d-D index" % (aryty.ndim, len(indty)) ) lary = context.make_array(aryty)(context, builder, ary) ptr = cgutils.get_item_pointer(builder, aryty, lary, indices) return builder.atomic_rmw("add", ptr, val, ordering="monotonic")
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _stencil_wrapper(self, result, sigret, return_type, typemap, calltypes, *args): # Overall approach: # 1) Construct a string containing a function definition for the stencil function # that will execute the stencil kernel. This function definition includes a # unique stencil function name, the parameters to the stencil kernel, loop # nests across the dimensions of the input array. Those loop nests use the # computed stencil kernel size so as not to try to compute elements where # elements outside the bounds of the input array would be needed. # 2) The but of the loop nest in this new function is a special sentinel # assignment. # 3) Get the IR of this new function. # 4) Split the block containing the sentinel assignment and remove the sentinel # assignment. Insert the stencil kernel IR into the stencil function IR # after label and variable renaming of the stencil kernel IR to prevent # conflicts with the stencil function IR. # 5) Compile the combined stencil function IR + stencil kernel IR into existence. # Copy the kernel so that our changes for this callsite # won't effect other callsites. (kernel_copy, copy_calltypes) = self.copy_ir_with_calltypes( self.kernel_ir, calltypes ) # The stencil kernel body becomes the body of a loop, for which args aren't needed. ir_utils.remove_args(kernel_copy.blocks) first_arg = kernel_copy.arg_names[0] in_cps, out_cps = ir_utils.copy_propagate(kernel_copy.blocks, typemap) name_var_table = ir_utils.get_name_var_table(kernel_copy.blocks) ir_utils.apply_copy_propagate( kernel_copy.blocks, in_cps, name_var_table, typemap, copy_calltypes ) if "out" in name_var_table: raise ValueError("Cannot use the reserved word 'out' in stencil kernels.") sentinel_name = ir_utils.get_unused_var_name("__sentinel__", name_var_table) if config.DEBUG_ARRAY_OPT >= 1: print("name_var_table", name_var_table, sentinel_name) the_array = args[0] if config.DEBUG_ARRAY_OPT >= 1: print( "_stencil_wrapper", return_type, return_type.dtype, type(return_type.dtype), args, ) ir_utils.dump_blocks(kernel_copy.blocks) # We generate a Numba function to execute this stencil and here # create the unique name of this function. stencil_func_name = "__numba_stencil_%s_%s" % ( hex(id(the_array)).replace("-", "_"), self.id, ) # We will put a loop nest in the generated function for each # dimension in the input array. Here we create the name for # the index variable for each dimension. index0, index1, ... index_vars = [] for i in range(the_array.ndim): index_var_name = ir_utils.get_unused_var_name("index" + str(i), name_var_table) index_vars += [index_var_name] # Create extra signature for out and neighborhood. out_name = ir_utils.get_unused_var_name("out", name_var_table) neighborhood_name = ir_utils.get_unused_var_name("neighborhood", name_var_table) sig_extra = "" if result is not None: sig_extra += ", {}=None".format(out_name) if "neighborhood" in dict(self.kws): sig_extra += ", {}=None".format(neighborhood_name) # Get a list of the standard indexed array names. standard_indexed = self.options.get("standard_indexing", []) if first_arg in standard_indexed: raise ValueError( "The first argument to a stencil kernel must " "use relative indexing, not standard indexing." ) if len(set(standard_indexed) - set(kernel_copy.arg_names)) != 0: raise ValueError( "Standard indexing requested for an array name " "not present in the stencil kernel definition." ) # Add index variables to getitems in the IR to transition the accesses # in the kernel from relative to regular Python indexing. Returns the # computed size of the stencil kernel and a list of the relatively indexed # arrays. kernel_size, relatively_indexed = self.add_indices_to_kernel( kernel_copy, index_vars, the_array.ndim, self.neighborhood, standard_indexed, typemap, copy_calltypes, ) if self.neighborhood is None: self.neighborhood = kernel_size if config.DEBUG_ARRAY_OPT >= 1: print("After add_indices_to_kernel") ir_utils.dump_blocks(kernel_copy.blocks) # The return in the stencil kernel becomes a setitem for that # particular point in the iteration space. ret_blocks = self.replace_return_with_setitem( kernel_copy.blocks, index_vars, out_name ) if config.DEBUG_ARRAY_OPT >= 1: print("After replace_return_with_setitem", ret_blocks) ir_utils.dump_blocks(kernel_copy.blocks) # Start to form the new function to execute the stencil kernel. func_text = "def {}({}{}):\n".format( stencil_func_name, ",".join(kernel_copy.arg_names), sig_extra ) # Get loop ranges for each dimension, which could be either int # or variable. In the latter case we'll use the extra neighborhood # argument to the function. ranges = [] for i in range(the_array.ndim): if isinstance(kernel_size[i][0], int): lo = kernel_size[i][0] hi = kernel_size[i][1] else: lo = "{}[{}][0]".format(neighborhood_name, i) hi = "{}[{}][1]".format(neighborhood_name, i) ranges.append((lo, hi)) # If there are more than one relatively indexed arrays, add a call to # a function that will raise an error if any of the relatively indexed # arrays are of different size than the first input array. if len(relatively_indexed) > 1: func_text += " raise_if_incompatible_array_sizes(" + first_arg for other_array in relatively_indexed: if other_array != first_arg: func_text += "," + other_array func_text += ")\n" # Get the shape of the first input array. shape_name = ir_utils.get_unused_var_name("full_shape", name_var_table) func_text += " {} = {}.shape\n".format(shape_name, first_arg) # If we have to allocate the output array (the out argument was not used) # then us numpy.full if the user specified a cval stencil decorator option # or np.zeros if they didn't to allocate the array. if result is None: return_type_name = numpy_support.as_dtype(return_type.dtype).type.__name__ if "cval" in self.options: cval = self.options["cval"] if return_type.dtype != typing.typeof.typeof(cval): raise ValueError("cval type does not match stencil return type.") out_init = "{} = np.full({}, {}, dtype=np.{})\n".format( out_name, shape_name, cval, return_type_name ) else: out_init = "{} = np.zeros({}, dtype=np.{})\n".format( out_name, shape_name, return_type_name ) func_text += " " + out_init else: # result is present, if cval is set then use it if "cval" in self.options: cval = self.options["cval"] cval_ty = typing.typeof.typeof(cval) if not self._typingctx.can_convert(cval_ty, return_type.dtype): msg = "cval type does not match stencil return type." raise ValueError(msg) out_init = "{}[:] = {}\n".format(out_name, cval) func_text += " " + out_init offset = 1 # Add the loop nests to the new function. for i in range(the_array.ndim): for j in range(offset): func_text += " " # ranges[i][0] is the minimum index used in the i'th dimension # but minimum's greater than 0 don't preclude any entry in the array. # So, take the minimum of 0 and the minimum index found in the kernel # and this will be a negative number (potentially -0). Then, we do # unary - on that to get the positive offset in this dimension whose # use is precluded. # ranges[i][1] is the maximum of 0 and the observed maximum index # in this dimension because negative maximums would not cause us to # preclude any entry in the array from being used. func_text += ("for {} in range(-min(0,{}),{}[{}]-max(0,{})):\n").format( index_vars[i], ranges[i][0], shape_name, i, ranges[i][1] ) offset += 1 for j in range(offset): func_text += " " # Put a sentinel in the code so we can locate it in the IR. We will # remove this sentinel assignment and replace it with the IR for the # stencil kernel body. func_text += "{} = 0\n".format(sentinel_name) func_text += " return {}\n".format(out_name) if config.DEBUG_ARRAY_OPT >= 1: print("new stencil func text") print(func_text) # Force the new stencil function into existence. exec_(func_text) in globals(), locals() stencil_func = eval(stencil_func_name) if sigret is not None: pysig = utils.pysignature(stencil_func) sigret.pysig = pysig # Get the IR for the newly created stencil function. stencil_ir = compiler.run_frontend(stencil_func) ir_utils.remove_dels(stencil_ir.blocks) # rename all variables in stencil_ir afresh var_table = ir_utils.get_name_var_table(stencil_ir.blocks) new_var_dict = {} reserved_names = ( [sentinel_name, out_name, neighborhood_name, shape_name] + kernel_copy.arg_names + index_vars ) for name, var in var_table.items(): if not name in reserved_names: new_var_dict[name] = ir_utils.mk_unique_var(name) ir_utils.replace_var_names(stencil_ir.blocks, new_var_dict) stencil_stub_last_label = max(stencil_ir.blocks.keys()) + 1 # Shift lables in the kernel copy so they are guaranteed unique # and don't conflict with any labels in the stencil_ir. kernel_copy.blocks = ir_utils.add_offset_to_labels( kernel_copy.blocks, stencil_stub_last_label ) new_label = max(kernel_copy.blocks.keys()) + 1 # Adjust ret_blocks to account for addition of the offset. ret_blocks = [x + stencil_stub_last_label for x in ret_blocks] if config.DEBUG_ARRAY_OPT >= 1: print("ret_blocks w/ offsets", ret_blocks, stencil_stub_last_label) print("before replace sentinel stencil_ir") ir_utils.dump_blocks(stencil_ir.blocks) print("before replace sentinel kernel_copy") ir_utils.dump_blocks(kernel_copy.blocks) # Search all the block in the stencil outline for the sentinel. for label, block in stencil_ir.blocks.items(): for i, inst in enumerate(block.body): if isinstance(inst, ir.Assign) and inst.target.name == sentinel_name: # We found the sentinel assignment. loc = inst.loc scope = block.scope # split block across __sentinel__ # A new block is allocated for the statements prior to the # sentinel but the new block maintains the current block # label. prev_block = ir.Block(scope, loc) prev_block.body = block.body[:i] # The current block is used for statements after sentinel. block.body = block.body[i + 1 :] # But the current block gets a new label. body_first_label = min(kernel_copy.blocks.keys()) # The previous block jumps to the minimum labelled block of # the parfor body. prev_block.append(ir.Jump(body_first_label, loc)) # Add all the parfor loop body blocks to the gufunc # function's IR. for l, b in kernel_copy.blocks.items(): stencil_ir.blocks[l] = b stencil_ir.blocks[new_label] = block stencil_ir.blocks[label] = prev_block # Add a jump from all the blocks that previously contained # a return in the stencil kernel to the block # containing statements after the sentinel. for ret_block in ret_blocks: stencil_ir.blocks[ret_block].append(ir.Jump(new_label, loc)) break else: continue break stencil_ir.blocks = ir_utils.rename_labels(stencil_ir.blocks) ir_utils.remove_dels(stencil_ir.blocks) assert isinstance(the_array, types.Type) array_types = args new_stencil_param_types = list(array_types) if config.DEBUG_ARRAY_OPT >= 1: print("new_stencil_param_types", new_stencil_param_types) ir_utils.dump_blocks(stencil_ir.blocks) # Compile the combined stencil function with the replaced loop # body in it. new_func = compiler.compile_ir( self._typingctx, self._targetctx, stencil_ir, new_stencil_param_types, None, compiler.DEFAULT_FLAGS, {}, ) return new_func
def _stencil_wrapper(self, result, sigret, return_type, typemap, calltypes, *args): # Overall approach: # 1) Construct a string containing a function definition for the stencil function # that will execute the stencil kernel. This function definition includes a # unique stencil function name, the parameters to the stencil kernel, loop # nests across the dimenions of the input array. Those loop nests use the # computed stencil kernel size so as not to try to compute elements where # elements outside the bounds of the input array would be needed. # 2) The but of the loop nest in this new function is a special sentinel # assignment. # 3) Get the IR of this new function. # 4) Split the block containing the sentinel assignment and remove the sentinel # assignment. Insert the stencil kernel IR into the stencil function IR # after label and variable renaming of the stencil kernel IR to prevent # conflicts with the stencil function IR. # 5) Compile the combined stencil function IR + stencil kernel IR into existence. # Copy the kernel so that our changes for this callsite # won't effect other callsites. (kernel_copy, copy_calltypes) = self.copy_ir_with_calltypes( self.kernel_ir, calltypes ) # The stencil kernel body becomes the body of a loop, for which args aren't needed. ir_utils.remove_args(kernel_copy.blocks) first_arg = kernel_copy.arg_names[0] in_cps, out_cps = ir_utils.copy_propagate(kernel_copy.blocks, typemap) name_var_table = ir_utils.get_name_var_table(kernel_copy.blocks) ir_utils.apply_copy_propagate( kernel_copy.blocks, in_cps, name_var_table, typemap, copy_calltypes ) if "out" in name_var_table: raise ValueError("Cannot use the reserved word 'out' in stencil kernels.") sentinel_name = ir_utils.get_unused_var_name("__sentinel__", name_var_table) if config.DEBUG_ARRAY_OPT >= 1: print("name_var_table", name_var_table, sentinel_name) the_array = args[0] if config.DEBUG_ARRAY_OPT >= 1: print( "_stencil_wrapper", return_type, return_type.dtype, type(return_type.dtype), args, ) ir_utils.dump_blocks(kernel_copy.blocks) # We generate a Numba function to execute this stencil and here # create the unique name of this function. stencil_func_name = "__numba_stencil_%s_%s" % ( hex(id(the_array)).replace("-", "_"), self.id, ) # We will put a loop nest in the generated function for each # dimension in the input array. Here we create the name for # the index variable for each dimension. index0, index1, ... index_vars = [] for i in range(the_array.ndim): index_var_name = ir_utils.get_unused_var_name("index" + str(i), name_var_table) index_vars += [index_var_name] # Create extra signature for out and neighborhood. out_name = ir_utils.get_unused_var_name("out", name_var_table) neighborhood_name = ir_utils.get_unused_var_name("neighborhood", name_var_table) sig_extra = "" if result is not None: sig_extra += ", {}=None".format(out_name) if "neighborhood" in dict(self.kws): sig_extra += ", {}=None".format(neighborhood_name) # Get a list of the standard indexed array names. standard_indexed = self.options.get("standard_indexing", []) if first_arg in standard_indexed: raise ValueError( "The first argument to a stencil kernel must " "use relative indexing, not standard indexing." ) if len(set(standard_indexed) - set(kernel_copy.arg_names)) != 0: raise ValueError( "Standard indexing requested for an array name " "not present in the stencil kernel definition." ) # Add index variables to getitems in the IR to transition the accesses # in the kernel from relative to regular Python indexing. Returns the # computed size of the stencil kernel and a list of the relatively indexed # arrays. kernel_size, relatively_indexed = self.add_indices_to_kernel( kernel_copy, index_vars, the_array.ndim, self.neighborhood, standard_indexed, typemap, copy_calltypes, ) if self.neighborhood is None: self.neighborhood = kernel_size if config.DEBUG_ARRAY_OPT >= 1: print("After add_indices_to_kernel") ir_utils.dump_blocks(kernel_copy.blocks) # The return in the stencil kernel becomes a setitem for that # particular point in the iteration space. ret_blocks = self.replace_return_with_setitem( kernel_copy.blocks, index_vars, out_name ) if config.DEBUG_ARRAY_OPT >= 1: print("After replace_return_with_setitem", ret_blocks) ir_utils.dump_blocks(kernel_copy.blocks) # Start to form the new function to execute the stencil kernel. func_text = "def {}({}{}):\n".format( stencil_func_name, ",".join(kernel_copy.arg_names), sig_extra ) # Get loop ranges for each dimension, which could be either int # or variable. In the latter case we'll use the extra neighborhood # argument to the function. ranges = [] for i in range(the_array.ndim): if isinstance(kernel_size[i][0], int): lo = kernel_size[i][0] hi = kernel_size[i][1] else: lo = "{}[{}][0]".format(neighborhood_name, i) hi = "{}[{}][1]".format(neighborhood_name, i) ranges.append((lo, hi)) # If there are more than one relatively indexed arrays, add a call to # a function that will raise an error if any of the relatively indexed # arrays are of different size than the first input array. if len(relatively_indexed) > 1: func_text += " raise_if_incompatible_array_sizes(" + first_arg for other_array in relatively_indexed: if other_array != first_arg: func_text += "," + other_array func_text += ")\n" # Get the shape of the first input array. shape_name = ir_utils.get_unused_var_name("full_shape", name_var_table) func_text += " {} = {}.shape\n".format(shape_name, first_arg) # If we have to allocate the output array (the out argument was not used) # then us numpy.full if the user specified a cval stencil decorator option # or np.zeros if they didn't to allocate the array. if result is None: return_type_name = numpy_support.as_dtype(return_type.dtype).type.__name__ if "cval" in self.options: cval = self.options["cval"] if return_type.dtype != typing.typeof.typeof(cval): raise ValueError("cval type does not match stencil return type.") out_init = "{} = np.full({}, {}, dtype=np.{})\n".format( out_name, shape_name, cval, return_type_name ) else: out_init = "{} = np.zeros({}, dtype=np.{})\n".format( out_name, shape_name, return_type_name ) func_text += " " + out_init else: # result is present, if cval is set then use it if "cval" in self.options: cval = self.options["cval"] cval_ty = typing.typeof.typeof(cval) if not self._typingctx.can_convert(cval_ty, return_type.dtype): msg = "cval type does not match stencil return type." raise ValueError(msg) out_init = "{}[:] = {}\n".format(out_name, cval) func_text += " " + out_init offset = 1 # Add the loop nests to the new function. for i in range(the_array.ndim): for j in range(offset): func_text += " " # ranges[i][0] is the minimum index used in the i'th dimension # but minimum's greater than 0 don't preclude any entry in the array. # So, take the minimum of 0 and the minimum index found in the kernel # and this will be a negative number (potentially -0). Then, we do # unary - on that to get the positive offset in this dimension whose # use is precluded. # ranges[i][1] is the maximum of 0 and the observed maximum index # in this dimension because negative maximums would not cause us to # preclude any entry in the array from being used. func_text += ("for {} in range(-min(0,{}),{}[{}]-max(0,{})):\n").format( index_vars[i], ranges[i][0], shape_name, i, ranges[i][1] ) offset += 1 for j in range(offset): func_text += " " # Put a sentinel in the code so we can locate it in the IR. We will # remove this sentinel assignment and replace it with the IR for the # stencil kernel body. func_text += "{} = 0\n".format(sentinel_name) func_text += " return {}\n".format(out_name) if config.DEBUG_ARRAY_OPT >= 1: print("new stencil func text") print(func_text) # Force the new stencil function into existence. exec_(func_text) in globals(), locals() stencil_func = eval(stencil_func_name) if sigret is not None: pysig = utils.pysignature(stencil_func) sigret.pysig = pysig # Get the IR for the newly created stencil function. stencil_ir = compiler.run_frontend(stencil_func) ir_utils.remove_dels(stencil_ir.blocks) # rename all variables in stencil_ir afresh var_table = ir_utils.get_name_var_table(stencil_ir.blocks) new_var_dict = {} reserved_names = ( [sentinel_name, out_name, neighborhood_name, shape_name] + kernel_copy.arg_names + index_vars ) for name, var in var_table.items(): if not name in reserved_names: new_var_dict[name] = ir_utils.mk_unique_var(name) ir_utils.replace_var_names(stencil_ir.blocks, new_var_dict) stencil_stub_last_label = max(stencil_ir.blocks.keys()) + 1 # Shift lables in the kernel copy so they are guaranteed unique # and don't conflict with any labels in the stencil_ir. kernel_copy.blocks = ir_utils.add_offset_to_labels( kernel_copy.blocks, stencil_stub_last_label ) new_label = max(kernel_copy.blocks.keys()) + 1 # Adjust ret_blocks to account for addition of the offset. ret_blocks = [x + stencil_stub_last_label for x in ret_blocks] if config.DEBUG_ARRAY_OPT >= 1: print("ret_blocks w/ offsets", ret_blocks, stencil_stub_last_label) print("before replace sentinel stencil_ir") ir_utils.dump_blocks(stencil_ir.blocks) print("before replace sentinel kernel_copy") ir_utils.dump_blocks(kernel_copy.blocks) # Search all the block in the stencil outline for the sentinel. for label, block in stencil_ir.blocks.items(): for i, inst in enumerate(block.body): if isinstance(inst, ir.Assign) and inst.target.name == sentinel_name: # We found the sentinel assignment. loc = inst.loc scope = block.scope # split block across __sentinel__ # A new block is allocated for the statements prior to the # sentinel but the new block maintains the current block # label. prev_block = ir.Block(scope, loc) prev_block.body = block.body[:i] # The current block is used for statements after sentinel. block.body = block.body[i + 1 :] # But the current block gets a new label. body_first_label = min(kernel_copy.blocks.keys()) # The previous block jumps to the minimum labelled block of # the parfor body. prev_block.append(ir.Jump(body_first_label, loc)) # Add all the parfor loop body blocks to the gufunc # function's IR. for l, b in kernel_copy.blocks.items(): stencil_ir.blocks[l] = b stencil_ir.blocks[new_label] = block stencil_ir.blocks[label] = prev_block # Add a jump from all the blocks that previously contained # a return in the stencil kernel to the block # containing statements after the sentinel. for ret_block in ret_blocks: stencil_ir.blocks[ret_block].append(ir.Jump(new_label, loc)) break else: continue break stencil_ir.blocks = ir_utils.rename_labels(stencil_ir.blocks) ir_utils.remove_dels(stencil_ir.blocks) assert isinstance(the_array, types.Type) array_types = args new_stencil_param_types = list(array_types) if config.DEBUG_ARRAY_OPT >= 1: print("new_stencil_param_types", new_stencil_param_types) ir_utils.dump_blocks(stencil_ir.blocks) # Compile the combined stencil function with the replaced loop # body in it. new_func = compiler.compile_ir( self._typingctx, self._targetctx, stencil_ir, new_stencil_param_types, None, compiler.DEFAULT_FLAGS, {}, ) return new_func
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def np_interp_impl_inner(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp prior to 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.15.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/3430d78c01a3b9a19adad75f1acb5ae18286da73/numpy/core/src/multiarray/compiled_base.c#L532 # noqa: E501 dz = np.asarray(x, dtype=np.float64) dx = np.asarray(xp, dtype=np.float64) dy = np.asarray(fp, dtype=np.float64) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in master but not in any released # version of 1.16.x yet... # # If we get nan in one direction, try the other # if np.isnan(dres.flat[i]): # dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # # if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: # dres.flat[i] = dy[j] return dres
def np_interp_impl_inner(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp prior to 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.15.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/3430d78c01a3b9a19adad75f1acb5ae18286da73/numpy/core/src/multiarray/compiled_base.c#L532 # noqa: E501 dz = np.asarray(x) dx = np.asarray(xp) dy = np.asarray(fp) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in master but not in any released # version of 1.16.x yet... # # If we get nan in one direction, try the other # if np.isnan(dres.flat[i]): # dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # # if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: # dres.flat[i] = dy[j] return dres
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def np_interp_impl_inner_factory(np117_nan_handling): def impl(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp post 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.16.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/971e2e89d08deeae0139d3011d15646fdac13c92/numpy/core/src/multiarray/compiled_base.c#L473 # noqa: E501 dz = np.asarray(x, dtype=np.float64) dx = np.asarray(xp, dtype=np.float64) dy = np.asarray(fp, dtype=np.float64) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] elif dx[j] == x_val: # Avoid potential non-finite interpolation dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in np1.17 # https://github.com/numpy/numpy/blob/maintenance/1.17.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/91fbe4dde246559fa5b085ebf4bc268e2b89eea8/numpy/core/src/multiarray/compiled_base.c#L610-L616 # noqa: E501 # # If we get nan in one direction, try the other if np117_nan_handling: if np.isnan(dres.flat[i]): dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # noqa: E501 if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: dres.flat[i] = dy[j] return dres return impl
def np_interp_impl_inner_factory(np117_nan_handling): def impl(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp post 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.16.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/971e2e89d08deeae0139d3011d15646fdac13c92/numpy/core/src/multiarray/compiled_base.c#L473 # noqa: E501 dz = np.asarray(x) dx = np.asarray(xp) dy = np.asarray(fp) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] elif dx[j] == x_val: # Avoid potential non-finite interpolation dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in np1.17 # https://github.com/numpy/numpy/blob/maintenance/1.17.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/91fbe4dde246559fa5b085ebf4bc268e2b89eea8/numpy/core/src/multiarray/compiled_base.c#L610-L616 # noqa: E501 # # If we get nan in one direction, try the other if np117_nan_handling: if np.isnan(dres.flat[i]): dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # noqa: E501 if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: dres.flat[i] = dy[j] return dres return impl
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def impl(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp post 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.16.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/971e2e89d08deeae0139d3011d15646fdac13c92/numpy/core/src/multiarray/compiled_base.c#L473 # noqa: E501 dz = np.asarray(x, dtype=np.float64) dx = np.asarray(xp, dtype=np.float64) dy = np.asarray(fp, dtype=np.float64) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] elif dx[j] == x_val: # Avoid potential non-finite interpolation dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in np1.17 # https://github.com/numpy/numpy/blob/maintenance/1.17.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/91fbe4dde246559fa5b085ebf4bc268e2b89eea8/numpy/core/src/multiarray/compiled_base.c#L610-L616 # noqa: E501 # # If we get nan in one direction, try the other if np117_nan_handling: if np.isnan(dres.flat[i]): dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # noqa: E501 if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: dres.flat[i] = dy[j] return dres
def impl(x, xp, fp, dtype): # NOTE: Do not refactor... see note in np_interp function impl below # this is a facsimile of arr_interp post 1.16: # https://github.com/numpy/numpy/blob/maintenance/1.16.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/971e2e89d08deeae0139d3011d15646fdac13c92/numpy/core/src/multiarray/compiled_base.c#L473 # noqa: E501 dz = np.asarray(x) dx = np.asarray(xp) dy = np.asarray(fp) if len(dx) == 0: raise ValueError("array of sample points is empty") if len(dx) != len(dy): raise ValueError("fp and xp are not of the same size.") if dx.size == 1: return np.full(dz.shape, fill_value=dy[0], dtype=dtype) dres = np.empty(dz.shape, dtype=dtype) lenx = dz.size lenxp = len(dx) lval = dy[0] rval = dy[lenxp - 1] if lenxp == 1: xp_val = dx[0] fp_val = dy[0] for i in range(lenx): x_val = dz.flat[i] if x_val < xp_val: dres.flat[i] = lval elif x_val > xp_val: dres.flat[i] = rval else: dres.flat[i] = fp_val else: j = 0 # only pre-calculate slopes if there are relatively few of them. if lenxp <= lenx: slopes = (dy[1:] - dy[:-1]) / (dx[1:] - dx[:-1]) else: slopes = np.empty(0, dtype=dtype) for i in range(lenx): x_val = dz.flat[i] if np.isnan(x_val): dres.flat[i] = x_val continue j = binary_search_with_guess(x_val, dx, lenxp, j) if j == -1: dres.flat[i] = lval elif j == lenxp: dres.flat[i] = rval elif j == lenxp - 1: dres.flat[i] = dy[j] elif dx[j] == x_val: # Avoid potential non-finite interpolation dres.flat[i] = dy[j] else: if slopes.size: slope = slopes[j] else: slope = (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]) dres.flat[i] = slope * (x_val - dx[j]) + dy[j] # NOTE: this is in np1.17 # https://github.com/numpy/numpy/blob/maintenance/1.17.x/numpy/core/src/multiarray/compiled_base.c # noqa: E501 # Permanent reference: # https://github.com/numpy/numpy/blob/91fbe4dde246559fa5b085ebf4bc268e2b89eea8/numpy/core/src/multiarray/compiled_base.c#L610-L616 # noqa: E501 # # If we get nan in one direction, try the other if np117_nan_handling: if np.isnan(dres.flat[i]): dres.flat[i] = slope * (x_val - dx[j + 1]) + dy[j + 1] # noqa: E501 if np.isnan(dres.flat[i]) and dy[j] == dy[j + 1]: dres.flat[i] = dy[j] return dres
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def array_nonzero(context, builder, sig, args): aryty = sig.args[0] # Return type is a N-tuple of 1D C-contiguous arrays retty = sig.return_type outaryty = retty.dtype nouts = retty.count ary = make_array(aryty)(context, builder, args[0]) shape = cgutils.unpack_tuple(builder, ary.shape) strides = cgutils.unpack_tuple(builder, ary.strides) data = ary.data layout = aryty.layout # First count the number of non-zero elements zero = context.get_constant(types.intp, 0) one = context.get_constant(types.intp, 1) count = cgutils.alloca_once_value(builder, zero) with cgutils.loop_nest(builder, shape, zero.type) as indices: ptr = cgutils.get_item_pointer2( context, builder, data, shape, strides, layout, indices ) val = load_item(context, builder, aryty, ptr) nz = context.is_true(builder, aryty.dtype, val) with builder.if_then(nz): builder.store(builder.add(builder.load(count), one), count) # Then allocate output arrays of the right size out_shape = (builder.load(count),) outs = [ _empty_nd_impl(context, builder, outaryty, out_shape)._getvalue() for i in range(nouts) ] outarys = [make_array(outaryty)(context, builder, out) for out in outs] out_datas = [out.data for out in outarys] # And fill them up index = cgutils.alloca_once_value(builder, zero) with cgutils.loop_nest(builder, shape, zero.type) as indices: ptr = cgutils.get_item_pointer2( context, builder, data, shape, strides, layout, indices ) val = load_item(context, builder, aryty, ptr) nz = context.is_true(builder, aryty.dtype, val) with builder.if_then(nz): # Store element indices in output arrays if not indices: # For a 0-d array, store 0 in the unique output array indices = (zero,) cur = builder.load(index) for i in range(nouts): ptr = cgutils.get_item_pointer2( context, builder, out_datas[i], out_shape, (), "C", [cur] ) store_item(context, builder, outaryty, indices[i], ptr) builder.store(builder.add(cur, one), index) tup = context.make_tuple(builder, sig.return_type, outs) return impl_ret_new_ref(context, builder, sig.return_type, tup)
def array_nonzero(context, builder, sig, args): aryty = sig.args[0] # Return type is a N-tuple of 1D C-contiguous arrays retty = sig.return_type outaryty = retty.dtype nouts = retty.count ary = make_array(aryty)(context, builder, args[0]) shape = cgutils.unpack_tuple(builder, ary.shape) strides = cgutils.unpack_tuple(builder, ary.strides) data = ary.data layout = aryty.layout # First count the number of non-zero elements zero = context.get_constant(types.intp, 0) one = context.get_constant(types.intp, 1) count = cgutils.alloca_once_value(builder, zero) with cgutils.loop_nest(builder, shape, zero.type) as indices: ptr = cgutils.get_item_pointer2(builder, data, shape, strides, layout, indices) val = load_item(context, builder, aryty, ptr) nz = context.is_true(builder, aryty.dtype, val) with builder.if_then(nz): builder.store(builder.add(builder.load(count), one), count) # Then allocate output arrays of the right size out_shape = (builder.load(count),) outs = [ _empty_nd_impl(context, builder, outaryty, out_shape)._getvalue() for i in range(nouts) ] outarys = [make_array(outaryty)(context, builder, out) for out in outs] out_datas = [out.data for out in outarys] # And fill them up index = cgutils.alloca_once_value(builder, zero) with cgutils.loop_nest(builder, shape, zero.type) as indices: ptr = cgutils.get_item_pointer2(builder, data, shape, strides, layout, indices) val = load_item(context, builder, aryty, ptr) nz = context.is_true(builder, aryty.dtype, val) with builder.if_then(nz): # Store element indices in output arrays if not indices: # For a 0-d array, store 0 in the unique output array indices = (zero,) cur = builder.load(index) for i in range(nouts): ptr = cgutils.get_item_pointer2( builder, out_datas[i], out_shape, (), "C", [cur] ) store_item(context, builder, outaryty, indices[i], ptr) builder.store(builder.add(cur, one), index) tup = context.make_tuple(builder, sig.return_type, outs) return impl_ret_new_ref(context, builder, sig.return_type, tup)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _getitem_array1d(context, builder, arrayty, array, idx, wraparound): """ Look up and return an element from a 1D array. """ ptr = cgutils.get_item_pointer( context, builder, arrayty, array, [idx], wraparound=wraparound ) return load_item(context, builder, arrayty, ptr)
def _getitem_array1d(context, builder, arrayty, array, idx, wraparound): """ Look up and return an element from a 1D array. """ ptr = cgutils.get_item_pointer( builder, arrayty, array, [idx], wraparound=wraparound ) return load_item(context, builder, arrayty, ptr)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def basic_indexing( context, builder, aryty, ary, index_types, indices, boundscheck=None ): """ Perform basic indexing on the given array. A (data pointer, shapes, strides) tuple is returned describing the corresponding view. """ zero = context.get_constant(types.intp, 0) shapes = cgutils.unpack_tuple(builder, ary.shape, aryty.ndim) strides = cgutils.unpack_tuple(builder, ary.strides, aryty.ndim) output_indices = [] output_shapes = [] output_strides = [] ax = 0 for indexval, idxty in zip(indices, index_types): if idxty is types.ellipsis: # Fill up missing dimensions at the middle n_missing = aryty.ndim - len(indices) + 1 for i in range(n_missing): output_indices.append(zero) output_shapes.append(shapes[ax]) output_strides.append(strides[ax]) ax += 1 continue # Regular index value if isinstance(idxty, types.SliceType): slice = context.make_helper(builder, idxty, value=indexval) slicing.guard_invalid_slice(context, builder, idxty, slice) slicing.fix_slice(builder, slice, shapes[ax]) output_indices.append(slice.start) sh = slicing.get_slice_length(builder, slice) st = slicing.fix_stride(builder, slice, strides[ax]) output_shapes.append(sh) output_strides.append(st) elif isinstance(idxty, types.Integer): ind = fix_integer_index(context, builder, idxty, indexval, shapes[ax]) if boundscheck: cgutils.do_boundscheck(context, builder, ind, shapes[ax], ax) output_indices.append(ind) else: raise NotImplementedError("unexpected index type: %s" % (idxty,)) ax += 1 # Fill up missing dimensions at the end assert ax <= aryty.ndim while ax < aryty.ndim: output_shapes.append(shapes[ax]) output_strides.append(strides[ax]) ax += 1 # No need to check wraparound, as negative indices were already # fixed in the loop above. dataptr = cgutils.get_item_pointer( context, builder, aryty, ary, output_indices, wraparound=False, boundscheck=False, ) return (dataptr, output_shapes, output_strides)
def basic_indexing(context, builder, aryty, ary, index_types, indices): """ Perform basic indexing on the given array. A (data pointer, shapes, strides) tuple is returned describing the corresponding view. """ zero = context.get_constant(types.intp, 0) shapes = cgutils.unpack_tuple(builder, ary.shape, aryty.ndim) strides = cgutils.unpack_tuple(builder, ary.strides, aryty.ndim) output_indices = [] output_shapes = [] output_strides = [] ax = 0 for indexval, idxty in zip(indices, index_types): if idxty is types.ellipsis: # Fill up missing dimensions at the middle n_missing = aryty.ndim - len(indices) + 1 for i in range(n_missing): output_indices.append(zero) output_shapes.append(shapes[ax]) output_strides.append(strides[ax]) ax += 1 continue # Regular index value if isinstance(idxty, types.SliceType): slice = context.make_helper(builder, idxty, value=indexval) slicing.guard_invalid_slice(context, builder, idxty, slice) slicing.fix_slice(builder, slice, shapes[ax]) output_indices.append(slice.start) sh = slicing.get_slice_length(builder, slice) st = slicing.fix_stride(builder, slice, strides[ax]) output_shapes.append(sh) output_strides.append(st) elif isinstance(idxty, types.Integer): ind = fix_integer_index(context, builder, idxty, indexval, shapes[ax]) output_indices.append(ind) else: raise NotImplementedError("unexpected index type: %s" % (idxty,)) ax += 1 # Fill up missing dimensions at the end assert ax <= aryty.ndim while ax < aryty.ndim: output_shapes.append(shapes[ax]) output_strides.append(strides[ax]) ax += 1 # No need to check wraparound, as negative indices were already # fixed in the loop above. dataptr = cgutils.get_item_pointer( builder, aryty, ary, output_indices, wraparound=False ) return (dataptr, output_shapes, output_strides)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _getitem_array_generic( context, builder, return_type, aryty, ary, index_types, indices ): """ Return the result of indexing *ary* with the given *indices*, returning either a scalar or a view. """ dataptr, view_shapes, view_strides = basic_indexing( context, builder, aryty, ary, index_types, indices, boundscheck=context.enable_boundscheck, ) if isinstance(return_type, types.Buffer): # Build array view retary = make_view( context, builder, aryty, ary, return_type, dataptr, view_shapes, view_strides, ) return retary._getvalue() else: # Load scalar from 0-d result assert not view_shapes return load_item(context, builder, aryty, dataptr)
def _getitem_array_generic( context, builder, return_type, aryty, ary, index_types, indices ): """ Return the result of indexing *ary* with the given *indices*, returning either a scalar or a view. """ dataptr, view_shapes, view_strides = basic_indexing( context, builder, aryty, ary, index_types, indices ) if isinstance(return_type, types.Buffer): # Build array view retary = make_view( context, builder, aryty, ary, return_type, dataptr, view_shapes, view_strides, ) return retary._getvalue() else: # Load scalar from 0-d result assert not view_shapes return load_item(context, builder, aryty, dataptr)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def setitem_array(context, builder, sig, args): """ array[a] = scalar_or_array array[a,..,b] = scalar_or_array """ aryty, idxty, valty = sig.args ary, idx, val = args if isinstance(idxty, types.BaseTuple): index_types = idxty.types indices = cgutils.unpack_tuple(builder, idx, count=len(idxty)) else: index_types = (idxty,) indices = (idx,) ary = make_array(aryty)(context, builder, ary) # First try basic indexing to see if a single array location is denoted. index_types, indices = normalize_indices(context, builder, index_types, indices) try: dataptr, shapes, strides = basic_indexing( context, builder, aryty, ary, index_types, indices, boundscheck=context.enable_boundscheck, ) except NotImplementedError: use_fancy_indexing = True else: use_fancy_indexing = bool(shapes) if use_fancy_indexing: # Index describes a non-trivial view => use generic slice assignment # (NOTE: this also handles scalar broadcasting) return fancy_setslice(context, builder, sig, args, index_types, indices) # Store source value the given location val = context.cast(builder, val, valty, aryty.dtype) store_item(context, builder, aryty, val, dataptr)
def setitem_array(context, builder, sig, args): """ array[a] = scalar_or_array array[a,..,b] = scalar_or_array """ aryty, idxty, valty = sig.args ary, idx, val = args if isinstance(idxty, types.BaseTuple): index_types = idxty.types indices = cgutils.unpack_tuple(builder, idx, count=len(idxty)) else: index_types = (idxty,) indices = (idx,) ary = make_array(aryty)(context, builder, ary) # First try basic indexing to see if a single array location is denoted. index_types, indices = normalize_indices(context, builder, index_types, indices) try: dataptr, shapes, strides = basic_indexing( context, builder, aryty, ary, index_types, indices ) except NotImplementedError: use_fancy_indexing = True else: use_fancy_indexing = bool(shapes) if use_fancy_indexing: # Index describes a non-trivial view => use generic slice assignment # (NOTE: this also handles scalar broadcasting) return fancy_setslice(context, builder, sig, args, index_types, indices) # Store source value the given location val = context.cast(builder, val, valty, aryty.dtype) store_item(context, builder, aryty, val, dataptr)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def fancy_getitem(context, builder, sig, args, aryty, ary, index_types, indices): shapes = cgutils.unpack_tuple(builder, ary.shape) strides = cgutils.unpack_tuple(builder, ary.strides) data = ary.data indexer = FancyIndexer(context, builder, aryty, ary, index_types, indices) indexer.prepare() # Construct output array out_ty = sig.return_type out_shapes = indexer.get_shape() out = _empty_nd_impl(context, builder, out_ty, out_shapes) out_data = out.data out_idx = cgutils.alloca_once_value(builder, context.get_constant(types.intp, 0)) # Loop on source and copy to destination indices, _ = indexer.begin_loops() # No need to check for wraparound, as the indexers all ensure # a positive index is returned. ptr = cgutils.get_item_pointer2( context, builder, data, shapes, strides, aryty.layout, indices, wraparound=False, boundscheck=context.enable_boundscheck, ) val = load_item(context, builder, aryty, ptr) # Since the destination is C-contiguous, no need for multi-dimensional # indexing. cur = builder.load(out_idx) ptr = builder.gep(out_data, [cur]) store_item(context, builder, out_ty, val, ptr) next_idx = cgutils.increment_index(builder, cur) builder.store(next_idx, out_idx) indexer.end_loops() return impl_ret_new_ref(context, builder, out_ty, out._getvalue())
def fancy_getitem(context, builder, sig, args, aryty, ary, index_types, indices): shapes = cgutils.unpack_tuple(builder, ary.shape) strides = cgutils.unpack_tuple(builder, ary.strides) data = ary.data indexer = FancyIndexer(context, builder, aryty, ary, index_types, indices) indexer.prepare() # Construct output array out_ty = sig.return_type out_shapes = indexer.get_shape() out = _empty_nd_impl(context, builder, out_ty, out_shapes) out_data = out.data out_idx = cgutils.alloca_once_value(builder, context.get_constant(types.intp, 0)) # Loop on source and copy to destination indices, _ = indexer.begin_loops() # No need to check for wraparound, as the indexers all ensure # a positive index is returned. ptr = cgutils.get_item_pointer2( builder, data, shapes, strides, aryty.layout, indices, wraparound=False ) val = load_item(context, builder, aryty, ptr) # Since the destination is C-contiguous, no need for multi-dimensional # indexing. cur = builder.load(out_idx) ptr = builder.gep(out_data, [cur]) store_item(context, builder, out_ty, val, ptr) next_idx = cgutils.increment_index(builder, cur) builder.store(next_idx, out_idx) indexer.end_loops() return impl_ret_new_ref(context, builder, out_ty, out._getvalue())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def maybe_copy_source( context, builder, use_copy, srcty, src, src_shapes, src_strides, src_data ): ptrty = src_data.type copy_layout = "C" copy_data = cgutils.alloca_once_value(builder, src_data) copy_shapes = src_shapes copy_strides = None # unneeded for contiguous arrays with builder.if_then(use_copy, likely=False): # Allocate temporary scratchpad # XXX: should we use a stack-allocated array for very small # data sizes? allocsize = builder.mul(src.itemsize, src.nitems) data = context.nrt.allocate(builder, allocsize) voidptrty = data.type data = builder.bitcast(data, ptrty) builder.store(data, copy_data) # Copy source data into scratchpad intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, src_shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( context, builder, src_data, src_shapes, src_strides, srcty.layout, indices, ) dest_ptr = cgutils.get_item_pointer2( context, builder, data, copy_shapes, copy_strides, copy_layout, indices ) builder.store(builder.load(src_ptr), dest_ptr) def src_getitem(source_indices): assert len(source_indices) == srcty.ndim src_ptr = cgutils.alloca_once(builder, ptrty) with builder.if_else(use_copy, likely=False) as (if_copy, otherwise): with if_copy: builder.store( cgutils.get_item_pointer2( context, builder, builder.load(copy_data), copy_shapes, copy_strides, copy_layout, source_indices, wraparound=False, ), src_ptr, ) with otherwise: builder.store( cgutils.get_item_pointer2( context, builder, src_data, src_shapes, src_strides, srcty.layout, source_indices, wraparound=False, ), src_ptr, ) return load_item(context, builder, srcty, builder.load(src_ptr)) def src_cleanup(): # Deallocate memory with builder.if_then(use_copy, likely=False): data = builder.load(copy_data) data = builder.bitcast(data, voidptrty) context.nrt.free(builder, data) return src_getitem, src_cleanup
def maybe_copy_source( context, builder, use_copy, srcty, src, src_shapes, src_strides, src_data ): ptrty = src_data.type copy_layout = "C" copy_data = cgutils.alloca_once_value(builder, src_data) copy_shapes = src_shapes copy_strides = None # unneeded for contiguous arrays with builder.if_then(use_copy, likely=False): # Allocate temporary scratchpad # XXX: should we use a stack-allocated array for very small # data sizes? allocsize = builder.mul(src.itemsize, src.nitems) data = context.nrt.allocate(builder, allocsize) voidptrty = data.type data = builder.bitcast(data, ptrty) builder.store(data, copy_data) # Copy source data into scratchpad intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, src_shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( builder, src_data, src_shapes, src_strides, srcty.layout, indices ) dest_ptr = cgutils.get_item_pointer2( builder, data, copy_shapes, copy_strides, copy_layout, indices ) builder.store(builder.load(src_ptr), dest_ptr) def src_getitem(source_indices): assert len(source_indices) == srcty.ndim src_ptr = cgutils.alloca_once(builder, ptrty) with builder.if_else(use_copy, likely=False) as (if_copy, otherwise): with if_copy: builder.store( cgutils.get_item_pointer2( builder, builder.load(copy_data), copy_shapes, copy_strides, copy_layout, source_indices, wraparound=False, ), src_ptr, ) with otherwise: builder.store( cgutils.get_item_pointer2( builder, src_data, src_shapes, src_strides, srcty.layout, source_indices, wraparound=False, ), src_ptr, ) return load_item(context, builder, srcty, builder.load(src_ptr)) def src_cleanup(): # Deallocate memory with builder.if_then(use_copy, likely=False): data = builder.load(copy_data) data = builder.bitcast(data, voidptrty) context.nrt.free(builder, data) return src_getitem, src_cleanup
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def src_getitem(source_indices): assert len(source_indices) == srcty.ndim src_ptr = cgutils.alloca_once(builder, ptrty) with builder.if_else(use_copy, likely=False) as (if_copy, otherwise): with if_copy: builder.store( cgutils.get_item_pointer2( context, builder, builder.load(copy_data), copy_shapes, copy_strides, copy_layout, source_indices, wraparound=False, ), src_ptr, ) with otherwise: builder.store( cgutils.get_item_pointer2( context, builder, src_data, src_shapes, src_strides, srcty.layout, source_indices, wraparound=False, ), src_ptr, ) return load_item(context, builder, srcty, builder.load(src_ptr))
def src_getitem(source_indices): assert len(source_indices) == srcty.ndim src_ptr = cgutils.alloca_once(builder, ptrty) with builder.if_else(use_copy, likely=False) as (if_copy, otherwise): with if_copy: builder.store( cgutils.get_item_pointer2( builder, builder.load(copy_data), copy_shapes, copy_strides, copy_layout, source_indices, wraparound=False, ), src_ptr, ) with otherwise: builder.store( cgutils.get_item_pointer2( builder, src_data, src_shapes, src_strides, srcty.layout, source_indices, wraparound=False, ), src_ptr, ) return load_item(context, builder, srcty, builder.load(src_ptr))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def fancy_setslice(context, builder, sig, args, index_types, indices): """ Implement slice assignment for arrays. This implementation works for basic as well as fancy indexing, since there's no functional difference between the two for indexed assignment. """ aryty, _, srcty = sig.args ary, _, src = args ary = make_array(aryty)(context, builder, ary) dest_shapes = cgutils.unpack_tuple(builder, ary.shape) dest_strides = cgutils.unpack_tuple(builder, ary.strides) dest_data = ary.data indexer = FancyIndexer(context, builder, aryty, ary, index_types, indices) indexer.prepare() if isinstance(srcty, types.Buffer): # Source is an array src_dtype = srcty.dtype index_shape = indexer.get_shape() src = make_array(srcty)(context, builder, src) # Broadcast source array to shape srcty, src = _broadcast_to_shape(context, builder, srcty, src, index_shape) src_shapes = cgutils.unpack_tuple(builder, src.shape) src_strides = cgutils.unpack_tuple(builder, src.strides) src_data = src.data # Check shapes are equal shape_error = cgutils.false_bit assert len(index_shape) == len(src_shapes) for u, v in zip(src_shapes, index_shape): shape_error = builder.or_(shape_error, builder.icmp_signed("!=", u, v)) with builder.if_then(shape_error, likely=False): msg = "cannot assign slice from input of different size" context.call_conv.return_user_exc(builder, ValueError, (msg,)) # Check for array overlap src_start, src_end = get_array_memory_extents( context, builder, srcty, src, src_shapes, src_strides, src_data ) dest_lower, dest_upper = indexer.get_offset_bounds(dest_strides, ary.itemsize) dest_start, dest_end = compute_memory_extents( context, builder, dest_lower, dest_upper, dest_data ) use_copy = extents_may_overlap( context, builder, src_start, src_end, dest_start, dest_end ) src_getitem, src_cleanup = maybe_copy_source( context, builder, use_copy, srcty, src, src_shapes, src_strides, src_data ) elif isinstance(srcty, types.Sequence): src_dtype = srcty.dtype # Check shape is equal to sequence length index_shape = indexer.get_shape() assert len(index_shape) == 1 len_impl = context.get_function(len, signature(types.intp, srcty)) seq_len = len_impl(builder, (src,)) shape_error = builder.icmp_signed("!=", index_shape[0], seq_len) with builder.if_then(shape_error, likely=False): msg = "cannot assign slice from input of different size" context.call_conv.return_user_exc(builder, ValueError, (msg,)) def src_getitem(source_indices): (idx,) = source_indices getitem_impl = context.get_function( operator.getitem, signature(src_dtype, srcty, types.intp), ) return getitem_impl(builder, (src, idx)) def src_cleanup(): pass else: # Source is a scalar (broadcast or not, depending on destination # shape). src_dtype = srcty def src_getitem(source_indices): return src def src_cleanup(): pass # Loop on destination and copy from source to destination dest_indices, counts = indexer.begin_loops() # Source is iterated in natural order source_indices = tuple(c for c in counts if c is not None) val = src_getitem(source_indices) # Cast to the destination dtype (cross-dtype slice assignement is allowed) val = context.cast(builder, val, src_dtype, aryty.dtype) # No need to check for wraparound, as the indexers all ensure # a positive index is returned. dest_ptr = cgutils.get_item_pointer2( context, builder, dest_data, dest_shapes, dest_strides, aryty.layout, dest_indices, wraparound=False, ) store_item(context, builder, aryty, val, dest_ptr) indexer.end_loops() src_cleanup() return context.get_dummy_value()
def fancy_setslice(context, builder, sig, args, index_types, indices): """ Implement slice assignment for arrays. This implementation works for basic as well as fancy indexing, since there's no functional difference between the two for indexed assignment. """ aryty, _, srcty = sig.args ary, _, src = args ary = make_array(aryty)(context, builder, ary) dest_shapes = cgutils.unpack_tuple(builder, ary.shape) dest_strides = cgutils.unpack_tuple(builder, ary.strides) dest_data = ary.data indexer = FancyIndexer(context, builder, aryty, ary, index_types, indices) indexer.prepare() if isinstance(srcty, types.Buffer): # Source is an array src_dtype = srcty.dtype index_shape = indexer.get_shape() src = make_array(srcty)(context, builder, src) # Broadcast source array to shape srcty, src = _broadcast_to_shape(context, builder, srcty, src, index_shape) src_shapes = cgutils.unpack_tuple(builder, src.shape) src_strides = cgutils.unpack_tuple(builder, src.strides) src_data = src.data # Check shapes are equal shape_error = cgutils.false_bit assert len(index_shape) == len(src_shapes) for u, v in zip(src_shapes, index_shape): shape_error = builder.or_(shape_error, builder.icmp_signed("!=", u, v)) with builder.if_then(shape_error, likely=False): msg = "cannot assign slice from input of different size" context.call_conv.return_user_exc(builder, ValueError, (msg,)) # Check for array overlap src_start, src_end = get_array_memory_extents( context, builder, srcty, src, src_shapes, src_strides, src_data ) dest_lower, dest_upper = indexer.get_offset_bounds(dest_strides, ary.itemsize) dest_start, dest_end = compute_memory_extents( context, builder, dest_lower, dest_upper, dest_data ) use_copy = extents_may_overlap( context, builder, src_start, src_end, dest_start, dest_end ) src_getitem, src_cleanup = maybe_copy_source( context, builder, use_copy, srcty, src, src_shapes, src_strides, src_data ) elif isinstance(srcty, types.Sequence): src_dtype = srcty.dtype # Check shape is equal to sequence length index_shape = indexer.get_shape() assert len(index_shape) == 1 len_impl = context.get_function(len, signature(types.intp, srcty)) seq_len = len_impl(builder, (src,)) shape_error = builder.icmp_signed("!=", index_shape[0], seq_len) with builder.if_then(shape_error, likely=False): msg = "cannot assign slice from input of different size" context.call_conv.return_user_exc(builder, ValueError, (msg,)) def src_getitem(source_indices): (idx,) = source_indices getitem_impl = context.get_function( operator.getitem, signature(src_dtype, srcty, types.intp), ) return getitem_impl(builder, (src, idx)) def src_cleanup(): pass else: # Source is a scalar (broadcast or not, depending on destination # shape). src_dtype = srcty def src_getitem(source_indices): return src def src_cleanup(): pass # Loop on destination and copy from source to destination dest_indices, counts = indexer.begin_loops() # Source is iterated in natural order source_indices = tuple(c for c in counts if c is not None) val = src_getitem(source_indices) # Cast to the destination dtype (cross-dtype slice assignement is allowed) val = context.cast(builder, val, src_dtype, aryty.dtype) # No need to check for wraparound, as the indexers all ensure # a positive index is returned. dest_ptr = cgutils.get_item_pointer2( builder, dest_data, dest_shapes, dest_strides, aryty.layout, dest_indices, wraparound=False, ) store_item(context, builder, aryty, val, dest_ptr) indexer.end_loops() src_cleanup() return context.get_dummy_value()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def array_repeat(a, repeats): def array_repeat_impl(a, repeats): return np.repeat(a, repeats) return array_repeat_impl
def array_repeat(a, repeats): def array_repeat_impl(a, repeat): return np.repeat(a, repeat) return array_repeat_impl
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def array_repeat_impl(a, repeats): return np.repeat(a, repeats)
def array_repeat_impl(a, repeat): return np.repeat(a, repeat)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def array_complex_attr(context, builder, typ, value, attr): """ Given a complex array, it's memory layout is: R C R C R C ^ ^ ^ (`R` indicates a float for the real part; `C` indicates a float for the imaginary part; the `^` indicates the start of each element) To get the real part, we can simply change the dtype and itemsize to that of the underlying float type. The new layout is: R x R x R x ^ ^ ^ (`x` indicates unused) A load operation will use the dtype to determine the number of bytes to load. To get the imaginary part, we shift the pointer by 1 float offset and change the dtype and itemsize. The new layout is: x C x C x C ^ ^ ^ """ if attr not in ["real", "imag"] or typ.dtype not in types.complex_domain: raise NotImplementedError("cannot get attribute `{}`".format(attr)) arrayty = make_array(typ) array = arrayty(context, builder, value) # sizeof underlying float type flty = typ.dtype.underlying_float sizeof_flty = context.get_abi_sizeof(context.get_data_type(flty)) itemsize = array.itemsize.type(sizeof_flty) # cast data pointer to float type llfltptrty = context.get_value_type(flty).as_pointer() dataptr = builder.bitcast(array.data, llfltptrty) # add offset if attr == "imag": dataptr = builder.gep(dataptr, [ir.IntType(32)(1)]) # make result resultty = typ.copy(dtype=flty, layout="A") result = make_array(resultty)(context, builder) repl = dict(data=dataptr, itemsize=itemsize) cgutils.copy_struct(result, array, repl) return impl_ret_borrowed(context, builder, resultty, result._getvalue())
def array_complex_attr(context, builder, typ, value, attr): """ Given a complex array, it's memory layout is: R C R C R C ^ ^ ^ (`R` indicates a float for the real part; `C` indicates a float for the imaginery part; the `^` indicates the start of each element) To get the real part, we can simply change the dtype and itemsize to that of the underlying float type. The new layout is: R x R x R x ^ ^ ^ (`x` indicates unused) A load operation will use the dtype to determine the number of bytes to load. To get the imaginary part, we shift the pointer by 1 float offset and change the dtype and itemsize. The new layout is: x C x C x C ^ ^ ^ """ if attr not in ["real", "imag"] or typ.dtype not in types.complex_domain: raise NotImplementedError("cannot get attribute `{}`".format(attr)) arrayty = make_array(typ) array = arrayty(context, builder, value) # sizeof underlying float type flty = typ.dtype.underlying_float sizeof_flty = context.get_abi_sizeof(context.get_data_type(flty)) itemsize = array.itemsize.type(sizeof_flty) # cast data pointer to float type llfltptrty = context.get_value_type(flty).as_pointer() dataptr = builder.bitcast(array.data, llfltptrty) # add offset if attr == "imag": dataptr = builder.gep(dataptr, [ir.IntType(32)(1)]) # make result resultty = typ.copy(dtype=flty, layout="A") result = make_array(resultty)(context, builder) repl = dict(data=dataptr, itemsize=itemsize) cgutils.copy_struct(result, array, repl) return impl_ret_borrowed(context, builder, resultty, result._getvalue())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def make_nditer_cls(nditerty): """ Return the Structure representation of the given *nditerty* (an instance of types.NumpyNdIterType). """ ndim = nditerty.ndim layout = nditerty.layout narrays = len(nditerty.arrays) nshapes = ndim if nditerty.need_shaped_indexing else 1 class BaseSubIter(object): """ Base class for sub-iterators of a nditer() instance. """ def __init__(self, nditer, member_name, start_dim, end_dim): self.nditer = nditer self.member_name = member_name self.start_dim = start_dim self.end_dim = end_dim self.ndim = end_dim - start_dim def set_member_ptr(self, ptr): setattr(self.nditer, self.member_name, ptr) @utils.cached_property def member_ptr(self): return getattr(self.nditer, self.member_name) def init_specific(self, context, builder): pass def loop_continue(self, context, builder, logical_dim): pass def loop_break(self, context, builder, logical_dim): pass class FlatSubIter(BaseSubIter): """ Sub-iterator walking a contiguous array in physical order, with support for broadcasting (the index is reset on the outer dimension). """ def init_specific(self, context, builder): zero = context.get_constant(types.intp, 0) self.set_member_ptr(cgutils.alloca_once_value(builder, zero)) def compute_pointer(self, context, builder, indices, arrty, arr): index = builder.load(self.member_ptr) return builder.gep(arr.data, [index]) def loop_continue(self, context, builder, logical_dim): if logical_dim == self.ndim - 1: # Only increment index inside innermost logical dimension index = builder.load(self.member_ptr) index = cgutils.increment_index(builder, index) builder.store(index, self.member_ptr) def loop_break(self, context, builder, logical_dim): if logical_dim == 0: # At the exit of outermost logical dimension, reset index zero = context.get_constant(types.intp, 0) builder.store(zero, self.member_ptr) elif logical_dim == self.ndim - 1: # Inside innermost logical dimension, increment index index = builder.load(self.member_ptr) index = cgutils.increment_index(builder, index) builder.store(index, self.member_ptr) class TrivialFlatSubIter(BaseSubIter): """ Sub-iterator walking a contiguous array in physical order, *without* support for broadcasting. """ def init_specific(self, context, builder): assert not nditerty.need_shaped_indexing def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) <= 1, len(indices) return builder.gep(arr.data, indices) class IndexedSubIter(BaseSubIter): """ Sub-iterator walking an array in logical order. """ def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) == self.ndim return cgutils.get_item_pointer( context, builder, arrty, arr, indices, wraparound=False ) class ZeroDimSubIter(BaseSubIter): """ Sub-iterator "walking" a 0-d array. """ def compute_pointer(self, context, builder, indices, arrty, arr): return arr.data class ScalarSubIter(BaseSubIter): """ Sub-iterator "walking" a scalar value. """ def compute_pointer(self, context, builder, indices, arrty, arr): return arr class NdIter(cgutils.create_struct_proxy(nditerty)): """ .nditer() implementation. Note: 'F' layout means the shape is iterated in reverse logical order, so indices and shapes arrays have to be reversed as well. """ @utils.cached_property def subiters(self): l = [] factories = { "flat": FlatSubIter if nditerty.need_shaped_indexing else TrivialFlatSubIter, "indexed": IndexedSubIter, "0d": ZeroDimSubIter, "scalar": ScalarSubIter, } for i, sub in enumerate(nditerty.indexers): kind, start_dim, end_dim, _ = sub member_name = "index%d" % i factory = factories[kind] l.append(factory(self, member_name, start_dim, end_dim)) return l def init_specific(self, context, builder, arrtys, arrays): """ Initialize the nditer() instance for the specific array inputs. """ zero = context.get_constant(types.intp, 0) # Store inputs self.arrays = context.make_tuple(builder, types.Tuple(arrtys), arrays) # Create slots for scalars for i, ty in enumerate(arrtys): if not isinstance(ty, types.Array): member_name = "scalar%d" % i # XXX as_data()? slot = cgutils.alloca_once_value(builder, arrays[i]) setattr(self, member_name, slot) arrays = self._arrays_or_scalars(context, builder, arrtys, arrays) # Extract iterator shape (the shape of the most-dimensional input) main_shape_ty = types.UniTuple(types.intp, ndim) main_shape = None main_nitems = None for i, arrty in enumerate(arrtys): if isinstance(arrty, types.Array) and arrty.ndim == ndim: main_shape = arrays[i].shape main_nitems = arrays[i].nitems break else: # Only scalar inputs => synthesize a dummy shape assert ndim == 0 main_shape = context.make_tuple(builder, main_shape_ty, ()) main_nitems = context.get_constant(types.intp, 1) # Validate shapes of array inputs def check_shape(shape, main_shape): n = len(shape) for i in range(n): if shape[i] != main_shape[len(main_shape) - n + i]: raise ValueError( "nditer(): operands could not be broadcast together" ) for arrty, arr in zip(arrtys, arrays): if isinstance(arrty, types.Array) and arrty.ndim > 0: sig = signature( types.none, types.UniTuple(types.intp, arrty.ndim), main_shape_ty, ) context.compile_internal( builder, check_shape, sig, (arr.shape, main_shape) ) # Compute shape and size shapes = cgutils.unpack_tuple(builder, main_shape) if layout == "F": shapes = shapes[::-1] # If shape is empty, mark iterator exhausted shape_is_empty = builder.icmp_signed("==", main_nitems, zero) exhausted = builder.select( shape_is_empty, cgutils.true_byte, cgutils.false_byte ) if not nditerty.need_shaped_indexing: # Flatten shape to make iteration faster on small innermost # dimensions (e.g. a (100000, 3) shape) shapes = (main_nitems,) assert len(shapes) == nshapes indices = cgutils.alloca_once(builder, zero.type, size=nshapes) for dim in range(nshapes): idxptr = cgutils.gep_inbounds(builder, indices, dim) builder.store(zero, idxptr) self.indices = indices self.shape = cgutils.pack_array(builder, shapes, zero.type) self.exhausted = cgutils.alloca_once_value(builder, exhausted) # Initialize subiterators for subiter in self.subiters: subiter.init_specific(context, builder) def iternext_specific(self, context, builder, result): """ Compute next iteration of the nditer() instance. """ bbend = builder.append_basic_block("end") # Branch early if exhausted exhausted = cgutils.as_bool_bit(builder, builder.load(self.exhausted)) with cgutils.if_unlikely(builder, exhausted): result.set_valid(False) builder.branch(bbend) arrtys = nditerty.arrays arrays = cgutils.unpack_tuple(builder, self.arrays) arrays = self._arrays_or_scalars(context, builder, arrtys, arrays) indices = self.indices # Compute iterated results result.set_valid(True) views = self._make_views(context, builder, indices, arrtys, arrays) views = [v._getvalue() for v in views] if len(views) == 1: result.yield_(views[0]) else: result.yield_(context.make_tuple(builder, nditerty.yield_type, views)) shape = cgutils.unpack_tuple(builder, self.shape) _increment_indices( context, builder, len(shape), shape, indices, self.exhausted, functools.partial(self._loop_continue, context, builder), functools.partial(self._loop_break, context, builder), ) builder.branch(bbend) builder.position_at_end(bbend) def _loop_continue(self, context, builder, dim): for sub in self.subiters: if sub.start_dim <= dim < sub.end_dim: sub.loop_continue(context, builder, dim - sub.start_dim) def _loop_break(self, context, builder, dim): for sub in self.subiters: if sub.start_dim <= dim < sub.end_dim: sub.loop_break(context, builder, dim - sub.start_dim) def _make_views(self, context, builder, indices, arrtys, arrays): """ Compute the views to be yielded. """ views = [None] * narrays indexers = nditerty.indexers subiters = self.subiters rettys = nditerty.yield_type if isinstance(rettys, types.BaseTuple): rettys = list(rettys) else: rettys = [rettys] indices = [ builder.load(cgutils.gep_inbounds(builder, indices, i)) for i in range(nshapes) ] for sub, subiter in zip(indexers, subiters): _, _, _, array_indices = sub sub_indices = indices[subiter.start_dim : subiter.end_dim] if layout == "F": sub_indices = sub_indices[::-1] for i in array_indices: assert views[i] is None views[i] = self._make_view( context, builder, sub_indices, rettys[i], arrtys[i], arrays[i], subiter, ) assert all(v for v in views) return views def _make_view(self, context, builder, indices, retty, arrty, arr, subiter): """ Compute a 0d view for a given input array. """ assert isinstance(retty, types.Array) and retty.ndim == 0 ptr = subiter.compute_pointer(context, builder, indices, arrty, arr) view = context.make_array(retty)(context, builder) itemsize = get_itemsize(context, retty) shape = context.make_tuple(builder, types.UniTuple(types.intp, 0), ()) strides = context.make_tuple(builder, types.UniTuple(types.intp, 0), ()) # HACK: meminfo=None avoids expensive refcounting operations # on ephemeral views populate_array(view, ptr, shape, strides, itemsize, meminfo=None) return view def _arrays_or_scalars(self, context, builder, arrtys, arrays): # Return a list of either array structures or pointers to # scalar slots l = [] for i, (arrty, arr) in enumerate(zip(arrtys, arrays)): if isinstance(arrty, types.Array): l.append(context.make_array(arrty)(context, builder, value=arr)) else: l.append(getattr(self, "scalar%d" % i)) return l return NdIter
def make_nditer_cls(nditerty): """ Return the Structure representation of the given *nditerty* (an instance of types.NumpyNdIterType). """ ndim = nditerty.ndim layout = nditerty.layout narrays = len(nditerty.arrays) nshapes = ndim if nditerty.need_shaped_indexing else 1 class BaseSubIter(object): """ Base class for sub-iterators of a nditer() instance. """ def __init__(self, nditer, member_name, start_dim, end_dim): self.nditer = nditer self.member_name = member_name self.start_dim = start_dim self.end_dim = end_dim self.ndim = end_dim - start_dim def set_member_ptr(self, ptr): setattr(self.nditer, self.member_name, ptr) @utils.cached_property def member_ptr(self): return getattr(self.nditer, self.member_name) def init_specific(self, context, builder): pass def loop_continue(self, context, builder, logical_dim): pass def loop_break(self, context, builder, logical_dim): pass class FlatSubIter(BaseSubIter): """ Sub-iterator walking a contiguous array in physical order, with support for broadcasting (the index is reset on the outer dimension). """ def init_specific(self, context, builder): zero = context.get_constant(types.intp, 0) self.set_member_ptr(cgutils.alloca_once_value(builder, zero)) def compute_pointer(self, context, builder, indices, arrty, arr): index = builder.load(self.member_ptr) return builder.gep(arr.data, [index]) def loop_continue(self, context, builder, logical_dim): if logical_dim == self.ndim - 1: # Only increment index inside innermost logical dimension index = builder.load(self.member_ptr) index = cgutils.increment_index(builder, index) builder.store(index, self.member_ptr) def loop_break(self, context, builder, logical_dim): if logical_dim == 0: # At the exit of outermost logical dimension, reset index zero = context.get_constant(types.intp, 0) builder.store(zero, self.member_ptr) elif logical_dim == self.ndim - 1: # Inside innermost logical dimension, increment index index = builder.load(self.member_ptr) index = cgutils.increment_index(builder, index) builder.store(index, self.member_ptr) class TrivialFlatSubIter(BaseSubIter): """ Sub-iterator walking a contiguous array in physical order, *without* support for broadcasting. """ def init_specific(self, context, builder): assert not nditerty.need_shaped_indexing def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) <= 1, len(indices) return builder.gep(arr.data, indices) class IndexedSubIter(BaseSubIter): """ Sub-iterator walking an array in logical order. """ def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) == self.ndim return cgutils.get_item_pointer( builder, arrty, arr, indices, wraparound=False ) class ZeroDimSubIter(BaseSubIter): """ Sub-iterator "walking" a 0-d array. """ def compute_pointer(self, context, builder, indices, arrty, arr): return arr.data class ScalarSubIter(BaseSubIter): """ Sub-iterator "walking" a scalar value. """ def compute_pointer(self, context, builder, indices, arrty, arr): return arr class NdIter(cgutils.create_struct_proxy(nditerty)): """ .nditer() implementation. Note: 'F' layout means the shape is iterated in reverse logical order, so indices and shapes arrays have to be reversed as well. """ @utils.cached_property def subiters(self): l = [] factories = { "flat": FlatSubIter if nditerty.need_shaped_indexing else TrivialFlatSubIter, "indexed": IndexedSubIter, "0d": ZeroDimSubIter, "scalar": ScalarSubIter, } for i, sub in enumerate(nditerty.indexers): kind, start_dim, end_dim, _ = sub member_name = "index%d" % i factory = factories[kind] l.append(factory(self, member_name, start_dim, end_dim)) return l def init_specific(self, context, builder, arrtys, arrays): """ Initialize the nditer() instance for the specific array inputs. """ zero = context.get_constant(types.intp, 0) # Store inputs self.arrays = context.make_tuple(builder, types.Tuple(arrtys), arrays) # Create slots for scalars for i, ty in enumerate(arrtys): if not isinstance(ty, types.Array): member_name = "scalar%d" % i # XXX as_data()? slot = cgutils.alloca_once_value(builder, arrays[i]) setattr(self, member_name, slot) arrays = self._arrays_or_scalars(context, builder, arrtys, arrays) # Extract iterator shape (the shape of the most-dimensional input) main_shape_ty = types.UniTuple(types.intp, ndim) main_shape = None main_nitems = None for i, arrty in enumerate(arrtys): if isinstance(arrty, types.Array) and arrty.ndim == ndim: main_shape = arrays[i].shape main_nitems = arrays[i].nitems break else: # Only scalar inputs => synthesize a dummy shape assert ndim == 0 main_shape = context.make_tuple(builder, main_shape_ty, ()) main_nitems = context.get_constant(types.intp, 1) # Validate shapes of array inputs def check_shape(shape, main_shape): n = len(shape) for i in range(n): if shape[i] != main_shape[len(main_shape) - n + i]: raise ValueError( "nditer(): operands could not be broadcast together" ) for arrty, arr in zip(arrtys, arrays): if isinstance(arrty, types.Array) and arrty.ndim > 0: sig = signature( types.none, types.UniTuple(types.intp, arrty.ndim), main_shape_ty, ) context.compile_internal( builder, check_shape, sig, (arr.shape, main_shape) ) # Compute shape and size shapes = cgutils.unpack_tuple(builder, main_shape) if layout == "F": shapes = shapes[::-1] # If shape is empty, mark iterator exhausted shape_is_empty = builder.icmp_signed("==", main_nitems, zero) exhausted = builder.select( shape_is_empty, cgutils.true_byte, cgutils.false_byte ) if not nditerty.need_shaped_indexing: # Flatten shape to make iteration faster on small innermost # dimensions (e.g. a (100000, 3) shape) shapes = (main_nitems,) assert len(shapes) == nshapes indices = cgutils.alloca_once(builder, zero.type, size=nshapes) for dim in range(nshapes): idxptr = cgutils.gep_inbounds(builder, indices, dim) builder.store(zero, idxptr) self.indices = indices self.shape = cgutils.pack_array(builder, shapes, zero.type) self.exhausted = cgutils.alloca_once_value(builder, exhausted) # Initialize subiterators for subiter in self.subiters: subiter.init_specific(context, builder) def iternext_specific(self, context, builder, result): """ Compute next iteration of the nditer() instance. """ bbend = builder.append_basic_block("end") # Branch early if exhausted exhausted = cgutils.as_bool_bit(builder, builder.load(self.exhausted)) with cgutils.if_unlikely(builder, exhausted): result.set_valid(False) builder.branch(bbend) arrtys = nditerty.arrays arrays = cgutils.unpack_tuple(builder, self.arrays) arrays = self._arrays_or_scalars(context, builder, arrtys, arrays) indices = self.indices # Compute iterated results result.set_valid(True) views = self._make_views(context, builder, indices, arrtys, arrays) views = [v._getvalue() for v in views] if len(views) == 1: result.yield_(views[0]) else: result.yield_(context.make_tuple(builder, nditerty.yield_type, views)) shape = cgutils.unpack_tuple(builder, self.shape) _increment_indices( context, builder, len(shape), shape, indices, self.exhausted, functools.partial(self._loop_continue, context, builder), functools.partial(self._loop_break, context, builder), ) builder.branch(bbend) builder.position_at_end(bbend) def _loop_continue(self, context, builder, dim): for sub in self.subiters: if sub.start_dim <= dim < sub.end_dim: sub.loop_continue(context, builder, dim - sub.start_dim) def _loop_break(self, context, builder, dim): for sub in self.subiters: if sub.start_dim <= dim < sub.end_dim: sub.loop_break(context, builder, dim - sub.start_dim) def _make_views(self, context, builder, indices, arrtys, arrays): """ Compute the views to be yielded. """ views = [None] * narrays indexers = nditerty.indexers subiters = self.subiters rettys = nditerty.yield_type if isinstance(rettys, types.BaseTuple): rettys = list(rettys) else: rettys = [rettys] indices = [ builder.load(cgutils.gep_inbounds(builder, indices, i)) for i in range(nshapes) ] for sub, subiter in zip(indexers, subiters): _, _, _, array_indices = sub sub_indices = indices[subiter.start_dim : subiter.end_dim] if layout == "F": sub_indices = sub_indices[::-1] for i in array_indices: assert views[i] is None views[i] = self._make_view( context, builder, sub_indices, rettys[i], arrtys[i], arrays[i], subiter, ) assert all(v for v in views) return views def _make_view(self, context, builder, indices, retty, arrty, arr, subiter): """ Compute a 0d view for a given input array. """ assert isinstance(retty, types.Array) and retty.ndim == 0 ptr = subiter.compute_pointer(context, builder, indices, arrty, arr) view = context.make_array(retty)(context, builder) itemsize = get_itemsize(context, retty) shape = context.make_tuple(builder, types.UniTuple(types.intp, 0), ()) strides = context.make_tuple(builder, types.UniTuple(types.intp, 0), ()) # HACK: meminfo=None avoids expensive refcounting operations # on ephemeral views populate_array(view, ptr, shape, strides, itemsize, meminfo=None) return view def _arrays_or_scalars(self, context, builder, arrtys, arrays): # Return a list of either array structures or pointers to # scalar slots l = [] for i, (arrty, arr) in enumerate(zip(arrtys, arrays)): if isinstance(arrty, types.Array): l.append(context.make_array(arrty)(context, builder, value=arr)) else: l.append(getattr(self, "scalar%d" % i)) return l return NdIter
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) == self.ndim return cgutils.get_item_pointer( context, builder, arrty, arr, indices, wraparound=False )
def compute_pointer(self, context, builder, indices, arrty, arr): assert len(indices) == self.ndim return cgutils.get_item_pointer(builder, arrty, arr, indices, wraparound=False)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _make_flattening_iter_cls(flatiterty, kind): assert kind in ("flat", "ndenumerate") array_type = flatiterty.array_type if array_type.layout == "C": class CContiguousFlatIter(cgutils.create_struct_proxy(flatiterty)): """ .flat() / .ndenumerate() implementation for C-contiguous arrays. """ def init_specific(self, context, builder, arrty, arr): zero = context.get_constant(types.intp, 0) self.index = cgutils.alloca_once_value(builder, zero) # We can't trust strides[-1] to always contain the right # step value, see # http://docs.scipy.org/doc/numpy-dev/release.html#npy-relaxed-strides-checking # noqa: E501 self.stride = arr.itemsize if kind == "ndenumerate": # Zero-initialize the indices array. indices = cgutils.alloca_once( builder, zero.type, size=context.get_constant(types.intp, arrty.ndim), ) for dim in range(arrty.ndim): idxptr = cgutils.gep_inbounds(builder, indices, dim) builder.store(zero, idxptr) self.indices = indices # NOTE: Using gep() instead of explicit pointer addition helps # LLVM vectorize the loop (since the stride is known and # constant). This is not possible in the non-contiguous case, # where the strides are unknown at compile-time. def iternext_specific(self, context, builder, arrty, arr, result): ndim = arrty.ndim nitems = arr.nitems index = builder.load(self.index) is_valid = builder.icmp(lc.ICMP_SLT, index, nitems) result.set_valid(is_valid) with cgutils.if_likely(builder, is_valid): ptr = builder.gep(arr.data, [index]) value = load_item(context, builder, arrty, ptr) if kind == "flat": result.yield_(value) else: # ndenumerate(): fetch and increment indices indices = self.indices idxvals = [ builder.load(cgutils.gep_inbounds(builder, indices, dim)) for dim in range(ndim) ] idxtuple = cgutils.pack_array(builder, idxvals) result.yield_( cgutils.make_anonymous_struct(builder, [idxtuple, value]) ) _increment_indices_array(context, builder, arrty, arr, indices) index = cgutils.increment_index(builder, index) builder.store(index, self.index) def getitem(self, context, builder, arrty, arr, index): ptr = builder.gep(arr.data, [index]) return load_item(context, builder, arrty, ptr) def setitem(self, context, builder, arrty, arr, index, value): ptr = builder.gep(arr.data, [index]) store_item(context, builder, arrty, value, ptr) return CContiguousFlatIter else: class FlatIter(cgutils.create_struct_proxy(flatiterty)): """ Generic .flat() / .ndenumerate() implementation for non-contiguous arrays. It keeps track of pointers along each dimension in order to minimize computations. """ def init_specific(self, context, builder, arrty, arr): zero = context.get_constant(types.intp, 0) data = arr.data ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, ndim) indices = cgutils.alloca_once( builder, zero.type, size=context.get_constant(types.intp, arrty.ndim), ) pointers = cgutils.alloca_once( builder, data.type, size=context.get_constant(types.intp, arrty.ndim), ) exhausted = cgutils.alloca_once_value(builder, cgutils.false_byte) # Initialize indices and pointers with their start values. for dim in range(ndim): idxptr = cgutils.gep_inbounds(builder, indices, dim) ptrptr = cgutils.gep_inbounds(builder, pointers, dim) builder.store(data, ptrptr) builder.store(zero, idxptr) # 0-sized dimensions really indicate an empty array, # but we have to catch that condition early to avoid # a bug inside the iteration logic (see issue #846). dim_size = shapes[dim] dim_is_empty = builder.icmp(lc.ICMP_EQ, dim_size, zero) with cgutils.if_unlikely(builder, dim_is_empty): builder.store(cgutils.true_byte, exhausted) self.indices = indices self.pointers = pointers self.exhausted = exhausted def iternext_specific(self, context, builder, arrty, arr, result): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, ndim) strides = cgutils.unpack_tuple(builder, arr.strides, ndim) indices = self.indices pointers = self.pointers zero = context.get_constant(types.intp, 0) bbend = builder.append_basic_block("end") # Catch already computed iterator exhaustion is_exhausted = cgutils.as_bool_bit( builder, builder.load(self.exhausted) ) with cgutils.if_unlikely(builder, is_exhausted): result.set_valid(False) builder.branch(bbend) result.set_valid(True) # Current pointer inside last dimension last_ptr = cgutils.gep_inbounds(builder, pointers, ndim - 1) ptr = builder.load(last_ptr) value = load_item(context, builder, arrty, ptr) if kind == "flat": result.yield_(value) else: # ndenumerate() => yield (indices, value) idxvals = [ builder.load(cgutils.gep_inbounds(builder, indices, dim)) for dim in range(ndim) ] idxtuple = cgutils.pack_array(builder, idxvals) result.yield_( cgutils.make_anonymous_struct(builder, [idxtuple, value]) ) # Update indices and pointers by walking from inner # dimension to outer. for dim in reversed(range(ndim)): idxptr = cgutils.gep_inbounds(builder, indices, dim) idx = cgutils.increment_index(builder, builder.load(idxptr)) count = shapes[dim] stride = strides[dim] in_bounds = builder.icmp(lc.ICMP_SLT, idx, count) with cgutils.if_likely(builder, in_bounds): # Index is valid => pointer can simply be incremented. builder.store(idx, idxptr) ptrptr = cgutils.gep_inbounds(builder, pointers, dim) ptr = builder.load(ptrptr) ptr = cgutils.pointer_add(builder, ptr, stride) builder.store(ptr, ptrptr) # Reset pointers in inner dimensions for inner_dim in range(dim + 1, ndim): ptrptr = cgutils.gep_inbounds(builder, pointers, inner_dim) builder.store(ptr, ptrptr) builder.branch(bbend) # Reset index and continue with next dimension builder.store(zero, idxptr) # End of array builder.store(cgutils.true_byte, self.exhausted) builder.branch(bbend) builder.position_at_end(bbend) def _ptr_for_index(self, context, builder, arrty, arr, index): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, count=ndim) strides = cgutils.unpack_tuple(builder, arr.strides, count=ndim) # First convert the flattened index into a regular n-dim index indices = [] for dim in reversed(range(ndim)): indices.append(builder.urem(index, shapes[dim])) index = builder.udiv(index, shapes[dim]) indices.reverse() ptr = cgutils.get_item_pointer2( context, builder, arr.data, shapes, strides, arrty.layout, indices ) return ptr def getitem(self, context, builder, arrty, arr, index): ptr = self._ptr_for_index(context, builder, arrty, arr, index) return load_item(context, builder, arrty, ptr) def setitem(self, context, builder, arrty, arr, index, value): ptr = self._ptr_for_index(context, builder, arrty, arr, index) store_item(context, builder, arrty, value, ptr) return FlatIter
def _make_flattening_iter_cls(flatiterty, kind): assert kind in ("flat", "ndenumerate") array_type = flatiterty.array_type if array_type.layout == "C": class CContiguousFlatIter(cgutils.create_struct_proxy(flatiterty)): """ .flat() / .ndenumerate() implementation for C-contiguous arrays. """ def init_specific(self, context, builder, arrty, arr): zero = context.get_constant(types.intp, 0) self.index = cgutils.alloca_once_value(builder, zero) # We can't trust strides[-1] to always contain the right # step value, see # http://docs.scipy.org/doc/numpy-dev/release.html#npy-relaxed-strides-checking # noqa: E501 self.stride = arr.itemsize if kind == "ndenumerate": # Zero-initialize the indices array. indices = cgutils.alloca_once( builder, zero.type, size=context.get_constant(types.intp, arrty.ndim), ) for dim in range(arrty.ndim): idxptr = cgutils.gep_inbounds(builder, indices, dim) builder.store(zero, idxptr) self.indices = indices # NOTE: Using gep() instead of explicit pointer addition helps # LLVM vectorize the loop (since the stride is known and # constant). This is not possible in the non-contiguous case, # where the strides are unknown at compile-time. def iternext_specific(self, context, builder, arrty, arr, result): ndim = arrty.ndim nitems = arr.nitems index = builder.load(self.index) is_valid = builder.icmp(lc.ICMP_SLT, index, nitems) result.set_valid(is_valid) with cgutils.if_likely(builder, is_valid): ptr = builder.gep(arr.data, [index]) value = load_item(context, builder, arrty, ptr) if kind == "flat": result.yield_(value) else: # ndenumerate(): fetch and increment indices indices = self.indices idxvals = [ builder.load(cgutils.gep_inbounds(builder, indices, dim)) for dim in range(ndim) ] idxtuple = cgutils.pack_array(builder, idxvals) result.yield_( cgutils.make_anonymous_struct(builder, [idxtuple, value]) ) _increment_indices_array(context, builder, arrty, arr, indices) index = cgutils.increment_index(builder, index) builder.store(index, self.index) def getitem(self, context, builder, arrty, arr, index): ptr = builder.gep(arr.data, [index]) return load_item(context, builder, arrty, ptr) def setitem(self, context, builder, arrty, arr, index, value): ptr = builder.gep(arr.data, [index]) store_item(context, builder, arrty, value, ptr) return CContiguousFlatIter else: class FlatIter(cgutils.create_struct_proxy(flatiterty)): """ Generic .flat() / .ndenumerate() implementation for non-contiguous arrays. It keeps track of pointers along each dimension in order to minimize computations. """ def init_specific(self, context, builder, arrty, arr): zero = context.get_constant(types.intp, 0) data = arr.data ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, ndim) indices = cgutils.alloca_once( builder, zero.type, size=context.get_constant(types.intp, arrty.ndim), ) pointers = cgutils.alloca_once( builder, data.type, size=context.get_constant(types.intp, arrty.ndim), ) exhausted = cgutils.alloca_once_value(builder, cgutils.false_byte) # Initialize indices and pointers with their start values. for dim in range(ndim): idxptr = cgutils.gep_inbounds(builder, indices, dim) ptrptr = cgutils.gep_inbounds(builder, pointers, dim) builder.store(data, ptrptr) builder.store(zero, idxptr) # 0-sized dimensions really indicate an empty array, # but we have to catch that condition early to avoid # a bug inside the iteration logic (see issue #846). dim_size = shapes[dim] dim_is_empty = builder.icmp(lc.ICMP_EQ, dim_size, zero) with cgutils.if_unlikely(builder, dim_is_empty): builder.store(cgutils.true_byte, exhausted) self.indices = indices self.pointers = pointers self.exhausted = exhausted def iternext_specific(self, context, builder, arrty, arr, result): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, ndim) strides = cgutils.unpack_tuple(builder, arr.strides, ndim) indices = self.indices pointers = self.pointers zero = context.get_constant(types.intp, 0) bbend = builder.append_basic_block("end") # Catch already computed iterator exhaustion is_exhausted = cgutils.as_bool_bit( builder, builder.load(self.exhausted) ) with cgutils.if_unlikely(builder, is_exhausted): result.set_valid(False) builder.branch(bbend) result.set_valid(True) # Current pointer inside last dimension last_ptr = cgutils.gep_inbounds(builder, pointers, ndim - 1) ptr = builder.load(last_ptr) value = load_item(context, builder, arrty, ptr) if kind == "flat": result.yield_(value) else: # ndenumerate() => yield (indices, value) idxvals = [ builder.load(cgutils.gep_inbounds(builder, indices, dim)) for dim in range(ndim) ] idxtuple = cgutils.pack_array(builder, idxvals) result.yield_( cgutils.make_anonymous_struct(builder, [idxtuple, value]) ) # Update indices and pointers by walking from inner # dimension to outer. for dim in reversed(range(ndim)): idxptr = cgutils.gep_inbounds(builder, indices, dim) idx = cgutils.increment_index(builder, builder.load(idxptr)) count = shapes[dim] stride = strides[dim] in_bounds = builder.icmp(lc.ICMP_SLT, idx, count) with cgutils.if_likely(builder, in_bounds): # Index is valid => pointer can simply be incremented. builder.store(idx, idxptr) ptrptr = cgutils.gep_inbounds(builder, pointers, dim) ptr = builder.load(ptrptr) ptr = cgutils.pointer_add(builder, ptr, stride) builder.store(ptr, ptrptr) # Reset pointers in inner dimensions for inner_dim in range(dim + 1, ndim): ptrptr = cgutils.gep_inbounds(builder, pointers, inner_dim) builder.store(ptr, ptrptr) builder.branch(bbend) # Reset index and continue with next dimension builder.store(zero, idxptr) # End of array builder.store(cgutils.true_byte, self.exhausted) builder.branch(bbend) builder.position_at_end(bbend) def _ptr_for_index(self, context, builder, arrty, arr, index): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, count=ndim) strides = cgutils.unpack_tuple(builder, arr.strides, count=ndim) # First convert the flattened index into a regular n-dim index indices = [] for dim in reversed(range(ndim)): indices.append(builder.urem(index, shapes[dim])) index = builder.udiv(index, shapes[dim]) indices.reverse() ptr = cgutils.get_item_pointer2( builder, arr.data, shapes, strides, arrty.layout, indices ) return ptr def getitem(self, context, builder, arrty, arr, index): ptr = self._ptr_for_index(context, builder, arrty, arr, index) return load_item(context, builder, arrty, ptr) def setitem(self, context, builder, arrty, arr, index, value): ptr = self._ptr_for_index(context, builder, arrty, arr, index) store_item(context, builder, arrty, value, ptr) return FlatIter
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _ptr_for_index(self, context, builder, arrty, arr, index): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, count=ndim) strides = cgutils.unpack_tuple(builder, arr.strides, count=ndim) # First convert the flattened index into a regular n-dim index indices = [] for dim in reversed(range(ndim)): indices.append(builder.urem(index, shapes[dim])) index = builder.udiv(index, shapes[dim]) indices.reverse() ptr = cgutils.get_item_pointer2( context, builder, arr.data, shapes, strides, arrty.layout, indices ) return ptr
def _ptr_for_index(self, context, builder, arrty, arr, index): ndim = arrty.ndim shapes = cgutils.unpack_tuple(builder, arr.shape, count=ndim) strides = cgutils.unpack_tuple(builder, arr.strides, count=ndim) # First convert the flattened index into a regular n-dim index indices = [] for dim in reversed(range(ndim)): indices.append(builder.urem(index, shapes[dim])) index = builder.udiv(index, shapes[dim]) indices.reverse() ptr = cgutils.get_item_pointer2( builder, arr.data, shapes, strides, arrty.layout, indices ) return ptr
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _arange_dtype(*args): bounds = [a for a in args if not isinstance(a, types.NoneType)] if any(isinstance(a, types.Complex) for a in bounds): dtype = types.complex128 elif any(isinstance(a, types.Float) for a in bounds): dtype = types.float64 else: # numerous attempts were made at guessing this type from the NumPy # source but it turns out on running `np.arange(10).dtype` on pretty # much all platform and python combinations that it matched np.int?! # Windows 64 is broken by default here because Numba (as of 0.47) does # not differentiate between Python and NumPy integers, so a `typeof(1)` # on w64 is `int64`, i.e. `intp`. This means an arange(<some int>) will # be typed as arange(int64) and the following will yield int64 opposed # to int32. Example: without a load of analysis to work out of the args # were wrapped in NumPy int*() calls it's not possible to detect the # difference between `np.arange(10)` and `np.arange(np.int64(10)`. NPY_TY = getattr(types, "int%s" % (8 * np.dtype(np.int).itemsize)) dtype = max( bounds + [ NPY_TY, ] ) return dtype
def _arange_dtype(*args): bounds = [a for a in args if not isinstance(a, types.NoneType)] if any(isinstance(a, types.Complex) for a in bounds): dtype = types.complex128 elif any(isinstance(a, types.Float) for a in bounds): dtype = types.float64 else: # It's not possible for the dtype to replicate NumPy as integer literals # are intp size in Numba but np.dtype(int) (i.e. intc) in NumPy. The # NumPy logic is to basically do max(np.long, *[type(x) for x in args]). # On windows 64, in NumPy, that would mean: # * np.arange(1, 10) -> max(np.long, np.intc, np.intc) -> int32 # but in Numba: # * np.arange(1, 10) -> max(np.long, np.intp, np.intp) -> int64 # # It's therefore not possible to replicate the case where integer # literals are supplied, however best effort is made to correctly handle # cases like: # * np.arange(np.int8(10)) -> max(np.long, np.int8) -> np.long # # Alg ref: # https://github.com/numpy/numpy/blob/maintenance/1.17.x/numpy/core/src/multiarray/ctors.c#L3376-L3377 # noqa: E501 # # Also not Py2.7 on 32 bit linux as a 32bit np.long where as Py3 has a # 64bit, numba is not replicating this! dtype = max( bounds + [ types.long_, ] ) return dtype
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def numpy_linspace_3(context, builder, sig, args): dtype = as_dtype(sig.return_type.dtype) def linspace(start, stop, num): arr = np.empty(num, dtype) if num == 0: return arr div = num - 1 delta = stop - start arr[0] = start for i in range(1, num): arr[i] = start + delta * (i / div) return arr res = context.compile_internal(builder, linspace, sig, args) return impl_ret_new_ref(context, builder, sig.return_type, res)
def numpy_linspace_3(context, builder, sig, args): dtype = as_dtype(sig.return_type.dtype) def linspace(start, stop, num): arr = np.empty(num, dtype) div = num - 1 delta = stop - start arr[0] = start for i in range(1, num): arr[i] = start + delta * (i / div) return arr res = context.compile_internal(builder, linspace, sig, args) return impl_ret_new_ref(context, builder, sig.return_type, res)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def linspace(start, stop, num): arr = np.empty(num, dtype) if num == 0: return arr div = num - 1 delta = stop - start arr[0] = start for i in range(1, num): arr[i] = start + delta * (i / div) return arr
def linspace(start, stop, num): arr = np.empty(num, dtype) div = num - 1 delta = stop - start arr[0] = start for i in range(1, num): arr[i] = start + delta * (i / div) return arr
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _array_copy(context, builder, sig, args): """ Array copy. """ arytype = sig.args[0] ary = make_array(arytype)(context, builder, value=args[0]) shapes = cgutils.unpack_tuple(builder, ary.shape) rettype = sig.return_type ret = _empty_nd_impl(context, builder, rettype, shapes) src_data = ary.data dest_data = ret.data assert rettype.layout in "CF" if arytype.layout == rettype.layout: # Fast path: memcpy cgutils.raw_memcpy( builder, dest_data, src_data, ary.nitems, ary.itemsize, align=1 ) else: src_strides = cgutils.unpack_tuple(builder, ary.strides) dest_strides = cgutils.unpack_tuple(builder, ret.strides) intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( context, builder, src_data, shapes, src_strides, arytype.layout, indices ) dest_ptr = cgutils.get_item_pointer2( context, builder, dest_data, shapes, dest_strides, rettype.layout, indices, ) builder.store(builder.load(src_ptr), dest_ptr) return impl_ret_new_ref(context, builder, sig.return_type, ret._getvalue())
def _array_copy(context, builder, sig, args): """ Array copy. """ arytype = sig.args[0] ary = make_array(arytype)(context, builder, value=args[0]) shapes = cgutils.unpack_tuple(builder, ary.shape) rettype = sig.return_type ret = _empty_nd_impl(context, builder, rettype, shapes) src_data = ary.data dest_data = ret.data assert rettype.layout in "CF" if arytype.layout == rettype.layout: # Fast path: memcpy cgutils.raw_memcpy( builder, dest_data, src_data, ary.nitems, ary.itemsize, align=1 ) else: src_strides = cgutils.unpack_tuple(builder, ary.strides) dest_strides = cgutils.unpack_tuple(builder, ret.strides) intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( builder, src_data, shapes, src_strides, arytype.layout, indices ) dest_ptr = cgutils.get_item_pointer2( builder, dest_data, shapes, dest_strides, rettype.layout, indices ) builder.store(builder.load(src_ptr), dest_ptr) return impl_ret_new_ref(context, builder, sig.return_type, ret._getvalue())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def array_astype(context, builder, sig, args): arytype = sig.args[0] ary = make_array(arytype)(context, builder, value=args[0]) shapes = cgutils.unpack_tuple(builder, ary.shape) rettype = sig.return_type ret = _empty_nd_impl(context, builder, rettype, shapes) src_data = ary.data dest_data = ret.data src_strides = cgutils.unpack_tuple(builder, ary.strides) dest_strides = cgutils.unpack_tuple(builder, ret.strides) intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( context, builder, src_data, shapes, src_strides, arytype.layout, indices ) dest_ptr = cgutils.get_item_pointer2( context, builder, dest_data, shapes, dest_strides, rettype.layout, indices ) item = load_item(context, builder, arytype, src_ptr) item = context.cast(builder, item, arytype.dtype, rettype.dtype) store_item(context, builder, rettype, item, dest_ptr) return impl_ret_new_ref(context, builder, sig.return_type, ret._getvalue())
def array_astype(context, builder, sig, args): arytype = sig.args[0] ary = make_array(arytype)(context, builder, value=args[0]) shapes = cgutils.unpack_tuple(builder, ary.shape) rettype = sig.return_type ret = _empty_nd_impl(context, builder, rettype, shapes) src_data = ary.data dest_data = ret.data src_strides = cgutils.unpack_tuple(builder, ary.strides) dest_strides = cgutils.unpack_tuple(builder, ret.strides) intp_t = context.get_value_type(types.intp) with cgutils.loop_nest(builder, shapes, intp_t) as indices: src_ptr = cgutils.get_item_pointer2( builder, src_data, shapes, src_strides, arytype.layout, indices ) dest_ptr = cgutils.get_item_pointer2( builder, dest_data, shapes, dest_strides, rettype.layout, indices ) item = load_item(context, builder, arytype, src_ptr) item = context.cast(builder, item, arytype.dtype, rettype.dtype) store_item(context, builder, rettype, item, dest_ptr) return impl_ret_new_ref(context, builder, sig.return_type, ret._getvalue())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def assign_sequence_to_array( context, builder, data, shapes, strides, arrty, seqty, seq ): """ Assign a nested sequence contents to an array. The shape must match the sequence's structure. """ def assign_item(indices, valty, val): ptr = cgutils.get_item_pointer2( context, builder, data, shapes, strides, arrty.layout, indices, wraparound=False, ) val = context.cast(builder, val, valty, arrty.dtype) store_item(context, builder, arrty, val, ptr) def assign(seqty, seq, shapes, indices): if len(shapes) == 0: assert not isinstance(seqty, (types.Sequence, types.BaseTuple)) assign_item(indices, seqty, seq) return size = shapes[0] if isinstance(seqty, types.Sequence): getitem_impl = _get_borrowing_getitem(context, seqty) with cgutils.for_range(builder, size) as loop: innerty = seqty.dtype inner = getitem_impl(builder, (seq, loop.index)) assign(innerty, inner, shapes[1:], indices + (loop.index,)) elif isinstance(seqty, types.BaseTuple): for i in range(len(seqty)): innerty = seqty[i] inner = builder.extract_value(seq, i) index = context.get_constant(types.intp, i) assign(innerty, inner, shapes[1:], indices + (index,)) else: assert 0, seqty assign(seqty, seq, shapes, ())
def assign_sequence_to_array( context, builder, data, shapes, strides, arrty, seqty, seq ): """ Assign a nested sequence contents to an array. The shape must match the sequence's structure. """ def assign_item(indices, valty, val): ptr = cgutils.get_item_pointer2( builder, data, shapes, strides, arrty.layout, indices, wraparound=False ) val = context.cast(builder, val, valty, arrty.dtype) store_item(context, builder, arrty, val, ptr) def assign(seqty, seq, shapes, indices): if len(shapes) == 0: assert not isinstance(seqty, (types.Sequence, types.BaseTuple)) assign_item(indices, seqty, seq) return size = shapes[0] if isinstance(seqty, types.Sequence): getitem_impl = _get_borrowing_getitem(context, seqty) with cgutils.for_range(builder, size) as loop: innerty = seqty.dtype inner = getitem_impl(builder, (seq, loop.index)) assign(innerty, inner, shapes[1:], indices + (loop.index,)) elif isinstance(seqty, types.BaseTuple): for i in range(len(seqty)): innerty = seqty[i] inner = builder.extract_value(seq, i) index = context.get_constant(types.intp, i) assign(innerty, inner, shapes[1:], indices + (index,)) else: assert 0, seqty assign(seqty, seq, shapes, ())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def assign_item(indices, valty, val): ptr = cgutils.get_item_pointer2( context, builder, data, shapes, strides, arrty.layout, indices, wraparound=False ) val = context.cast(builder, val, valty, arrty.dtype) store_item(context, builder, arrty, val, ptr)
def assign_item(indices, valty, val): ptr = cgutils.get_item_pointer2( builder, data, shapes, strides, arrty.layout, indices, wraparound=False ) val = context.cast(builder, val, valty, arrty.dtype) store_item(context, builder, arrty, val, ptr)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _do_concatenate( context, builder, axis, arrtys, arrs, arr_shapes, arr_strides, retty, ret_shapes ): """ Concatenate arrays along the given axis. """ assert len(arrtys) == len(arrs) == len(arr_shapes) == len(arr_strides) zero = cgutils.intp_t(0) # Allocate return array ret = _empty_nd_impl(context, builder, retty, ret_shapes) ret_strides = cgutils.unpack_tuple(builder, ret.strides) # Compute the offset by which to bump the destination pointer # after copying each input array. # Morally, we need to copy each input array at different start indices # into the destination array; bumping the destination pointer # is simply easier than offsetting all destination indices. copy_offsets = [] for arr_sh in arr_shapes: # offset = ret_strides[axis] * input_shape[axis] offset = zero for dim, (size, stride) in enumerate(zip(arr_sh, ret_strides)): is_axis = builder.icmp_signed("==", axis.type(dim), axis) addend = builder.mul(size, stride) offset = builder.select(is_axis, builder.add(offset, addend), offset) copy_offsets.append(offset) # Copy input arrays into the return array ret_data = ret.data for arrty, arr, arr_sh, arr_st, offset in zip( arrtys, arrs, arr_shapes, arr_strides, copy_offsets ): arr_data = arr.data # Do the copy loop # Note the loop nesting is optimized for the destination layout loop_nest = cgutils.loop_nest( builder, arr_sh, cgutils.intp_t, order=retty.layout ) with loop_nest as indices: src_ptr = cgutils.get_item_pointer2( context, builder, arr_data, arr_sh, arr_st, arrty.layout, indices ) val = load_item(context, builder, arrty, src_ptr) val = context.cast(builder, val, arrty.dtype, retty.dtype) dest_ptr = cgutils.get_item_pointer2( context, builder, ret_data, ret_shapes, ret_strides, retty.layout, indices, ) store_item(context, builder, retty, val, dest_ptr) # Bump destination pointer ret_data = cgutils.pointer_add(builder, ret_data, offset) return ret
def _do_concatenate( context, builder, axis, arrtys, arrs, arr_shapes, arr_strides, retty, ret_shapes ): """ Concatenate arrays along the given axis. """ assert len(arrtys) == len(arrs) == len(arr_shapes) == len(arr_strides) zero = cgutils.intp_t(0) # Allocate return array ret = _empty_nd_impl(context, builder, retty, ret_shapes) ret_strides = cgutils.unpack_tuple(builder, ret.strides) # Compute the offset by which to bump the destination pointer # after copying each input array. # Morally, we need to copy each input array at different start indices # into the destination array; bumping the destination pointer # is simply easier than offsetting all destination indices. copy_offsets = [] for arr_sh in arr_shapes: # offset = ret_strides[axis] * input_shape[axis] offset = zero for dim, (size, stride) in enumerate(zip(arr_sh, ret_strides)): is_axis = builder.icmp_signed("==", axis.type(dim), axis) addend = builder.mul(size, stride) offset = builder.select(is_axis, builder.add(offset, addend), offset) copy_offsets.append(offset) # Copy input arrays into the return array ret_data = ret.data for arrty, arr, arr_sh, arr_st, offset in zip( arrtys, arrs, arr_shapes, arr_strides, copy_offsets ): arr_data = arr.data # Do the copy loop # Note the loop nesting is optimized for the destination layout loop_nest = cgutils.loop_nest( builder, arr_sh, cgutils.intp_t, order=retty.layout ) with loop_nest as indices: src_ptr = cgutils.get_item_pointer2( builder, arr_data, arr_sh, arr_st, arrty.layout, indices ) val = load_item(context, builder, arrty, src_ptr) val = context.cast(builder, val, arrty.dtype, retty.dtype) dest_ptr = cgutils.get_item_pointer2( builder, ret_data, ret_shapes, ret_strides, retty.layout, indices ) store_item(context, builder, retty, val, dest_ptr) # Bump destination pointer ret_data = cgutils.pointer_add(builder, ret_data, offset) return ret
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __init__(self, typing_context): _load_global_helpers() self.address_size = utils.MACHINE_BITS self.typing_context = typing_context # A mapping of installed registries to their loaders self._registries = {} # Declarations loaded from registries and other sources self._defns = defaultdict(OverloadSelector) self._getattrs = defaultdict(OverloadSelector) self._setattrs = defaultdict(OverloadSelector) self._casts = OverloadSelector() self._get_constants = OverloadSelector() # Other declarations self._generators = {} self.special_ops = {} self.cached_internal_func = {} self._pid = None self._codelib_stack = [] self._boundscheck = False self.data_model_manager = datamodel.default_manager # Initialize self.init()
def __init__(self, typing_context): _load_global_helpers() self.address_size = utils.MACHINE_BITS self.typing_context = typing_context # A mapping of installed registries to their loaders self._registries = {} # Declarations loaded from registries and other sources self._defns = defaultdict(OverloadSelector) self._getattrs = defaultdict(OverloadSelector) self._setattrs = defaultdict(OverloadSelector) self._casts = OverloadSelector() self._get_constants = OverloadSelector() # Other declarations self._generators = {} self.special_ops = {} self.cached_internal_func = {} self._pid = None self._codelib_stack = [] self.data_model_manager = datamodel.default_manager # Initialize self.init()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def refresh(self): """ Refresh context with new declarations from known registries. Useful for third-party extensions. """ # Populate built-in registry from . import ( arraymath, enumimpl, iterators, linalg, numbers, optional, polynomial, rangeobj, slicing, tupleobj, gdb_hook, hashing, heapq, literal, ) try: from . import npdatetime except NotImplementedError: pass self.install_registry(builtin_registry) self.load_additional_registries() # Also refresh typing context, since @overload declarations can # affect it. self.typing_context.refresh()
def refresh(self): """ Refresh context with new declarations from known registries. Useful for third-party extensions. """ # Populate built-in registry from . import ( arraymath, enumimpl, iterators, linalg, numbers, optional, polynomial, rangeobj, slicing, tupleobj, gdb_hook, hashing, heapq, literal_dispatch, ) try: from . import npdatetime except NotImplementedError: pass self.install_registry(builtin_registry) self.load_additional_registries() # Also refresh typing context, since @overload declarations can # affect it. self.typing_context.refresh()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def generic_compare(self, builder, key, argtypes, args): """ Compare the given LLVM values of the given Numba types using the comparison *key* (e.g. '=='). The values are first cast to a common safe conversion type. """ at, bt = argtypes av, bv = args ty = self.typing_context.unify_types(at, bt) assert ty is not None cav = self.cast(builder, av, at, ty) cbv = self.cast(builder, bv, bt, ty) fnty = self.typing_context.resolve_value_type(key) # the sig is homogeneous in the unified casted type cmpsig = fnty.get_call_type(self.typing_context, (ty, ty), {}) cmpfunc = self.get_function(fnty, cmpsig) self.add_linking_libs(getattr(cmpfunc, "libs", ())) return cmpfunc(builder, (cav, cbv))
def generic_compare(self, builder, key, argtypes, args): """ Compare the given LLVM values of the given Numba types using the comparison *key* (e.g. '=='). The values are first cast to a common safe conversion type. """ at, bt = argtypes av, bv = args ty = self.typing_context.unify_types(at, bt) assert ty is not None cav = self.cast(builder, av, at, ty) cbv = self.cast(builder, bv, bt, ty) fnty = self.typing_context.resolve_value_type(key) cmpsig = fnty.get_call_type(self.typing_context, argtypes, {}) cmpfunc = self.get_function(fnty, cmpsig) self.add_linking_libs(getattr(cmpfunc, "libs", ())) return cmpfunc(builder, (cav, cbv))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def is_true(self, builder, typ, val): """ Return the truth value of a value of the given Numba type. """ fnty = self.typing_context.resolve_value_type(bool) sig = fnty.get_call_type(self.typing_context, (typ,), {}) impl = self.get_function(fnty, sig) return impl(builder, (val,))
def is_true(self, builder, typ, val): """ Return the truth value of a value of the given Numba type. """ impl = self.get_function(bool, typing.signature(types.boolean, typ)) return impl(builder, (val,))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __init__(self, imp, context, sig): self._callable = _wrap_missing_loc(imp) self._imp = self._callable() self._context = context self._sig = sig
def __init__(self, imp, context, sig): self._imp = _wrap_missing_loc(imp) self._context = context self._sig = sig
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __repr__(self): return "<wrapped %s>" % repr(self._callable)
def __repr__(self): return "<wrapped %s>" % self._imp
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __call__(self): """Wrap function for missing ``loc`` keyword argument. Otherwise, return the original *fn*. """ fn = self.func if not _has_loc(fn): def wrapper(*args, **kwargs): kwargs.pop("loc") # drop unused loc return fn(*args, **kwargs) # Copy the following attributes from the wrapped. # Following similar implementation as functools.wraps but # ignore attributes if not available (i.e fix py2.7) attrs = "__name__", "libs" for attr in attrs: try: val = getattr(fn, attr) except AttributeError: pass else: setattr(wrapper, attr, val) return wrapper else: return fn
def __call__(self, builder, args, loc=None): res = self._imp(self._context, builder, self._sig, args, loc=loc) self._context.add_linking_libs(getattr(self, "libs", ())) return res
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def impl(a, b): return not val
def impl(func, iterable): for x in iterable: if func(x): yield x
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def return_user_exc(self, builder, exc, exc_args=None, loc=None, func_name=None): try_info = getattr(builder, "_in_try_block", False) self.set_static_user_exc( builder, exc, exc_args=exc_args, loc=loc, func_name=func_name ) trystatus = self.check_try_status(builder) if try_info: # This is a hack for old-style impl. # We will branch directly to the exception handler. builder.branch(try_info["target"]) else: # Return from the current function self._return_errcode_raw(builder, RETCODE_USEREXC)
def return_user_exc(self, builder, exc, exc_args=None, loc=None, func_name=None): if exc is not None and not issubclass(exc, BaseException): raise TypeError("exc should be None or exception class, got %r" % (exc,)) if exc_args is not None and not isinstance(exc_args, tuple): raise TypeError("exc_args should be None or tuple, got %r" % (exc_args,)) # None is indicative of no args, set the exc_args to an empty tuple # as PyObject_CallObject(exc, exc_args) requires the second argument to # be a tuple (or nullptr, but doing this makes it consistent) if exc_args is None: exc_args = tuple() pyapi = self.context.get_python_api(builder) # Build excinfo struct if loc is not None: fname = loc._raw_function_name() if fname is None: # could be exec(<string>) or REPL, try func_name fname = func_name locinfo = (fname, loc.filename, loc.line) if None in locinfo: locinfo = None else: locinfo = None exc = (exc, exc_args, locinfo) struct_gv = pyapi.serialize_object(exc) excptr = self._get_excinfo_argument(builder.function) builder.store(struct_gv, excptr) self._return_errcode_raw(builder, RETCODE_USEREXC)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def return_status_propagate(self, builder, status): trystatus = self.check_try_status(builder) excptr = self._get_excinfo_argument(builder.function) builder.store(status.excinfoptr, excptr) with builder.if_then(builder.not_(trystatus.in_try)): self._return_errcode_raw(builder, status.code)
def return_status_propagate(self, builder, status): excptr = self._get_excinfo_argument(builder.function) builder.store(status.excinfoptr, excptr) self._return_errcode_raw(builder, status.code)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def dump(header, body): if config.HIGHLIGHT_DUMPS: try: import pygments except ImportError: msg = "Please install pygments to see highlighted dumps" raise ValueError(msg) else: from pygments import highlight from pygments.lexers import GasLexer as lexer from pygments.formatters import Terminal256Formatter def printer(arg): print( highlight( arg, lexer(), Terminal256Formatter(style="solarized-light") ) ) else: printer = print print("=" * 80) print(header.center(80, "-")) printer(body) print("=" * 80)
def dump(header, body): print(header.center(80, "-")) print(body) print("=" * 80)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _check_llvm_bugs(self): """ Guard against some well-known LLVM bug(s). """ # Check the locale bug at https://github.com/numba/numba/issues/1569 # Note we can't cache the result as locale settings can change # across a process's lifetime. Also, for this same reason, # the check here is a mere heuristic (there may be a race condition # between now and actually compiling IR). ir = """ define double @func() { ret double 1.23e+01 } """ mod = ll.parse_assembly(ir) ir_out = str(mod) if "12.3" in ir_out or "1.23" in ir_out: # Everything ok return if "1.0" in ir_out: loc = locale.getlocale() raise RuntimeError( "LLVM will produce incorrect floating-point code " "in the current locale %s.\nPlease read " "http://numba.pydata.org/numba-doc/latest/user/faq.html#llvm-locale-bug " "for more information." % (loc,) ) raise AssertionError("Unexpected IR:\n%s\n" % (ir_out,))
def _check_llvm_bugs(self): """ Guard against some well-known LLVM bug(s). """ # Check the locale bug at https://github.com/numba/numba/issues/1569 # Note we can't cache the result as locale settings can change # accross a process's lifetime. Also, for this same reason, # the check here is a mere heuristic (there may be a race condition # between now and actually compiling IR). ir = """ define double @func() { ret double 1.23e+01 } """ mod = ll.parse_assembly(ir) ir_out = str(mod) if "12.3" in ir_out or "1.23" in ir_out: # Everything ok return if "1.0" in ir_out: loc = locale.getlocale() raise RuntimeError( "LLVM will produce incorrect floating-point code " "in the current locale %s.\nPlease read " "http://numba.pydata.org/numba-doc/latest/user/faq.html#llvm-locale-bug " "for more information." % (loc,) ) raise AssertionError("Unexpected IR:\n%s\n" % (ir_out,))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def tuple_hash(val): if _py38_or_later or isinstance(val, types.Sequence): def impl(val): return _tuple_hash(val) return impl else: def impl(val): hashed = _Py_hash_t(_tuple_hash_resolve(val)) return process_return(hashed) return impl
def tuple_hash(val): if isinstance(val, types.Sequence): def impl(val): return _tuple_hash(val) return impl else: def impl(val): hashed = _Py_hash_t(_tuple_hash_resolve(val)) return process_return(hashed) return impl
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _load_effective_address(self, indices): return cgutils.get_item_pointer2( self.context, self.builder, data=self.data, shape=self.shape, strides=self.strides, layout=self.layout, inds=indices, )
def _load_effective_address(self, indices): return cgutils.get_item_pointer2( self.builder, data=self.data, shape=self.shape, strides=self.strides, layout=self.layout, inds=indices, )
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def set_flags(self, flags): """ Provide default flags setting logic. Subclass can override. """ kws = self.values.copy() if kws.pop("nopython", False) == False: flags.set("enable_pyobject") if kws.pop("forceobj", False): flags.set("force_pyobject") if kws.pop("looplift", True): flags.set("enable_looplift") if kws.pop("boundscheck", False): flags.set("boundscheck") if kws.pop("_nrt", True): flags.set("nrt") if kws.pop("debug", config.DEBUGINFO_DEFAULT): flags.set("debuginfo") flags.set("boundscheck") if kws.pop("nogil", False): flags.set("release_gil") if kws.pop("no_rewrites", False): flags.set("no_rewrites") if kws.pop("no_cpython_wrapper", False): flags.set("no_cpython_wrapper") if "parallel" in kws: flags.set("auto_parallel", kws.pop("parallel")) if "fastmath" in kws: flags.set("fastmath", kws.pop("fastmath")) if "error_model" in kws: flags.set("error_model", kws.pop("error_model")) if "inline" in kws: flags.set("inline", kws.pop("inline")) flags.set("enable_pyobject_looplift") if kws: # Unread options? raise NameError("Unrecognized options: %s" % kws.keys())
def set_flags(self, flags): """ Provide default flags setting logic. Subclass can override. """ kws = self.values.copy() if kws.pop("nopython", False) == False: flags.set("enable_pyobject") if kws.pop("forceobj", False): flags.set("force_pyobject") if kws.pop("looplift", True): flags.set("enable_looplift") if kws.pop("boundcheck", False): flags.set("boundcheck") if kws.pop("_nrt", True): flags.set("nrt") if kws.pop("debug", config.DEBUGINFO_DEFAULT): flags.set("debuginfo") flags.set("boundcheck") if kws.pop("nogil", False): flags.set("release_gil") if kws.pop("no_rewrites", False): flags.set("no_rewrites") if kws.pop("no_cpython_wrapper", False): flags.set("no_cpython_wrapper") if "parallel" in kws: flags.set("auto_parallel", kws.pop("parallel")) if "fastmath" in kws: flags.set("fastmath", kws.pop("fastmath")) if "error_model" in kws: flags.set("error_model", kws.pop("error_model")) if "inline" in kws: flags.set("inline", kws.pop("inline")) flags.set("enable_pyobject_looplift") if kws: # Unread options? raise NameError("Unrecognized options: %s" % kws.keys())
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def make_quicksort_impl(wrap, lt=None, is_argsort=False, is_list=False): intp = types.intp zero = intp(0) # Two subroutines to make the core algorithm generic wrt. argsort # or normal sorting. Note the genericity may make basic sort() # slightly slower (~5%) if is_argsort: if is_list: @wrap def make_res(A): return [x for x in range(len(A))] else: @wrap def make_res(A): return np.arange(A.size) @wrap def GET(A, idx_or_val): return A[idx_or_val] else: @wrap def make_res(A): return A @wrap def GET(A, idx_or_val): return idx_or_val def default_lt(a, b): """ Trivial comparison function between two keys. """ return a < b LT = wrap(lt if lt is not None else default_lt) @wrap def insertion_sort(A, R, low, high): """ Insertion sort A[low:high + 1]. Note the inclusive bounds. """ assert low >= 0 if high <= low: return for i in range(low + 1, high + 1): k = R[i] v = GET(A, k) # Insert v into A[low:i] j = i while j > low and LT(v, GET(A, R[j - 1])): # Make place for moving A[i] downwards R[j] = R[j - 1] j -= 1 R[j] = k @wrap def partition(A, R, low, high): """ Partition A[low:high + 1] around a chosen pivot. The pivot's index is returned. """ assert low >= 0 assert high > low mid = (low + high) >> 1 # NOTE: the pattern of swaps below for the pivot choice and the # partitioning gives good results (i.e. regular O(n log n)) # on sorted, reverse-sorted, and uniform arrays. Subtle changes # risk breaking this property. # median of three {low, middle, high} if LT(GET(A, R[mid]), GET(A, R[low])): R[low], R[mid] = R[mid], R[low] if LT(GET(A, R[high]), GET(A, R[mid])): R[high], R[mid] = R[mid], R[high] if LT(GET(A, R[mid]), GET(A, R[low])): R[low], R[mid] = R[mid], R[low] pivot = GET(A, R[mid]) # Temporarily stash the pivot at the end R[high], R[mid] = R[mid], R[high] i = low j = high - 1 while True: while i < high and LT(GET(A, R[i]), pivot): i += 1 while j >= low and LT(pivot, GET(A, R[j])): j -= 1 if i >= j: break R[i], R[j] = R[j], R[i] i += 1 j -= 1 # Put the pivot back in its final place (all items before `i` # are smaller than the pivot, all items at/after `i` are larger) R[i], R[high] = R[high], R[i] return i @wrap def partition3(A, low, high): """ Three-way partition [low, high) around a chosen pivot. A tuple (lt, gt) is returned such that: - all elements in [low, lt) are < pivot - all elements in [lt, gt] are == pivot - all elements in (gt, high] are > pivot """ mid = (low + high) >> 1 # median of three {low, middle, high} if LT(A[mid], A[low]): A[low], A[mid] = A[mid], A[low] if LT(A[high], A[mid]): A[high], A[mid] = A[mid], A[high] if LT(A[mid], A[low]): A[low], A[mid] = A[mid], A[low] pivot = A[mid] A[low], A[mid] = A[mid], A[low] lt = low gt = high i = low + 1 while i <= gt: if LT(A[i], pivot): A[lt], A[i] = A[i], A[lt] lt += 1 i += 1 elif LT(pivot, A[i]): A[gt], A[i] = A[i], A[gt] gt -= 1 else: i += 1 return lt, gt @wrap def run_quicksort(A): R = make_res(A) if len(A) < 2: return R stack = [Partition(zero, zero)] * MAX_STACK stack[0] = Partition(zero, len(A) - 1) n = 1 while n > 0: n -= 1 low, high = stack[n] # Partition until it becomes more efficient to do an insertion sort while high - low >= SMALL_QUICKSORT: assert n < MAX_STACK i = partition(A, R, low, high) # Push largest partition on the stack if high - i > i - low: # Right is larger if high > i: stack[n] = Partition(i + 1, high) n += 1 high = i - 1 else: if i > low: stack[n] = Partition(low, i - 1) n += 1 low = i + 1 insertion_sort(A, R, low, high) return R # Unused quicksort implementation based on 3-way partitioning; the # partitioning scheme turns out exhibiting bad behaviour on sorted arrays. @wrap def _run_quicksort(A): stack = [Partition(zero, zero)] * 100 stack[0] = Partition(zero, len(A) - 1) n = 1 while n > 0: n -= 1 low, high = stack[n] # Partition until it becomes more efficient to do an insertion sort while high - low >= SMALL_QUICKSORT: assert n < MAX_STACK l, r = partition3(A, low, high) # One trivial (empty) partition => iterate on the other if r == high: high = l - 1 elif l == low: low = r + 1 # Push largest partition on the stack elif high - r > l - low: # Right is larger stack[n] = Partition(r + 1, high) n += 1 high = l - 1 else: stack[n] = Partition(low, l - 1) n += 1 low = r + 1 insertion_sort(A, low, high) return QuicksortImplementation( wrap, partition, partition3, insertion_sort, run_quicksort )
def make_quicksort_impl(wrap, lt=None, is_argsort=False): intp = types.intp zero = intp(0) # Two subroutines to make the core algorithm generic wrt. argsort # or normal sorting. Note the genericity may make basic sort() # slightly slower (~5%) if is_argsort: @wrap def make_res(A): return np.arange(A.size) @wrap def GET(A, idx_or_val): return A[idx_or_val] else: @wrap def make_res(A): return A @wrap def GET(A, idx_or_val): return idx_or_val def default_lt(a, b): """ Trivial comparison function between two keys. """ return a < b LT = wrap(lt if lt is not None else default_lt) @wrap def insertion_sort(A, R, low, high): """ Insertion sort A[low:high + 1]. Note the inclusive bounds. """ assert low >= 0 if high <= low: return for i in range(low + 1, high + 1): k = R[i] v = GET(A, k) # Insert v into A[low:i] j = i while j > low and LT(v, GET(A, R[j - 1])): # Make place for moving A[i] downwards R[j] = R[j - 1] j -= 1 R[j] = k @wrap def partition(A, R, low, high): """ Partition A[low:high + 1] around a chosen pivot. The pivot's index is returned. """ assert low >= 0 assert high > low mid = (low + high) >> 1 # NOTE: the pattern of swaps below for the pivot choice and the # partitioning gives good results (i.e. regular O(n log n)) # on sorted, reverse-sorted, and uniform arrays. Subtle changes # risk breaking this property. # median of three {low, middle, high} if LT(GET(A, R[mid]), GET(A, R[low])): R[low], R[mid] = R[mid], R[low] if LT(GET(A, R[high]), GET(A, R[mid])): R[high], R[mid] = R[mid], R[high] if LT(GET(A, R[mid]), GET(A, R[low])): R[low], R[mid] = R[mid], R[low] pivot = GET(A, R[mid]) # Temporarily stash the pivot at the end R[high], R[mid] = R[mid], R[high] i = low j = high - 1 while True: while i < high and LT(GET(A, R[i]), pivot): i += 1 while j >= low and LT(pivot, GET(A, R[j])): j -= 1 if i >= j: break R[i], R[j] = R[j], R[i] i += 1 j -= 1 # Put the pivot back in its final place (all items before `i` # are smaller than the pivot, all items at/after `i` are larger) R[i], R[high] = R[high], R[i] return i @wrap def partition3(A, low, high): """ Three-way partition [low, high) around a chosen pivot. A tuple (lt, gt) is returned such that: - all elements in [low, lt) are < pivot - all elements in [lt, gt] are == pivot - all elements in (gt, high] are > pivot """ mid = (low + high) >> 1 # median of three {low, middle, high} if LT(A[mid], A[low]): A[low], A[mid] = A[mid], A[low] if LT(A[high], A[mid]): A[high], A[mid] = A[mid], A[high] if LT(A[mid], A[low]): A[low], A[mid] = A[mid], A[low] pivot = A[mid] A[low], A[mid] = A[mid], A[low] lt = low gt = high i = low + 1 while i <= gt: if LT(A[i], pivot): A[lt], A[i] = A[i], A[lt] lt += 1 i += 1 elif LT(pivot, A[i]): A[gt], A[i] = A[i], A[gt] gt -= 1 else: i += 1 return lt, gt @wrap def run_quicksort(A): R = make_res(A) if len(A) < 2: return R stack = [Partition(zero, zero)] * MAX_STACK stack[0] = Partition(zero, len(A) - 1) n = 1 while n > 0: n -= 1 low, high = stack[n] # Partition until it becomes more efficient to do an insertion sort while high - low >= SMALL_QUICKSORT: assert n < MAX_STACK i = partition(A, R, low, high) # Push largest partition on the stack if high - i > i - low: # Right is larger if high > i: stack[n] = Partition(i + 1, high) n += 1 high = i - 1 else: if i > low: stack[n] = Partition(low, i - 1) n += 1 low = i + 1 insertion_sort(A, R, low, high) return R # Unused quicksort implementation based on 3-way partitioning; the # partitioning scheme turns out exhibiting bad behaviour on sorted arrays. @wrap def _run_quicksort(A): stack = [Partition(zero, zero)] * 100 stack[0] = Partition(zero, len(A) - 1) n = 1 while n > 0: n -= 1 low, high = stack[n] # Partition until it becomes more efficient to do an insertion sort while high - low >= SMALL_QUICKSORT: assert n < MAX_STACK l, r = partition3(A, low, high) # One trivial (empty) partition => iterate on the other if r == high: high = l - 1 elif l == low: low = r + 1 # Push largest partition on the stack elif high - r > l - low: # Right is larger stack[n] = Partition(r + 1, high) n += 1 high = l - 1 else: stack[n] = Partition(low, l - 1) n += 1 low = r + 1 insertion_sort(A, low, high) return QuicksortImplementation( wrap, partition, partition3, insertion_sort, run_quicksort )
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def make_res(A): return np.arange(A.size)
def make_res(A): return A
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _fill_ufunc_db(ufunc_db): # some of these imports would cause a problem of circular # imports if done at global scope when importing the numba # module. from . import numbers, npyfuncs, mathimpl, cmathimpl from numba import numpy_support v = numpy_support.version ufunc_db[np.negative] = { "?->?": numbers.int_invert_impl, "b->b": numbers.int_negate_impl, "B->B": numbers.int_negate_impl, "h->h": numbers.int_negate_impl, "H->H": numbers.int_negate_impl, "i->i": numbers.int_negate_impl, "I->I": numbers.int_negate_impl, "l->l": numbers.int_negate_impl, "L->L": numbers.int_negate_impl, "q->q": numbers.int_negate_impl, "Q->Q": numbers.int_negate_impl, "f->f": numbers.real_negate_impl, "d->d": numbers.real_negate_impl, "F->F": numbers.complex_negate_impl, "D->D": numbers.complex_negate_impl, } ufunc_db[np.absolute] = { "?->?": numbers.int_abs_impl, "b->b": numbers.int_abs_impl, "B->B": numbers.uint_abs_impl, "h->h": numbers.int_abs_impl, "H->H": numbers.uint_abs_impl, "i->i": numbers.int_abs_impl, "I->I": numbers.uint_abs_impl, "l->l": numbers.int_abs_impl, "L->L": numbers.uint_abs_impl, "q->q": numbers.int_abs_impl, "Q->Q": numbers.uint_abs_impl, "f->f": numbers.real_abs_impl, "d->d": numbers.real_abs_impl, "F->f": numbers.complex_abs_impl, "D->d": numbers.complex_abs_impl, } ufunc_db[np.sign] = { "b->b": numbers.int_sign_impl, "B->B": numbers.int_sign_impl, "h->h": numbers.int_sign_impl, "H->H": numbers.int_sign_impl, "i->i": numbers.int_sign_impl, "I->I": numbers.int_sign_impl, "l->l": numbers.int_sign_impl, "L->L": numbers.int_sign_impl, "q->q": numbers.int_sign_impl, "Q->Q": numbers.int_sign_impl, "f->f": numbers.real_sign_impl, "d->d": numbers.real_sign_impl, "F->F": npyfuncs.np_complex_sign_impl, "D->D": npyfuncs.np_complex_sign_impl, } ufunc_db[np.add] = { "??->?": numbers.int_or_impl, "bb->b": numbers.int_add_impl, "BB->B": numbers.int_add_impl, "hh->h": numbers.int_add_impl, "HH->H": numbers.int_add_impl, "ii->i": numbers.int_add_impl, "II->I": numbers.int_add_impl, "ll->l": numbers.int_add_impl, "LL->L": numbers.int_add_impl, "qq->q": numbers.int_add_impl, "QQ->Q": numbers.int_add_impl, "ff->f": numbers.real_add_impl, "dd->d": numbers.real_add_impl, "FF->F": numbers.complex_add_impl, "DD->D": numbers.complex_add_impl, } ufunc_db[np.subtract] = { "??->?": numbers.int_xor_impl, "bb->b": numbers.int_sub_impl, "BB->B": numbers.int_sub_impl, "hh->h": numbers.int_sub_impl, "HH->H": numbers.int_sub_impl, "ii->i": numbers.int_sub_impl, "II->I": numbers.int_sub_impl, "ll->l": numbers.int_sub_impl, "LL->L": numbers.int_sub_impl, "qq->q": numbers.int_sub_impl, "QQ->Q": numbers.int_sub_impl, "ff->f": numbers.real_sub_impl, "dd->d": numbers.real_sub_impl, "FF->F": numbers.complex_sub_impl, "DD->D": numbers.complex_sub_impl, } ufunc_db[np.multiply] = { "??->?": numbers.int_and_impl, "bb->b": numbers.int_mul_impl, "BB->B": numbers.int_mul_impl, "hh->h": numbers.int_mul_impl, "HH->H": numbers.int_mul_impl, "ii->i": numbers.int_mul_impl, "II->I": numbers.int_mul_impl, "ll->l": numbers.int_mul_impl, "LL->L": numbers.int_mul_impl, "qq->q": numbers.int_mul_impl, "QQ->Q": numbers.int_mul_impl, "ff->f": numbers.real_mul_impl, "dd->d": numbers.real_mul_impl, "FF->F": numbers.complex_mul_impl, "DD->D": numbers.complex_mul_impl, } if np.divide != np.true_divide: ufunc_db[np.divide] = { "bb->b": npyfuncs.np_int_sdiv_impl, "BB->B": npyfuncs.np_int_udiv_impl, "hh->h": npyfuncs.np_int_sdiv_impl, "HH->H": npyfuncs.np_int_udiv_impl, "ii->i": npyfuncs.np_int_sdiv_impl, "II->I": npyfuncs.np_int_udiv_impl, "ll->l": npyfuncs.np_int_sdiv_impl, "LL->L": npyfuncs.np_int_udiv_impl, "qq->q": npyfuncs.np_int_sdiv_impl, "QQ->Q": npyfuncs.np_int_udiv_impl, "ff->f": npyfuncs.np_real_div_impl, "dd->d": npyfuncs.np_real_div_impl, "FF->F": npyfuncs.np_complex_div_impl, "DD->D": npyfuncs.np_complex_div_impl, } ufunc_db[np.true_divide] = { "bb->d": npyfuncs.np_int_truediv_impl, "BB->d": npyfuncs.np_int_truediv_impl, "hh->d": npyfuncs.np_int_truediv_impl, "HH->d": npyfuncs.np_int_truediv_impl, "ii->d": npyfuncs.np_int_truediv_impl, "II->d": npyfuncs.np_int_truediv_impl, "ll->d": npyfuncs.np_int_truediv_impl, "LL->d": npyfuncs.np_int_truediv_impl, "qq->d": npyfuncs.np_int_truediv_impl, "QQ->d": npyfuncs.np_int_truediv_impl, "ff->f": npyfuncs.np_real_div_impl, "dd->d": npyfuncs.np_real_div_impl, "FF->F": npyfuncs.np_complex_div_impl, "DD->D": npyfuncs.np_complex_div_impl, } ufunc_db[np.floor_divide] = { "bb->b": npyfuncs.np_int_sdiv_impl, "BB->B": npyfuncs.np_int_udiv_impl, "hh->h": npyfuncs.np_int_sdiv_impl, "HH->H": npyfuncs.np_int_udiv_impl, "ii->i": npyfuncs.np_int_sdiv_impl, "II->I": npyfuncs.np_int_udiv_impl, "ll->l": npyfuncs.np_int_sdiv_impl, "LL->L": npyfuncs.np_int_udiv_impl, "qq->q": npyfuncs.np_int_sdiv_impl, "QQ->Q": npyfuncs.np_int_udiv_impl, "ff->f": npyfuncs.np_real_floor_div_impl, "dd->d": npyfuncs.np_real_floor_div_impl, "FF->F": npyfuncs.np_complex_floor_div_impl, "DD->D": npyfuncs.np_complex_floor_div_impl, } ufunc_db[np.remainder] = { "bb->b": npyfuncs.np_int_srem_impl, "BB->B": npyfuncs.np_int_urem_impl, "hh->h": npyfuncs.np_int_srem_impl, "HH->H": npyfuncs.np_int_urem_impl, "ii->i": npyfuncs.np_int_srem_impl, "II->I": npyfuncs.np_int_urem_impl, "ll->l": npyfuncs.np_int_srem_impl, "LL->L": npyfuncs.np_int_urem_impl, "qq->q": npyfuncs.np_int_srem_impl, "QQ->Q": npyfuncs.np_int_urem_impl, "ff->f": npyfuncs.np_real_mod_impl, "dd->d": npyfuncs.np_real_mod_impl, } ufunc_db[np.fmod] = { "bb->b": npyfuncs.np_int_fmod_impl, "BB->B": npyfuncs.np_int_fmod_impl, "hh->h": npyfuncs.np_int_fmod_impl, "HH->H": npyfuncs.np_int_fmod_impl, "ii->i": npyfuncs.np_int_fmod_impl, "II->I": npyfuncs.np_int_fmod_impl, "ll->l": npyfuncs.np_int_fmod_impl, "LL->L": npyfuncs.np_int_fmod_impl, "qq->q": npyfuncs.np_int_fmod_impl, "QQ->Q": npyfuncs.np_int_fmod_impl, "ff->f": npyfuncs.np_real_fmod_impl, "dd->d": npyfuncs.np_real_fmod_impl, } ufunc_db[np.logaddexp] = { "ff->f": npyfuncs.np_real_logaddexp_impl, "dd->d": npyfuncs.np_real_logaddexp_impl, } ufunc_db[np.logaddexp2] = { "ff->f": npyfuncs.np_real_logaddexp2_impl, "dd->d": npyfuncs.np_real_logaddexp2_impl, } ufunc_db[np.power] = { "bb->b": numbers.int_power_impl, "BB->B": numbers.int_power_impl, "hh->h": numbers.int_power_impl, "HH->H": numbers.int_power_impl, "ii->i": numbers.int_power_impl, "II->I": numbers.int_power_impl, "ll->l": numbers.int_power_impl, "LL->L": numbers.int_power_impl, "qq->q": numbers.int_power_impl, "QQ->Q": numbers.int_power_impl, # XXX we would like to use `int_power_impl` for real ** integer # as well (for better performance), but the current ufunc typing # rules forbid that "ff->f": numbers.real_power_impl, "dd->d": numbers.real_power_impl, "FF->F": npyfuncs.np_complex_power_impl, "DD->D": npyfuncs.np_complex_power_impl, } if v >= (1, 15): ufunc_db[np.gcd] = { "bb->b": npyfuncs.np_gcd_impl, "BB->B": npyfuncs.np_gcd_impl, "hh->h": npyfuncs.np_gcd_impl, "HH->H": npyfuncs.np_gcd_impl, "ii->i": npyfuncs.np_gcd_impl, "II->I": npyfuncs.np_gcd_impl, "ll->l": npyfuncs.np_gcd_impl, "LL->L": npyfuncs.np_gcd_impl, "qq->q": npyfuncs.np_gcd_impl, "QQ->Q": npyfuncs.np_gcd_impl, } ufunc_db[np.lcm] = { "bb->b": npyfuncs.np_lcm_impl, "BB->B": npyfuncs.np_lcm_impl, "hh->h": npyfuncs.np_lcm_impl, "HH->H": npyfuncs.np_lcm_impl, "ii->i": npyfuncs.np_lcm_impl, "II->I": npyfuncs.np_lcm_impl, "ll->l": npyfuncs.np_lcm_impl, "LL->L": npyfuncs.np_lcm_impl, "qq->q": npyfuncs.np_lcm_impl, "QQ->Q": npyfuncs.np_lcm_impl, } ufunc_db[np.rint] = { "f->f": npyfuncs.np_real_rint_impl, "d->d": npyfuncs.np_real_rint_impl, "F->F": npyfuncs.np_complex_rint_impl, "D->D": npyfuncs.np_complex_rint_impl, } ufunc_db[np.conjugate] = { "b->b": numbers.real_conjugate_impl, "B->B": numbers.real_conjugate_impl, "h->h": numbers.real_conjugate_impl, "H->H": numbers.real_conjugate_impl, "i->i": numbers.real_conjugate_impl, "I->I": numbers.real_conjugate_impl, "l->l": numbers.real_conjugate_impl, "L->L": numbers.real_conjugate_impl, "q->q": numbers.real_conjugate_impl, "Q->Q": numbers.real_conjugate_impl, "f->f": numbers.real_conjugate_impl, "d->d": numbers.real_conjugate_impl, "F->F": numbers.complex_conjugate_impl, "D->D": numbers.complex_conjugate_impl, } ufunc_db[np.exp] = { "f->f": npyfuncs.np_real_exp_impl, "d->d": npyfuncs.np_real_exp_impl, "F->F": npyfuncs.np_complex_exp_impl, "D->D": npyfuncs.np_complex_exp_impl, } ufunc_db[np.exp2] = { "f->f": npyfuncs.np_real_exp2_impl, "d->d": npyfuncs.np_real_exp2_impl, "F->F": npyfuncs.np_complex_exp2_impl, "D->D": npyfuncs.np_complex_exp2_impl, } ufunc_db[np.log] = { "f->f": npyfuncs.np_real_log_impl, "d->d": npyfuncs.np_real_log_impl, "F->F": npyfuncs.np_complex_log_impl, "D->D": npyfuncs.np_complex_log_impl, } ufunc_db[np.log2] = { "f->f": npyfuncs.np_real_log2_impl, "d->d": npyfuncs.np_real_log2_impl, "F->F": npyfuncs.np_complex_log2_impl, "D->D": npyfuncs.np_complex_log2_impl, } ufunc_db[np.log10] = { "f->f": npyfuncs.np_real_log10_impl, "d->d": npyfuncs.np_real_log10_impl, "F->F": npyfuncs.np_complex_log10_impl, "D->D": npyfuncs.np_complex_log10_impl, } ufunc_db[np.expm1] = { "f->f": npyfuncs.np_real_expm1_impl, "d->d": npyfuncs.np_real_expm1_impl, "F->F": npyfuncs.np_complex_expm1_impl, "D->D": npyfuncs.np_complex_expm1_impl, } ufunc_db[np.log1p] = { "f->f": npyfuncs.np_real_log1p_impl, "d->d": npyfuncs.np_real_log1p_impl, "F->F": npyfuncs.np_complex_log1p_impl, "D->D": npyfuncs.np_complex_log1p_impl, } ufunc_db[np.sqrt] = { "f->f": npyfuncs.np_real_sqrt_impl, "d->d": npyfuncs.np_real_sqrt_impl, "F->F": npyfuncs.np_complex_sqrt_impl, "D->D": npyfuncs.np_complex_sqrt_impl, } ufunc_db[np.square] = { "b->b": npyfuncs.np_int_square_impl, "B->B": npyfuncs.np_int_square_impl, "h->h": npyfuncs.np_int_square_impl, "H->H": npyfuncs.np_int_square_impl, "i->i": npyfuncs.np_int_square_impl, "I->I": npyfuncs.np_int_square_impl, "l->l": npyfuncs.np_int_square_impl, "L->L": npyfuncs.np_int_square_impl, "q->q": npyfuncs.np_int_square_impl, "Q->Q": npyfuncs.np_int_square_impl, "f->f": npyfuncs.np_real_square_impl, "d->d": npyfuncs.np_real_square_impl, "F->F": npyfuncs.np_complex_square_impl, "D->D": npyfuncs.np_complex_square_impl, } ufunc_db[np.reciprocal] = { "b->b": npyfuncs.np_int_reciprocal_impl, "B->B": npyfuncs.np_int_reciprocal_impl, "h->h": npyfuncs.np_int_reciprocal_impl, "H->H": npyfuncs.np_int_reciprocal_impl, "i->i": npyfuncs.np_int_reciprocal_impl, "I->I": npyfuncs.np_int_reciprocal_impl, "l->l": npyfuncs.np_int_reciprocal_impl, "L->L": npyfuncs.np_int_reciprocal_impl, "q->q": npyfuncs.np_int_reciprocal_impl, "Q->Q": npyfuncs.np_int_reciprocal_impl, "f->f": npyfuncs.np_real_reciprocal_impl, "d->d": npyfuncs.np_real_reciprocal_impl, "F->F": npyfuncs.np_complex_reciprocal_impl, "D->D": npyfuncs.np_complex_reciprocal_impl, } ufunc_db[np.sin] = { "f->f": npyfuncs.np_real_sin_impl, "d->d": npyfuncs.np_real_sin_impl, "F->F": npyfuncs.np_complex_sin_impl, "D->D": npyfuncs.np_complex_sin_impl, } ufunc_db[np.cos] = { "f->f": npyfuncs.np_real_cos_impl, "d->d": npyfuncs.np_real_cos_impl, "F->F": npyfuncs.np_complex_cos_impl, "D->D": npyfuncs.np_complex_cos_impl, } tan_impl = cmathimpl.tan_impl if v >= (1, 10) else npyfuncs.np_complex_tan_impl ufunc_db[np.tan] = { "f->f": npyfuncs.np_real_tan_impl, "d->d": npyfuncs.np_real_tan_impl, "F->F": tan_impl, "D->D": tan_impl, } arcsin_impl = cmathimpl.asin_impl if v >= (1, 10) else npyfuncs.np_complex_asin_impl ufunc_db[np.arcsin] = { "f->f": npyfuncs.np_real_asin_impl, "d->d": npyfuncs.np_real_asin_impl, "F->F": arcsin_impl, "D->D": arcsin_impl, } ufunc_db[np.arccos] = { "f->f": npyfuncs.np_real_acos_impl, "d->d": npyfuncs.np_real_acos_impl, "F->F": cmathimpl.acos_impl, "D->D": cmathimpl.acos_impl, } arctan_impl = cmathimpl.atan_impl if v >= (1, 10) else npyfuncs.np_complex_atan_impl ufunc_db[np.arctan] = { "f->f": npyfuncs.np_real_atan_impl, "d->d": npyfuncs.np_real_atan_impl, "F->F": arctan_impl, "D->D": arctan_impl, } ufunc_db[np.arctan2] = { "ff->f": npyfuncs.np_real_atan2_impl, "dd->d": npyfuncs.np_real_atan2_impl, } ufunc_db[np.hypot] = { "ff->f": npyfuncs.np_real_hypot_impl, "dd->d": npyfuncs.np_real_hypot_impl, } ufunc_db[np.sinh] = { "f->f": npyfuncs.np_real_sinh_impl, "d->d": npyfuncs.np_real_sinh_impl, "F->F": npyfuncs.np_complex_sinh_impl, "D->D": npyfuncs.np_complex_sinh_impl, } ufunc_db[np.cosh] = { "f->f": npyfuncs.np_real_cosh_impl, "d->d": npyfuncs.np_real_cosh_impl, "F->F": npyfuncs.np_complex_cosh_impl, "D->D": npyfuncs.np_complex_cosh_impl, } ufunc_db[np.tanh] = { "f->f": npyfuncs.np_real_tanh_impl, "d->d": npyfuncs.np_real_tanh_impl, "F->F": npyfuncs.np_complex_tanh_impl, "D->D": npyfuncs.np_complex_tanh_impl, } arcsinh_impl = ( cmathimpl.asinh_impl if v >= (1, 10) else npyfuncs.np_complex_asinh_impl ) ufunc_db[np.arcsinh] = { "f->f": npyfuncs.np_real_asinh_impl, "d->d": npyfuncs.np_real_asinh_impl, "F->F": arcsinh_impl, "D->D": arcsinh_impl, } ufunc_db[np.arccosh] = { "f->f": npyfuncs.np_real_acosh_impl, "d->d": npyfuncs.np_real_acosh_impl, "F->F": npyfuncs.np_complex_acosh_impl, "D->D": npyfuncs.np_complex_acosh_impl, } arctanh_impl = ( cmathimpl.atanh_impl if v >= (1, 10) else npyfuncs.np_complex_atanh_impl ) ufunc_db[np.arctanh] = { "f->f": npyfuncs.np_real_atanh_impl, "d->d": npyfuncs.np_real_atanh_impl, "F->F": arctanh_impl, "D->D": arctanh_impl, } ufunc_db[np.deg2rad] = { "f->f": mathimpl.radians_float_impl, "d->d": mathimpl.radians_float_impl, } ufunc_db[np.radians] = ufunc_db[np.deg2rad] ufunc_db[np.rad2deg] = { "f->f": mathimpl.degrees_float_impl, "d->d": mathimpl.degrees_float_impl, } ufunc_db[np.degrees] = ufunc_db[np.rad2deg] ufunc_db[np.floor] = { "f->f": npyfuncs.np_real_floor_impl, "d->d": npyfuncs.np_real_floor_impl, } ufunc_db[np.ceil] = { "f->f": npyfuncs.np_real_ceil_impl, "d->d": npyfuncs.np_real_ceil_impl, } ufunc_db[np.trunc] = { "f->f": npyfuncs.np_real_trunc_impl, "d->d": npyfuncs.np_real_trunc_impl, } ufunc_db[np.fabs] = { "f->f": npyfuncs.np_real_fabs_impl, "d->d": npyfuncs.np_real_fabs_impl, } # logical ufuncs ufunc_db[np.greater] = { "??->?": numbers.int_ugt_impl, "bb->?": numbers.int_sgt_impl, "BB->?": numbers.int_ugt_impl, "hh->?": numbers.int_sgt_impl, "HH->?": numbers.int_ugt_impl, "ii->?": numbers.int_sgt_impl, "II->?": numbers.int_ugt_impl, "ll->?": numbers.int_sgt_impl, "LL->?": numbers.int_ugt_impl, "qq->?": numbers.int_sgt_impl, "QQ->?": numbers.int_ugt_impl, "ff->?": numbers.real_gt_impl, "dd->?": numbers.real_gt_impl, "FF->?": npyfuncs.np_complex_gt_impl, "DD->?": npyfuncs.np_complex_gt_impl, } ufunc_db[np.greater_equal] = { "??->?": numbers.int_uge_impl, "bb->?": numbers.int_sge_impl, "BB->?": numbers.int_uge_impl, "hh->?": numbers.int_sge_impl, "HH->?": numbers.int_uge_impl, "ii->?": numbers.int_sge_impl, "II->?": numbers.int_uge_impl, "ll->?": numbers.int_sge_impl, "LL->?": numbers.int_uge_impl, "qq->?": numbers.int_sge_impl, "QQ->?": numbers.int_uge_impl, "ff->?": numbers.real_ge_impl, "dd->?": numbers.real_ge_impl, "FF->?": npyfuncs.np_complex_ge_impl, "DD->?": npyfuncs.np_complex_ge_impl, } ufunc_db[np.less] = { "??->?": numbers.int_ult_impl, "bb->?": numbers.int_slt_impl, "BB->?": numbers.int_ult_impl, "hh->?": numbers.int_slt_impl, "HH->?": numbers.int_ult_impl, "ii->?": numbers.int_slt_impl, "II->?": numbers.int_ult_impl, "ll->?": numbers.int_slt_impl, "LL->?": numbers.int_ult_impl, "qq->?": numbers.int_slt_impl, "QQ->?": numbers.int_ult_impl, "ff->?": numbers.real_lt_impl, "dd->?": numbers.real_lt_impl, "FF->?": npyfuncs.np_complex_lt_impl, "DD->?": npyfuncs.np_complex_lt_impl, } ufunc_db[np.less_equal] = { "??->?": numbers.int_ule_impl, "bb->?": numbers.int_sle_impl, "BB->?": numbers.int_ule_impl, "hh->?": numbers.int_sle_impl, "HH->?": numbers.int_ule_impl, "ii->?": numbers.int_sle_impl, "II->?": numbers.int_ule_impl, "ll->?": numbers.int_sle_impl, "LL->?": numbers.int_ule_impl, "qq->?": numbers.int_sle_impl, "QQ->?": numbers.int_ule_impl, "ff->?": numbers.real_le_impl, "dd->?": numbers.real_le_impl, "FF->?": npyfuncs.np_complex_le_impl, "DD->?": npyfuncs.np_complex_le_impl, } ufunc_db[np.not_equal] = { "??->?": numbers.int_ne_impl, "bb->?": numbers.int_ne_impl, "BB->?": numbers.int_ne_impl, "hh->?": numbers.int_ne_impl, "HH->?": numbers.int_ne_impl, "ii->?": numbers.int_ne_impl, "II->?": numbers.int_ne_impl, "ll->?": numbers.int_ne_impl, "LL->?": numbers.int_ne_impl, "qq->?": numbers.int_ne_impl, "QQ->?": numbers.int_ne_impl, "ff->?": numbers.real_ne_impl, "dd->?": numbers.real_ne_impl, "FF->?": npyfuncs.np_complex_ne_impl, "DD->?": npyfuncs.np_complex_ne_impl, } ufunc_db[np.equal] = { "??->?": numbers.int_eq_impl, "bb->?": numbers.int_eq_impl, "BB->?": numbers.int_eq_impl, "hh->?": numbers.int_eq_impl, "HH->?": numbers.int_eq_impl, "ii->?": numbers.int_eq_impl, "II->?": numbers.int_eq_impl, "ll->?": numbers.int_eq_impl, "LL->?": numbers.int_eq_impl, "qq->?": numbers.int_eq_impl, "QQ->?": numbers.int_eq_impl, "ff->?": numbers.real_eq_impl, "dd->?": numbers.real_eq_impl, "FF->?": npyfuncs.np_complex_eq_impl, "DD->?": npyfuncs.np_complex_eq_impl, } ufunc_db[np.logical_and] = { "??->?": npyfuncs.np_logical_and_impl, "bb->?": npyfuncs.np_logical_and_impl, "BB->?": npyfuncs.np_logical_and_impl, "hh->?": npyfuncs.np_logical_and_impl, "HH->?": npyfuncs.np_logical_and_impl, "ii->?": npyfuncs.np_logical_and_impl, "II->?": npyfuncs.np_logical_and_impl, "ll->?": npyfuncs.np_logical_and_impl, "LL->?": npyfuncs.np_logical_and_impl, "qq->?": npyfuncs.np_logical_and_impl, "QQ->?": npyfuncs.np_logical_and_impl, "ff->?": npyfuncs.np_logical_and_impl, "dd->?": npyfuncs.np_logical_and_impl, "FF->?": npyfuncs.np_complex_logical_and_impl, "DD->?": npyfuncs.np_complex_logical_and_impl, } ufunc_db[np.logical_or] = { "??->?": npyfuncs.np_logical_or_impl, "bb->?": npyfuncs.np_logical_or_impl, "BB->?": npyfuncs.np_logical_or_impl, "hh->?": npyfuncs.np_logical_or_impl, "HH->?": npyfuncs.np_logical_or_impl, "ii->?": npyfuncs.np_logical_or_impl, "II->?": npyfuncs.np_logical_or_impl, "ll->?": npyfuncs.np_logical_or_impl, "LL->?": npyfuncs.np_logical_or_impl, "qq->?": npyfuncs.np_logical_or_impl, "QQ->?": npyfuncs.np_logical_or_impl, "ff->?": npyfuncs.np_logical_or_impl, "dd->?": npyfuncs.np_logical_or_impl, "FF->?": npyfuncs.np_complex_logical_or_impl, "DD->?": npyfuncs.np_complex_logical_or_impl, } ufunc_db[np.logical_xor] = { "??->?": npyfuncs.np_logical_xor_impl, "bb->?": npyfuncs.np_logical_xor_impl, "BB->?": npyfuncs.np_logical_xor_impl, "hh->?": npyfuncs.np_logical_xor_impl, "HH->?": npyfuncs.np_logical_xor_impl, "ii->?": npyfuncs.np_logical_xor_impl, "II->?": npyfuncs.np_logical_xor_impl, "ll->?": npyfuncs.np_logical_xor_impl, "LL->?": npyfuncs.np_logical_xor_impl, "qq->?": npyfuncs.np_logical_xor_impl, "QQ->?": npyfuncs.np_logical_xor_impl, "ff->?": npyfuncs.np_logical_xor_impl, "dd->?": npyfuncs.np_logical_xor_impl, "FF->?": npyfuncs.np_complex_logical_xor_impl, "DD->?": npyfuncs.np_complex_logical_xor_impl, } ufunc_db[np.logical_not] = { "?->?": npyfuncs.np_logical_not_impl, "b->?": npyfuncs.np_logical_not_impl, "B->?": npyfuncs.np_logical_not_impl, "h->?": npyfuncs.np_logical_not_impl, "H->?": npyfuncs.np_logical_not_impl, "i->?": npyfuncs.np_logical_not_impl, "I->?": npyfuncs.np_logical_not_impl, "l->?": npyfuncs.np_logical_not_impl, "L->?": npyfuncs.np_logical_not_impl, "q->?": npyfuncs.np_logical_not_impl, "Q->?": npyfuncs.np_logical_not_impl, "f->?": npyfuncs.np_logical_not_impl, "d->?": npyfuncs.np_logical_not_impl, "F->?": npyfuncs.np_complex_logical_not_impl, "D->?": npyfuncs.np_complex_logical_not_impl, } ufunc_db[np.maximum] = { "??->?": npyfuncs.np_logical_or_impl, "bb->b": npyfuncs.np_int_smax_impl, "BB->B": npyfuncs.np_int_umax_impl, "hh->h": npyfuncs.np_int_smax_impl, "HH->H": npyfuncs.np_int_umax_impl, "ii->i": npyfuncs.np_int_smax_impl, "II->I": npyfuncs.np_int_umax_impl, "ll->l": npyfuncs.np_int_smax_impl, "LL->L": npyfuncs.np_int_umax_impl, "qq->q": npyfuncs.np_int_smax_impl, "QQ->Q": npyfuncs.np_int_umax_impl, "ff->f": npyfuncs.np_real_maximum_impl, "dd->d": npyfuncs.np_real_maximum_impl, "FF->F": npyfuncs.np_complex_maximum_impl, "DD->D": npyfuncs.np_complex_maximum_impl, } ufunc_db[np.minimum] = { "??->?": npyfuncs.np_logical_and_impl, "bb->b": npyfuncs.np_int_smin_impl, "BB->B": npyfuncs.np_int_umin_impl, "hh->h": npyfuncs.np_int_smin_impl, "HH->H": npyfuncs.np_int_umin_impl, "ii->i": npyfuncs.np_int_smin_impl, "II->I": npyfuncs.np_int_umin_impl, "ll->l": npyfuncs.np_int_smin_impl, "LL->L": npyfuncs.np_int_umin_impl, "qq->q": npyfuncs.np_int_smin_impl, "QQ->Q": npyfuncs.np_int_umin_impl, "ff->f": npyfuncs.np_real_minimum_impl, "dd->d": npyfuncs.np_real_minimum_impl, "FF->F": npyfuncs.np_complex_minimum_impl, "DD->D": npyfuncs.np_complex_minimum_impl, } ufunc_db[np.fmax] = { "??->?": npyfuncs.np_logical_or_impl, "bb->b": npyfuncs.np_int_smax_impl, "BB->B": npyfuncs.np_int_umax_impl, "hh->h": npyfuncs.np_int_smax_impl, "HH->H": npyfuncs.np_int_umax_impl, "ii->i": npyfuncs.np_int_smax_impl, "II->I": npyfuncs.np_int_umax_impl, "ll->l": npyfuncs.np_int_smax_impl, "LL->L": npyfuncs.np_int_umax_impl, "qq->q": npyfuncs.np_int_smax_impl, "QQ->Q": npyfuncs.np_int_umax_impl, "ff->f": npyfuncs.np_real_fmax_impl, "dd->d": npyfuncs.np_real_fmax_impl, "FF->F": npyfuncs.np_complex_fmax_impl, "DD->D": npyfuncs.np_complex_fmax_impl, } ufunc_db[np.fmin] = { "??->?": npyfuncs.np_logical_and_impl, "bb->b": npyfuncs.np_int_smin_impl, "BB->B": npyfuncs.np_int_umin_impl, "hh->h": npyfuncs.np_int_smin_impl, "HH->H": npyfuncs.np_int_umin_impl, "ii->i": npyfuncs.np_int_smin_impl, "II->I": npyfuncs.np_int_umin_impl, "ll->l": npyfuncs.np_int_smin_impl, "LL->L": npyfuncs.np_int_umin_impl, "qq->q": npyfuncs.np_int_smin_impl, "QQ->Q": npyfuncs.np_int_umin_impl, "ff->f": npyfuncs.np_real_fmin_impl, "dd->d": npyfuncs.np_real_fmin_impl, "FF->F": npyfuncs.np_complex_fmin_impl, "DD->D": npyfuncs.np_complex_fmin_impl, } # misc floating functions ufunc_db[np.isnan] = { "f->?": npyfuncs.np_real_isnan_impl, "d->?": npyfuncs.np_real_isnan_impl, "F->?": npyfuncs.np_complex_isnan_impl, "D->?": npyfuncs.np_complex_isnan_impl, # int8 "b->?": npyfuncs.np_int_isnan_impl, "B->?": npyfuncs.np_int_isnan_impl, # int16 "h->?": npyfuncs.np_int_isnan_impl, "H->?": npyfuncs.np_int_isnan_impl, # int32 "i->?": npyfuncs.np_int_isnan_impl, "I->?": npyfuncs.np_int_isnan_impl, # int64 "l->?": npyfuncs.np_int_isnan_impl, "L->?": npyfuncs.np_int_isnan_impl, # intp "q->?": npyfuncs.np_int_isnan_impl, "Q->?": npyfuncs.np_int_isnan_impl, # boolean "?->?": npyfuncs.np_int_isnan_impl, } ufunc_db[np.isinf] = { "f->?": npyfuncs.np_real_isinf_impl, "d->?": npyfuncs.np_real_isinf_impl, "F->?": npyfuncs.np_complex_isinf_impl, "D->?": npyfuncs.np_complex_isinf_impl, # int8 "b->?": npyfuncs.np_int_isinf_impl, "B->?": npyfuncs.np_int_isinf_impl, # int16 "h->?": npyfuncs.np_int_isinf_impl, "H->?": npyfuncs.np_int_isinf_impl, # int32 "i->?": npyfuncs.np_int_isinf_impl, "I->?": npyfuncs.np_int_isinf_impl, # int64 "l->?": npyfuncs.np_int_isinf_impl, "L->?": npyfuncs.np_int_isinf_impl, # intp "q->?": npyfuncs.np_int_isinf_impl, "Q->?": npyfuncs.np_int_isinf_impl, # boolean "?->?": npyfuncs.np_int_isinf_impl, } ufunc_db[np.isfinite] = { "f->?": npyfuncs.np_real_isfinite_impl, "d->?": npyfuncs.np_real_isfinite_impl, "F->?": npyfuncs.np_complex_isfinite_impl, "D->?": npyfuncs.np_complex_isfinite_impl, # int8 "b->?": npyfuncs.np_int_isfinite_impl, "B->?": npyfuncs.np_int_isfinite_impl, # int16 "h->?": npyfuncs.np_int_isfinite_impl, "H->?": npyfuncs.np_int_isfinite_impl, # int32 "i->?": npyfuncs.np_int_isfinite_impl, "I->?": npyfuncs.np_int_isfinite_impl, # int64 "l->?": npyfuncs.np_int_isfinite_impl, "L->?": npyfuncs.np_int_isfinite_impl, # intp "q->?": npyfuncs.np_int_isfinite_impl, "Q->?": npyfuncs.np_int_isfinite_impl, # boolean "?->?": npyfuncs.np_int_isfinite_impl, # datetime & timedelta "M->?": npyfuncs.np_datetime_isfinite_impl, "m->?": npyfuncs.np_datetime_isfinite_impl, } ufunc_db[np.signbit] = { "f->?": npyfuncs.np_real_signbit_impl, "d->?": npyfuncs.np_real_signbit_impl, } ufunc_db[np.copysign] = { "ff->f": npyfuncs.np_real_copysign_impl, "dd->d": npyfuncs.np_real_copysign_impl, } ufunc_db[np.nextafter] = { "ff->f": npyfuncs.np_real_nextafter_impl, "dd->d": npyfuncs.np_real_nextafter_impl, } ufunc_db[np.spacing] = { "f->f": npyfuncs.np_real_spacing_impl, "d->d": npyfuncs.np_real_spacing_impl, } ufunc_db[np.ldexp] = { "fi->f": npyfuncs.np_real_ldexp_impl, "fl->f": npyfuncs.np_real_ldexp_impl, "di->d": npyfuncs.np_real_ldexp_impl, "dl->d": npyfuncs.np_real_ldexp_impl, } # bit twiddling functions ufunc_db[np.bitwise_and] = { "??->?": numbers.int_and_impl, "bb->b": numbers.int_and_impl, "BB->B": numbers.int_and_impl, "hh->h": numbers.int_and_impl, "HH->H": numbers.int_and_impl, "ii->i": numbers.int_and_impl, "II->I": numbers.int_and_impl, "ll->l": numbers.int_and_impl, "LL->L": numbers.int_and_impl, "qq->q": numbers.int_and_impl, "QQ->Q": numbers.int_and_impl, } ufunc_db[np.bitwise_or] = { "??->?": numbers.int_or_impl, "bb->b": numbers.int_or_impl, "BB->B": numbers.int_or_impl, "hh->h": numbers.int_or_impl, "HH->H": numbers.int_or_impl, "ii->i": numbers.int_or_impl, "II->I": numbers.int_or_impl, "ll->l": numbers.int_or_impl, "LL->L": numbers.int_or_impl, "qq->q": numbers.int_or_impl, "QQ->Q": numbers.int_or_impl, } ufunc_db[np.bitwise_xor] = { "??->?": numbers.int_xor_impl, "bb->b": numbers.int_xor_impl, "BB->B": numbers.int_xor_impl, "hh->h": numbers.int_xor_impl, "HH->H": numbers.int_xor_impl, "ii->i": numbers.int_xor_impl, "II->I": numbers.int_xor_impl, "ll->l": numbers.int_xor_impl, "LL->L": numbers.int_xor_impl, "qq->q": numbers.int_xor_impl, "QQ->Q": numbers.int_xor_impl, } ufunc_db[np.invert] = { # aka np.bitwise_not "?->?": numbers.int_invert_impl, "b->b": numbers.int_invert_impl, "B->B": numbers.int_invert_impl, "h->h": numbers.int_invert_impl, "H->H": numbers.int_invert_impl, "i->i": numbers.int_invert_impl, "I->I": numbers.int_invert_impl, "l->l": numbers.int_invert_impl, "L->L": numbers.int_invert_impl, "q->q": numbers.int_invert_impl, "Q->Q": numbers.int_invert_impl, } ufunc_db[np.left_shift] = { "bb->b": numbers.int_shl_impl, "BB->B": numbers.int_shl_impl, "hh->h": numbers.int_shl_impl, "HH->H": numbers.int_shl_impl, "ii->i": numbers.int_shl_impl, "II->I": numbers.int_shl_impl, "ll->l": numbers.int_shl_impl, "LL->L": numbers.int_shl_impl, "qq->q": numbers.int_shl_impl, "QQ->Q": numbers.int_shl_impl, } ufunc_db[np.right_shift] = { "bb->b": numbers.int_shr_impl, "BB->B": numbers.int_shr_impl, "hh->h": numbers.int_shr_impl, "HH->H": numbers.int_shr_impl, "ii->i": numbers.int_shr_impl, "II->I": numbers.int_shr_impl, "ll->l": numbers.int_shr_impl, "LL->L": numbers.int_shr_impl, "qq->q": numbers.int_shr_impl, "QQ->Q": numbers.int_shr_impl, } # Inject datetime64 support from . import npdatetime ufunc_db[np.negative].update( { "m->m": npdatetime.timedelta_neg_impl, } ) ufunc_db[np.absolute].update( { "m->m": npdatetime.timedelta_abs_impl, } ) ufunc_db[np.sign].update( { "m->m": npdatetime.timedelta_sign_impl, } ) ufunc_db[np.add].update( { "mm->m": npdatetime.timedelta_add_impl, "Mm->M": npdatetime.datetime_plus_timedelta, "mM->M": npdatetime.timedelta_plus_datetime, } ) ufunc_db[np.subtract].update( { "mm->m": npdatetime.timedelta_sub_impl, "Mm->M": npdatetime.datetime_minus_timedelta, "MM->m": npdatetime.datetime_minus_datetime, } ) ufunc_db[np.multiply].update( { "mq->m": npdatetime.timedelta_times_number, "md->m": npdatetime.timedelta_times_number, "qm->m": npdatetime.number_times_timedelta, "dm->m": npdatetime.number_times_timedelta, } ) if np.divide != np.true_divide: ufunc_db[np.divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, "mm->d": npdatetime.timedelta_over_timedelta, } ) ufunc_db[np.true_divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, "mm->d": npdatetime.timedelta_over_timedelta, } ) ufunc_db[np.floor_divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, } ) if numpy_support.version >= (1, 16): ufunc_db[np.floor_divide].update( { "mm->q": npdatetime.timedelta_floor_div_timedelta, } ) ufunc_db[np.equal].update( { "MM->?": npdatetime.datetime_eq_datetime_impl, "mm->?": npdatetime.timedelta_eq_timedelta_impl, } ) ufunc_db[np.not_equal].update( { "MM->?": npdatetime.datetime_ne_datetime_impl, "mm->?": npdatetime.timedelta_ne_timedelta_impl, } ) ufunc_db[np.less].update( { "MM->?": npdatetime.datetime_lt_datetime_impl, "mm->?": npdatetime.timedelta_lt_timedelta_impl, } ) ufunc_db[np.less_equal].update( { "MM->?": npdatetime.datetime_le_datetime_impl, "mm->?": npdatetime.timedelta_le_timedelta_impl, } ) ufunc_db[np.greater].update( { "MM->?": npdatetime.datetime_gt_datetime_impl, "mm->?": npdatetime.timedelta_gt_timedelta_impl, } ) ufunc_db[np.greater_equal].update( { "MM->?": npdatetime.datetime_ge_datetime_impl, "mm->?": npdatetime.timedelta_ge_timedelta_impl, } ) ufunc_db[np.maximum].update( { "MM->M": npdatetime.datetime_max_impl, "mm->m": npdatetime.timedelta_max_impl, } ) ufunc_db[np.minimum].update( { "MM->M": npdatetime.datetime_min_impl, "mm->m": npdatetime.timedelta_min_impl, } ) # there is no difference for datetime/timedelta in maximum/fmax # and minimum/fmin ufunc_db[np.fmax].update( { "MM->M": npdatetime.datetime_max_impl, "mm->m": npdatetime.timedelta_max_impl, } ) ufunc_db[np.fmin].update( { "MM->M": npdatetime.datetime_min_impl, "mm->m": npdatetime.timedelta_min_impl, } ) if numpy_support.version >= (1, 16): ufunc_db[np.remainder].update( { "mm->m": npdatetime.timedelta_mod_timedelta, } )
def _fill_ufunc_db(ufunc_db): # some of these imports would cause a problem of circular # imports if done at global scope when importing the numba # module. from . import numbers, npyfuncs, mathimpl, cmathimpl from numba import numpy_support v = numpy_support.version ufunc_db[np.negative] = { "?->?": numbers.int_invert_impl, "b->b": numbers.int_negate_impl, "B->B": numbers.int_negate_impl, "h->h": numbers.int_negate_impl, "H->H": numbers.int_negate_impl, "i->i": numbers.int_negate_impl, "I->I": numbers.int_negate_impl, "l->l": numbers.int_negate_impl, "L->L": numbers.int_negate_impl, "q->q": numbers.int_negate_impl, "Q->Q": numbers.int_negate_impl, "f->f": numbers.real_negate_impl, "d->d": numbers.real_negate_impl, "F->F": numbers.complex_negate_impl, "D->D": numbers.complex_negate_impl, } ufunc_db[np.absolute] = { "?->?": numbers.int_abs_impl, "b->b": numbers.int_abs_impl, "B->B": numbers.uint_abs_impl, "h->h": numbers.int_abs_impl, "H->H": numbers.uint_abs_impl, "i->i": numbers.int_abs_impl, "I->I": numbers.uint_abs_impl, "l->l": numbers.int_abs_impl, "L->L": numbers.uint_abs_impl, "q->q": numbers.int_abs_impl, "Q->Q": numbers.uint_abs_impl, "f->f": numbers.real_abs_impl, "d->d": numbers.real_abs_impl, "F->f": numbers.complex_abs_impl, "D->d": numbers.complex_abs_impl, } ufunc_db[np.sign] = { "b->b": numbers.int_sign_impl, "B->B": numbers.int_sign_impl, "h->h": numbers.int_sign_impl, "H->H": numbers.int_sign_impl, "i->i": numbers.int_sign_impl, "I->I": numbers.int_sign_impl, "l->l": numbers.int_sign_impl, "L->L": numbers.int_sign_impl, "q->q": numbers.int_sign_impl, "Q->Q": numbers.int_sign_impl, "f->f": numbers.real_sign_impl, "d->d": numbers.real_sign_impl, "F->F": npyfuncs.np_complex_sign_impl, "D->D": npyfuncs.np_complex_sign_impl, } ufunc_db[np.add] = { "??->?": numbers.int_or_impl, "bb->b": numbers.int_add_impl, "BB->B": numbers.int_add_impl, "hh->h": numbers.int_add_impl, "HH->H": numbers.int_add_impl, "ii->i": numbers.int_add_impl, "II->I": numbers.int_add_impl, "ll->l": numbers.int_add_impl, "LL->L": numbers.int_add_impl, "qq->q": numbers.int_add_impl, "QQ->Q": numbers.int_add_impl, "ff->f": numbers.real_add_impl, "dd->d": numbers.real_add_impl, "FF->F": numbers.complex_add_impl, "DD->D": numbers.complex_add_impl, } ufunc_db[np.subtract] = { "??->?": numbers.int_xor_impl, "bb->b": numbers.int_sub_impl, "BB->B": numbers.int_sub_impl, "hh->h": numbers.int_sub_impl, "HH->H": numbers.int_sub_impl, "ii->i": numbers.int_sub_impl, "II->I": numbers.int_sub_impl, "ll->l": numbers.int_sub_impl, "LL->L": numbers.int_sub_impl, "qq->q": numbers.int_sub_impl, "QQ->Q": numbers.int_sub_impl, "ff->f": numbers.real_sub_impl, "dd->d": numbers.real_sub_impl, "FF->F": numbers.complex_sub_impl, "DD->D": numbers.complex_sub_impl, } ufunc_db[np.multiply] = { "??->?": numbers.int_and_impl, "bb->b": numbers.int_mul_impl, "BB->B": numbers.int_mul_impl, "hh->h": numbers.int_mul_impl, "HH->H": numbers.int_mul_impl, "ii->i": numbers.int_mul_impl, "II->I": numbers.int_mul_impl, "ll->l": numbers.int_mul_impl, "LL->L": numbers.int_mul_impl, "qq->q": numbers.int_mul_impl, "QQ->Q": numbers.int_mul_impl, "ff->f": numbers.real_mul_impl, "dd->d": numbers.real_mul_impl, "FF->F": numbers.complex_mul_impl, "DD->D": numbers.complex_mul_impl, } if np.divide != np.true_divide: ufunc_db[np.divide] = { "bb->b": npyfuncs.np_int_sdiv_impl, "BB->B": npyfuncs.np_int_udiv_impl, "hh->h": npyfuncs.np_int_sdiv_impl, "HH->H": npyfuncs.np_int_udiv_impl, "ii->i": npyfuncs.np_int_sdiv_impl, "II->I": npyfuncs.np_int_udiv_impl, "ll->l": npyfuncs.np_int_sdiv_impl, "LL->L": npyfuncs.np_int_udiv_impl, "qq->q": npyfuncs.np_int_sdiv_impl, "QQ->Q": npyfuncs.np_int_udiv_impl, "ff->f": npyfuncs.np_real_div_impl, "dd->d": npyfuncs.np_real_div_impl, "FF->F": npyfuncs.np_complex_div_impl, "DD->D": npyfuncs.np_complex_div_impl, } ufunc_db[np.true_divide] = { "bb->d": npyfuncs.np_int_truediv_impl, "BB->d": npyfuncs.np_int_truediv_impl, "hh->d": npyfuncs.np_int_truediv_impl, "HH->d": npyfuncs.np_int_truediv_impl, "ii->d": npyfuncs.np_int_truediv_impl, "II->d": npyfuncs.np_int_truediv_impl, "ll->d": npyfuncs.np_int_truediv_impl, "LL->d": npyfuncs.np_int_truediv_impl, "qq->d": npyfuncs.np_int_truediv_impl, "QQ->d": npyfuncs.np_int_truediv_impl, "ff->f": npyfuncs.np_real_div_impl, "dd->d": npyfuncs.np_real_div_impl, "FF->F": npyfuncs.np_complex_div_impl, "DD->D": npyfuncs.np_complex_div_impl, } ufunc_db[np.floor_divide] = { "bb->b": npyfuncs.np_int_sdiv_impl, "BB->B": npyfuncs.np_int_udiv_impl, "hh->h": npyfuncs.np_int_sdiv_impl, "HH->H": npyfuncs.np_int_udiv_impl, "ii->i": npyfuncs.np_int_sdiv_impl, "II->I": npyfuncs.np_int_udiv_impl, "ll->l": npyfuncs.np_int_sdiv_impl, "LL->L": npyfuncs.np_int_udiv_impl, "qq->q": npyfuncs.np_int_sdiv_impl, "QQ->Q": npyfuncs.np_int_udiv_impl, "ff->f": npyfuncs.np_real_floor_div_impl, "dd->d": npyfuncs.np_real_floor_div_impl, "FF->F": npyfuncs.np_complex_floor_div_impl, "DD->D": npyfuncs.np_complex_floor_div_impl, } ufunc_db[np.remainder] = { "bb->b": npyfuncs.np_int_srem_impl, "BB->B": npyfuncs.np_int_urem_impl, "hh->h": npyfuncs.np_int_srem_impl, "HH->H": npyfuncs.np_int_urem_impl, "ii->i": npyfuncs.np_int_srem_impl, "II->I": npyfuncs.np_int_urem_impl, "ll->l": npyfuncs.np_int_srem_impl, "LL->L": npyfuncs.np_int_urem_impl, "qq->q": npyfuncs.np_int_srem_impl, "QQ->Q": npyfuncs.np_int_urem_impl, "ff->f": npyfuncs.np_real_mod_impl, "dd->d": npyfuncs.np_real_mod_impl, } ufunc_db[np.fmod] = { "bb->b": npyfuncs.np_int_fmod_impl, "BB->B": npyfuncs.np_int_fmod_impl, "hh->h": npyfuncs.np_int_fmod_impl, "HH->H": npyfuncs.np_int_fmod_impl, "ii->i": npyfuncs.np_int_fmod_impl, "II->I": npyfuncs.np_int_fmod_impl, "ll->l": npyfuncs.np_int_fmod_impl, "LL->L": npyfuncs.np_int_fmod_impl, "qq->q": npyfuncs.np_int_fmod_impl, "QQ->Q": npyfuncs.np_int_fmod_impl, "ff->f": npyfuncs.np_real_fmod_impl, "dd->d": npyfuncs.np_real_fmod_impl, } ufunc_db[np.logaddexp] = { "ff->f": npyfuncs.np_real_logaddexp_impl, "dd->d": npyfuncs.np_real_logaddexp_impl, } ufunc_db[np.logaddexp2] = { "ff->f": npyfuncs.np_real_logaddexp2_impl, "dd->d": npyfuncs.np_real_logaddexp2_impl, } ufunc_db[np.power] = { "bb->b": numbers.int_power_impl, "BB->B": numbers.int_power_impl, "hh->h": numbers.int_power_impl, "HH->H": numbers.int_power_impl, "ii->i": numbers.int_power_impl, "II->I": numbers.int_power_impl, "ll->l": numbers.int_power_impl, "LL->L": numbers.int_power_impl, "qq->q": numbers.int_power_impl, "QQ->Q": numbers.int_power_impl, # XXX we would like to use `int_power_impl` for real ** integer # as well (for better performance), but the current ufunc typing # rules forbid that "ff->f": numbers.real_power_impl, "dd->d": numbers.real_power_impl, "FF->F": npyfuncs.np_complex_power_impl, "DD->D": npyfuncs.np_complex_power_impl, } ufunc_db[np.rint] = { "f->f": npyfuncs.np_real_rint_impl, "d->d": npyfuncs.np_real_rint_impl, "F->F": npyfuncs.np_complex_rint_impl, "D->D": npyfuncs.np_complex_rint_impl, } ufunc_db[np.conjugate] = { "b->b": numbers.real_conjugate_impl, "B->B": numbers.real_conjugate_impl, "h->h": numbers.real_conjugate_impl, "H->H": numbers.real_conjugate_impl, "i->i": numbers.real_conjugate_impl, "I->I": numbers.real_conjugate_impl, "l->l": numbers.real_conjugate_impl, "L->L": numbers.real_conjugate_impl, "q->q": numbers.real_conjugate_impl, "Q->Q": numbers.real_conjugate_impl, "f->f": numbers.real_conjugate_impl, "d->d": numbers.real_conjugate_impl, "F->F": numbers.complex_conjugate_impl, "D->D": numbers.complex_conjugate_impl, } ufunc_db[np.exp] = { "f->f": npyfuncs.np_real_exp_impl, "d->d": npyfuncs.np_real_exp_impl, "F->F": npyfuncs.np_complex_exp_impl, "D->D": npyfuncs.np_complex_exp_impl, } ufunc_db[np.exp2] = { "f->f": npyfuncs.np_real_exp2_impl, "d->d": npyfuncs.np_real_exp2_impl, "F->F": npyfuncs.np_complex_exp2_impl, "D->D": npyfuncs.np_complex_exp2_impl, } ufunc_db[np.log] = { "f->f": npyfuncs.np_real_log_impl, "d->d": npyfuncs.np_real_log_impl, "F->F": npyfuncs.np_complex_log_impl, "D->D": npyfuncs.np_complex_log_impl, } ufunc_db[np.log2] = { "f->f": npyfuncs.np_real_log2_impl, "d->d": npyfuncs.np_real_log2_impl, "F->F": npyfuncs.np_complex_log2_impl, "D->D": npyfuncs.np_complex_log2_impl, } ufunc_db[np.log10] = { "f->f": npyfuncs.np_real_log10_impl, "d->d": npyfuncs.np_real_log10_impl, "F->F": npyfuncs.np_complex_log10_impl, "D->D": npyfuncs.np_complex_log10_impl, } ufunc_db[np.expm1] = { "f->f": npyfuncs.np_real_expm1_impl, "d->d": npyfuncs.np_real_expm1_impl, "F->F": npyfuncs.np_complex_expm1_impl, "D->D": npyfuncs.np_complex_expm1_impl, } ufunc_db[np.log1p] = { "f->f": npyfuncs.np_real_log1p_impl, "d->d": npyfuncs.np_real_log1p_impl, "F->F": npyfuncs.np_complex_log1p_impl, "D->D": npyfuncs.np_complex_log1p_impl, } ufunc_db[np.sqrt] = { "f->f": npyfuncs.np_real_sqrt_impl, "d->d": npyfuncs.np_real_sqrt_impl, "F->F": npyfuncs.np_complex_sqrt_impl, "D->D": npyfuncs.np_complex_sqrt_impl, } ufunc_db[np.square] = { "b->b": npyfuncs.np_int_square_impl, "B->B": npyfuncs.np_int_square_impl, "h->h": npyfuncs.np_int_square_impl, "H->H": npyfuncs.np_int_square_impl, "i->i": npyfuncs.np_int_square_impl, "I->I": npyfuncs.np_int_square_impl, "l->l": npyfuncs.np_int_square_impl, "L->L": npyfuncs.np_int_square_impl, "q->q": npyfuncs.np_int_square_impl, "Q->Q": npyfuncs.np_int_square_impl, "f->f": npyfuncs.np_real_square_impl, "d->d": npyfuncs.np_real_square_impl, "F->F": npyfuncs.np_complex_square_impl, "D->D": npyfuncs.np_complex_square_impl, } ufunc_db[np.reciprocal] = { "b->b": npyfuncs.np_int_reciprocal_impl, "B->B": npyfuncs.np_int_reciprocal_impl, "h->h": npyfuncs.np_int_reciprocal_impl, "H->H": npyfuncs.np_int_reciprocal_impl, "i->i": npyfuncs.np_int_reciprocal_impl, "I->I": npyfuncs.np_int_reciprocal_impl, "l->l": npyfuncs.np_int_reciprocal_impl, "L->L": npyfuncs.np_int_reciprocal_impl, "q->q": npyfuncs.np_int_reciprocal_impl, "Q->Q": npyfuncs.np_int_reciprocal_impl, "f->f": npyfuncs.np_real_reciprocal_impl, "d->d": npyfuncs.np_real_reciprocal_impl, "F->F": npyfuncs.np_complex_reciprocal_impl, "D->D": npyfuncs.np_complex_reciprocal_impl, } ufunc_db[np.sin] = { "f->f": npyfuncs.np_real_sin_impl, "d->d": npyfuncs.np_real_sin_impl, "F->F": npyfuncs.np_complex_sin_impl, "D->D": npyfuncs.np_complex_sin_impl, } ufunc_db[np.cos] = { "f->f": npyfuncs.np_real_cos_impl, "d->d": npyfuncs.np_real_cos_impl, "F->F": npyfuncs.np_complex_cos_impl, "D->D": npyfuncs.np_complex_cos_impl, } tan_impl = cmathimpl.tan_impl if v >= (1, 10) else npyfuncs.np_complex_tan_impl ufunc_db[np.tan] = { "f->f": npyfuncs.np_real_tan_impl, "d->d": npyfuncs.np_real_tan_impl, "F->F": tan_impl, "D->D": tan_impl, } arcsin_impl = cmathimpl.asin_impl if v >= (1, 10) else npyfuncs.np_complex_asin_impl ufunc_db[np.arcsin] = { "f->f": npyfuncs.np_real_asin_impl, "d->d": npyfuncs.np_real_asin_impl, "F->F": arcsin_impl, "D->D": arcsin_impl, } ufunc_db[np.arccos] = { "f->f": npyfuncs.np_real_acos_impl, "d->d": npyfuncs.np_real_acos_impl, "F->F": cmathimpl.acos_impl, "D->D": cmathimpl.acos_impl, } arctan_impl = cmathimpl.atan_impl if v >= (1, 10) else npyfuncs.np_complex_atan_impl ufunc_db[np.arctan] = { "f->f": npyfuncs.np_real_atan_impl, "d->d": npyfuncs.np_real_atan_impl, "F->F": arctan_impl, "D->D": arctan_impl, } ufunc_db[np.arctan2] = { "ff->f": npyfuncs.np_real_atan2_impl, "dd->d": npyfuncs.np_real_atan2_impl, } ufunc_db[np.hypot] = { "ff->f": npyfuncs.np_real_hypot_impl, "dd->d": npyfuncs.np_real_hypot_impl, } ufunc_db[np.sinh] = { "f->f": npyfuncs.np_real_sinh_impl, "d->d": npyfuncs.np_real_sinh_impl, "F->F": npyfuncs.np_complex_sinh_impl, "D->D": npyfuncs.np_complex_sinh_impl, } ufunc_db[np.cosh] = { "f->f": npyfuncs.np_real_cosh_impl, "d->d": npyfuncs.np_real_cosh_impl, "F->F": npyfuncs.np_complex_cosh_impl, "D->D": npyfuncs.np_complex_cosh_impl, } ufunc_db[np.tanh] = { "f->f": npyfuncs.np_real_tanh_impl, "d->d": npyfuncs.np_real_tanh_impl, "F->F": npyfuncs.np_complex_tanh_impl, "D->D": npyfuncs.np_complex_tanh_impl, } arcsinh_impl = ( cmathimpl.asinh_impl if v >= (1, 10) else npyfuncs.np_complex_asinh_impl ) ufunc_db[np.arcsinh] = { "f->f": npyfuncs.np_real_asinh_impl, "d->d": npyfuncs.np_real_asinh_impl, "F->F": arcsinh_impl, "D->D": arcsinh_impl, } ufunc_db[np.arccosh] = { "f->f": npyfuncs.np_real_acosh_impl, "d->d": npyfuncs.np_real_acosh_impl, "F->F": npyfuncs.np_complex_acosh_impl, "D->D": npyfuncs.np_complex_acosh_impl, } arctanh_impl = ( cmathimpl.atanh_impl if v >= (1, 10) else npyfuncs.np_complex_atanh_impl ) ufunc_db[np.arctanh] = { "f->f": npyfuncs.np_real_atanh_impl, "d->d": npyfuncs.np_real_atanh_impl, "F->F": arctanh_impl, "D->D": arctanh_impl, } ufunc_db[np.deg2rad] = { "f->f": mathimpl.radians_float_impl, "d->d": mathimpl.radians_float_impl, } ufunc_db[np.radians] = ufunc_db[np.deg2rad] ufunc_db[np.rad2deg] = { "f->f": mathimpl.degrees_float_impl, "d->d": mathimpl.degrees_float_impl, } ufunc_db[np.degrees] = ufunc_db[np.rad2deg] ufunc_db[np.floor] = { "f->f": npyfuncs.np_real_floor_impl, "d->d": npyfuncs.np_real_floor_impl, } ufunc_db[np.ceil] = { "f->f": npyfuncs.np_real_ceil_impl, "d->d": npyfuncs.np_real_ceil_impl, } ufunc_db[np.trunc] = { "f->f": npyfuncs.np_real_trunc_impl, "d->d": npyfuncs.np_real_trunc_impl, } ufunc_db[np.fabs] = { "f->f": npyfuncs.np_real_fabs_impl, "d->d": npyfuncs.np_real_fabs_impl, } # logical ufuncs ufunc_db[np.greater] = { "??->?": numbers.int_ugt_impl, "bb->?": numbers.int_sgt_impl, "BB->?": numbers.int_ugt_impl, "hh->?": numbers.int_sgt_impl, "HH->?": numbers.int_ugt_impl, "ii->?": numbers.int_sgt_impl, "II->?": numbers.int_ugt_impl, "ll->?": numbers.int_sgt_impl, "LL->?": numbers.int_ugt_impl, "qq->?": numbers.int_sgt_impl, "QQ->?": numbers.int_ugt_impl, "ff->?": numbers.real_gt_impl, "dd->?": numbers.real_gt_impl, "FF->?": npyfuncs.np_complex_gt_impl, "DD->?": npyfuncs.np_complex_gt_impl, } ufunc_db[np.greater_equal] = { "??->?": numbers.int_uge_impl, "bb->?": numbers.int_sge_impl, "BB->?": numbers.int_uge_impl, "hh->?": numbers.int_sge_impl, "HH->?": numbers.int_uge_impl, "ii->?": numbers.int_sge_impl, "II->?": numbers.int_uge_impl, "ll->?": numbers.int_sge_impl, "LL->?": numbers.int_uge_impl, "qq->?": numbers.int_sge_impl, "QQ->?": numbers.int_uge_impl, "ff->?": numbers.real_ge_impl, "dd->?": numbers.real_ge_impl, "FF->?": npyfuncs.np_complex_ge_impl, "DD->?": npyfuncs.np_complex_ge_impl, } ufunc_db[np.less] = { "??->?": numbers.int_ult_impl, "bb->?": numbers.int_slt_impl, "BB->?": numbers.int_ult_impl, "hh->?": numbers.int_slt_impl, "HH->?": numbers.int_ult_impl, "ii->?": numbers.int_slt_impl, "II->?": numbers.int_ult_impl, "ll->?": numbers.int_slt_impl, "LL->?": numbers.int_ult_impl, "qq->?": numbers.int_slt_impl, "QQ->?": numbers.int_ult_impl, "ff->?": numbers.real_lt_impl, "dd->?": numbers.real_lt_impl, "FF->?": npyfuncs.np_complex_lt_impl, "DD->?": npyfuncs.np_complex_lt_impl, } ufunc_db[np.less_equal] = { "??->?": numbers.int_ule_impl, "bb->?": numbers.int_sle_impl, "BB->?": numbers.int_ule_impl, "hh->?": numbers.int_sle_impl, "HH->?": numbers.int_ule_impl, "ii->?": numbers.int_sle_impl, "II->?": numbers.int_ule_impl, "ll->?": numbers.int_sle_impl, "LL->?": numbers.int_ule_impl, "qq->?": numbers.int_sle_impl, "QQ->?": numbers.int_ule_impl, "ff->?": numbers.real_le_impl, "dd->?": numbers.real_le_impl, "FF->?": npyfuncs.np_complex_le_impl, "DD->?": npyfuncs.np_complex_le_impl, } ufunc_db[np.not_equal] = { "??->?": numbers.int_ne_impl, "bb->?": numbers.int_ne_impl, "BB->?": numbers.int_ne_impl, "hh->?": numbers.int_ne_impl, "HH->?": numbers.int_ne_impl, "ii->?": numbers.int_ne_impl, "II->?": numbers.int_ne_impl, "ll->?": numbers.int_ne_impl, "LL->?": numbers.int_ne_impl, "qq->?": numbers.int_ne_impl, "QQ->?": numbers.int_ne_impl, "ff->?": numbers.real_ne_impl, "dd->?": numbers.real_ne_impl, "FF->?": npyfuncs.np_complex_ne_impl, "DD->?": npyfuncs.np_complex_ne_impl, } ufunc_db[np.equal] = { "??->?": numbers.int_eq_impl, "bb->?": numbers.int_eq_impl, "BB->?": numbers.int_eq_impl, "hh->?": numbers.int_eq_impl, "HH->?": numbers.int_eq_impl, "ii->?": numbers.int_eq_impl, "II->?": numbers.int_eq_impl, "ll->?": numbers.int_eq_impl, "LL->?": numbers.int_eq_impl, "qq->?": numbers.int_eq_impl, "QQ->?": numbers.int_eq_impl, "ff->?": numbers.real_eq_impl, "dd->?": numbers.real_eq_impl, "FF->?": npyfuncs.np_complex_eq_impl, "DD->?": npyfuncs.np_complex_eq_impl, } ufunc_db[np.logical_and] = { "??->?": npyfuncs.np_logical_and_impl, "bb->?": npyfuncs.np_logical_and_impl, "BB->?": npyfuncs.np_logical_and_impl, "hh->?": npyfuncs.np_logical_and_impl, "HH->?": npyfuncs.np_logical_and_impl, "ii->?": npyfuncs.np_logical_and_impl, "II->?": npyfuncs.np_logical_and_impl, "ll->?": npyfuncs.np_logical_and_impl, "LL->?": npyfuncs.np_logical_and_impl, "qq->?": npyfuncs.np_logical_and_impl, "QQ->?": npyfuncs.np_logical_and_impl, "ff->?": npyfuncs.np_logical_and_impl, "dd->?": npyfuncs.np_logical_and_impl, "FF->?": npyfuncs.np_complex_logical_and_impl, "DD->?": npyfuncs.np_complex_logical_and_impl, } ufunc_db[np.logical_or] = { "??->?": npyfuncs.np_logical_or_impl, "bb->?": npyfuncs.np_logical_or_impl, "BB->?": npyfuncs.np_logical_or_impl, "hh->?": npyfuncs.np_logical_or_impl, "HH->?": npyfuncs.np_logical_or_impl, "ii->?": npyfuncs.np_logical_or_impl, "II->?": npyfuncs.np_logical_or_impl, "ll->?": npyfuncs.np_logical_or_impl, "LL->?": npyfuncs.np_logical_or_impl, "qq->?": npyfuncs.np_logical_or_impl, "QQ->?": npyfuncs.np_logical_or_impl, "ff->?": npyfuncs.np_logical_or_impl, "dd->?": npyfuncs.np_logical_or_impl, "FF->?": npyfuncs.np_complex_logical_or_impl, "DD->?": npyfuncs.np_complex_logical_or_impl, } ufunc_db[np.logical_xor] = { "??->?": npyfuncs.np_logical_xor_impl, "bb->?": npyfuncs.np_logical_xor_impl, "BB->?": npyfuncs.np_logical_xor_impl, "hh->?": npyfuncs.np_logical_xor_impl, "HH->?": npyfuncs.np_logical_xor_impl, "ii->?": npyfuncs.np_logical_xor_impl, "II->?": npyfuncs.np_logical_xor_impl, "ll->?": npyfuncs.np_logical_xor_impl, "LL->?": npyfuncs.np_logical_xor_impl, "qq->?": npyfuncs.np_logical_xor_impl, "QQ->?": npyfuncs.np_logical_xor_impl, "ff->?": npyfuncs.np_logical_xor_impl, "dd->?": npyfuncs.np_logical_xor_impl, "FF->?": npyfuncs.np_complex_logical_xor_impl, "DD->?": npyfuncs.np_complex_logical_xor_impl, } ufunc_db[np.logical_not] = { "?->?": npyfuncs.np_logical_not_impl, "b->?": npyfuncs.np_logical_not_impl, "B->?": npyfuncs.np_logical_not_impl, "h->?": npyfuncs.np_logical_not_impl, "H->?": npyfuncs.np_logical_not_impl, "i->?": npyfuncs.np_logical_not_impl, "I->?": npyfuncs.np_logical_not_impl, "l->?": npyfuncs.np_logical_not_impl, "L->?": npyfuncs.np_logical_not_impl, "q->?": npyfuncs.np_logical_not_impl, "Q->?": npyfuncs.np_logical_not_impl, "f->?": npyfuncs.np_logical_not_impl, "d->?": npyfuncs.np_logical_not_impl, "F->?": npyfuncs.np_complex_logical_not_impl, "D->?": npyfuncs.np_complex_logical_not_impl, } ufunc_db[np.maximum] = { "??->?": npyfuncs.np_logical_or_impl, "bb->b": npyfuncs.np_int_smax_impl, "BB->B": npyfuncs.np_int_umax_impl, "hh->h": npyfuncs.np_int_smax_impl, "HH->H": npyfuncs.np_int_umax_impl, "ii->i": npyfuncs.np_int_smax_impl, "II->I": npyfuncs.np_int_umax_impl, "ll->l": npyfuncs.np_int_smax_impl, "LL->L": npyfuncs.np_int_umax_impl, "qq->q": npyfuncs.np_int_smax_impl, "QQ->Q": npyfuncs.np_int_umax_impl, "ff->f": npyfuncs.np_real_maximum_impl, "dd->d": npyfuncs.np_real_maximum_impl, "FF->F": npyfuncs.np_complex_maximum_impl, "DD->D": npyfuncs.np_complex_maximum_impl, } ufunc_db[np.minimum] = { "??->?": npyfuncs.np_logical_and_impl, "bb->b": npyfuncs.np_int_smin_impl, "BB->B": npyfuncs.np_int_umin_impl, "hh->h": npyfuncs.np_int_smin_impl, "HH->H": npyfuncs.np_int_umin_impl, "ii->i": npyfuncs.np_int_smin_impl, "II->I": npyfuncs.np_int_umin_impl, "ll->l": npyfuncs.np_int_smin_impl, "LL->L": npyfuncs.np_int_umin_impl, "qq->q": npyfuncs.np_int_smin_impl, "QQ->Q": npyfuncs.np_int_umin_impl, "ff->f": npyfuncs.np_real_minimum_impl, "dd->d": npyfuncs.np_real_minimum_impl, "FF->F": npyfuncs.np_complex_minimum_impl, "DD->D": npyfuncs.np_complex_minimum_impl, } ufunc_db[np.fmax] = { "??->?": npyfuncs.np_logical_or_impl, "bb->b": npyfuncs.np_int_smax_impl, "BB->B": npyfuncs.np_int_umax_impl, "hh->h": npyfuncs.np_int_smax_impl, "HH->H": npyfuncs.np_int_umax_impl, "ii->i": npyfuncs.np_int_smax_impl, "II->I": npyfuncs.np_int_umax_impl, "ll->l": npyfuncs.np_int_smax_impl, "LL->L": npyfuncs.np_int_umax_impl, "qq->q": npyfuncs.np_int_smax_impl, "QQ->Q": npyfuncs.np_int_umax_impl, "ff->f": npyfuncs.np_real_fmax_impl, "dd->d": npyfuncs.np_real_fmax_impl, "FF->F": npyfuncs.np_complex_fmax_impl, "DD->D": npyfuncs.np_complex_fmax_impl, } ufunc_db[np.fmin] = { "??->?": npyfuncs.np_logical_and_impl, "bb->b": npyfuncs.np_int_smin_impl, "BB->B": npyfuncs.np_int_umin_impl, "hh->h": npyfuncs.np_int_smin_impl, "HH->H": npyfuncs.np_int_umin_impl, "ii->i": npyfuncs.np_int_smin_impl, "II->I": npyfuncs.np_int_umin_impl, "ll->l": npyfuncs.np_int_smin_impl, "LL->L": npyfuncs.np_int_umin_impl, "qq->q": npyfuncs.np_int_smin_impl, "QQ->Q": npyfuncs.np_int_umin_impl, "ff->f": npyfuncs.np_real_fmin_impl, "dd->d": npyfuncs.np_real_fmin_impl, "FF->F": npyfuncs.np_complex_fmin_impl, "DD->D": npyfuncs.np_complex_fmin_impl, } # misc floating functions ufunc_db[np.isnan] = { "f->?": npyfuncs.np_real_isnan_impl, "d->?": npyfuncs.np_real_isnan_impl, "F->?": npyfuncs.np_complex_isnan_impl, "D->?": npyfuncs.np_complex_isnan_impl, # int8 "b->?": npyfuncs.np_int_isnan_impl, "B->?": npyfuncs.np_int_isnan_impl, # int16 "h->?": npyfuncs.np_int_isnan_impl, "H->?": npyfuncs.np_int_isnan_impl, # int32 "i->?": npyfuncs.np_int_isnan_impl, "I->?": npyfuncs.np_int_isnan_impl, # int64 "l->?": npyfuncs.np_int_isnan_impl, "L->?": npyfuncs.np_int_isnan_impl, # intp "q->?": npyfuncs.np_int_isnan_impl, "Q->?": npyfuncs.np_int_isnan_impl, # boolean "?->?": npyfuncs.np_int_isnan_impl, } ufunc_db[np.isinf] = { "f->?": npyfuncs.np_real_isinf_impl, "d->?": npyfuncs.np_real_isinf_impl, "F->?": npyfuncs.np_complex_isinf_impl, "D->?": npyfuncs.np_complex_isinf_impl, # int8 "b->?": npyfuncs.np_int_isinf_impl, "B->?": npyfuncs.np_int_isinf_impl, # int16 "h->?": npyfuncs.np_int_isinf_impl, "H->?": npyfuncs.np_int_isinf_impl, # int32 "i->?": npyfuncs.np_int_isinf_impl, "I->?": npyfuncs.np_int_isinf_impl, # int64 "l->?": npyfuncs.np_int_isinf_impl, "L->?": npyfuncs.np_int_isinf_impl, # intp "q->?": npyfuncs.np_int_isinf_impl, "Q->?": npyfuncs.np_int_isinf_impl, # boolean "?->?": npyfuncs.np_int_isinf_impl, } ufunc_db[np.isfinite] = { "f->?": npyfuncs.np_real_isfinite_impl, "d->?": npyfuncs.np_real_isfinite_impl, "F->?": npyfuncs.np_complex_isfinite_impl, "D->?": npyfuncs.np_complex_isfinite_impl, # int8 "b->?": npyfuncs.np_int_isfinite_impl, "B->?": npyfuncs.np_int_isfinite_impl, # int16 "h->?": npyfuncs.np_int_isfinite_impl, "H->?": npyfuncs.np_int_isfinite_impl, # int32 "i->?": npyfuncs.np_int_isfinite_impl, "I->?": npyfuncs.np_int_isfinite_impl, # int64 "l->?": npyfuncs.np_int_isfinite_impl, "L->?": npyfuncs.np_int_isfinite_impl, # intp "q->?": npyfuncs.np_int_isfinite_impl, "Q->?": npyfuncs.np_int_isfinite_impl, # boolean "?->?": npyfuncs.np_int_isfinite_impl, # datetime & timedelta "M->?": npyfuncs.np_datetime_isfinite_impl, "m->?": npyfuncs.np_datetime_isfinite_impl, } ufunc_db[np.signbit] = { "f->?": npyfuncs.np_real_signbit_impl, "d->?": npyfuncs.np_real_signbit_impl, } ufunc_db[np.copysign] = { "ff->f": npyfuncs.np_real_copysign_impl, "dd->d": npyfuncs.np_real_copysign_impl, } ufunc_db[np.nextafter] = { "ff->f": npyfuncs.np_real_nextafter_impl, "dd->d": npyfuncs.np_real_nextafter_impl, } ufunc_db[np.spacing] = { "f->f": npyfuncs.np_real_spacing_impl, "d->d": npyfuncs.np_real_spacing_impl, } ufunc_db[np.ldexp] = { "fi->f": npyfuncs.np_real_ldexp_impl, "fl->f": npyfuncs.np_real_ldexp_impl, "di->d": npyfuncs.np_real_ldexp_impl, "dl->d": npyfuncs.np_real_ldexp_impl, } # bit twiddling functions ufunc_db[np.bitwise_and] = { "??->?": numbers.int_and_impl, "bb->b": numbers.int_and_impl, "BB->B": numbers.int_and_impl, "hh->h": numbers.int_and_impl, "HH->H": numbers.int_and_impl, "ii->i": numbers.int_and_impl, "II->I": numbers.int_and_impl, "ll->l": numbers.int_and_impl, "LL->L": numbers.int_and_impl, "qq->q": numbers.int_and_impl, "QQ->Q": numbers.int_and_impl, } ufunc_db[np.bitwise_or] = { "??->?": numbers.int_or_impl, "bb->b": numbers.int_or_impl, "BB->B": numbers.int_or_impl, "hh->h": numbers.int_or_impl, "HH->H": numbers.int_or_impl, "ii->i": numbers.int_or_impl, "II->I": numbers.int_or_impl, "ll->l": numbers.int_or_impl, "LL->L": numbers.int_or_impl, "qq->q": numbers.int_or_impl, "QQ->Q": numbers.int_or_impl, } ufunc_db[np.bitwise_xor] = { "??->?": numbers.int_xor_impl, "bb->b": numbers.int_xor_impl, "BB->B": numbers.int_xor_impl, "hh->h": numbers.int_xor_impl, "HH->H": numbers.int_xor_impl, "ii->i": numbers.int_xor_impl, "II->I": numbers.int_xor_impl, "ll->l": numbers.int_xor_impl, "LL->L": numbers.int_xor_impl, "qq->q": numbers.int_xor_impl, "QQ->Q": numbers.int_xor_impl, } ufunc_db[np.invert] = { # aka np.bitwise_not "?->?": numbers.int_invert_impl, "b->b": numbers.int_invert_impl, "B->B": numbers.int_invert_impl, "h->h": numbers.int_invert_impl, "H->H": numbers.int_invert_impl, "i->i": numbers.int_invert_impl, "I->I": numbers.int_invert_impl, "l->l": numbers.int_invert_impl, "L->L": numbers.int_invert_impl, "q->q": numbers.int_invert_impl, "Q->Q": numbers.int_invert_impl, } ufunc_db[np.left_shift] = { "bb->b": numbers.int_shl_impl, "BB->B": numbers.int_shl_impl, "hh->h": numbers.int_shl_impl, "HH->H": numbers.int_shl_impl, "ii->i": numbers.int_shl_impl, "II->I": numbers.int_shl_impl, "ll->l": numbers.int_shl_impl, "LL->L": numbers.int_shl_impl, "qq->q": numbers.int_shl_impl, "QQ->Q": numbers.int_shl_impl, } ufunc_db[np.right_shift] = { "bb->b": numbers.int_shr_impl, "BB->B": numbers.int_shr_impl, "hh->h": numbers.int_shr_impl, "HH->H": numbers.int_shr_impl, "ii->i": numbers.int_shr_impl, "II->I": numbers.int_shr_impl, "ll->l": numbers.int_shr_impl, "LL->L": numbers.int_shr_impl, "qq->q": numbers.int_shr_impl, "QQ->Q": numbers.int_shr_impl, } # Inject datetime64 support from . import npdatetime ufunc_db[np.negative].update( { "m->m": npdatetime.timedelta_neg_impl, } ) ufunc_db[np.absolute].update( { "m->m": npdatetime.timedelta_abs_impl, } ) ufunc_db[np.sign].update( { "m->m": npdatetime.timedelta_sign_impl, } ) ufunc_db[np.add].update( { "mm->m": npdatetime.timedelta_add_impl, "Mm->M": npdatetime.datetime_plus_timedelta, "mM->M": npdatetime.timedelta_plus_datetime, } ) ufunc_db[np.subtract].update( { "mm->m": npdatetime.timedelta_sub_impl, "Mm->M": npdatetime.datetime_minus_timedelta, "MM->m": npdatetime.datetime_minus_datetime, } ) ufunc_db[np.multiply].update( { "mq->m": npdatetime.timedelta_times_number, "md->m": npdatetime.timedelta_times_number, "qm->m": npdatetime.number_times_timedelta, "dm->m": npdatetime.number_times_timedelta, } ) if np.divide != np.true_divide: ufunc_db[np.divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, "mm->d": npdatetime.timedelta_over_timedelta, } ) ufunc_db[np.true_divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, "mm->d": npdatetime.timedelta_over_timedelta, } ) ufunc_db[np.floor_divide].update( { "mq->m": npdatetime.timedelta_over_number, "md->m": npdatetime.timedelta_over_number, } ) if numpy_support.version >= (1, 16): ufunc_db[np.floor_divide].update( { "mm->q": npdatetime.timedelta_floor_div_timedelta, } ) ufunc_db[np.equal].update( { "MM->?": npdatetime.datetime_eq_datetime_impl, "mm->?": npdatetime.timedelta_eq_timedelta_impl, } ) ufunc_db[np.not_equal].update( { "MM->?": npdatetime.datetime_ne_datetime_impl, "mm->?": npdatetime.timedelta_ne_timedelta_impl, } ) ufunc_db[np.less].update( { "MM->?": npdatetime.datetime_lt_datetime_impl, "mm->?": npdatetime.timedelta_lt_timedelta_impl, } ) ufunc_db[np.less_equal].update( { "MM->?": npdatetime.datetime_le_datetime_impl, "mm->?": npdatetime.timedelta_le_timedelta_impl, } ) ufunc_db[np.greater].update( { "MM->?": npdatetime.datetime_gt_datetime_impl, "mm->?": npdatetime.timedelta_gt_timedelta_impl, } ) ufunc_db[np.greater_equal].update( { "MM->?": npdatetime.datetime_ge_datetime_impl, "mm->?": npdatetime.timedelta_ge_timedelta_impl, } ) ufunc_db[np.maximum].update( { "MM->M": npdatetime.datetime_max_impl, "mm->m": npdatetime.timedelta_max_impl, } ) ufunc_db[np.minimum].update( { "MM->M": npdatetime.datetime_min_impl, "mm->m": npdatetime.timedelta_min_impl, } ) # there is no difference for datetime/timedelta in maximum/fmax # and minimum/fmin ufunc_db[np.fmax].update( { "MM->M": npdatetime.datetime_max_impl, "mm->m": npdatetime.timedelta_max_impl, } ) ufunc_db[np.fmin].update( { "MM->M": npdatetime.datetime_min_impl, "mm->m": npdatetime.timedelta_min_impl, } ) if numpy_support.version >= (1, 16): ufunc_db[np.remainder].update( { "mm->m": npdatetime.timedelta_mod_timedelta, } )
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _extract_loop_lifting_candidates(cfg, blocks): """ Returns a list of loops that are candidate for loop lifting """ # check well-formed-ness of the loop def same_exit_point(loop): "all exits must point to the same location" outedges = set() for k in loop.exits: succs = set(x for x, _ in cfg.successors(k)) if not succs: # If the exit point has no successor, it contains an return # statement, which is not handled by the looplifting code. # Thus, this loop is not a candidate. _logger.debug("return-statement in loop.") return False outedges |= succs ok = len(outedges) == 1 _logger.debug("same_exit_point=%s (%s)", ok, outedges) return ok def one_entry(loop): "there is one entry" ok = len(loop.entries) == 1 _logger.debug("one_entry=%s", ok) return ok def cannot_yield(loop): "cannot have yield inside the loop" insiders = set(loop.body) | set(loop.entries) | set(loop.exits) for blk in map(blocks.__getitem__, insiders): for inst in blk.body: if isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Yield): _logger.debug("has yield") return False _logger.debug("no yield") return True _logger.info("finding looplift candidates") # the check for cfg.entry_point in the loop.entries is to prevent a bad # rewrite where a prelude for a lifted loop would get written into block -1 # if a loop entry were in block 0 candidates = [] for loop in find_top_level_loops(cfg): _logger.debug("top-level loop: %s", loop) if ( same_exit_point(loop) and one_entry(loop) and cannot_yield(loop) and cfg.entry_point() not in loop.entries ): candidates.append(loop) _logger.debug("add candidate: %s", loop) return candidates
def _extract_loop_lifting_candidates(cfg, blocks): """ Returns a list of loops that are candidate for loop lifting """ # check well-formed-ness of the loop def same_exit_point(loop): "all exits must point to the same location" outedges = set() for k in loop.exits: succs = set(x for x, _ in cfg.successors(k)) if not succs: # If the exit point has no successor, it contains an return # statement, which is not handled by the looplifting code. # Thus, this loop is not a candidate. _logger.debug("return-statement in loop.") return False outedges |= succs ok = len(outedges) == 1 _logger.debug("same_exit_point=%s", ok) return ok def one_entry(loop): "there is one entry" ok = len(loop.entries) == 1 _logger.debug("one_entry=%s", ok) return ok def cannot_yield(loop): "cannot have yield inside the loop" insiders = set(loop.body) | set(loop.entries) | set(loop.exits) for blk in map(blocks.__getitem__, insiders): for inst in blk.body: if isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Yield): _logger.debug("has yield") return False _logger.debug("no yield") return True _logger.info("finding looplift candidates") # the check for cfg.entry_point in the loop.entries is to prevent a bad # rewrite where a prelude for a lifted loop would get written into block -1 # if a loop entry were in block 0 candidates = [] for loop in find_top_level_loops(cfg): _logger.debug("top-level loop: %s", loop) if ( same_exit_point(loop) and one_entry(loop) and cannot_yield(loop) and cfg.entry_point() not in loop.entries ): candidates.append(loop) _logger.debug("add candidate: %s", loop) return candidates
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def same_exit_point(loop): "all exits must point to the same location" outedges = set() for k in loop.exits: succs = set(x for x, _ in cfg.successors(k)) if not succs: # If the exit point has no successor, it contains an return # statement, which is not handled by the looplifting code. # Thus, this loop is not a candidate. _logger.debug("return-statement in loop.") return False outedges |= succs ok = len(outedges) == 1 _logger.debug("same_exit_point=%s (%s)", ok, outedges) return ok
def same_exit_point(loop): "all exits must point to the same location" outedges = set() for k in loop.exits: succs = set(x for x, _ in cfg.successors(k)) if not succs: # If the exit point has no successor, it contains an return # statement, which is not handled by the looplifting code. # Thus, this loop is not a candidate. _logger.debug("return-statement in loop.") return False outedges |= succs ok = len(outedges) == 1 _logger.debug("same_exit_point=%s", ok) return ok
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _loop_lift_get_candidate_infos(cfg, blocks, livemap): """ Returns information on looplifting candidates. """ loops = _extract_loop_lifting_candidates(cfg, blocks) loopinfos = [] for loop in loops: [callfrom] = loop.entries # requirement checked earlier an_exit = next(iter(loop.exits)) # anyone of the exit block if len(loop.exits) > 1: # Pre-Py3.8 may have multiple exits [(returnto, _)] = cfg.successors(an_exit) # requirement checked earlier else: # Post-Py3.8 DO NOT have multiple exits returnto = an_exit local_block_ids = set(loop.body) | set(loop.entries) inputs, outputs = find_region_inout_vars( blocks=blocks, livemap=livemap, callfrom=callfrom, returnto=returnto, body_block_ids=local_block_ids, ) lli = _loop_lift_info( loop=loop, inputs=inputs, outputs=outputs, callfrom=callfrom, returnto=returnto, ) loopinfos.append(lli) return loopinfos
def _loop_lift_get_candidate_infos(cfg, blocks, livemap): """ Returns information on looplifting candidates. """ loops = _extract_loop_lifting_candidates(cfg, blocks) loopinfos = [] for loop in loops: [callfrom] = loop.entries # requirement checked earlier an_exit = next(iter(loop.exits)) # anyone of the exit block [(returnto, _)] = cfg.successors(an_exit) # requirement checked earlier local_block_ids = set(loop.body) | set(loop.entries) | set(loop.exits) inputs, outputs = find_region_inout_vars( blocks=blocks, livemap=livemap, callfrom=callfrom, returnto=returnto, body_block_ids=local_block_ids, ) lli = _loop_lift_info( loop=loop, inputs=inputs, outputs=outputs, callfrom=callfrom, returnto=returnto, ) loopinfos.append(lli) return loopinfos
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _loop_lift_modify_blocks( func_ir, loopinfo, blocks, typingctx, targetctx, flags, locals ): """ Modify the block inplace to call to the lifted-loop. Returns a dictionary of blocks of the lifted-loop. """ from numba.dispatcher import LiftedLoop # Copy loop blocks loop = loopinfo.loop loopblockkeys = set(loop.body) | set(loop.entries) if len(loop.exits) > 1: # Pre-Py3.8 may have multiple exits loopblockkeys |= loop.exits loopblocks = dict((k, blocks[k].copy()) for k in loopblockkeys) # Modify the loop blocks _loop_lift_prepare_loop_func(loopinfo, loopblocks) # Create a new IR for the lifted loop lifted_ir = func_ir.derive( blocks=loopblocks, arg_names=tuple(loopinfo.inputs), arg_count=len(loopinfo.inputs), force_non_generator=True, ) liftedloop = LiftedLoop(lifted_ir, typingctx, targetctx, flags, locals) # modify for calling into liftedloop callblock = _loop_lift_modify_call_block( liftedloop, blocks[loopinfo.callfrom], loopinfo.inputs, loopinfo.outputs, loopinfo.returnto, ) # remove blocks for k in loopblockkeys: del blocks[k] # update main interpreter callsite into the liftedloop blocks[loopinfo.callfrom] = callblock return liftedloop
def _loop_lift_modify_blocks( func_ir, loopinfo, blocks, typingctx, targetctx, flags, locals ): """ Modify the block inplace to call to the lifted-loop. Returns a dictionary of blocks of the lifted-loop. """ from numba.dispatcher import LiftedLoop # Copy loop blocks loop = loopinfo.loop loopblockkeys = set(loop.body) | set(loop.entries) | set(loop.exits) loopblocks = dict((k, blocks[k].copy()) for k in loopblockkeys) # Modify the loop blocks _loop_lift_prepare_loop_func(loopinfo, loopblocks) # Create a new IR for the lifted loop lifted_ir = func_ir.derive( blocks=loopblocks, arg_names=tuple(loopinfo.inputs), arg_count=len(loopinfo.inputs), force_non_generator=True, ) liftedloop = LiftedLoop(lifted_ir, typingctx, targetctx, flags, locals) # modify for calling into liftedloop callblock = _loop_lift_modify_call_block( liftedloop, blocks[loopinfo.callfrom], loopinfo.inputs, loopinfo.outputs, loopinfo.returnto, ) # remove blocks for k in loopblockkeys: del blocks[k] # update main interpreter callsite into the liftedloop blocks[loopinfo.callfrom] = callblock return liftedloop
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def loop_lifting(func_ir, typingctx, targetctx, flags, locals): """ Loop lifting transformation. Given a interpreter `func_ir` returns a 2 tuple of `(toplevel_interp, [loop0_interp, loop1_interp, ....])` """ blocks = func_ir.blocks.copy() cfg = compute_cfg_from_blocks(blocks) loopinfos = _loop_lift_get_candidate_infos( cfg, blocks, func_ir.variable_lifetime.livemap ) loops = [] if loopinfos: _logger.debug( "loop lifting this IR with %d candidates:\n%s", len(loopinfos), func_ir.dump_to_string(), ) for loopinfo in loopinfos: lifted = _loop_lift_modify_blocks( func_ir, loopinfo, blocks, typingctx, targetctx, flags, locals ) loops.append(lifted) # Make main IR main = func_ir.derive(blocks=blocks) return main, loops
def loop_lifting(func_ir, typingctx, targetctx, flags, locals): """ Loop lifting transformation. Given a interpreter `func_ir` returns a 2 tuple of `(toplevel_interp, [loop0_interp, loop1_interp, ....])` """ blocks = func_ir.blocks.copy() cfg = compute_cfg_from_blocks(blocks) loopinfos = _loop_lift_get_candidate_infos( cfg, blocks, func_ir.variable_lifetime.livemap ) loops = [] for loopinfo in loopinfos: lifted = _loop_lift_modify_blocks( func_ir, loopinfo, blocks, typingctx, targetctx, flags, locals ) loops.append(lifted) # Make main IR main = func_ir.derive(blocks=blocks) return main, loops
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def type_inference_stage( typingctx, interp, args, return_type, locals={}, raise_errors=True ): if len(args) != interp.arg_count: raise TypeError("Mismatch number of argument types") warnings = errors.WarningsFixer(errors.NumbaWarning) infer = typeinfer.TypeInferer(typingctx, interp, warnings) with typingctx.callstack.register(infer, interp.func_id, args): # Seed argument types for index, (name, ty) in enumerate(zip(interp.arg_names, args)): infer.seed_argument(name, index, ty) # Seed return type if return_type is not None: infer.seed_return(return_type) # Seed local types for k, v in locals.items(): infer.seed_type(k, v) infer.build_constraint() infer.propagate(raise_errors=raise_errors) typemap, restype, calltypes = infer.unify(raise_errors=raise_errors) # Output all Numba warnings warnings.flush() return typemap, restype, calltypes
def type_inference_stage(typingctx, interp, args, return_type, locals={}): if len(args) != interp.arg_count: raise TypeError("Mismatch number of argument types") warnings = errors.WarningsFixer(errors.NumbaWarning) infer = typeinfer.TypeInferer(typingctx, interp, warnings) with typingctx.callstack.register(infer, interp.func_id, args): # Seed argument types for index, (name, ty) in enumerate(zip(interp.arg_names, args)): infer.seed_argument(name, index, ty) # Seed return type if return_type is not None: infer.seed_return(return_type) # Seed local types for k, v in locals.items(): infer.seed_type(k, v) infer.build_constraint() infer.propagate() typemap, restype, calltypes = infer.unify() # Output all Numba warnings warnings.flush() return typemap, restype, calltypes
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def legalize_return_type(return_type, interp, targetctx): """ Only accept array return type iff it is passed into the function. Reject function object return types if in nopython mode. """ if not targetctx.enable_nrt and isinstance(return_type, types.Array): # Walk IR to discover all arguments and all return statements retstmts = [] caststmts = {} argvars = set() for bid, blk in interp.blocks.items(): for inst in blk.body: if isinstance(inst, ir.Return): retstmts.append(inst.value.name) elif isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Expr) and inst.value.op == "cast": caststmts[inst.target.name] = inst.value elif isinstance(inst.value, ir.Arg): argvars.add(inst.target.name) assert retstmts, "No return statements?" for var in retstmts: cast = caststmts.get(var) if cast is None or cast.value.name not in argvars: if self._raise_errors: raise TypeError( "Only accept returning of array " "passed into the function as " "argument" ) elif isinstance(return_type, types.Function) or isinstance( return_type, types.Phantom ): if self._raise_errors: msg = "Can't return function object ({}) in nopython mode" raise TypeError(msg.format(return_type))
def legalize_return_type(return_type, interp, targetctx): """ Only accept array return type iff it is passed into the function. Reject function object return types if in nopython mode. """ if not targetctx.enable_nrt and isinstance(return_type, types.Array): # Walk IR to discover all arguments and all return statements retstmts = [] caststmts = {} argvars = set() for bid, blk in interp.blocks.items(): for inst in blk.body: if isinstance(inst, ir.Return): retstmts.append(inst.value.name) elif isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Expr) and inst.value.op == "cast": caststmts[inst.target.name] = inst.value elif isinstance(inst.value, ir.Arg): argvars.add(inst.target.name) assert retstmts, "No return statements?" for var in retstmts: cast = caststmts.get(var) if cast is None or cast.value.name not in argvars: raise TypeError( "Only accept returning of array passed " "into the function as argument" ) elif isinstance(return_type, types.Function) or isinstance( return_type, types.Phantom ): msg = "Can't return function object ({}) in nopython mode" raise TypeError(msg.format(return_type))
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def run_pass(self, state): """Run inlining of overloads""" if self._DEBUG: print("before overload inline".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) modified = False work_list = list(state.func_ir.blocks.items()) # use a work list, look for call sites via `ir.Expr.op == call` and # then pass these to `self._do_work` to make decisions about inlining. while work_list: label, block = work_list.pop() for i, instr in enumerate(block.body): if isinstance(instr, ir.Assign): expr = instr.value if isinstance(expr, ir.Expr): if expr.op == "call": workfn = self._do_work_call elif expr.op == "getattr": workfn = self._do_work_getattr else: continue if guard(workfn, state, work_list, block, i, expr): modified = True break # because block structure changed if self._DEBUG: print("after overload inline".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) if modified: # clean up blocks dead_code_elimination(state.func_ir, typemap=state.type_annotation.typemap) # clean up unconditional branches that appear due to inlined # functions introducing blocks state.func_ir.blocks = simplify_CFG(state.func_ir.blocks) if self._DEBUG: print("after overload inline DCE".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) return True
def run_pass(self, state): """Run inlining of overloads""" if config.DEBUG or self._DEBUG: print("before overload inline".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) modified = False work_list = list(state.func_ir.blocks.items()) # use a work list, look for call sites via `ir.Expr.op == call` and # then pass these to `self._do_work` to make decisions about inlining. while work_list: label, block = work_list.pop() for i, instr in enumerate(block.body): if isinstance(instr, ir.Assign): expr = instr.value if isinstance(expr, ir.Expr) and expr.op == "call": if guard(self._do_work, state, work_list, block, i, expr): modified = True break # because block structure changed if config.DEBUG or self._DEBUG: print("after overload inline".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) if modified: # clean up blocks dead_code_elimination(state.func_ir, typemap=state.type_annotation.typemap) # clean up unconditional branches that appear due to inlined # functions introducing blocks state.func_ir.blocks = simplify_CFG(state.func_ir.blocks) if config.DEBUG or self._DEBUG: print("after overload inline DCE".center(80, "-")) print(state.func_ir.dump()) print("".center(80, "-")) return True
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def resolve(self, typeinfer, typevars, fnty): assert fnty context = typeinfer.context r = fold_arg_vars(typevars, self.args, self.vararg, self.kws) if r is None: # Cannot resolve call type until all argument types are known return pos_args, kw_args = r # Check argument to be precise for a in itertools.chain(pos_args, kw_args.values()): # Forbids imprecise type except array of undefined dtype if not a.is_precise() and not isinstance(a, types.Array): return # Resolve call type try: sig = typeinfer.resolve_call(fnty, pos_args, kw_args) except ForceLiteralArg as e: folded = e.fold_arguments(self.args, self.kws) requested = set() unsatisified = set() for idx in e.requested_args: maybe_arg = typeinfer.func_ir.get_definition(folded[idx]) if isinstance(maybe_arg, ir.Arg): requested.add(maybe_arg.index) else: unsatisified.add(idx) if unsatisified: raise TypingError("Cannot request literal type.", loc=self.loc) elif requested: raise ForceLiteralArg(requested, loc=self.loc) if sig is None: # Note: duplicated error checking. # See types.BaseFunction.get_call_type # Arguments are invalid => explain why headtemp = "Invalid use of {0} with parameters ({1})" args = [str(a) for a in pos_args] args += ["%s=%s" % (k, v) for k, v in sorted(kw_args.items())] head = headtemp.format(fnty, ", ".join(map(str, args))) desc = context.explain_function_type(fnty) msg = "\n".join([head, desc]) raise TypingError(msg) typeinfer.add_type(self.target, sig.return_type, loc=self.loc) # If the function is a bound function and its receiver type # was refined, propagate it. if ( isinstance(fnty, types.BoundFunction) and sig.recvr is not None and sig.recvr != fnty.this ): refined_this = context.unify_pairs(sig.recvr, fnty.this) if refined_this is None and fnty.this.is_precise() and sig.recvr.is_precise(): msg = "Cannot refine type {} to {}".format( sig.recvr, fnty.this, ) raise TypingError(msg, loc=self.loc) if refined_this is not None and refined_this.is_precise(): refined_fnty = fnty.copy(this=refined_this) typeinfer.propagate_refined_type(self.func, refined_fnty) # If the return type is imprecise but can be unified with the # target variable's inferred type, use the latter. # Useful for code such as:: # s = set() # s.add(1) # (the set() call must be typed as int64(), not undefined()) if not sig.return_type.is_precise(): target = typevars[self.target] if target.defined: targetty = target.getone() if context.unify_pairs(targetty, sig.return_type) == targetty: sig = sig.replace(return_type=targetty) self.signature = sig self._add_refine_map(typeinfer, typevars, sig)
def resolve(self, typeinfer, typevars, fnty): assert fnty context = typeinfer.context r = fold_arg_vars(typevars, self.args, self.vararg, self.kws) if r is None: # Cannot resolve call type until all argument types are known return pos_args, kw_args = r # Check argument to be precise for a in itertools.chain(pos_args, kw_args.values()): # Forbids imprecise type except array of undefined dtype if not a.is_precise() and not isinstance(a, types.Array): return # Resolve call type try: sig = typeinfer.resolve_call(fnty, pos_args, kw_args) except ForceLiteralArg as e: folded = e.fold_arguments(self.args, self.kws) requested = set() unsatisified = set() for idx in e.requested_args: maybe_arg = typeinfer.func_ir.get_definition(folded[idx]) if isinstance(maybe_arg, ir.Arg): requested.add(maybe_arg.index) else: unsatisified.add(idx) if unsatisified: raise TypingError("Cannot request literal type.", loc=self.loc) elif requested: raise ForceLiteralArg(requested, loc=self.loc) if sig is None: # Note: duplicated error checking. # See types.BaseFunction.get_call_type # Arguments are invalid => explain why headtemp = "Invalid use of {0} with parameters ({1})" args = [str(a) for a in pos_args] args += ["%s=%s" % (k, v) for k, v in sorted(kw_args.items())] head = headtemp.format(fnty, ", ".join(map(str, args))) desc = context.explain_function_type(fnty) msg = "\n".join([head, desc]) raise TypingError(msg) typeinfer.add_type(self.target, sig.return_type, loc=self.loc) # If the function is a bound function and its receiver type # was refined, propagate it. if ( isinstance(fnty, types.BoundFunction) and sig.recvr is not None and sig.recvr != fnty.this ): refined_this = context.unify_pairs(sig.recvr, fnty.this) if refined_this is not None and refined_this.is_precise(): refined_fnty = fnty.copy(this=refined_this) typeinfer.propagate_refined_type(self.func, refined_fnty) # If the return type is imprecise but can be unified with the # target variable's inferred type, use the latter. # Useful for code such as:: # s = set() # s.add(1) # (the set() call must be typed as int64(), not undefined()) if not sig.return_type.is_precise(): target = typevars[self.target] if target.defined: targetty = target.getone() if context.unify_pairs(targetty, sig.return_type) == targetty: sig = sig.replace(return_type=targetty) self.signature = sig self._add_refine_map(typeinfer, typevars, sig)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def unify(self, raise_errors=True): """ Run the final unification pass over all inferred types, and catch imprecise types. """ typdict = utils.UniqueDict() def find_offender(name, exhaustive=False): # finds the offending variable definition by name # if exhaustive is set it will try and trace through temporary # variables to find a concrete offending definition. offender = None for block in self.func_ir.blocks.values(): offender = block.find_variable_assignment(name) if offender is not None: if not exhaustive: break try: # simple assignment hasattr(offender.value, "name") offender_value = offender.value.name except (AttributeError, KeyError): break orig_offender = offender if offender_value.startswith("$"): offender = find_offender(offender_value, exhaustive=exhaustive) if offender is None: offender = orig_offender break return offender def diagnose_imprecision(offender): # helper for diagnosing imprecise types list_msg = """\n For Numba to be able to compile a list, the list must have a known and precise type that can be inferred from the other variables. Whilst sometimes the type of empty lists can be inferred, this is not always the case, see this documentation for help: http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-has-an-untyped-list-problem """ if offender is not None: # This block deals with imprecise lists if hasattr(offender, "value"): if hasattr(offender.value, "op"): # might be `foo = []` if offender.value.op == "build_list": return list_msg # or might be `foo = list()` elif offender.value.op == "call": try: # assignment involving a call call_name = offender.value.func.name # find the offender based on the call name offender = find_offender(call_name) if isinstance(offender.value, ir.Global): if offender.value.name == "list": return list_msg except (AttributeError, KeyError): pass return "" # no help possible def check_var(name): tv = self.typevars[name] if not tv.defined: if raise_errors: offender = find_offender(name) val = getattr(offender, "value", "unknown operation") loc = getattr(offender, "loc", ir.unknown_loc) msg = ( "Type of variable '%s' cannot be determined, " "operation: %s, location: %s" ) raise TypingError(msg % (var, val, loc), loc) else: typdict[var] = types.unknown return tp = tv.getone() if not tp.is_precise(): offender = find_offender(name, exhaustive=True) msg = ( "Cannot infer the type of variable '%s'%s, have imprecise type: %s. %s" ) istmp = " (temporary variable)" if var.startswith("$") else "" loc = getattr(offender, "loc", ir.unknown_loc) # is this an untyped list? try and provide help extra_msg = diagnose_imprecision(offender) if raise_errors: raise TypingError(msg % (var, istmp, tp, extra_msg), loc) else: typdict[var] = types.unknown return else: # type is precise, hold it typdict[var] = tp # For better error display, check first user-visible vars, then # temporaries temps = set(k for k in self.typevars if not k[0].isalpha()) others = set(self.typevars) - temps for var in sorted(others): check_var(var) for var in sorted(temps): check_var(var) try: retty = self.get_return_type(typdict) except Exception as e: # partial type inference may raise e.g. attribute error if a # constraint has no computable signature, ignore this as needed if raise_errors: raise e else: retty = None try: fntys = self.get_function_types(typdict) except Exception as e: # partial type inference may raise e.g. attribute error if a # constraint has no computable signature, ignore this as needed if raise_errors: raise e else: fntys = None if self.generator_info: retty = self.get_generator_type(typdict, retty, raise_errors=raise_errors) self.debug.unify_finished(typdict, retty, fntys) return typdict, retty, fntys
def unify(self): """ Run the final unification pass over all inferred types, and catch imprecise types. """ typdict = utils.UniqueDict() def find_offender(name, exhaustive=False): # finds the offending variable definition by name # if exhaustive is set it will try and trace through temporary # variables to find a concrete offending definition. offender = None for block in self.func_ir.blocks.values(): offender = block.find_variable_assignment(name) if offender is not None: if not exhaustive: break try: # simple assignment hasattr(offender.value, "name") offender_value = offender.value.name except (AttributeError, KeyError): break orig_offender = offender if offender_value.startswith("$"): offender = find_offender(offender_value, exhaustive=exhaustive) if offender is None: offender = orig_offender break return offender def diagnose_imprecision(offender): # helper for diagnosing imprecise types list_msg = """\n For Numba to be able to compile a list, the list must have a known and precise type that can be inferred from the other variables. Whilst sometimes the type of empty lists can be inferred, this is not always the case, see this documentation for help: http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-has-an-untyped-list-problem """ if offender is not None: # This block deals with imprecise lists if hasattr(offender, "value"): if hasattr(offender.value, "op"): # might be `foo = []` if offender.value.op == "build_list": return list_msg # or might be `foo = list()` elif offender.value.op == "call": try: # assignment involving a call call_name = offender.value.func.name # find the offender based on the call name offender = find_offender(call_name) if isinstance(offender.value, ir.Global): if offender.value.name == "list": return list_msg except (AttributeError, KeyError): pass return "" # no help possible def check_var(name): tv = self.typevars[name] if not tv.defined: offender = find_offender(name) val = getattr(offender, "value", "unknown operation") loc = getattr(offender, "loc", ir.unknown_loc) msg = ( "Type of variable '%s' cannot be determined, operation:" " %s, location: %s" ) raise TypingError(msg % (var, val, loc), loc) tp = tv.getone() if not tp.is_precise(): offender = find_offender(name, exhaustive=True) msg = ( "Cannot infer the type of variable '%s'%s, have imprecise type: %s. %s" ) istmp = " (temporary variable)" if var.startswith("$") else "" loc = getattr(offender, "loc", ir.unknown_loc) # is this an untyped list? try and provide help extra_msg = diagnose_imprecision(offender) raise TypingError(msg % (var, istmp, tp, extra_msg), loc) else: # type is precise, hold it typdict[var] = tp # For better error display, check first user-visible vars, then # temporaries temps = set(k for k in self.typevars if not k[0].isalpha()) others = set(self.typevars) - temps for var in sorted(others): check_var(var) for var in sorted(temps): check_var(var) retty = self.get_return_type(typdict) fntys = self.get_function_types(typdict) if self.generator_info: retty = self.get_generator_type(typdict, retty) self.debug.unify_finished(typdict, retty, fntys) return typdict, retty, fntys
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def check_var(name): tv = self.typevars[name] if not tv.defined: if raise_errors: offender = find_offender(name) val = getattr(offender, "value", "unknown operation") loc = getattr(offender, "loc", ir.unknown_loc) msg = ( "Type of variable '%s' cannot be determined, " "operation: %s, location: %s" ) raise TypingError(msg % (var, val, loc), loc) else: typdict[var] = types.unknown return tp = tv.getone() if not tp.is_precise(): offender = find_offender(name, exhaustive=True) msg = "Cannot infer the type of variable '%s'%s, have imprecise type: %s. %s" istmp = " (temporary variable)" if var.startswith("$") else "" loc = getattr(offender, "loc", ir.unknown_loc) # is this an untyped list? try and provide help extra_msg = diagnose_imprecision(offender) if raise_errors: raise TypingError(msg % (var, istmp, tp, extra_msg), loc) else: typdict[var] = types.unknown return else: # type is precise, hold it typdict[var] = tp
def check_var(name): tv = self.typevars[name] if not tv.defined: offender = find_offender(name) val = getattr(offender, "value", "unknown operation") loc = getattr(offender, "loc", ir.unknown_loc) msg = "Type of variable '%s' cannot be determined, operation: %s, location: %s" raise TypingError(msg % (var, val, loc), loc) tp = tv.getone() if not tp.is_precise(): offender = find_offender(name, exhaustive=True) msg = "Cannot infer the type of variable '%s'%s, have imprecise type: %s. %s" istmp = " (temporary variable)" if var.startswith("$") else "" loc = getattr(offender, "loc", ir.unknown_loc) # is this an untyped list? try and provide help extra_msg = diagnose_imprecision(offender) raise TypingError(msg % (var, istmp, tp, extra_msg), loc) else: # type is precise, hold it typdict[var] = tp
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def get_generator_type(self, typdict, retty, raise_errors=True): gi = self.generator_info arg_types = [None] * len(self.arg_names) for index, name in self.arg_names.items(): arg_types[index] = typdict[name] state_types = None try: state_types = [typdict[var_name] for var_name in gi.state_vars] except KeyError: msg = "Cannot type generator: state variable types cannot be found" if raise_errors: raise TypingError(msg) state_types = [types.unknown for _ in gi.state_vars] yield_types = None try: yield_types = [typdict[y.inst.value.name] for y in gi.get_yield_points()] except KeyError: msg = "Cannot type generator: yield type cannot be found" if raise_errors: raise TypingError(msg) if not yield_types: msg = "Cannot type generator: it does not yield any value" if raise_errors: raise TypingError(msg) yield_types = [types.unknown for _ in gi.get_yield_points()] if not yield_types or all(yield_types) == types.unknown: # unknown yield, probably partial type inference, escape return types.Generator( self.func_id.func, types.unknown, arg_types, state_types, has_finalizer=True ) yield_type = self.context.unify_types(*yield_types) if yield_type is None or isinstance(yield_type, types.Optional): msg = "Cannot type generator: cannot unify yielded types %s" yp_highlights = [] for y in gi.get_yield_points(): msg = _termcolor.errmsg("Yield of: IR '%s', type '%s', location: %s") yp_highlights.append( msg % (str(y.inst), typdict[y.inst.value.name], y.inst.loc.strformat()) ) explain_ty = set() for ty in yield_types: if isinstance(ty, types.Optional): explain_ty.add(ty.type) explain_ty.add(types.NoneType("none")) else: explain_ty.add(ty) if raise_errors: raise TypingError( "Can't unify yield type from the " "following types: %s" % ", ".join(sorted(map(str, explain_ty))) + "\n\n" + "\n".join(yp_highlights) ) return types.Generator( self.func_id.func, yield_type, arg_types, state_types, has_finalizer=True )
def get_generator_type(self, typdict, retty): gi = self.generator_info arg_types = [None] * len(self.arg_names) for index, name in self.arg_names.items(): arg_types[index] = typdict[name] state_types = [typdict[var_name] for var_name in gi.state_vars] yield_types = [typdict[y.inst.value.name] for y in gi.get_yield_points()] if not yield_types: msg = "Cannot type generator: it does not yield any value" raise TypingError(msg) yield_type = self.context.unify_types(*yield_types) if yield_type is None or isinstance(yield_type, types.Optional): msg = "Cannot type generator: cannot unify yielded types %s" yp_highlights = [] for y in gi.get_yield_points(): msg = _termcolor.errmsg("Yield of: IR '%s', type '%s', location: %s") yp_highlights.append( msg % (str(y.inst), typdict[y.inst.value.name], y.inst.loc.strformat()) ) explain_ty = set() for ty in yield_types: if isinstance(ty, types.Optional): explain_ty.add(ty.type) explain_ty.add(types.NoneType("none")) else: explain_ty.add(ty) raise TypingError( "Can't unify yield type from the " "following types: %s" % ", ".join(sorted(map(str, explain_ty))) + "\n\n" + "\n".join(yp_highlights) ) return types.Generator( self.func_id.func, yield_type, arg_types, state_types, has_finalizer=True )
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _unify_return_types(self, rettypes): if rettypes: unified = self.context.unify_types(*rettypes) if unified is None or not unified.is_precise(): def check_type(atype): lst = [] for k, v in self.typevars.items(): if atype == v.type: lst.append(k) returns = {} for x in reversed(lst): for block in self.func_ir.blocks.values(): for instr in block.find_insts(ir.Return): value = instr.value if isinstance(value, ir.Var): name = value.name else: pass if x == name: returns[x] = instr break interped = "" for name, offender in returns.items(): loc = getattr(offender, "loc", ir.unknown_loc) msg = "Return of: IR name '%s', type '%s', location: %s" interped = msg % (name, atype, loc.strformat()) return interped problem_str = [] for xtype in rettypes: problem_str.append(_termcolor.errmsg(check_type(xtype))) raise TypingError( "Can't unify return type from the " "following types: %s" % ", ".join(sorted(map(str, rettypes))) + "\n" + "\n".join(problem_str) ) return unified else: # Function without a successful return path return types.none
def _unify_return_types(self, rettypes): if rettypes: unified = self.context.unify_types(*rettypes) if unified is None or not unified.is_precise(): def check_type(atype): lst = [] for k, v in self.typevars.items(): if atype == v.type: lst.append(k) returns = {} for x in reversed(lst): for block in self.func_ir.blocks.values(): for instr in block.find_insts(ir.Return): value = instr.value if isinstance(value, ir.Var): name = value.name else: pass if x == name: returns[x] = instr break for name, offender in returns.items(): loc = getattr(offender, "loc", ir.unknown_loc) msg = "Return of: IR name '%s', type '%s', location: %s" interped = msg % (name, atype, loc.strformat()) return interped problem_str = [] for xtype in rettypes: problem_str.append(_termcolor.errmsg(check_type(xtype))) raise TypingError( "Can't unify return type from the " "following types: %s" % ", ".join(sorted(map(str, rettypes))) + "\n" + "\n".join(problem_str) ) return unified else: # Function without a successful return path return types.none
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def check_type(atype): lst = [] for k, v in self.typevars.items(): if atype == v.type: lst.append(k) returns = {} for x in reversed(lst): for block in self.func_ir.blocks.values(): for instr in block.find_insts(ir.Return): value = instr.value if isinstance(value, ir.Var): name = value.name else: pass if x == name: returns[x] = instr break interped = "" for name, offender in returns.items(): loc = getattr(offender, "loc", ir.unknown_loc) msg = "Return of: IR name '%s', type '%s', location: %s" interped = msg % (name, atype, loc.strformat()) return interped
def check_type(atype): lst = [] for k, v in self.typevars.items(): if atype == v.type: lst.append(k) returns = {} for x in reversed(lst): for block in self.func_ir.blocks.values(): for instr in block.find_insts(ir.Return): value = instr.value if isinstance(value, ir.Var): name = value.name else: pass if x == name: returns[x] = instr break for name, offender in returns.items(): loc = getattr(offender, "loc", ir.unknown_loc) msg = "Return of: IR name '%s', type '%s', location: %s" interped = msg % (name, atype, loc.strformat()) return interped
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def constrain_statement(self, inst): if isinstance(inst, ir.Assign): self.typeof_assign(inst) elif isinstance(inst, ir.SetItem): self.typeof_setitem(inst) elif isinstance(inst, ir.StaticSetItem): self.typeof_static_setitem(inst) elif isinstance(inst, ir.DelItem): self.typeof_delitem(inst) elif isinstance(inst, ir.SetAttr): self.typeof_setattr(inst) elif isinstance(inst, ir.Print): self.typeof_print(inst) elif isinstance(inst, ir.StoreMap): self.typeof_storemap(inst) elif isinstance(inst, (ir.Jump, ir.Branch, ir.Return, ir.Del)): pass elif isinstance(inst, (ir.StaticRaise, ir.StaticTryRaise)): pass elif type(inst) in typeinfer_extensions: # let external calls handle stmt if type matches f = typeinfer_extensions[type(inst)] f(inst, self) else: msg = "Unsupported constraint encountered: %s" % inst raise UnsupportedError(msg, loc=inst.loc)
def constrain_statement(self, inst): if isinstance(inst, ir.Assign): self.typeof_assign(inst) elif isinstance(inst, ir.SetItem): self.typeof_setitem(inst) elif isinstance(inst, ir.StaticSetItem): self.typeof_static_setitem(inst) elif isinstance(inst, ir.DelItem): self.typeof_delitem(inst) elif isinstance(inst, ir.SetAttr): self.typeof_setattr(inst) elif isinstance(inst, ir.Print): self.typeof_print(inst) elif isinstance(inst, ir.StoreMap): self.typeof_storemap(inst) elif isinstance(inst, (ir.Jump, ir.Branch, ir.Return, ir.Del)): pass elif isinstance(inst, ir.StaticRaise): pass elif type(inst) in typeinfer_extensions: # let external calls handle stmt if type matches f = typeinfer_extensions[type(inst)] f(inst, self) else: msg = "Unsupported constraint encountered: %s" % inst raise UnsupportedError(msg, loc=inst.loc)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def typeof_expr(self, inst, target, expr): if expr.op == "call": if isinstance(expr.func, ir.Intrinsic): sig = expr.func.type self.add_type(target.name, sig.return_type, loc=inst.loc) self.add_calltype(expr, sig) else: self.typeof_call(inst, target, expr) elif expr.op in ("getiter", "iternext"): self.typeof_intrinsic_call(inst, target, expr.op, expr.value) elif expr.op == "exhaust_iter": constraint = ExhaustIterConstraint( target.name, count=expr.count, iterator=expr.value, loc=expr.loc ) self.constraints.append(constraint) elif expr.op == "pair_first": constraint = PairFirstConstraint(target.name, pair=expr.value, loc=expr.loc) self.constraints.append(constraint) elif expr.op == "pair_second": constraint = PairSecondConstraint(target.name, pair=expr.value, loc=expr.loc) self.constraints.append(constraint) elif expr.op == "binop": self.typeof_intrinsic_call(inst, target, expr.fn, expr.lhs, expr.rhs) elif expr.op == "inplace_binop": self.typeof_intrinsic_call(inst, target, expr.fn, expr.lhs, expr.rhs) elif expr.op == "unary": self.typeof_intrinsic_call(inst, target, expr.fn, expr.value) elif expr.op == "static_getitem": constraint = StaticGetItemConstraint( target.name, value=expr.value, index=expr.index, index_var=expr.index_var, loc=expr.loc, ) self.constraints.append(constraint) self.calls.append((inst.value, constraint)) elif expr.op == "getitem": self.typeof_intrinsic_call( inst, target, operator.getitem, expr.value, expr.index, ) elif expr.op == "typed_getitem": constraint = TypedGetItemConstraint( target.name, value=expr.value, dtype=expr.dtype, index=expr.index, loc=expr.loc, ) self.constraints.append(constraint) self.calls.append((inst.value, constraint)) elif expr.op == "getattr": constraint = GetAttrConstraint( target.name, attr=expr.attr, value=expr.value, loc=inst.loc, inst=inst ) self.constraints.append(constraint) elif expr.op == "build_tuple": constraint = BuildTupleConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_list": constraint = BuildListConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_set": constraint = BuildSetConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_map": constraint = BuildMapConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "cast": self.constraints.append( Propagate(dst=target.name, src=expr.value.name, loc=inst.loc) ) elif expr.op == "make_function": self.lock_type( target.name, types.MakeFunctionLiteral(expr), loc=inst.loc, literal_value=expr, ) else: msg = "Unsupported op-code encountered: %s" % expr raise UnsupportedError(msg, loc=inst.loc)
def typeof_expr(self, inst, target, expr): if expr.op == "call": if isinstance(expr.func, ir.Intrinsic): sig = expr.func.type self.add_type(target.name, sig.return_type, loc=inst.loc) self.add_calltype(expr, sig) else: self.typeof_call(inst, target, expr) elif expr.op in ("getiter", "iternext"): self.typeof_intrinsic_call(inst, target, expr.op, expr.value) elif expr.op == "exhaust_iter": constraint = ExhaustIterConstraint( target.name, count=expr.count, iterator=expr.value, loc=expr.loc ) self.constraints.append(constraint) elif expr.op == "pair_first": constraint = PairFirstConstraint(target.name, pair=expr.value, loc=expr.loc) self.constraints.append(constraint) elif expr.op == "pair_second": constraint = PairSecondConstraint(target.name, pair=expr.value, loc=expr.loc) self.constraints.append(constraint) elif expr.op == "binop": self.typeof_intrinsic_call(inst, target, expr.fn, expr.lhs, expr.rhs) elif expr.op == "inplace_binop": self.typeof_intrinsic_call(inst, target, expr.fn, expr.lhs, expr.rhs) elif expr.op == "unary": self.typeof_intrinsic_call(inst, target, expr.fn, expr.value) elif expr.op == "static_getitem": constraint = StaticGetItemConstraint( target.name, value=expr.value, index=expr.index, index_var=expr.index_var, loc=expr.loc, ) self.constraints.append(constraint) self.calls.append((inst.value, constraint)) elif expr.op == "getitem": self.typeof_intrinsic_call( inst, target, operator.getitem, expr.value, expr.index, ) elif expr.op == "getattr": constraint = GetAttrConstraint( target.name, attr=expr.attr, value=expr.value, loc=inst.loc, inst=inst ) self.constraints.append(constraint) elif expr.op == "build_tuple": constraint = BuildTupleConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_list": constraint = BuildListConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_set": constraint = BuildSetConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "build_map": constraint = BuildMapConstraint(target.name, items=expr.items, loc=inst.loc) self.constraints.append(constraint) elif expr.op == "cast": self.constraints.append( Propagate(dst=target.name, src=expr.value.name, loc=inst.loc) ) elif expr.op == "make_function": self.lock_type( target.name, types.MakeFunctionLiteral(expr), loc=inst.loc, literal_value=expr, ) else: msg = "Unsupported op-code encountered: %s" % expr raise UnsupportedError(msg, loc=inst.loc)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __init__(self, dtype, count): self.dtype = dtype self.count = count name = "%s(%s x %d)" % ( self.__class__.__name__, dtype, count, ) super(UniTuple, self).__init__(name)
def __init__(self, dtype, count): self.dtype = dtype self.count = count name = "tuple(%s x %d)" % (dtype, count) super(UniTuple, self).__init__(name)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def __init__(self, types): self.types = tuple(types) self.count = len(self.types) self.dtype = UnionType(types) name = "%s(%s)" % ( self.__class__.__name__, ", ".join(str(i) for i in self.types), ) super(Tuple, self).__init__(name)
def __init__(self, types): self.types = tuple(types) self.count = len(self.types) name = "(%s)" % ", ".join(str(i) for i in self.types) super(Tuple, self).__init__(name)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def get_call_type(self, context, args, kws): failures = _ResolutionFailures(context, self, args, kws) for temp_cls in self.templates: temp = temp_cls(context) for uselit in [True, False]: try: if uselit: sig = temp.apply(args, kws) else: nolitargs = tuple([unliteral(a) for a in args]) nolitkws = {k: unliteral(v) for k, v in kws.items()} sig = temp.apply(nolitargs, nolitkws) except Exception as e: sig = None failures.add_error(temp_cls, e) else: if sig is not None: self._impl_keys[sig.args] = temp.get_impl_key(sig) return sig else: haslit = "" if uselit else "out" msg = "All templates rejected with%s literals." % haslit failures.add_error(temp_cls, msg) if len(failures) == 0: raise AssertionError( "Internal Error. " "Function resolution ended with no failures " "or successful signature" ) failures.raise_error()
def get_call_type(self, context, args, kws): failures = _ResolutionFailures(context, self, args, kws) for temp_cls in self.templates: temp = temp_cls(context) for uselit in [True, False]: try: if uselit: sig = temp.apply(args, kws) else: nolitargs = tuple([unliteral(a) for a in args]) nolitkws = {k: unliteral(v) for k, v in kws.items()} sig = temp.apply(nolitargs, nolitkws) except Exception as e: sig = None failures.add_error(temp_cls, e) else: if sig is not None: self._impl_keys[sig.args] = temp.get_impl_key(sig) return sig else: haslit = "" if uselit else "out" msg = "All templates rejected with%s literals." % haslit failures.add_error(temp_cls, msg) if len(failures) == 0: raise AssertionError( "Internal Error. " "Function resolution ended with no failures " "or successfull signature" ) failures.raise_error()
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def resolve_getattr(self, typ, attr): """ Resolve getting the attribute *attr* (a string) on the Numba type. The attribute's type is returned, or None if resolution failed. """ def core(typ): out = self.find_matching_getattr_template(typ, attr) if out: return out["return_type"] out = core(typ) if out is not None: return out # Try again without literals out = core(types.unliteral(typ)) if out is not None: return out if isinstance(typ, types.Module): attrty = self.resolve_module_constants(typ, attr) if attrty is not None: return attrty
def resolve_getattr(self, typ, attr): """ Resolve getting the attribute *attr* (a string) on the Numba type. The attribute's type is returned, or None if resolution failed. """ def core(typ): for attrinfo in self._get_attribute_templates(typ): ret = attrinfo.resolve(typ, attr) if ret is not None: return ret out = core(typ) if out is not None: return out # Try again without literals out = core(types.unliteral(typ)) if out is not None: return out if isinstance(typ, types.Module): attrty = self.resolve_module_constants(typ, attr) if attrty is not None: return attrty
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def core(typ): out = self.find_matching_getattr_template(typ, attr) if out: return out["return_type"]
def core(typ): for attrinfo in self._get_attribute_templates(typ): ret = attrinfo.resolve(typ, attr) if ret is not None: return ret
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError
def _load_builtins(self): # Initialize declarations from . import builtins, arraydecl, npdatetime # noqa: F401 from . import ctypes_utils, bufproto # noqa: F401 from numba.unsafe import eh # noqa: F401 self.install_registry(templates.builtin_registry)
def _load_builtins(self): # Initialize declarations from . import builtins, arraydecl, npdatetime # noqa: F401 from . import ctypes_utils, bufproto # noqa: F401 self.install_registry(templates.builtin_registry)
https://github.com/numba/numba/issues/4944
Traceback (most recent call last): File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 619, in __init__ typ = typ.elements[i] IndexError: tuple index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ibutygin/src/numba/numba/numba/errors.py", line 717, in new_error_context yield File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 303, in lower_inst val = self.lower_assign(ty, inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 467, in lower_assign return self.lower_expr(ty, value) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 932, in lower_expr res = self.lower_call(resty, expr) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 724, in lower_call res = self._lower_call_normal(fnty, expr, signature) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 903, in _lower_call_normal res = impl(self.builder, argvals, self.loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/typing/templates.py", line 778, in method_impl return call(builder, args) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1132, in __call__ res = self._imp(self._context, builder, self._sig, args, loc=loc) File "/home/ibutygin/src/numba/numba/numba/targets/base.py", line 1157, in wrapper return fn(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/targets/imputils.py", line 193, in imp builder, func, fndesc.restype, fndesc.argtypes, args) File "/home/ibutygin/src/numba/numba/numba/targets/callconv.py", line 477, in call_function args = list(arginfo.as_arguments(builder, args)) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in as_arguments for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/packer.py", line 100, in <listcomp> for dm, val in zip(self._dm_args, values) File "/home/ibutygin/src/numba/numba/numba/datamodel/models.py", line 447, in as_argument v = builder.extract_value(value, [i]) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/builder.py", line 927, in extract_value instr = instructions.ExtractValue(self.block, agg, idx, name=name) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/site-packages/llvmlite/ir/instructions.py", line 622, in __init__ % (list(indices), agg.type)) TypeError: Can't index at [0] in {} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 73, in <module> print(bar(Dummy())) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 420, in _compile_for_args raise e File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 77, in compile status, retval = self._compile_cached(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/home/ibutygin/src/numba/numba/numba/dispatcher.py", line 109, in _compile_core pipeline_class=self.pipeline_class) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 543, in compile_extra return pipeline.compile_extra(func) File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 389, in _compile_bytecode return self._compile_core() File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 368, in _compile_core raise e File "/home/ibutygin/src/numba/numba/numba/compiler.py", line 359, in _compile_core pm.run(self.state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 331, in run raise patched_exception File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 322, in run self._runPass(idx, pass_inst, state) File "/home/ibutygin/src/numba/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 281, in _runPass mutated |= check(pss.run_pass, internal_state) File "/home/ibutygin/src/numba/numba/numba/compiler_machinery.py", line 268, in check mangled = func(compiler_state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 391, in run_pass NativeLowering().run_pass(state) File "/home/ibutygin/src/numba/numba/numba/typed_passes.py", line 333, in run_pass lower.lower() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 179, in lower self.lower_normal_function(self.fndesc) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 220, in lower_normal_function entry_block_tail = self.lower_function_body() File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 245, in lower_function_body self.lower_block(block) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 260, in lower_block self.lower_inst(inst) File "/home/ibutygin/miniconda3/envs/NUMBA_CUSTOM/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/home/ibutygin/src/numba/numba/numba/errors.py", line 725, in new_error_context six.reraise(type(newerr), newerr, tb) File "/home/ibutygin/src/numba/numba/numba/six.py", line 669, in reraise raise value numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Can't index at [0] in {} File "test.py", line 71: def bar(obj): return obj.inline_method(123,456) ^ [1] During: lowering "$10call_method.4 = call $4load_method.1($const6.2, $const8.3, func=$4load_method.1, args=[Var($const6.2, test.py:71), Var($const8.3, test.py:71)], kws=(), vararg=None)" at test.py (71)
IndexError