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 _make_list(itemty, allocated=DEFAULT_ALLOCATED): return listobject._as_meminfo(listobject.new_list(itemty, allocated=allocated))
def _make_list(itemty, allocated=0): return listobject._as_meminfo(listobject.new_list(itemty, allocated=allocated))
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def _allocated(self): if not self._typed: return DEFAULT_ALLOCATED else: return _allocated(self)
def _allocated(self): if not self._typed: return 0 else: return _allocated(self)
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def __new__(cls, lsttype=None, meminfo=None, allocated=DEFAULT_ALLOCATED): if config.DISABLE_JIT: return list.__new__(list) else: return object.__new__(cls)
def __new__(cls, lsttype=None, meminfo=None, allocated=None): if config.DISABLE_JIT: return list.__new__(list) else: return object.__new__(cls)
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def empty_list(cls, item_type, allocated=DEFAULT_ALLOCATED): """Create a new empty List. Parameters ---------- item_type: Numba type type of the list item. allocated: int number of items to pre-allocate """ if config.DISABLE_JIT: return list() else: return cls(lsttype=ListType(item_type), allocated=allocated)
def empty_list(cls, item_type, allocated=0): """Create a new empty List. Parameters ---------- item_type: Numba type type of the list item. allocated: int number of items to pre-allocate """ if config.DISABLE_JIT: return list() else: return cls(lsttype=ListType(item_type), allocated=allocated)
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def _parse_arg(self, lsttype, meminfo=None, allocated=DEFAULT_ALLOCATED): if not isinstance(lsttype, ListType): raise TypeError("*lsttype* must be a ListType") if meminfo is not None: opaque = meminfo else: opaque = _make_list(lsttype.item_type, allocated=allocated) return lsttype, opaque
def _parse_arg(self, lsttype, meminfo=None, allocated=0): if not isinstance(lsttype, ListType): raise TypeError("*lsttype* must be a ListType") if meminfo is not None: opaque = meminfo else: opaque = _make_list(lsttype.item_type, allocated=allocated) return lsttype, opaque
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def typedlist_empty(cls, item_type, allocated=DEFAULT_ALLOCATED): if cls.instance_type is not ListType: return def impl(cls, item_type, allocated=DEFAULT_ALLOCATED): return listobject.new_list(item_type, allocated=allocated) return impl
def typedlist_empty(cls, item_type): if cls.instance_type is not ListType: return def impl(cls, item_type): return listobject.new_list(item_type) return impl
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
def impl(cls, item_type, allocated=DEFAULT_ALLOCATED): return listobject.new_list(item_type, allocated=allocated)
def impl(cls, item_type): return listobject.new_list(item_type)
https://github.com/numba/numba/issues/5355
====================================================================== ERROR: test_numba_typed_list_allocated (sdc.tests.test_series.TestSeries) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sdc\tests\test_series.py ", line 6817, in test_numba_typed_list_allocated print(jitted()) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\disp atcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\numba\six. py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function typedlist_empty at 0x0000015A9C481550>) with argument( s) of type(s): (typeref[<class 'numba.types.containers.ListType'>], class(int64), int64) * parameterized In definition 0: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 In definition 1: TypeError: typedlist_empty() takes 2 positional arguments but 3 were given raised from c:\users\akozlov\appdata\local\continuum\anaconda3\numba_master\numba\nu mba\typing\templates.py:539 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.types.abstract.TypeRef'> , 'empty_list') for typeref[<class 'numba.types.containers.ListType'>]) [2] During: typing of call at C:\Users\akozlov\AppData\Local\Continuum\anaconda3\hpat\sd c\tests\test_series.py (6813) File "sdc\tests\test_series.py", line 6813: def test_impl(): <source elided> # problem in overload of empty_list in typedlist.py alloc_list = List.empty_list(types.int64, 10) ^ ---------------------------------------------------------------------- Ran 1 test in 0.075s FAILED (errors=1)
numba.errors.TypingError
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") _check_for_none_typed(l, "extend") def select_impl(): if isinstance(iterable, types.ListType): def impl(l, iterable): if not l._is_mutable(): raise ValueError("list is immutable") # 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 elif isinstance(iterable, types.UnicodeType): ty = iterable 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") _check_for_none_typed(l, "extend") def select_impl(): if isinstance(iterable, types.ListType): def impl(l, iterable): if not l._is_mutable(): raise ValueError("list is immutable") # 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()
https://github.com/numba/numba/issues/5289
Traceback (most recent call last): File "/Users/vhaenel/git/numba/numba/core/typeinfer.py", line 149, in propagate constraint(typeinfer) File "/Users/vhaenel/git/numba/numba/core/typeinfer.py", line 486, in __call__ self.resolve(typeinfer, typevars, fnty) File "/Users/vhaenel/git/numba/numba/core/typeinfer.py", line 506, in resolve sig = typeinfer.resolve_call(fnty, pos_args, kw_args) File "/Users/vhaenel/git/numba/numba/core/typeinfer.py", line 1440, in resolve_call return self.context.resolve_function_type(fnty, pos_args, kw_args) File "/Users/vhaenel/git/numba/numba/core/typing/context.py", line 214, in resolve_function_type raise last_exception File "/Users/vhaenel/git/numba/numba/core/typing/context.py", line 197, in resolve_function_type res = self._resolve_user_function_type(func, args, kws) File "/Users/vhaenel/git/numba/numba/core/typing/context.py", line 249, in _resolve_user_function_type return func.get_call_type(self, args, kws) File "/Users/vhaenel/git/numba/numba/core/types/functions.py", line 215, in get_call_type out = template.apply(args, kws) File "/Users/vhaenel/git/numba/numba/core/typing/templates.py", line 246, in apply sig = generic(args, kws) File "/Users/vhaenel/git/numba/numba/core/typing/templates.py", line 802, in generic sig = self._get_signature(self.context, fnty, args, kws) File "/Users/vhaenel/git/numba/numba/core/typing/templates.py", line 753, in _get_signature sig = fnty.get_call_type(typingctx, args, kws) File "/Users/vhaenel/git/numba/numba/core/types/functions.py", line 148, in get_call_type failures.raise_error() File "/Users/vhaenel/git/numba/numba/core/types/functions.py", line 77, in raise_error raise errors.TypingError(self.format()) numba.core.errors.TypingError: Invalid use of Function(<function impl_extend at 0x117b72b80>) with argument(s) of type(s): (ListType[undefined], unicode_type) * parameterized In definition 0: TypingError: unable to extend list, iterable is missing either *dtype*, *item_type* or *yield_type*. raised from /Users/vhaenel/git/numba/numba/typed/listobject.py:1053 In definition 1: TypingError: unable to extend list, iterable is missing either *dtype*, *item_type* or *yield_type*. raised from /Users/vhaenel/git/numba/numba/typed/listobject.py:1053 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.core.types.containers.ListType'>, 'extend') for ListType[undefined]) [2] During: typing of call at foo/foo134.py (8) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "foo/foo134.py", line 12, in <module> print(foo()) File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 342, in error_rewrite raise e File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 353, in _compile_for_args return self.compile(tuple(argtypes)) File "/Users/vhaenel/git/numba/numba/core/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 768, in compile cres = self._compiler.compile(args, return_type) File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 81, in compile raise retval File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 91, in _compile_cached retval = self._compile_core(args, return_type) File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 104, in _compile_core cres = compiler.compile_extra(self.targetdescr.typing_context, File "/Users/vhaenel/git/numba/numba/core/compiler.py", line 548, in compile_extra return pipeline.compile_extra(func) File "/Users/vhaenel/git/numba/numba/core/compiler.py", line 328, in compile_extra return self._compile_bytecode() File "/Users/vhaenel/git/numba/numba/core/compiler.py", line 390, in _compile_bytecode return self._compile_core() File "/Users/vhaenel/git/numba/numba/core/compiler.py", line 370, in _compile_core raise e File "/Users/vhaenel/git/numba/numba/core/compiler.py", line 361, in _compile_core pm.run(self.state) File "/Users/vhaenel/git/numba/numba/core/compiler_machinery.py", line 335, in run raise patched_exception File "/Users/vhaenel/git/numba/numba/core/compiler_machinery.py", line 326, in run self._runPass(idx, pass_inst, state) File "/Users/vhaenel/git/numba/numba/core/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/Users/vhaenel/git/numba/numba/core/compiler_machinery.py", line 290, in _runPass mutated |= check(pss.run_pass, internal_state) File "/Users/vhaenel/git/numba/numba/core/compiler_machinery.py", line 263, in check mangled = func(compiler_state) File "/Users/vhaenel/git/numba/numba/core/typed_passes.py", line 89, in run_pass typemap, return_type, calltypes = type_inference_stage( File "/Users/vhaenel/git/numba/numba/core/typed_passes.py", line 67, in type_inference_stage infer.propagate(raise_errors=raise_errors) File "/Users/vhaenel/git/numba/numba/core/typeinfer.py", line 985, in propagate raise errors[0] numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<function impl_extend at 0x117b72b80>) with argument(s) of type(s): (ListType[undefined], unicode_type) * parameterized In definition 0: TypingError: unable to extend list, iterable is missing either *dtype*, *item_type* or *yield_type*. raised from /Users/vhaenel/git/numba/numba/typed/listobject.py:1053 In definition 1: TypingError: unable to extend list, iterable is missing either *dtype*, *item_type* or *yield_type*. raised from /Users/vhaenel/git/numba/numba/typed/listobject.py:1053 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: BoundFunction((<class 'numba.core.types.containers.ListType'>, 'extend') for ListType[undefined]) [2] During: typing of call at foo/foo134.py (8) File "foo/foo134.py", line 8: def foo(): <source elided> l = List() l.extend("abc")
numba.core.errors.TypingError
def _lower_parfor_parallel(lowerer, parfor): """Lowerer that handles LLVM code generation for parfor. This function lowers a parfor IR node to LLVM. The general approach is as follows: 1) The code from the parfor's init block is lowered normally in the context of the current function. 2) The body of the parfor is transformed into a gufunc function. 3) Code is inserted into the main function that calls do_scheduling to divide the iteration space for each thread, allocates reduction arrays, calls the gufunc function, and then invokes the reduction function across the reduction arrays to produce the final reduction values. """ from numba.np.ufunc.parallel import get_thread_count ensure_parallel_support() typingctx = lowerer.context.typing_context targetctx = lowerer.context # We copy the typemap here because for race condition variable we'll # update their type to array so they can be updated by the gufunc. orig_typemap = lowerer.fndesc.typemap # replace original typemap with copy and restore the original at the end. lowerer.fndesc.typemap = copy.copy(orig_typemap) typemap = lowerer.fndesc.typemap varmap = lowerer.varmap if config.DEBUG_ARRAY_OPT: print("_lower_parfor_parallel") parfor.dump() loc = parfor.init_block.loc scope = parfor.init_block.scope # produce instructions for init_block if config.DEBUG_ARRAY_OPT: print("init_block = ", parfor.init_block, " ", type(parfor.init_block)) for instr in parfor.init_block.body: if config.DEBUG_ARRAY_OPT: print("lower init_block instr = ", instr) lowerer.lower_inst(instr) for racevar in parfor.races: if racevar not in varmap: rvtyp = typemap[racevar] rv = ir.Var(scope, racevar, loc) lowerer._alloca_var(rv.name, rvtyp) alias_map = {} arg_aliases = {} numba.parfors.parfor.find_potential_aliases_parfor( parfor, parfor.params, typemap, lowerer.func_ir, alias_map, arg_aliases ) if config.DEBUG_ARRAY_OPT: print("alias_map", alias_map) print("arg_aliases", arg_aliases) # run get_parfor_outputs() and get_parfor_reductions() before gufunc creation # since Jumps are modified so CFG of loop_body dict will become invalid assert parfor.params != None parfor_output_arrays = numba.parfors.parfor.get_parfor_outputs( parfor, parfor.params ) parfor_redvars, parfor_reddict = numba.parfors.parfor.get_parfor_reductions( lowerer.func_ir, parfor, parfor.params, lowerer.fndesc.calltypes ) # init reduction array allocation here. nredvars = len(parfor_redvars) redarrs = {} if nredvars > 0: # reduction arrays outer dimension equal to thread count thread_count = get_thread_count() scope = parfor.init_block.scope loc = parfor.init_block.loc # For each reduction variable... for i in range(nredvars): redvar_typ = lowerer.fndesc.typemap[parfor_redvars[i]] redvar = ir.Var(scope, parfor_redvars[i], loc) redarrvar_typ = redtyp_to_redarraytype(redvar_typ) reddtype = redarrvar_typ.dtype if config.DEBUG_ARRAY_OPT: print( "redvar_typ", redvar_typ, redarrvar_typ, reddtype, types.DType(reddtype), ) # If this is reduction over an array, # the reduction array has just one added per-worker dimension. if isinstance(redvar_typ, types.npytypes.Array): redarrdim = redvar_typ.ndim + 1 else: redarrdim = 1 # Reduction array is created and initialized to the initial reduction value. # First create a var for the numpy empty ufunc. empty_func = ir.Var(scope, mk_unique_var("empty_func"), loc) ff_fnty = get_np_ufunc_typ(np.empty) ff_sig = typingctx.resolve_function_type( ff_fnty, (types.UniTuple(types.intp, redarrdim), types.DType(reddtype)), {}, ) typemap[empty_func.name] = ff_fnty empty_assign = ir.Assign( ir.Global("empty", np.empty, loc=loc), empty_func, loc ) lowerer.lower_inst(empty_assign) # Create var for outer dimension size of reduction array equal to number of threads. num_threads_var = ir.Var(scope, mk_unique_var("num_threads"), loc) num_threads_assign = ir.Assign( ir.Const(thread_count, loc), num_threads_var, loc ) typemap[num_threads_var.name] = types.intp lowerer.lower_inst(num_threads_assign) # Empty call takes tuple of sizes. Create here and fill in outer dimension (num threads). size_var = ir.Var(scope, mk_unique_var("tuple_size_var"), loc) typemap[size_var.name] = types.UniTuple(types.intp, redarrdim) size_var_list = [num_threads_var] # If this is a reduction over an array... if isinstance(redvar_typ, types.npytypes.Array): # Add code to get the shape of the array being reduced over. redshape_var = ir.Var(scope, mk_unique_var("redarr_shape"), loc) typemap[redshape_var.name] = types.UniTuple(types.intp, redvar_typ.ndim) redshape_getattr = ir.Expr.getattr(redvar, "shape", loc) redshape_assign = ir.Assign(redshape_getattr, redshape_var, loc) lowerer.lower_inst(redshape_assign) # Add the dimension sizes of the array being reduced over to the tuple of sizes pass to empty. for j in range(redvar_typ.ndim): onedimvar = ir.Var(scope, mk_unique_var("redshapeonedim"), loc) onedimgetitem = ir.Expr.static_getitem(redshape_var, j, None, loc) typemap[onedimvar.name] = types.intp onedimassign = ir.Assign(onedimgetitem, onedimvar, loc) lowerer.lower_inst(onedimassign) size_var_list += [onedimvar] size_call = ir.Expr.build_tuple(size_var_list, loc) size_assign = ir.Assign(size_call, size_var, loc) lowerer.lower_inst(size_assign) # Add call to empty passing the size var tuple. empty_call = ir.Expr.call(empty_func, [size_var], {}, loc=loc) redarr_var = ir.Var(scope, mk_unique_var("redarr"), loc) typemap[redarr_var.name] = redarrvar_typ empty_call_assign = ir.Assign(empty_call, redarr_var, loc) lowerer.fndesc.calltypes[empty_call] = ff_sig lowerer.lower_inst(empty_call_assign) # Remember mapping of original reduction array to the newly created per-worker reduction array. redarrs[redvar.name] = redarr_var init_val = parfor_reddict[parfor_redvars[i]][0] if init_val != None: if isinstance(redvar_typ, types.npytypes.Array): # Create an array of identity values for the reduction. # First, create a variable for np.full. full_func = ir.Var(scope, mk_unique_var("full_func"), loc) full_fnty = get_np_ufunc_typ(np.full) full_sig = typingctx.resolve_function_type( full_fnty, ( types.UniTuple(types.intp, redvar_typ.ndim), reddtype, types.DType(reddtype), ), {}, ) typemap[full_func.name] = full_fnty full_assign = ir.Assign( ir.Global("full", np.full, loc=loc), full_func, loc ) lowerer.lower_inst(full_assign) # Then create a var with the identify value. init_val_var = ir.Var(scope, mk_unique_var("init_val"), loc) init_val_assign = ir.Assign( ir.Const(init_val, loc), init_val_var, loc ) typemap[init_val_var.name] = reddtype lowerer.lower_inst(init_val_assign) # Then, call np.full with the shape of the reduction array and the identity value. full_call = ir.Expr.call( full_func, [redshape_var, init_val_var], {}, loc=loc ) lowerer.fndesc.calltypes[full_call] = full_sig redtoset = ir.Var(scope, mk_unique_var("redtoset"), loc) redtoset_assign = ir.Assign(full_call, redtoset, loc) typemap[redtoset.name] = redvar_typ lowerer.lower_inst(redtoset_assign) else: redtoset = ir.Var(scope, mk_unique_var("redtoset"), loc) redtoset_assign = ir.Assign(ir.Const(init_val, loc), redtoset, loc) typemap[redtoset.name] = reddtype lowerer.lower_inst(redtoset_assign) else: redtoset = redvar # For each thread, initialize the per-worker reduction array to the current reduction array value. for j in range(get_thread_count()): index_var = ir.Var(scope, mk_unique_var("index_var"), loc) index_var_assign = ir.Assign(ir.Const(j, loc), index_var, loc) typemap[index_var.name] = types.uintp lowerer.lower_inst(index_var_assign) redsetitem = ir.SetItem(redarr_var, index_var, redtoset, loc) lowerer.fndesc.calltypes[redsetitem] = signature( types.none, typemap[redarr_var.name], typemap[index_var.name], redvar_typ, ) lowerer.lower_inst(redsetitem) # compile parfor body as a separate function to be used with GUFuncWrapper flags = copy.copy(parfor.flags) flags.set("error_model", "numpy") # Can't get here unless flags.set('auto_parallel', ParallelOptions(True)) index_var_typ = typemap[parfor.loop_nests[0].index_variable.name] # index variables should have the same type, check rest of indices for l in parfor.loop_nests[1:]: assert typemap[l.index_variable.name] == index_var_typ numba.parfors.parfor.sequential_parfor_lowering = True try: func, func_args, func_sig, redargstartdim, func_arg_types = ( _create_gufunc_for_parfor_body( lowerer, parfor, typemap, typingctx, targetctx, flags, {}, bool(alias_map), index_var_typ, parfor.races, ) ) finally: numba.parfors.parfor.sequential_parfor_lowering = False # get the shape signature func_args = ["sched"] + func_args num_reductions = len(parfor_redvars) num_inputs = len(func_args) - len(parfor_output_arrays) - num_reductions if config.DEBUG_ARRAY_OPT: print("func_args = ", func_args) print("num_inputs = ", num_inputs) print("parfor_outputs = ", parfor_output_arrays) print("parfor_redvars = ", parfor_redvars) print("num_reductions = ", num_reductions) gu_signature = _create_shape_signature( parfor.get_shape_classes, num_inputs, num_reductions, func_args, redargstartdim, func_sig, parfor.races, typemap, ) if config.DEBUG_ARRAY_OPT: print("gu_signature = ", gu_signature) # call the func in parallel by wrapping it with ParallelGUFuncBuilder loop_ranges = [(l.start, l.stop, l.step) for l in parfor.loop_nests] if config.DEBUG_ARRAY_OPT: print("loop_nests = ", parfor.loop_nests) print("loop_ranges = ", loop_ranges) call_parallel_gufunc( lowerer, func, gu_signature, func_sig, func_args, func_arg_types, loop_ranges, parfor_redvars, parfor_reddict, redarrs, parfor.init_block, index_var_typ, parfor.races, ) if config.DEBUG_ARRAY_OPT: sys.stdout.flush() if nredvars > 0: # Perform the final reduction across the reduction array created above. thread_count = get_thread_count() scope = parfor.init_block.scope loc = parfor.init_block.loc # For each reduction variable... for i in range(nredvars): name = parfor_redvars[i] redarr = redarrs[name] redvar_typ = lowerer.fndesc.typemap[name] if config.DEBUG_ARRAY_OPT: print("post-gufunc reduction:", name, redarr, redvar_typ) if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print(args=[lhs, redarr], vararg=None, loc=loc) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[redarr.name] ) print("res_print", res_print) lowerer.lower_inst(res_print) # For each element in the reduction array created above. for j in range(get_thread_count()): # Create index var to access that element. index_var = ir.Var(scope, mk_unique_var("index_var"), loc) index_var_assign = ir.Assign(ir.Const(j, loc), index_var, loc) typemap[index_var.name] = types.uintp lowerer.lower_inst(index_var_assign) # Read that element from the array into oneelem. oneelem = ir.Var(scope, mk_unique_var("redelem"), loc) oneelemgetitem = ir.Expr.getitem(redarr, index_var, loc) typemap[oneelem.name] = redvar_typ lowerer.fndesc.calltypes[oneelemgetitem] = signature( redvar_typ, typemap[redarr.name], typemap[index_var.name] ) oneelemassign = ir.Assign(oneelemgetitem, oneelem, loc) lowerer.lower_inst(oneelemassign) init_var = ir.Var(scope, name + "#init", loc) init_assign = ir.Assign(oneelem, init_var, loc) if name + "#init" not in typemap: typemap[init_var.name] = redvar_typ lowerer.lower_inst(init_assign) if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print1 for thread " + str(j) + ":" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc, ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print( args=[ lhs, index_var, oneelem, init_var, ir.Var(scope, name, loc), ], vararg=None, loc=loc, ) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[index_var.name], typemap[oneelem.name], typemap[init_var.name], typemap[name], ) print("res_print1", res_print) lowerer.lower_inst(res_print) # generate code for combining reduction variable with thread output for inst in parfor_reddict[name][1]: # If we have a case where a parfor body has an array reduction like A += B # and A and B have different data types then the reduction in the parallel # region will operate on those differeing types. However, here, after the # parallel region, we are summing across the reduction array and that is # guaranteed to have the same data type so we need to change the reduction # nodes so that the right-hand sides have a type equal to the reduction-type # and therefore the left-hand side. if isinstance(inst, ir.Assign): rhs = inst.value # We probably need to generalize this since it only does substitutions in # inplace_binops. if ( isinstance(rhs, ir.Expr) and rhs.op == "inplace_binop" and rhs.rhs.name == init_var.name ): if config.DEBUG_ARRAY_OPT: print("Adding call to reduction", rhs) if rhs.fn == operator.isub: rhs.fn = operator.iadd rhs.immutable_fn = operator.add if ( rhs.fn == operator.itruediv or rhs.fn == operator.ifloordiv ): rhs.fn = operator.imul rhs.immutable_fn = operator.mul if config.DEBUG_ARRAY_OPT: print("After changing sub to add or div to mul", rhs) # Get calltype of rhs. ct = lowerer.fndesc.calltypes[rhs] assert len(ct.args) == 2 # Create new arg types replace the second arg type with the reduction var type. ctargs = (ct.args[0], redvar_typ) # Update the signature of the call. ct = ct.replace(args=ctargs) # Remove so we can re-insert since calltypes is unique dict. lowerer.fndesc.calltypes.pop(rhs) # Add calltype back in for the expr with updated signature. lowerer.fndesc.calltypes[rhs] = ct lowerer.lower_inst(inst) if isinstance(inst, ir.Assign) and name == inst.target.name: break if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print2 for thread " + str(j) + ":" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc, ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print( args=[ lhs, index_var, oneelem, init_var, ir.Var(scope, name, loc), ], vararg=None, loc=loc, ) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[index_var.name], typemap[oneelem.name], typemap[init_var.name], typemap[name], ) print("res_print2", res_print) lowerer.lower_inst(res_print) # Cleanup reduction variable for v in redarrs.values(): lowerer.lower_inst(ir.Del(v.name, loc=loc)) # Restore the original typemap of the function that was replaced temporarily at the # Beginning of this function. lowerer.fndesc.typemap = orig_typemap if config.DEBUG_ARRAY_OPT: print("_lower_parfor_parallel done")
def _lower_parfor_parallel(lowerer, parfor): """Lowerer that handles LLVM code generation for parfor. This function lowers a parfor IR node to LLVM. The general approach is as follows: 1) The code from the parfor's init block is lowered normally in the context of the current function. 2) The body of the parfor is transformed into a gufunc function. 3) Code is inserted into the main function that calls do_scheduling to divide the iteration space for each thread, allocates reduction arrays, calls the gufunc function, and then invokes the reduction function across the reduction arrays to produce the final reduction values. """ from numba.np.ufunc.parallel import get_thread_count ensure_parallel_support() typingctx = lowerer.context.typing_context targetctx = lowerer.context # We copy the typemap here because for race condition variable we'll # update their type to array so they can be updated by the gufunc. orig_typemap = lowerer.fndesc.typemap # replace original typemap with copy and restore the original at the end. lowerer.fndesc.typemap = copy.copy(orig_typemap) typemap = lowerer.fndesc.typemap varmap = lowerer.varmap if config.DEBUG_ARRAY_OPT: print("_lower_parfor_parallel") parfor.dump() loc = parfor.init_block.loc scope = parfor.init_block.scope # produce instructions for init_block if config.DEBUG_ARRAY_OPT: print("init_block = ", parfor.init_block, " ", type(parfor.init_block)) for instr in parfor.init_block.body: if config.DEBUG_ARRAY_OPT: print("lower init_block instr = ", instr) lowerer.lower_inst(instr) for racevar in parfor.races: if racevar not in varmap: rvtyp = typemap[racevar] rv = ir.Var(scope, racevar, loc) lowerer._alloca_var(rv.name, rvtyp) alias_map = {} arg_aliases = {} numba.parfors.parfor.find_potential_aliases_parfor( parfor, parfor.params, typemap, lowerer.func_ir, alias_map, arg_aliases ) if config.DEBUG_ARRAY_OPT: print("alias_map", alias_map) print("arg_aliases", arg_aliases) # run get_parfor_outputs() and get_parfor_reductions() before gufunc creation # since Jumps are modified so CFG of loop_body dict will become invalid assert parfor.params != None parfor_output_arrays = numba.parfors.parfor.get_parfor_outputs( parfor, parfor.params ) parfor_redvars, parfor_reddict = numba.parfors.parfor.get_parfor_reductions( lowerer.func_ir, parfor, parfor.params, lowerer.fndesc.calltypes ) # init reduction array allocation here. nredvars = len(parfor_redvars) redarrs = {} if nredvars > 0: # reduction arrays outer dimension equal to thread count thread_count = get_thread_count() scope = parfor.init_block.scope loc = parfor.init_block.loc # For each reduction variable... for i in range(nredvars): redvar_typ = lowerer.fndesc.typemap[parfor_redvars[i]] redvar = ir.Var(scope, parfor_redvars[i], loc) redarrvar_typ = redtyp_to_redarraytype(redvar_typ) reddtype = redarrvar_typ.dtype if config.DEBUG_ARRAY_OPT: print( "redvar_typ", redvar_typ, redarrvar_typ, reddtype, types.DType(reddtype), ) # If this is reduction over an array, # the reduction array has just one added per-worker dimension. if isinstance(redvar_typ, types.npytypes.Array): redarrdim = redvar_typ.ndim + 1 else: redarrdim = 1 # Reduction array is created and initialized to the initial reduction value. # First create a var for the numpy empty ufunc. empty_func = ir.Var(scope, mk_unique_var("empty_func"), loc) ff_fnty = get_np_ufunc_typ(np.empty) ff_sig = typingctx.resolve_function_type( ff_fnty, (types.UniTuple(types.intp, redarrdim), types.DType(reddtype)), {}, ) typemap[empty_func.name] = ff_fnty empty_assign = ir.Assign( ir.Global("empty", np.empty, loc=loc), empty_func, loc ) lowerer.lower_inst(empty_assign) # Create var for outer dimension size of reduction array equal to number of threads. num_threads_var = ir.Var(scope, mk_unique_var("num_threads"), loc) num_threads_assign = ir.Assign( ir.Const(thread_count, loc), num_threads_var, loc ) typemap[num_threads_var.name] = types.intp lowerer.lower_inst(num_threads_assign) # Empty call takes tuple of sizes. Create here and fill in outer dimension (num threads). size_var = ir.Var(scope, mk_unique_var("tuple_size_var"), loc) typemap[size_var.name] = types.UniTuple(types.intp, redarrdim) size_var_list = [num_threads_var] # If this is a reduction over an array... if isinstance(redvar_typ, types.npytypes.Array): # Add code to get the shape of the array being reduced over. redshape_var = ir.Var(scope, mk_unique_var("redarr_shape"), loc) typemap[redshape_var.name] = types.UniTuple(types.intp, redvar_typ.ndim) redshape_getattr = ir.Expr.getattr(redvar, "shape", loc) redshape_assign = ir.Assign(redshape_getattr, redshape_var, loc) lowerer.lower_inst(redshape_assign) # Add the dimension sizes of the array being reduced over to the tuple of sizes pass to empty. for j in range(redvar_typ.ndim): onedimvar = ir.Var(scope, mk_unique_var("redshapeonedim"), loc) onedimgetitem = ir.Expr.static_getitem(redshape_var, j, None, loc) typemap[onedimvar.name] = types.intp onedimassign = ir.Assign(onedimgetitem, onedimvar, loc) lowerer.lower_inst(onedimassign) size_var_list += [onedimvar] size_call = ir.Expr.build_tuple(size_var_list, loc) size_assign = ir.Assign(size_call, size_var, loc) lowerer.lower_inst(size_assign) # Add call to empty passing the size var tuple. empty_call = ir.Expr.call(empty_func, [size_var], {}, loc=loc) redarr_var = ir.Var(scope, mk_unique_var("redarr"), loc) typemap[redarr_var.name] = redarrvar_typ empty_call_assign = ir.Assign(empty_call, redarr_var, loc) lowerer.fndesc.calltypes[empty_call] = ff_sig lowerer.lower_inst(empty_call_assign) # Remember mapping of original reduction array to the newly created per-worker reduction array. redarrs[redvar.name] = redarr_var init_val = parfor_reddict[parfor_redvars[i]][0] if init_val != None: if isinstance(redvar_typ, types.npytypes.Array): # Create an array of identity values for the reduction. # First, create a variable for np.full. full_func = ir.Var(scope, mk_unique_var("full_func"), loc) full_fnty = get_np_ufunc_typ(np.full) full_sig = typingctx.resolve_function_type( full_fnty, ( types.UniTuple(types.intp, redvar_typ.ndim), reddtype, types.DType(reddtype), ), {}, ) typemap[full_func.name] = full_fnty full_assign = ir.Assign( ir.Global("full", np.full, loc=loc), full_func, loc ) lowerer.lower_inst(full_assign) # Then create a var with the identify value. init_val_var = ir.Var(scope, mk_unique_var("init_val"), loc) init_val_assign = ir.Assign( ir.Const(init_val, loc), init_val_var, loc ) typemap[init_val_var.name] = reddtype lowerer.lower_inst(init_val_assign) # Then, call np.full with the shape of the reduction array and the identity value. full_call = ir.Expr.call( full_func, [redshape_var, init_val_var], {}, loc=loc ) lowerer.fndesc.calltypes[full_call] = full_sig redtoset = ir.Var(scope, mk_unique_var("redtoset"), loc) redtoset_assign = ir.Assign(full_call, redtoset, loc) typemap[redtoset.name] = redvar_typ lowerer.lower_inst(redtoset_assign) else: redtoset = ir.Var(scope, mk_unique_var("redtoset"), loc) redtoset_assign = ir.Assign(ir.Const(init_val, loc), redtoset, loc) typemap[redtoset.name] = reddtype lowerer.lower_inst(redtoset_assign) else: redtoset = redvar # For each thread, initialize the per-worker reduction array to the current reduction array value. for j in range(get_thread_count()): index_var = ir.Var(scope, mk_unique_var("index_var"), loc) index_var_assign = ir.Assign(ir.Const(j, loc), index_var, loc) typemap[index_var.name] = types.uintp lowerer.lower_inst(index_var_assign) redsetitem = ir.SetItem(redarr_var, index_var, redtoset, loc) lowerer.fndesc.calltypes[redsetitem] = signature( types.none, typemap[redarr_var.name], typemap[index_var.name], redvar_typ, ) lowerer.lower_inst(redsetitem) # compile parfor body as a separate function to be used with GUFuncWrapper flags = copy.copy(parfor.flags) flags.set("error_model", "numpy") # Can't get here unless flags.set('auto_parallel', ParallelOptions(True)) index_var_typ = typemap[parfor.loop_nests[0].index_variable.name] # index variables should have the same type, check rest of indices for l in parfor.loop_nests[1:]: assert typemap[l.index_variable.name] == index_var_typ numba.parfors.parfor.sequential_parfor_lowering = True func, func_args, func_sig, redargstartdim, func_arg_types = ( _create_gufunc_for_parfor_body( lowerer, parfor, typemap, typingctx, targetctx, flags, {}, bool(alias_map), index_var_typ, parfor.races, ) ) numba.parfors.parfor.sequential_parfor_lowering = False # get the shape signature func_args = ["sched"] + func_args num_reductions = len(parfor_redvars) num_inputs = len(func_args) - len(parfor_output_arrays) - num_reductions if config.DEBUG_ARRAY_OPT: print("func_args = ", func_args) print("num_inputs = ", num_inputs) print("parfor_outputs = ", parfor_output_arrays) print("parfor_redvars = ", parfor_redvars) print("num_reductions = ", num_reductions) gu_signature = _create_shape_signature( parfor.get_shape_classes, num_inputs, num_reductions, func_args, redargstartdim, func_sig, parfor.races, typemap, ) if config.DEBUG_ARRAY_OPT: print("gu_signature = ", gu_signature) # call the func in parallel by wrapping it with ParallelGUFuncBuilder loop_ranges = [(l.start, l.stop, l.step) for l in parfor.loop_nests] if config.DEBUG_ARRAY_OPT: print("loop_nests = ", parfor.loop_nests) print("loop_ranges = ", loop_ranges) call_parallel_gufunc( lowerer, func, gu_signature, func_sig, func_args, func_arg_types, loop_ranges, parfor_redvars, parfor_reddict, redarrs, parfor.init_block, index_var_typ, parfor.races, ) if config.DEBUG_ARRAY_OPT: sys.stdout.flush() if nredvars > 0: # Perform the final reduction across the reduction array created above. thread_count = get_thread_count() scope = parfor.init_block.scope loc = parfor.init_block.loc # For each reduction variable... for i in range(nredvars): name = parfor_redvars[i] redarr = redarrs[name] redvar_typ = lowerer.fndesc.typemap[name] if config.DEBUG_ARRAY_OPT: print("post-gufunc reduction:", name, redarr, redvar_typ) if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print(args=[lhs, redarr], vararg=None, loc=loc) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[redarr.name] ) print("res_print", res_print) lowerer.lower_inst(res_print) # For each element in the reduction array created above. for j in range(get_thread_count()): # Create index var to access that element. index_var = ir.Var(scope, mk_unique_var("index_var"), loc) index_var_assign = ir.Assign(ir.Const(j, loc), index_var, loc) typemap[index_var.name] = types.uintp lowerer.lower_inst(index_var_assign) # Read that element from the array into oneelem. oneelem = ir.Var(scope, mk_unique_var("redelem"), loc) oneelemgetitem = ir.Expr.getitem(redarr, index_var, loc) typemap[oneelem.name] = redvar_typ lowerer.fndesc.calltypes[oneelemgetitem] = signature( redvar_typ, typemap[redarr.name], typemap[index_var.name] ) oneelemassign = ir.Assign(oneelemgetitem, oneelem, loc) lowerer.lower_inst(oneelemassign) init_var = ir.Var(scope, name + "#init", loc) init_assign = ir.Assign(oneelem, init_var, loc) if name + "#init" not in typemap: typemap[init_var.name] = redvar_typ lowerer.lower_inst(init_assign) if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print1 for thread " + str(j) + ":" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc, ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print( args=[ lhs, index_var, oneelem, init_var, ir.Var(scope, name, loc), ], vararg=None, loc=loc, ) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[index_var.name], typemap[oneelem.name], typemap[init_var.name], typemap[name], ) print("res_print1", res_print) lowerer.lower_inst(res_print) # generate code for combining reduction variable with thread output for inst in parfor_reddict[name][1]: # If we have a case where a parfor body has an array reduction like A += B # and A and B have different data types then the reduction in the parallel # region will operate on those differeing types. However, here, after the # parallel region, we are summing across the reduction array and that is # guaranteed to have the same data type so we need to change the reduction # nodes so that the right-hand sides have a type equal to the reduction-type # and therefore the left-hand side. if isinstance(inst, ir.Assign): rhs = inst.value # We probably need to generalize this since it only does substitutions in # inplace_binops. if ( isinstance(rhs, ir.Expr) and rhs.op == "inplace_binop" and rhs.rhs.name == init_var.name ): if config.DEBUG_ARRAY_OPT: print("Adding call to reduction", rhs) if rhs.fn == operator.isub: rhs.fn = operator.iadd rhs.immutable_fn = operator.add if ( rhs.fn == operator.itruediv or rhs.fn == operator.ifloordiv ): rhs.fn = operator.imul rhs.immutable_fn = operator.mul if config.DEBUG_ARRAY_OPT: print("After changing sub to add or div to mul", rhs) # Get calltype of rhs. ct = lowerer.fndesc.calltypes[rhs] assert len(ct.args) == 2 # Create new arg types replace the second arg type with the reduction var type. ctargs = (ct.args[0], redvar_typ) # Update the signature of the call. ct = ct.replace(args=ctargs) # Remove so we can re-insert since calltypes is unique dict. lowerer.fndesc.calltypes.pop(rhs) # Add calltype back in for the expr with updated signature. lowerer.fndesc.calltypes[rhs] = ct lowerer.lower_inst(inst) if isinstance(inst, ir.Assign) and name == inst.target.name: break if config.DEBUG_ARRAY_OPT_RUNTIME: res_print_str = "res_print2 for thread " + str(j) + ":" strconsttyp = types.StringLiteral(res_print_str) lhs = ir.Var(scope, mk_unique_var("str_const"), loc) assign_lhs = ir.Assign( value=ir.Const(value=res_print_str, loc=loc), target=lhs, loc=loc, ) typemap[lhs.name] = strconsttyp lowerer.lower_inst(assign_lhs) res_print = ir.Print( args=[ lhs, index_var, oneelem, init_var, ir.Var(scope, name, loc), ], vararg=None, loc=loc, ) lowerer.fndesc.calltypes[res_print] = signature( types.none, typemap[lhs.name], typemap[index_var.name], typemap[oneelem.name], typemap[init_var.name], typemap[name], ) print("res_print2", res_print) lowerer.lower_inst(res_print) # Cleanup reduction variable for v in redarrs.values(): lowerer.lower_inst(ir.Del(v.name, loc=loc)) # Restore the original typemap of the function that was replaced temporarily at the # Beginning of this function. lowerer.fndesc.typemap = orig_typemap if config.DEBUG_ARRAY_OPT: print("_lower_parfor_parallel done")
https://github.com/numba/numba/issues/5098
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 288, in lower_block self.lower_inst(inst) File "/home/ibutygin/src/numba/numba/numba/lowering.py", line 476, in lower_inst func(self, inst) File "/home/ibutygin/src/numba/numba/numba/npyufunc/parfor.py", line 241, in _lower_parfor_parallel bool(alias_map), index_var_typ, parfor.races) File "/home/ibutygin/src/numba/numba/numba/npyufunc/parfor.py", line 833, in _create_gufunc_for_parfor_body replace_var_with_array(races, loop_body, typemap, lowerer.fndesc.calltypes) File "/home/ibutygin/src/numba/numba/numba/npyufunc/parfor.py", line 1206, in replace_var_with_array replace_var_with_array_internal(vars, loop_body, typemap, calltypes) File "/home/ibutygin/src/numba/numba/numba/npyufunc/parfor.py", line 1203, in replace_var_with_array_internal block.body = replace_var_with_array_in_block(vars, block, typemap, calltypes) File "/home/ibutygin/src/numba/numba/numba/npyufunc/parfor.py", line 1189, in replace_var_with_array_in_block setitem_node = ir.SetItem(inst.target, const_var, inst.value, inst.loc) File "/home/ibutygin/src/numba/numba/numba/ir.py", line 573, in __init__ assert isinstance(value, Var) AssertionError
AssertionError
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, {}, {}, self.typemap) # 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) 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
https://github.com/numba/numba/issues/4903
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 716 try: --> 717 yield 718 except NumbaError as e: ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst) 413 if isinstance(inst, _class): --> 414 func(self, inst) 415 return ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _lower_parfor_parallel(lowerer, parfor) 239 lowerer, parfor, typemap, typingctx, targetctx, flags, {}, --> 240 bool(alias_map), index_var_typ, parfor.races) 241 numba.parfor.sequential_parfor_lowering = False ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _create_gufunc_for_parfor_body(lowerer, parfor, typemap, typingctx, targetctx, flags, locals, has_aliases, index_var_typ, races) 1124 flags, -> 1125 locals) 1126 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, is_lifted_loop, library, pipeline_class) 591 return pipeline.compile_ir(func_ir=func_ir, lifted=lifted, --> 592 lifted_from=lifted_from) 593 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(self, func_ir, lifted, lifted_from) 335 FixupArgs().run_pass(self.state) --> 336 return self._compile_ir() 337 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_ir(self) 391 assert self.state.func_ir is not None --> 392 return self._compile_core() 393 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 364 if is_final_pipeline: --> 365 raise e 366 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 93 state.return_type, ---> 94 state.locals) 95 state.typemap = typemap ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in type_inference_stage(typingctx, interp, args, return_type, locals) 64 ---> 65 infer.build_constraint() 66 infer.propagate() ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in build_constraint(self) 903 for inst in blk.body: --> 904 self.constrain_statement(inst) 905 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in constrain_statement(self, inst) 1187 if isinstance(inst, ir.Assign): -> 1188 self.typeof_assign(inst) 1189 elif isinstance(inst, ir.SetItem): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_assign(self, inst) 1258 elif isinstance(value, (ir.Global, ir.FreeVar)): -> 1259 self.typeof_global(inst, inst.target, value) 1260 elif isinstance(value, ir.Arg): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_global(self, inst, target, gvar) 1399 lit = types.maybe_literal(gvar.value) -> 1400 self.lock_type(target.name, lit or typ, loc=inst.loc) 1401 self.assumed_immutables.add(inst) ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock_type(self, var, tp, loc, literal_value) 975 tv = self.typevars[var] --> 976 tv.lock(tp, loc=loc, literal_value=literal_value) 977 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock(self, tp, loc, literal_value) 82 assert isinstance(tp, types.Type), type(tp) ---> 83 assert not self.locked 84 AssertionError: Failed in nopython mode pipeline (step: nopython frontend) During handling of the above exception, another exception occurred: LoweringError Traceback (most recent call last) <ipython-input-1-1ddce8bd8630> in <module> 51 52 # nb.njit()(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ---> 53 nb.njit(parallel=True)(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 418 e.patch_message('\n'.join((str(e).rstrip(), help_msg))) 419 # ignore the FULL_TRACEBACKS config, this needs reporting! --> 420 raise e 421 422 def inspect_llvm(self, signature=None): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 351 argtypes.append(self.typeof_pyval(a)) 352 try: --> 353 return self.compile(tuple(argtypes)) 354 except errors.ForceLiteralArg as e: 355 # Received request for compiler re-entry with the list of arguments ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig) 766 self._cache_misses[sig] += 1 767 try: --> 768 cres = self._compiler.compile(args, return_type) 769 except errors.ForceLiteralArg as e: 770 def folded(args, kws): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type) 75 76 def compile(self, args, return_type): ---> 77 status, retval = self._compile_cached(args, return_type) 78 if status: 79 return retval ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type) 89 90 try: ---> 91 retval = self._compile_core(args, return_type) 92 except errors.TypingError as e: 93 self._failed_cache[key] = e ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type) 107 args=args, return_type=return_type, 108 flags=flags, locals=self.locals, --> 109 pipeline_class=self.pipeline_class) 110 # Check typing error if object mode is used 111 if cres.typing_error is not None and not flags.enable_pyobject: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class) 526 pipeline = pipeline_class(typingctx, targetctx, library, 527 args, return_type, flags, locals) --> 528 return pipeline.compile_extra(func) 529 530 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func) 324 self.state.lifted = () 325 self.state.lifted_from = None --> 326 return self._compile_bytecode() 327 328 def compile_ir(self, func_ir, lifted=(), lifted_from=None): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self) 383 """ 384 assert self.state.func_ir is None --> 385 return self._compile_core() 386 387 def _compile_ir(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 363 self.state.status.fail_reason = e 364 if is_final_pipeline: --> 365 raise e 366 else: 367 raise CompilerError("All available pipelines exhausted") ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 354 res = None 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: 358 break ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 326 (self.pipeline_name, pass_desc) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 330 def dependency_analysis(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 317 pass_inst = _pass_registry.get(pss).pass_inst 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: 321 raise BaseException("Legacy pass in use") ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 279 mutated |= check(pss.run_initialization, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: 283 mutated |= check(pss.run_finalizer, internal_state) ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 266 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): 270 msg = ("CompilerPass implementations should return True/False. " ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 378 state.library.enable_object_caching() 379 --> 380 NativeLowering().run_pass(state) # TODO: Pull this out into the pipeline 381 lowered = state['cr'] 382 signature = typing.signature(state.return_type, *state.args) ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 323 lower = lowering.Lower(targetctx, library, fndesc, interp, 324 metadata=metadata) --> 325 lower.lower() 326 if not flags.no_cpython_wrapper: 327 lower.create_cpython_wrapper(flags.release_gil) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower(self) 177 if self.generator_info is None: 178 self.genlower = None --> 179 self.lower_normal_function(self.fndesc) 180 else: 181 self.genlower = self.GeneratorLower(self) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc) 218 # Init argument values 219 self.extract_function_arguments() --> 220 entry_block_tail = self.lower_function_body() 221 222 # Close tail of entry block ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self) 243 bb = self.blkmap[offset] 244 self.builder.position_at_end(bb) --> 245 self.lower_block(block) 246 247 self.post_lower() ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 258 with new_error_context('lowering "{inst}" at {loc}', inst=inst, 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 262 def create_cpython_wrapper(self, release_gil=False): ~/anaconda3/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback) 128 value = type() 129 try: --> 130 self.gen.throw(type, value, traceback) 131 except StopIteration as exc: 132 # Suppress StopIteration *unless* it's the same exception that ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 723 from numba import config 724 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None --> 725 six.reraise(type(newerr), newerr, tb) 726 727 ~/anaconda3/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb) 667 if value.__traceback__ is not tb: 668 raise value.with_traceback(tb) --> 669 raise value 670 671 else: LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) File "<ipython-input-1-1ddce8bd8630>", line 14: def foo(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k): <source elided> for i in nb.prange(n): ^ [1] During: lowering "id=5[LoopNest(index_variable = parfor_index.104, range = (0, $n.119, 1))]{256: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 258: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 130: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 132: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 268: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 146: <ir.Block at <ipython-input-1-1ddce8bd8630> (19)>, 278: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 156: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 158: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 286: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 166: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 296: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 298: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 174: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 184: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 314: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 194: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 196: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 78: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 344: <ir.Block at <ipython-input-1-1ddce8bd8630> (29)>, 348: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 351: <ir.Block at <ipython-input-1-1ddce8bd8630> (30)>, 352: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 96: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 104: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 112: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 120: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>}Var(parfor_index.104, <ipython-input-1-1ddce8bd8630> (14))" at <ipython-input-1-1ddce8bd8630> (14)
AssertionError
def _arrayexpr_tree_to_ir( func_ir, typingctx, typemap, calltypes, equiv_set, init_block, expr_out_var, expr, parfor_index_tuple_var, all_parfor_indices, avail_vars, ): """generate IR from array_expr's expr tree recursively. Assign output to expr_out_var and returns the whole IR as a list of Assign nodes. """ el_typ = typemap[expr_out_var.name] scope = expr_out_var.scope loc = expr_out_var.loc out_ir = [] if isinstance(expr, tuple): op, arr_expr_args = expr arg_vars = [] for arg in arr_expr_args: arg_out_var = ir.Var(scope, mk_unique_var("$arg_out_var"), loc) typemap[arg_out_var.name] = el_typ out_ir += _arrayexpr_tree_to_ir( func_ir, typingctx, typemap, calltypes, equiv_set, init_block, arg_out_var, arg, parfor_index_tuple_var, all_parfor_indices, avail_vars, ) arg_vars.append(arg_out_var) if op in npydecl.supported_array_operators: el_typ1 = typemap[arg_vars[0].name] if len(arg_vars) == 2: el_typ2 = typemap[arg_vars[1].name] func_typ = typingctx.resolve_function_type(op, (el_typ1, el_typ), {}) ir_expr = ir.Expr.binop(op, arg_vars[0], arg_vars[1], loc) if op == operator.truediv: func_typ, ir_expr = _gen_np_divide( arg_vars[0], arg_vars[1], out_ir, typemap ) else: func_typ = typingctx.resolve_function_type(op, (el_typ1,), {}) ir_expr = ir.Expr.unary(op, arg_vars[0], loc) calltypes[ir_expr] = func_typ el_typ = func_typ.return_type out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) for T in array_analysis.MAP_TYPES: if isinstance(op, T): # elif isinstance(op, (np.ufunc, DUFunc)): # function calls are stored in variables which are not removed # op is typing_key to the variables type func_var_name = _find_func_var(typemap, op, avail_vars) func_var = ir.Var(scope, mk_unique_var(func_var_name), loc) typemap[func_var.name] = typemap[func_var_name] func_var_def = copy.deepcopy(func_ir.get_definition(func_var_name)) if ( isinstance(func_var_def, ir.Expr) and func_var_def.op == "getattr" and func_var_def.attr == "sqrt" ): g_math_var = ir.Var(scope, mk_unique_var("$math_g_var"), loc) typemap[g_math_var.name] = types.misc.Module(math) g_math = ir.Global("math", math, loc) g_math_assign = ir.Assign(g_math, g_math_var, loc) func_var_def = ir.Expr.getattr(g_math_var, "sqrt", loc) out_ir.append(g_math_assign) # out_ir.append(func_var_def) ir_expr = ir.Expr.call(func_var, arg_vars, (), loc) call_typ = typemap[func_var.name].get_call_type( typingctx, tuple(typemap[a.name] for a in arg_vars), {} ) calltypes[ir_expr] = call_typ el_typ = call_typ.return_type # signature(el_typ, el_typ) out_ir.append(ir.Assign(func_var_def, func_var, loc)) out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) elif isinstance(expr, ir.Var): var_typ = typemap[expr.name] if isinstance(var_typ, types.Array): el_typ = var_typ.dtype ir_expr = _gen_arrayexpr_getitem( equiv_set, expr, parfor_index_tuple_var, all_parfor_indices, el_typ, calltypes, typingctx, typemap, init_block, out_ir, ) else: # assert typemap[expr.name]==el_typ el_typ = var_typ ir_expr = expr out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) elif isinstance(expr, ir.Const): el_typ = typing.Context().resolve_value_type(expr.value) out_ir.append(ir.Assign(expr, expr_out_var, loc)) if len(out_ir) == 0: raise NotImplementedError( "Don't know how to translate array expression '%r'" % (expr,) ) typemap.pop(expr_out_var.name, None) typemap[expr_out_var.name] = el_typ return out_ir
def _arrayexpr_tree_to_ir( func_ir, typingctx, typemap, calltypes, equiv_set, init_block, expr_out_var, expr, parfor_index_tuple_var, all_parfor_indices, avail_vars, ): """generate IR from array_expr's expr tree recursively. Assign output to expr_out_var and returns the whole IR as a list of Assign nodes. """ el_typ = typemap[expr_out_var.name] scope = expr_out_var.scope loc = expr_out_var.loc out_ir = [] if isinstance(expr, tuple): op, arr_expr_args = expr arg_vars = [] for arg in arr_expr_args: arg_out_var = ir.Var(scope, mk_unique_var("$arg_out_var"), loc) typemap[arg_out_var.name] = el_typ out_ir += _arrayexpr_tree_to_ir( func_ir, typingctx, typemap, calltypes, equiv_set, init_block, arg_out_var, arg, parfor_index_tuple_var, all_parfor_indices, avail_vars, ) arg_vars.append(arg_out_var) if op in npydecl.supported_array_operators: el_typ1 = typemap[arg_vars[0].name] if len(arg_vars) == 2: el_typ2 = typemap[arg_vars[1].name] func_typ = typingctx.resolve_function_type(op, (el_typ1, el_typ), {}) ir_expr = ir.Expr.binop(op, arg_vars[0], arg_vars[1], loc) if op == operator.truediv: func_typ, ir_expr = _gen_np_divide( arg_vars[0], arg_vars[1], out_ir, typemap ) else: func_typ = typingctx.resolve_function_type(op, (el_typ1,), {}) ir_expr = ir.Expr.unary(op, arg_vars[0], loc) calltypes[ir_expr] = func_typ el_typ = func_typ.return_type out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) for T in array_analysis.MAP_TYPES: if isinstance(op, T): # elif isinstance(op, (np.ufunc, DUFunc)): # function calls are stored in variables which are not removed # op is typing_key to the variables type func_var_name = _find_func_var(typemap, op, avail_vars) func_var = ir.Var(scope, mk_unique_var(func_var_name), loc) typemap[func_var.name] = typemap[func_var_name] func_var_def = func_ir.get_definition(func_var_name) if ( isinstance(func_var_def, ir.Expr) and func_var_def.op == "getattr" and func_var_def.attr == "sqrt" ): g_math_var = ir.Var(scope, mk_unique_var("$math_g_var"), loc) typemap[g_math_var.name] = types.misc.Module(math) g_math = ir.Global("math", math, loc) g_math_assign = ir.Assign(g_math, g_math_var, loc) func_var_def = ir.Expr.getattr(g_math_var, "sqrt", loc) out_ir.append(g_math_assign) # out_ir.append(func_var_def) ir_expr = ir.Expr.call(func_var, arg_vars, (), loc) call_typ = typemap[func_var.name].get_call_type( typingctx, tuple(typemap[a.name] for a in arg_vars), {} ) calltypes[ir_expr] = call_typ el_typ = call_typ.return_type # signature(el_typ, el_typ) out_ir.append(ir.Assign(func_var_def, func_var, loc)) out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) elif isinstance(expr, ir.Var): var_typ = typemap[expr.name] if isinstance(var_typ, types.Array): el_typ = var_typ.dtype ir_expr = _gen_arrayexpr_getitem( equiv_set, expr, parfor_index_tuple_var, all_parfor_indices, el_typ, calltypes, typingctx, typemap, init_block, out_ir, ) else: # assert typemap[expr.name]==el_typ el_typ = var_typ ir_expr = expr out_ir.append(ir.Assign(ir_expr, expr_out_var, loc)) elif isinstance(expr, ir.Const): el_typ = typing.Context().resolve_value_type(expr.value) out_ir.append(ir.Assign(expr, expr_out_var, loc)) if len(out_ir) == 0: raise NotImplementedError( "Don't know how to translate array expression '%r'" % (expr,) ) typemap.pop(expr_out_var.name, None) typemap[expr_out_var.name] = el_typ return out_ir
https://github.com/numba/numba/issues/4903
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 716 try: --> 717 yield 718 except NumbaError as e: ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst) 413 if isinstance(inst, _class): --> 414 func(self, inst) 415 return ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _lower_parfor_parallel(lowerer, parfor) 239 lowerer, parfor, typemap, typingctx, targetctx, flags, {}, --> 240 bool(alias_map), index_var_typ, parfor.races) 241 numba.parfor.sequential_parfor_lowering = False ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _create_gufunc_for_parfor_body(lowerer, parfor, typemap, typingctx, targetctx, flags, locals, has_aliases, index_var_typ, races) 1124 flags, -> 1125 locals) 1126 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, is_lifted_loop, library, pipeline_class) 591 return pipeline.compile_ir(func_ir=func_ir, lifted=lifted, --> 592 lifted_from=lifted_from) 593 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(self, func_ir, lifted, lifted_from) 335 FixupArgs().run_pass(self.state) --> 336 return self._compile_ir() 337 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_ir(self) 391 assert self.state.func_ir is not None --> 392 return self._compile_core() 393 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 364 if is_final_pipeline: --> 365 raise e 366 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 93 state.return_type, ---> 94 state.locals) 95 state.typemap = typemap ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in type_inference_stage(typingctx, interp, args, return_type, locals) 64 ---> 65 infer.build_constraint() 66 infer.propagate() ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in build_constraint(self) 903 for inst in blk.body: --> 904 self.constrain_statement(inst) 905 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in constrain_statement(self, inst) 1187 if isinstance(inst, ir.Assign): -> 1188 self.typeof_assign(inst) 1189 elif isinstance(inst, ir.SetItem): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_assign(self, inst) 1258 elif isinstance(value, (ir.Global, ir.FreeVar)): -> 1259 self.typeof_global(inst, inst.target, value) 1260 elif isinstance(value, ir.Arg): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_global(self, inst, target, gvar) 1399 lit = types.maybe_literal(gvar.value) -> 1400 self.lock_type(target.name, lit or typ, loc=inst.loc) 1401 self.assumed_immutables.add(inst) ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock_type(self, var, tp, loc, literal_value) 975 tv = self.typevars[var] --> 976 tv.lock(tp, loc=loc, literal_value=literal_value) 977 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock(self, tp, loc, literal_value) 82 assert isinstance(tp, types.Type), type(tp) ---> 83 assert not self.locked 84 AssertionError: Failed in nopython mode pipeline (step: nopython frontend) During handling of the above exception, another exception occurred: LoweringError Traceback (most recent call last) <ipython-input-1-1ddce8bd8630> in <module> 51 52 # nb.njit()(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ---> 53 nb.njit(parallel=True)(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 418 e.patch_message('\n'.join((str(e).rstrip(), help_msg))) 419 # ignore the FULL_TRACEBACKS config, this needs reporting! --> 420 raise e 421 422 def inspect_llvm(self, signature=None): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 351 argtypes.append(self.typeof_pyval(a)) 352 try: --> 353 return self.compile(tuple(argtypes)) 354 except errors.ForceLiteralArg as e: 355 # Received request for compiler re-entry with the list of arguments ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig) 766 self._cache_misses[sig] += 1 767 try: --> 768 cres = self._compiler.compile(args, return_type) 769 except errors.ForceLiteralArg as e: 770 def folded(args, kws): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type) 75 76 def compile(self, args, return_type): ---> 77 status, retval = self._compile_cached(args, return_type) 78 if status: 79 return retval ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type) 89 90 try: ---> 91 retval = self._compile_core(args, return_type) 92 except errors.TypingError as e: 93 self._failed_cache[key] = e ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type) 107 args=args, return_type=return_type, 108 flags=flags, locals=self.locals, --> 109 pipeline_class=self.pipeline_class) 110 # Check typing error if object mode is used 111 if cres.typing_error is not None and not flags.enable_pyobject: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class) 526 pipeline = pipeline_class(typingctx, targetctx, library, 527 args, return_type, flags, locals) --> 528 return pipeline.compile_extra(func) 529 530 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func) 324 self.state.lifted = () 325 self.state.lifted_from = None --> 326 return self._compile_bytecode() 327 328 def compile_ir(self, func_ir, lifted=(), lifted_from=None): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self) 383 """ 384 assert self.state.func_ir is None --> 385 return self._compile_core() 386 387 def _compile_ir(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 363 self.state.status.fail_reason = e 364 if is_final_pipeline: --> 365 raise e 366 else: 367 raise CompilerError("All available pipelines exhausted") ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 354 res = None 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: 358 break ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 326 (self.pipeline_name, pass_desc) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 330 def dependency_analysis(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 317 pass_inst = _pass_registry.get(pss).pass_inst 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: 321 raise BaseException("Legacy pass in use") ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 279 mutated |= check(pss.run_initialization, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: 283 mutated |= check(pss.run_finalizer, internal_state) ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 266 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): 270 msg = ("CompilerPass implementations should return True/False. " ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 378 state.library.enable_object_caching() 379 --> 380 NativeLowering().run_pass(state) # TODO: Pull this out into the pipeline 381 lowered = state['cr'] 382 signature = typing.signature(state.return_type, *state.args) ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 323 lower = lowering.Lower(targetctx, library, fndesc, interp, 324 metadata=metadata) --> 325 lower.lower() 326 if not flags.no_cpython_wrapper: 327 lower.create_cpython_wrapper(flags.release_gil) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower(self) 177 if self.generator_info is None: 178 self.genlower = None --> 179 self.lower_normal_function(self.fndesc) 180 else: 181 self.genlower = self.GeneratorLower(self) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc) 218 # Init argument values 219 self.extract_function_arguments() --> 220 entry_block_tail = self.lower_function_body() 221 222 # Close tail of entry block ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self) 243 bb = self.blkmap[offset] 244 self.builder.position_at_end(bb) --> 245 self.lower_block(block) 246 247 self.post_lower() ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 258 with new_error_context('lowering "{inst}" at {loc}', inst=inst, 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 262 def create_cpython_wrapper(self, release_gil=False): ~/anaconda3/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback) 128 value = type() 129 try: --> 130 self.gen.throw(type, value, traceback) 131 except StopIteration as exc: 132 # Suppress StopIteration *unless* it's the same exception that ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 723 from numba import config 724 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None --> 725 six.reraise(type(newerr), newerr, tb) 726 727 ~/anaconda3/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb) 667 if value.__traceback__ is not tb: 668 raise value.with_traceback(tb) --> 669 raise value 670 671 else: LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) File "<ipython-input-1-1ddce8bd8630>", line 14: def foo(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k): <source elided> for i in nb.prange(n): ^ [1] During: lowering "id=5[LoopNest(index_variable = parfor_index.104, range = (0, $n.119, 1))]{256: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 258: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 130: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 132: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 268: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 146: <ir.Block at <ipython-input-1-1ddce8bd8630> (19)>, 278: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 156: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 158: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 286: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 166: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 296: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 298: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 174: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 184: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 314: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 194: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 196: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 78: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 344: <ir.Block at <ipython-input-1-1ddce8bd8630> (29)>, 348: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 351: <ir.Block at <ipython-input-1-1ddce8bd8630> (30)>, 352: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 96: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 104: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 112: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 120: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>}Var(parfor_index.104, <ipython-input-1-1ddce8bd8630> (14))" at <ipython-input-1-1ddce8bd8630> (14)
AssertionError
def push_call_vars(blocks, saved_globals, saved_getattrs, typemap, nested=False): """push call variables to right before their call site. assuming one global/getattr is created for each call site and control flow doesn't change it. """ for block in blocks.values(): new_body = [] # global/attr variables that are defined in this block already, # no need to reassign them block_defs = set() # Some definitions are copied right before the call but then we # need to rename that symbol in that block so that typing won't # generate an error trying to lock the save var twice. # In rename_dict, we collect the symbols that must be renamed in # this block. We collect them then apply the renaming at the end. rename_dict = {} for stmt in block.body: def process_assign(stmt): if isinstance(stmt, ir.Assign): rhs = stmt.value lhs = stmt.target if isinstance(rhs, ir.Global): saved_globals[lhs.name] = stmt block_defs.add(lhs.name) elif isinstance(rhs, ir.Expr) and rhs.op == "getattr": if ( rhs.value.name in saved_globals or rhs.value.name in saved_getattrs ): saved_getattrs[lhs.name] = stmt block_defs.add(lhs.name) if not nested and isinstance(stmt, Parfor): for s in stmt.init_block.body: process_assign(s) pblocks = stmt.loop_body.copy() push_call_vars( pblocks, saved_globals, saved_getattrs, typemap, nested=True ) new_body.append(stmt) continue else: process_assign(stmt) for v in stmt.list_vars(): new_body += _get_saved_call_nodes( v.name, saved_globals, saved_getattrs, block_defs, rename_dict ) new_body.append(stmt) block.body = new_body # If there is anything to rename then apply the renaming here. if len(rename_dict) > 0: # Fix-up the typing for the renamed vars. for k, v in rename_dict.items(): typemap[v] = typemap[k] # This is only to call replace_var_names which takes a dict. temp_blocks = {0: block} replace_var_names(temp_blocks, rename_dict) return
def push_call_vars(blocks, saved_globals, saved_getattrs, nested=False): """push call variables to right before their call site. assuming one global/getattr is created for each call site and control flow doesn't change it. """ for block in blocks.values(): new_body = [] # global/attr variables that are defined in this block already, # no need to reassign them block_defs = set() for stmt in block.body: def process_assign(stmt): if isinstance(stmt, ir.Assign): rhs = stmt.value lhs = stmt.target if isinstance(rhs, ir.Global): saved_globals[lhs.name] = stmt block_defs.add(lhs.name) elif isinstance(rhs, ir.Expr) and rhs.op == "getattr": if ( rhs.value.name in saved_globals or rhs.value.name in saved_getattrs ): saved_getattrs[lhs.name] = stmt block_defs.add(lhs.name) if not nested and isinstance(stmt, Parfor): for s in stmt.init_block.body: process_assign(s) pblocks = stmt.loop_body.copy() push_call_vars(pblocks, saved_globals, saved_getattrs, nested=True) new_body.append(stmt) continue else: process_assign(stmt) for v in stmt.list_vars(): new_body += _get_saved_call_nodes( v.name, saved_globals, saved_getattrs, block_defs ) new_body.append(stmt) block.body = new_body return
https://github.com/numba/numba/issues/4903
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 716 try: --> 717 yield 718 except NumbaError as e: ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst) 413 if isinstance(inst, _class): --> 414 func(self, inst) 415 return ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _lower_parfor_parallel(lowerer, parfor) 239 lowerer, parfor, typemap, typingctx, targetctx, flags, {}, --> 240 bool(alias_map), index_var_typ, parfor.races) 241 numba.parfor.sequential_parfor_lowering = False ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _create_gufunc_for_parfor_body(lowerer, parfor, typemap, typingctx, targetctx, flags, locals, has_aliases, index_var_typ, races) 1124 flags, -> 1125 locals) 1126 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, is_lifted_loop, library, pipeline_class) 591 return pipeline.compile_ir(func_ir=func_ir, lifted=lifted, --> 592 lifted_from=lifted_from) 593 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(self, func_ir, lifted, lifted_from) 335 FixupArgs().run_pass(self.state) --> 336 return self._compile_ir() 337 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_ir(self) 391 assert self.state.func_ir is not None --> 392 return self._compile_core() 393 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 364 if is_final_pipeline: --> 365 raise e 366 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 93 state.return_type, ---> 94 state.locals) 95 state.typemap = typemap ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in type_inference_stage(typingctx, interp, args, return_type, locals) 64 ---> 65 infer.build_constraint() 66 infer.propagate() ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in build_constraint(self) 903 for inst in blk.body: --> 904 self.constrain_statement(inst) 905 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in constrain_statement(self, inst) 1187 if isinstance(inst, ir.Assign): -> 1188 self.typeof_assign(inst) 1189 elif isinstance(inst, ir.SetItem): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_assign(self, inst) 1258 elif isinstance(value, (ir.Global, ir.FreeVar)): -> 1259 self.typeof_global(inst, inst.target, value) 1260 elif isinstance(value, ir.Arg): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_global(self, inst, target, gvar) 1399 lit = types.maybe_literal(gvar.value) -> 1400 self.lock_type(target.name, lit or typ, loc=inst.loc) 1401 self.assumed_immutables.add(inst) ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock_type(self, var, tp, loc, literal_value) 975 tv = self.typevars[var] --> 976 tv.lock(tp, loc=loc, literal_value=literal_value) 977 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock(self, tp, loc, literal_value) 82 assert isinstance(tp, types.Type), type(tp) ---> 83 assert not self.locked 84 AssertionError: Failed in nopython mode pipeline (step: nopython frontend) During handling of the above exception, another exception occurred: LoweringError Traceback (most recent call last) <ipython-input-1-1ddce8bd8630> in <module> 51 52 # nb.njit()(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ---> 53 nb.njit(parallel=True)(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 418 e.patch_message('\n'.join((str(e).rstrip(), help_msg))) 419 # ignore the FULL_TRACEBACKS config, this needs reporting! --> 420 raise e 421 422 def inspect_llvm(self, signature=None): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 351 argtypes.append(self.typeof_pyval(a)) 352 try: --> 353 return self.compile(tuple(argtypes)) 354 except errors.ForceLiteralArg as e: 355 # Received request for compiler re-entry with the list of arguments ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig) 766 self._cache_misses[sig] += 1 767 try: --> 768 cres = self._compiler.compile(args, return_type) 769 except errors.ForceLiteralArg as e: 770 def folded(args, kws): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type) 75 76 def compile(self, args, return_type): ---> 77 status, retval = self._compile_cached(args, return_type) 78 if status: 79 return retval ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type) 89 90 try: ---> 91 retval = self._compile_core(args, return_type) 92 except errors.TypingError as e: 93 self._failed_cache[key] = e ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type) 107 args=args, return_type=return_type, 108 flags=flags, locals=self.locals, --> 109 pipeline_class=self.pipeline_class) 110 # Check typing error if object mode is used 111 if cres.typing_error is not None and not flags.enable_pyobject: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class) 526 pipeline = pipeline_class(typingctx, targetctx, library, 527 args, return_type, flags, locals) --> 528 return pipeline.compile_extra(func) 529 530 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func) 324 self.state.lifted = () 325 self.state.lifted_from = None --> 326 return self._compile_bytecode() 327 328 def compile_ir(self, func_ir, lifted=(), lifted_from=None): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self) 383 """ 384 assert self.state.func_ir is None --> 385 return self._compile_core() 386 387 def _compile_ir(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 363 self.state.status.fail_reason = e 364 if is_final_pipeline: --> 365 raise e 366 else: 367 raise CompilerError("All available pipelines exhausted") ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 354 res = None 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: 358 break ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 326 (self.pipeline_name, pass_desc) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 330 def dependency_analysis(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 317 pass_inst = _pass_registry.get(pss).pass_inst 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: 321 raise BaseException("Legacy pass in use") ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 279 mutated |= check(pss.run_initialization, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: 283 mutated |= check(pss.run_finalizer, internal_state) ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 266 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): 270 msg = ("CompilerPass implementations should return True/False. " ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 378 state.library.enable_object_caching() 379 --> 380 NativeLowering().run_pass(state) # TODO: Pull this out into the pipeline 381 lowered = state['cr'] 382 signature = typing.signature(state.return_type, *state.args) ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 323 lower = lowering.Lower(targetctx, library, fndesc, interp, 324 metadata=metadata) --> 325 lower.lower() 326 if not flags.no_cpython_wrapper: 327 lower.create_cpython_wrapper(flags.release_gil) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower(self) 177 if self.generator_info is None: 178 self.genlower = None --> 179 self.lower_normal_function(self.fndesc) 180 else: 181 self.genlower = self.GeneratorLower(self) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc) 218 # Init argument values 219 self.extract_function_arguments() --> 220 entry_block_tail = self.lower_function_body() 221 222 # Close tail of entry block ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self) 243 bb = self.blkmap[offset] 244 self.builder.position_at_end(bb) --> 245 self.lower_block(block) 246 247 self.post_lower() ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 258 with new_error_context('lowering "{inst}" at {loc}', inst=inst, 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 262 def create_cpython_wrapper(self, release_gil=False): ~/anaconda3/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback) 128 value = type() 129 try: --> 130 self.gen.throw(type, value, traceback) 131 except StopIteration as exc: 132 # Suppress StopIteration *unless* it's the same exception that ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 723 from numba import config 724 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None --> 725 six.reraise(type(newerr), newerr, tb) 726 727 ~/anaconda3/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb) 667 if value.__traceback__ is not tb: 668 raise value.with_traceback(tb) --> 669 raise value 670 671 else: LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) File "<ipython-input-1-1ddce8bd8630>", line 14: def foo(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k): <source elided> for i in nb.prange(n): ^ [1] During: lowering "id=5[LoopNest(index_variable = parfor_index.104, range = (0, $n.119, 1))]{256: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 258: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 130: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 132: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 268: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 146: <ir.Block at <ipython-input-1-1ddce8bd8630> (19)>, 278: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 156: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 158: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 286: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 166: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 296: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 298: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 174: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 184: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 314: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 194: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 196: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 78: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 344: <ir.Block at <ipython-input-1-1ddce8bd8630> (29)>, 348: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 351: <ir.Block at <ipython-input-1-1ddce8bd8630> (30)>, 352: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 96: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 104: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 112: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 120: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>}Var(parfor_index.104, <ipython-input-1-1ddce8bd8630> (14))" at <ipython-input-1-1ddce8bd8630> (14)
AssertionError
def _get_saved_call_nodes( fname, saved_globals, saved_getattrs, block_defs, rename_dict ): """Implement the copying of globals or getattrs for the purposes noted in push_call_vars. We make a new var and assign to it a copy of the global or getattr. We remember this new assignment node and add an entry in the renaming dictionary so that for this block the original var name is replaced by the new var name we created. """ nodes = [] while fname not in block_defs and ( fname in saved_globals or fname in saved_getattrs ): def rename_global_or_getattr(obj, var_base, nodes, block_defs, rename_dict): assert isinstance(obj, ir.Assign) renamed_var = ir.Var( obj.target.scope, mk_unique_var(var_base), obj.target.loc ) renamed_assign = ir.Assign(copy.deepcopy(obj.value), renamed_var, obj.loc) nodes.append(renamed_assign) block_defs.add(obj.target.name) rename_dict[obj.target.name] = renamed_assign.target.name if fname in saved_globals: rename_global_or_getattr( saved_globals[fname], "$push_global_to_block", nodes, block_defs, rename_dict, ) fname = "_PA_DONE" elif fname in saved_getattrs: rename_global_or_getattr( saved_getattrs[fname], "$push_getattr_to_block", nodes, block_defs, rename_dict, ) fname = saved_getattrs[fname].value.value.name nodes.reverse() return nodes
def _get_saved_call_nodes(fname, saved_globals, saved_getattrs, block_defs): nodes = [] while fname not in block_defs and ( fname in saved_globals or fname in saved_getattrs ): if fname in saved_globals: nodes.append(saved_globals[fname]) block_defs.add(saved_globals[fname].target.name) fname = "_PA_DONE" elif fname in saved_getattrs: up_name = saved_getattrs[fname].value.value.name nodes.append(saved_getattrs[fname]) block_defs.add(saved_getattrs[fname].target.name) fname = up_name nodes.reverse() return nodes
https://github.com/numba/numba/issues/4903
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 716 try: --> 717 yield 718 except NumbaError as e: ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_inst(self, inst) 413 if isinstance(inst, _class): --> 414 func(self, inst) 415 return ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _lower_parfor_parallel(lowerer, parfor) 239 lowerer, parfor, typemap, typingctx, targetctx, flags, {}, --> 240 bool(alias_map), index_var_typ, parfor.races) 241 numba.parfor.sequential_parfor_lowering = False ~/anaconda3/lib/python3.7/site-packages/numba/npyufunc/parfor.py in _create_gufunc_for_parfor_body(lowerer, parfor, typemap, typingctx, targetctx, flags, locals, has_aliases, index_var_typ, races) 1124 flags, -> 1125 locals) 1126 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, is_lifted_loop, library, pipeline_class) 591 return pipeline.compile_ir(func_ir=func_ir, lifted=lifted, --> 592 lifted_from=lifted_from) 593 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_ir(self, func_ir, lifted, lifted_from) 335 FixupArgs().run_pass(self.state) --> 336 return self._compile_ir() 337 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_ir(self) 391 assert self.state.func_ir is not None --> 392 return self._compile_core() 393 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 364 if is_final_pipeline: --> 365 raise e 366 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 93 state.return_type, ---> 94 state.locals) 95 state.typemap = typemap ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in type_inference_stage(typingctx, interp, args, return_type, locals) 64 ---> 65 infer.build_constraint() 66 infer.propagate() ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in build_constraint(self) 903 for inst in blk.body: --> 904 self.constrain_statement(inst) 905 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in constrain_statement(self, inst) 1187 if isinstance(inst, ir.Assign): -> 1188 self.typeof_assign(inst) 1189 elif isinstance(inst, ir.SetItem): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_assign(self, inst) 1258 elif isinstance(value, (ir.Global, ir.FreeVar)): -> 1259 self.typeof_global(inst, inst.target, value) 1260 elif isinstance(value, ir.Arg): ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in typeof_global(self, inst, target, gvar) 1399 lit = types.maybe_literal(gvar.value) -> 1400 self.lock_type(target.name, lit or typ, loc=inst.loc) 1401 self.assumed_immutables.add(inst) ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock_type(self, var, tp, loc, literal_value) 975 tv = self.typevars[var] --> 976 tv.lock(tp, loc=loc, literal_value=literal_value) 977 ~/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in lock(self, tp, loc, literal_value) 82 assert isinstance(tp, types.Type), type(tp) ---> 83 assert not self.locked 84 AssertionError: Failed in nopython mode pipeline (step: nopython frontend) During handling of the above exception, another exception occurred: LoweringError Traceback (most recent call last) <ipython-input-1-1ddce8bd8630> in <module> 51 52 # nb.njit()(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ---> 53 nb.njit(parallel=True)(foo)(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k) ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 418 e.patch_message('\n'.join((str(e).rstrip(), help_msg))) 419 # ignore the FULL_TRACEBACKS config, this needs reporting! --> 420 raise e 421 422 def inspect_llvm(self, signature=None): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws) 351 argtypes.append(self.typeof_pyval(a)) 352 try: --> 353 return self.compile(tuple(argtypes)) 354 except errors.ForceLiteralArg as e: 355 # Received request for compiler re-entry with the list of arguments ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig) 766 self._cache_misses[sig] += 1 767 try: --> 768 cres = self._compiler.compile(args, return_type) 769 except errors.ForceLiteralArg as e: 770 def folded(args, kws): ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type) 75 76 def compile(self, args, return_type): ---> 77 status, retval = self._compile_cached(args, return_type) 78 if status: 79 return retval ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type) 89 90 try: ---> 91 retval = self._compile_core(args, return_type) 92 except errors.TypingError as e: 93 self._failed_cache[key] = e ~/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type) 107 args=args, return_type=return_type, 108 flags=flags, locals=self.locals, --> 109 pipeline_class=self.pipeline_class) 110 # Check typing error if object mode is used 111 if cres.typing_error is not None and not flags.enable_pyobject: ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class) 526 pipeline = pipeline_class(typingctx, targetctx, library, 527 args, return_type, flags, locals) --> 528 return pipeline.compile_extra(func) 529 530 ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func) 324 self.state.lifted = () 325 self.state.lifted_from = None --> 326 return self._compile_bytecode() 327 328 def compile_ir(self, func_ir, lifted=(), lifted_from=None): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self) 383 """ 384 assert self.state.func_ir is None --> 385 return self._compile_core() 386 387 def _compile_ir(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 363 self.state.status.fail_reason = e 364 if is_final_pipeline: --> 365 raise e 366 else: 367 raise CompilerError("All available pipelines exhausted") ~/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self) 354 res = None 355 try: --> 356 pm.run(self.state) 357 if self.state.cr is not None: 358 break ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 326 (self.pipeline_name, pass_desc) 327 patched_exception = self._patch_error(msg, e) --> 328 raise patched_exception 329 330 def dependency_analysis(self): ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in run(self, state) 317 pass_inst = _pass_registry.get(pss).pass_inst 318 if isinstance(pass_inst, CompilerPass): --> 319 self._runPass(idx, pass_inst, state) 320 else: 321 raise BaseException("Legacy pass in use") ~/anaconda3/lib/python3.7/site-packages/numba/compiler_lock.py in _acquire_compile_lock(*args, **kwargs) 30 def _acquire_compile_lock(*args, **kwargs): 31 with self: ---> 32 return func(*args, **kwargs) 33 return _acquire_compile_lock 34 ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in _runPass(self, index, pss, internal_state) 279 mutated |= check(pss.run_initialization, internal_state) 280 with SimpleTimer() as pass_time: --> 281 mutated |= check(pss.run_pass, internal_state) 282 with SimpleTimer() as finalize_time: 283 mutated |= check(pss.run_finalizer, internal_state) ~/anaconda3/lib/python3.7/site-packages/numba/compiler_machinery.py in check(func, compiler_state) 266 267 def check(func, compiler_state): --> 268 mangled = func(compiler_state) 269 if mangled not in (True, False): 270 msg = ("CompilerPass implementations should return True/False. " ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 378 state.library.enable_object_caching() 379 --> 380 NativeLowering().run_pass(state) # TODO: Pull this out into the pipeline 381 lowered = state['cr'] 382 signature = typing.signature(state.return_type, *state.args) ~/anaconda3/lib/python3.7/site-packages/numba/typed_passes.py in run_pass(self, state) 323 lower = lowering.Lower(targetctx, library, fndesc, interp, 324 metadata=metadata) --> 325 lower.lower() 326 if not flags.no_cpython_wrapper: 327 lower.create_cpython_wrapper(flags.release_gil) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower(self) 177 if self.generator_info is None: 178 self.genlower = None --> 179 self.lower_normal_function(self.fndesc) 180 else: 181 self.genlower = self.GeneratorLower(self) ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_normal_function(self, fndesc) 218 # Init argument values 219 self.extract_function_arguments() --> 220 entry_block_tail = self.lower_function_body() 221 222 # Close tail of entry block ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_function_body(self) 243 bb = self.blkmap[offset] 244 self.builder.position_at_end(bb) --> 245 self.lower_block(block) 246 247 self.post_lower() ~/anaconda3/lib/python3.7/site-packages/numba/lowering.py in lower_block(self, block) 258 with new_error_context('lowering "{inst}" at {loc}', inst=inst, 259 loc=self.loc, errcls_=defaulterrcls): --> 260 self.lower_inst(inst) 261 262 def create_cpython_wrapper(self, release_gil=False): ~/anaconda3/lib/python3.7/contextlib.py in __exit__(self, type, value, traceback) 128 value = type() 129 try: --> 130 self.gen.throw(type, value, traceback) 131 except StopIteration as exc: 132 # Suppress StopIteration *unless* it's the same exception that ~/anaconda3/lib/python3.7/site-packages/numba/errors.py in new_error_context(fmt_, *args, **kwargs) 723 from numba import config 724 tb = sys.exc_info()[2] if config.FULL_TRACEBACKS else None --> 725 six.reraise(type(newerr), newerr, tb) 726 727 ~/anaconda3/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb) 667 if value.__traceback__ is not tb: 668 raise value.with_traceback(tb) --> 669 raise value 670 671 else: LoweringError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) File "<ipython-input-1-1ddce8bd8630>", line 14: def foo(zz, xx, yyh, yyhi, vv, vvi, tc, s, w, h, k): <source elided> for i in nb.prange(n): ^ [1] During: lowering "id=5[LoopNest(index_variable = parfor_index.104, range = (0, $n.119, 1))]{256: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 258: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 130: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 132: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 268: <ir.Block at <ipython-input-1-1ddce8bd8630> (25)>, 146: <ir.Block at <ipython-input-1-1ddce8bd8630> (19)>, 278: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 156: <ir.Block at <ipython-input-1-1ddce8bd8630> (18)>, 158: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 286: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 166: <ir.Block at <ipython-input-1-1ddce8bd8630> (20)>, 296: <ir.Block at <ipython-input-1-1ddce8bd8630> (27)>, 298: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 174: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 184: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 314: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 194: <ir.Block at <ipython-input-1-1ddce8bd8630> (22)>, 196: <ir.Block at <ipython-input-1-1ddce8bd8630> (23)>, 78: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 344: <ir.Block at <ipython-input-1-1ddce8bd8630> (29)>, 348: <ir.Block at <ipython-input-1-1ddce8bd8630> (28)>, 351: <ir.Block at <ipython-input-1-1ddce8bd8630> (30)>, 352: <ir.Block at <ipython-input-1-1ddce8bd8630> (14)>, 96: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 104: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 112: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>, 120: <ir.Block at <ipython-input-1-1ddce8bd8630> (17)>}Var(parfor_index.104, <ipython-input-1-1ddce8bd8630> (14))" at <ipython-input-1-1ddce8bd8630> (14)
AssertionError
def wrap_index(typingctx, idx, size): """ Calculate index value "idx" relative to a size "size" value as (idx % size), where "size" is known to be positive. Note that we use the mod(%) operation here instead of (idx < 0 ? idx + size : idx) because we may have situations where idx > size due to the way indices are calculated during slice/range analysis. """ unified_ty = typingctx.unify_types(idx, size) if not unified_ty: raise ValueError("Argument types for wrap_index must match") def codegen(context, builder, sig, args): ll_unified_ty = context.get_data_type(unified_ty) idx = builder.sext(args[0], ll_unified_ty) size = builder.sext(args[1], ll_unified_ty) neg_size = builder.neg(size) zero = llvmlite.ir.Constant(ll_unified_ty, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod return signature(unified_ty, idx, size), codegen
def wrap_index(typingctx, idx, size): """ Calculate index value "idx" relative to a size "size" value as (idx % size), where "size" is known to be positive. Note that we use the mod(%) operation here instead of (idx < 0 ? idx + size : idx) because we may have situations where idx > size due to the way indices are calculated during slice/range analysis. """ if idx != size: raise ValueError("Argument types for wrap_index must match") def codegen(context, builder, sig, args): """ assert(len(args) == 2) idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed('<', rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed('>=', wrapped_rem, size) mod = builder.select(is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem)) return mod """ idx = args[0] size = args[1] neg_size = builder.neg(size) zero = llvmlite.ir.Constant(idx.type, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod return signature(idx, idx, size), codegen
https://github.com/numba/numba/issues/5056
Traceback (most recent call last): File "/home/phil/.PyCharm2019.3/config/scratches/scratch_1.py", line 12, in <module> test(np.array([.3, .4, .5, .6]),np.array([0, 2, 4], dtype=np.int32)) File "/usr/lib/python3.8/site-packages/numba/dispatcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "/usr/lib/python3.8/site-packages/numba/dispatcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "/usr/lib/python3.8/site-packages/numba/six.py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<intrinsic wrap_index>) with argument(s) of type(s): (int32, int64) * parameterized In definition 0: ValueError: Argument types for wrap_index must match raised from /usr/lib/python3.8/site-packages/numba/array_analysis.py:72 In definition 1: ValueError: Argument types for wrap_index must match raised from /usr/lib/python3.8/site-packages/numba/array_analysis.py:72 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: Function(<intrinsic wrap_index>) [2] During: typing of call at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (9) File "scratch_1.py", line 9: def test(data, indptr): <source elided> start, end = indptr[i], indptr[i + 1] sums[i] = np.sum(data[start:end]) ^ [1] During: lowering "id=2[LoopNest(index_variable = parfor_index.50, range = (0, $34binary_subtract.15, 1))]{42: <ir.Block at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (7)>}Var(parfor_index.50, scratch_1.py:7)" at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (7)
numba.errors.TypingError
def codegen(context, builder, sig, args): ll_unified_ty = context.get_data_type(unified_ty) idx = builder.sext(args[0], ll_unified_ty) size = builder.sext(args[1], ll_unified_ty) neg_size = builder.neg(size) zero = llvmlite.ir.Constant(ll_unified_ty, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod
def codegen(context, builder, sig, args): """ assert(len(args) == 2) idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed('<', rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed('>=', wrapped_rem, size) mod = builder.select(is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem)) return mod """ idx = args[0] size = args[1] neg_size = builder.neg(size) zero = llvmlite.ir.Constant(idx.type, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod
https://github.com/numba/numba/issues/5056
Traceback (most recent call last): File "/home/phil/.PyCharm2019.3/config/scratches/scratch_1.py", line 12, in <module> test(np.array([.3, .4, .5, .6]),np.array([0, 2, 4], dtype=np.int32)) File "/usr/lib/python3.8/site-packages/numba/dispatcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "/usr/lib/python3.8/site-packages/numba/dispatcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "/usr/lib/python3.8/site-packages/numba/six.py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython mode backend) Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<intrinsic wrap_index>) with argument(s) of type(s): (int32, int64) * parameterized In definition 0: ValueError: Argument types for wrap_index must match raised from /usr/lib/python3.8/site-packages/numba/array_analysis.py:72 In definition 1: ValueError: Argument types for wrap_index must match raised from /usr/lib/python3.8/site-packages/numba/array_analysis.py:72 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: Function(<intrinsic wrap_index>) [2] During: typing of call at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (9) File "scratch_1.py", line 9: def test(data, indptr): <source elided> start, end = indptr[i], indptr[i + 1] sums[i] = np.sum(data[start:end]) ^ [1] During: lowering "id=2[LoopNest(index_variable = parfor_index.50, range = (0, $34binary_subtract.15, 1))]{42: <ir.Block at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (7)>}Var(parfor_index.50, scratch_1.py:7)" at /home/phil/.PyCharm2019.3/config/scratches/scratch_1.py (7)
numba.errors.TypingError
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: # Adjust for bound methods folding_args = ( (fnty.this,) + tuple(self.args) if isinstance(fnty, types.BoundFunction) else self.args ) folded = e.fold_arguments(folding_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 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)
https://github.com/numba/numba/issues/5011
====================================================================== ERROR: test_literally_with_overload_method (tests.test_hpat_jit.TestHpatJitIssues) ---------------------------------------------------------------------- Traceback (most recent call last): File "/mnt/data/hpat_fork/hpat_2/sdc/tests/test_hpat_jit.py", line 492, in test_literally_with_overload_method print(jtest(5)) File "/mnt/data/numba_git/numba_master_master/numba/dispatcher.py", line 401, in _compile_for_args error_rewrite(e, 'typing') File "/mnt/data/numba_git/numba_master_master/numba/dispatcher.py", line 344, in error_rewrite reraise(type(e), e, None) File "/mnt/data/numba_git/numba_master_master/numba/six.py", line 668, in reraise raise value.with_traceback(tb) numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Internal error at <numba.typeinfer.CallConstraint object at 0x7f1724938da0>. missing a required argument: 'a' [1] During: resolving callee type: BoundFunction((<class 'tests.test_hpat_jit.TestHpatJitIssues.test_literally_with_overload_method.<locals>.DummyType'>, 'lit') for dummy) [2] During: typing of call at /mnt/data/hpat_fork/hpat_2/sdc/tests/test_hpat_jit.py (488) Enable logging at debug level for details. File "tests/test_hpat_jit.py", line 488: def test_impl(a): <source elided> return d.lit(a) ^
numba.errors.TypingError
def fold_argument_types(self, args, kws): """ Given positional and named argument types, fold keyword arguments and resolve defaults by inserting types.Omitted() instances. A (pysig, argument types) tuple is returned. """ def normal_handler(index, param, value): return value def default_handler(index, param, default): return types.Omitted(default) def stararg_handler(index, param, values): return types.StarArgTuple(values) # For now, we take argument values from the @jit function, even # in the case of generated jit. args = fold_arguments( self.pysig, args, kws, normal_handler, default_handler, stararg_handler ) return self.pysig, args
def fold_argument_types(self, args, kws): """ Given positional and named argument types, fold keyword arguments and resolve defaults by inserting types.Omitted() instances. A (pysig, argument types) tuple is returned. """ def normal_handler(index, param, value): return value def default_handler(index, param, default): return types.Omitted(default) def stararg_handler(index, param, values): return types.Tuple(values) # For now, we take argument values from the @jit function, even # in the case of generated jit. args = fold_arguments( self.pysig, args, kws, normal_handler, default_handler, stararg_handler ) return self.pysig, args
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 stararg_handler(index, param, values): return types.StarArgTuple(values)
def stararg_handler(index, param, values): return types.Tuple(values)
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 = "UniTuple(%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) self.dtype = UnionType(types) name = "Tuple(%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 __new__(cls, types): _HeterogeneousTuple.is_types_iterable(types) if types and all(t == types[0] for t in types[1:]): return StarArgUniTuple(dtype=types[0], count=len(types)) else: return object.__new__(StarArgTuple)
def __new__(cls, types): _HeterogeneousTuple.is_types_iterable(types) if types and all(t == types[0] for t in types[1:]): return UniTuple(dtype=types[0], count=len(types)) else: return object.__new__(Tuple)
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 fold_arguments(pysig, args, kws, normal_handler, default_handler, stararg_handler): """ Given the signature *pysig*, explicit *args* and *kws*, resolve omitted arguments and keyword arguments. A tuple of positional arguments is returned. Various handlers allow to process arguments: - normal_handler(index, param, value) is called for normal arguments - default_handler(index, param, default) is called for omitted arguments - stararg_handler(index, param, values) is called for a "*args" argument """ # deal with kwonly args params = pysig.parameters kwonly = [] for name, p in params.items(): if p.kind == p.KEYWORD_ONLY: kwonly.append(name) if kwonly: bind_args = args[: -len(kwonly)] else: bind_args = args bind_kws = kws.copy() if kwonly: for idx, n in enumerate(kwonly): bind_kws[n] = args[len(kwonly) + idx] # now bind ba = pysig.bind(*bind_args, **bind_kws) for i, param in enumerate(pysig.parameters.values()): name = param.name default = param.default if param.kind == param.VAR_POSITIONAL: # stararg may be omitted, in which case its "default" value # is simply the empty tuple if name in ba.arguments: argval = ba.arguments[name] # NOTE: avoid wrapping the tuple type for stararg in another # tuple. if len(argval) == 1 and isinstance( argval[0], (types.StarArgTuple, types.StarArgUniTuple) ): argval = tuple(argval[0]) else: argval = () out = stararg_handler(i, param, argval) ba.arguments[name] = out elif name in ba.arguments: # Non-stararg, present ba.arguments[name] = normal_handler(i, param, ba.arguments[name]) else: # Non-stararg, omitted assert default is not param.empty ba.arguments[name] = default_handler(i, param, default) # Collect args in the right order args = tuple(ba.arguments[param.name] for param in pysig.parameters.values()) return args
def fold_arguments(pysig, args, kws, normal_handler, default_handler, stararg_handler): """ Given the signature *pysig*, explicit *args* and *kws*, resolve omitted arguments and keyword arguments. A tuple of positional arguments is returned. Various handlers allow to process arguments: - normal_handler(index, param, value) is called for normal arguments - default_handler(index, param, default) is called for omitted arguments - stararg_handler(index, param, values) is called for a "*args" argument """ # deal with kwonly args params = pysig.parameters kwonly = [] for name, p in params.items(): if p.kind == p.KEYWORD_ONLY: kwonly.append(name) if kwonly: bind_args = args[: -len(kwonly)] else: bind_args = args bind_kws = kws.copy() if kwonly: for idx, n in enumerate(kwonly): bind_kws[n] = args[len(kwonly) + idx] # now bind ba = pysig.bind(*bind_args, **bind_kws) for i, param in enumerate(pysig.parameters.values()): name = param.name default = param.default if param.kind == param.VAR_POSITIONAL: # stararg may be omitted, in which case its "default" value # is simply the empty tuple ba.arguments[name] = stararg_handler(i, param, ba.arguments.get(name, ())) elif name in ba.arguments: # Non-stararg, present ba.arguments[name] = normal_handler(i, param, ba.arguments[name]) else: # Non-stararg, omitted assert default is not param.empty ba.arguments[name] = default_handler(i, param, default) # Collect args in the right order args = tuple(ba.arguments[param.name] for param in pysig.parameters.values()) return args
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_live_variables(cfg, blocks, var_def_map, var_dead_map): """ Compute the live variables at the beginning of each block and at each yield point. The ``var_def_map`` and ``var_dead_map`` indicates the variable defined and deleted at each block, respectively. """ # live var at the entry per block block_entry_vars = defaultdict(set) def fix_point_progress(): return tuple(map(len, block_entry_vars.values())) old_point = None new_point = fix_point_progress() # Propagate defined variables and still live the successors. # (note the entry block automatically gets an empty set) # Note: This is finding the actual available variables at the entry # of each block. The algorithm in compute_live_map() is finding # the variable that must be available at the entry of each block. # This is top-down in the dataflow. The other one is bottom-up. while old_point != new_point: # We iterate until the result stabilizes. This is necessary # because of loops in the graphself. for offset in blocks: # vars available + variable defined avail = block_entry_vars[offset] | var_def_map[offset] # subtract variables deleted avail -= var_dead_map[offset] # add ``avail`` to each successors for succ, _data in cfg.successors(offset): block_entry_vars[succ] |= avail old_point = new_point new_point = fix_point_progress() return block_entry_vars
def compute_live_variables(cfg, blocks, var_def_map, var_dead_map): """ Compute the live variables at the beginning of each block and at each yield point. The ``var_def_map`` and ``var_dead_map`` indicates the variable defined and deleted at each block, respectively. """ # live var at the entry per block block_entry_vars = defaultdict(set) def fix_point_progress(): return tuple(map(len, block_entry_vars.values())) old_point = None new_point = fix_point_progress() # Propagate defined variables and still live the successors. # (note the entry block automatically gets an empty set) # Note: This is finding the actual available variables at the entry # of each block. The algorithm in compute_live_map() is finding # the variable that must be available at the entry of each block. # This is top-down in the dataflow. The other one is bottom-up. while old_point != new_point: # We iterate until the result stabilizes. This is necessary # because of loops in the graphself. for offset in blocks: # vars available + variable defined avail = block_entry_vars[offset] | var_def_map[offset] # substract variables deleted avail -= var_dead_map[offset] # add ``avail`` to each successors for succ, _data in cfg.successors(offset): block_entry_vars[succ] |= avail old_point = new_point new_point = fix_point_progress() return block_entry_vars
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_top_level_loops(cfg): """ A generator that yields toplevel loops given a control-flow-graph """ blocks_in_loop = set() # get loop bodies for loop in cfg.loops().values(): insiders = set(loop.body) | set(loop.entries) | set(loop.exits) insiders.discard(loop.header) blocks_in_loop |= insiders # find loop that is not part of other loops for loop in cfg.loops().values(): if loop.header not in blocks_in_loop: yield _fix_loop_exit(cfg, loop)
def find_top_level_loops(cfg): """ A generator that yields toplevel loops given a control-flow-graph """ blocks_in_loop = set() # get loop bodies for loop in cfg.loops().values(): insiders = set(loop.body) | set(loop.entries) | set(loop.exits) insiders.discard(loop.header) blocks_in_loop |= insiders # find loop that is not part of other loops for loop in cfg.loops().values(): if loop.header not in blocks_in_loop: yield loop
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 wrap_index(typingctx, idx, size): """ Calculate index value "idx" relative to a size "size" value as (idx % size), where "size" is known to be positive. Note that we use the mod(%) operation here instead of (idx < 0 ? idx + size : idx) because we may have situations where idx > size due to the way indices are calculated during slice/range analysis. """ if idx != size: raise ValueError("Argument types for wrap_index must match") def codegen(context, builder, sig, args): """ assert(len(args) == 2) idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed('<', rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed('>=', wrapped_rem, size) mod = builder.select(is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem)) return mod """ idx = args[0] size = args[1] neg_size = builder.neg(size) zero = llvmlite.ir.Constant(idx.type, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod return signature(idx, idx, size), codegen
def wrap_index(typingctx, idx, size): """ Calculate index value "idx" relative to a size "size" value as (idx % size), where "size" is known to be positive. Note that we use the mod(%) operation here instead of (idx < 0 ? idx + size : idx) because we may have situations where idx > size due to the way indices are calculated during slice/range analysis. """ if idx != size: raise ValueError("Argument types for wrap_index must match") def codegen(context, builder, sig, args): assert len(args) == 2 idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed("<", rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed(">", wrapped_rem, size) mod = builder.select( is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem) ) return mod return signature(idx, idx, size), codegen
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 codegen(context, builder, sig, args): """ assert(len(args) == 2) idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed('<', rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed('>=', wrapped_rem, size) mod = builder.select(is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem)) return mod """ idx = args[0] size = args[1] neg_size = builder.neg(size) zero = llvmlite.ir.Constant(idx.type, 0) idx_negative = builder.icmp_signed("<", idx, zero) pos_oversize = builder.icmp_signed(">=", idx, size) neg_oversize = builder.icmp_signed("<=", idx, neg_size) pos_res = builder.select(pos_oversize, size, idx) neg_res = builder.select(neg_oversize, zero, builder.add(idx, size)) mod = builder.select(idx_negative, neg_res, pos_res) return mod
def codegen(context, builder, sig, args): assert len(args) == 2 idx = args[0] size = args[1] rem = builder.srem(idx, size) zero = llvmlite.ir.Constant(idx.type, 0) is_negative = builder.icmp_signed("<", rem, zero) wrapped_rem = builder.add(rem, size) is_oversize = builder.icmp_signed(">", wrapped_rem, size) mod = builder.select( is_negative, wrapped_rem, builder.select(is_oversize, rem, wrapped_rem) ) return mod
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 _insert(self, objs): """Base method that inserts a set of equivalent objects by modifying self. """ assert len(objs) > 1 inds = tuple(self._get_or_add_ind(x) for x in objs) ind = min(inds) if config.DEBUG_ARRAY_OPT >= 2: print("_insert:", objs, inds) if not (ind in self.ind_to_obj): self.ind_to_obj[ind] = [] for i, obj in zip(inds, objs): if i == ind: if not (obj in self.ind_to_obj[ind]): self.ind_to_obj[ind].append(obj) self.obj_to_ind[obj] = ind else: if i in self.ind_to_obj: # those already existing are reassigned for x in self.ind_to_obj[i]: self.obj_to_ind[x] = ind self.ind_to_obj[ind].append(x) del self.ind_to_obj[i] else: # those that are new are assigned. self.obj_to_ind[obj] = ind self.ind_to_obj[ind].append(obj)
def _insert(self, objs): """Base method that inserts a set of equivalent objects by modifying self. """ assert len(objs) > 1 inds = tuple(self._get_or_add_ind(x) for x in objs) ind = min(inds) if not (ind in self.ind_to_obj): self.ind_to_obj[ind] = [] for i, obj in zip(inds, objs): if i == ind: if not (obj in self.ind_to_obj[ind]): self.ind_to_obj[ind].append(obj) self.obj_to_ind[obj] = ind else: if i in self.ind_to_obj: # those already existing are reassigned for x in self.ind_to_obj[i]: self.obj_to_ind[x] = ind self.ind_to_obj[ind].append(x) del self.ind_to_obj[i] else: # those that are new are assigned. self.obj_to_ind[obj] = ind self.ind_to_obj[ind].append(obj)
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, blocks=None, equiv_set=None): """run array shape analysis on the given IR blocks, resulting in modified IR and finalized EquivSet for each block. """ if blocks == None: blocks = self.func_ir.blocks self.func_ir._definitions = build_definitions(self.func_ir.blocks) if equiv_set == None: init_equiv_set = SymbolicEquivSet(self.typemap) else: init_equiv_set = equiv_set aa_count_save = ArrayAnalysis.aa_count ArrayAnalysis.aa_count += 1 if config.DEBUG_ARRAY_OPT >= 1: print("Starting ArrayAnalysis:", aa_count_save) dprint_func_ir(self.func_ir, "before array analysis", blocks) if config.DEBUG_ARRAY_OPT >= 1: print("ArrayAnalysis variable types: ", sorted(self.typemap.items())) print("ArrayAnalysis call types: ", self.calltypes) cfg = compute_cfg_from_blocks(blocks) topo_order = find_topo_order(blocks, cfg=cfg) # Traverse blocks in topological order for label in topo_order: if config.DEBUG_ARRAY_OPT >= 2: print("Processing block:", label) block = blocks[label] scope = block.scope new_body = [] equiv_set = None # equiv_set is the intersection of predecessors preds = cfg.predecessors(label) # some incoming edge may be pruned due to prior analysis if label in self.pruned_predecessors: pruned = self.pruned_predecessors[label] else: pruned = [] # Go through each incoming edge, process prepended instructions and # calculate beginning equiv_set of current block as an intersection # of incoming ones. for p, q in preds: if p in pruned: continue if p in self.equiv_sets: from_set = self.equiv_sets[p].clone() if (p, label) in self.prepends: instrs = self.prepends[(p, label)] for inst in instrs: redefined = set() self._analyze_inst(label, scope, from_set, inst, redefined) # Remove anything multiply defined in this block # from every block equivs. self.remove_redefineds(redefined) if equiv_set == None: equiv_set = from_set else: equiv_set = equiv_set.intersect(from_set) redefined = set() equiv_set.union_defs(from_set.defs, redefined) # Remove anything multiply defined in this block # from every block equivs. self.remove_redefineds(redefined) # Start with a new equiv_set if none is computed if equiv_set == None: equiv_set = init_equiv_set self.equiv_sets[label] = equiv_set # Go through instructions in a block, and insert pre/post # instructions as we analyze them. for inst in block.body: redefined = set() if isinstance(inst, ir.StaticSetItem): orig_calltype = self.calltypes[inst] inst = ir.SetItem(inst.target, inst.index_var, inst.value, inst.loc) self.calltypes[inst] = orig_calltype pre, post = self._analyze_inst(label, scope, equiv_set, inst, redefined) # Remove anything multiply defined in this block from every block equivs. self.remove_redefineds(redefined) for instr in pre: new_body.append(instr) new_body.append(inst) for instr in post: new_body.append(instr) block.body = new_body if config.DEBUG_ARRAY_OPT >= 1: self.dump() print("ArrayAnalysis post variable types: ", sorted(self.typemap.items())) print("ArrayAnalysis post call types: ", self.calltypes) dprint_func_ir(self.func_ir, "after array analysis", blocks) if config.DEBUG_ARRAY_OPT >= 1: print("Ending ArrayAnalysis:", aa_count_save)
def run(self, blocks=None, equiv_set=None): """run array shape analysis on the given IR blocks, resulting in modified IR and finalized EquivSet for each block. """ if blocks == None: blocks = self.func_ir.blocks self.func_ir._definitions = build_definitions(self.func_ir.blocks) if equiv_set == None: init_equiv_set = SymbolicEquivSet(self.typemap) else: init_equiv_set = equiv_set dprint_func_ir(self.func_ir, "before array analysis", blocks) if config.DEBUG_ARRAY_OPT >= 1: print("ArrayAnalysis variable types: ", sorted(self.typemap.items())) print("ArrayAnalysis call types: ", self.calltypes) cfg = compute_cfg_from_blocks(blocks) topo_order = find_topo_order(blocks, cfg=cfg) # Traverse blocks in topological order for label in topo_order: block = blocks[label] scope = block.scope new_body = [] equiv_set = None # equiv_set is the intersection of predecessors preds = cfg.predecessors(label) # some incoming edge may be pruned due to prior analysis if label in self.pruned_predecessors: pruned = self.pruned_predecessors[label] else: pruned = [] # Go through each incoming edge, process prepended instructions and # calculate beginning equiv_set of current block as an intersection # of incoming ones. for p, q in preds: if p in pruned: continue if p in self.equiv_sets: from_set = self.equiv_sets[p].clone() if (p, label) in self.prepends: instrs = self.prepends[(p, label)] for inst in instrs: redefined = set() self._analyze_inst(label, scope, from_set, inst, redefined) # Remove anything multiply defined in this block # from every block equivs. self.remove_redefineds(redefined) if equiv_set == None: equiv_set = from_set else: equiv_set = equiv_set.intersect(from_set) redefined = set() equiv_set.union_defs(from_set.defs, redefined) # Remove anything multiply defined in this block # from every block equivs. self.remove_redefineds(redefined) # Start with a new equiv_set if none is computed if equiv_set == None: equiv_set = init_equiv_set self.equiv_sets[label] = equiv_set # Go through instructions in a block, and insert pre/post # instructions as we analyze them. for inst in block.body: redefined = set() pre, post = self._analyze_inst(label, scope, equiv_set, inst, redefined) # Remove anything multiply defined in this block from every block equivs. self.remove_redefineds(redefined) for instr in pre: new_body.append(instr) new_body.append(inst) for instr in post: new_body.append(instr) block.body = new_body if config.DEBUG_ARRAY_OPT >= 1: self.dump() print("ArrayAnalysis post variable types: ", sorted(self.typemap.items())) print("ArrayAnalysis post call types: ", self.calltypes) dprint_func_ir(self.func_ir, "after array analysis", blocks)
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 _analyze_inst(self, label, scope, equiv_set, inst, redefined): pre = [] post = [] if config.DEBUG_ARRAY_OPT >= 2: print("analyze_inst:", inst) if isinstance(inst, ir.Assign): lhs = inst.target typ = self.typemap[lhs.name] shape = None if isinstance(typ, types.ArrayCompatible) and typ.ndim == 0: shape = () elif isinstance(inst.value, ir.Expr): result = self._analyze_expr(scope, equiv_set, inst.value) if result: shape = result[0] pre = result[1] if len(result) > 2: rhs = result[2] inst.value = rhs elif isinstance(inst.value, ir.Var) or isinstance(inst.value, ir.Const): shape = inst.value if isinstance(shape, ir.Const): if isinstance(shape.value, tuple): loc = shape.loc shape = tuple(ir.Const(x, loc) for x in shape.value) elif isinstance(shape.value, int): shape = (shape,) else: shape = None elif isinstance(shape, ir.Var) and isinstance( self.typemap[shape.name], types.Integer ): shape = (shape,) elif isinstance(shape, WrapIndexMeta): """ Here we've got the special WrapIndexMeta object back from analyzing a wrap_index call. We define the lhs and then get it's equivalence class then add the mapping from the tuple of slice size and dimensional size equivalence ids to the lhs equivalence id. """ equiv_set.define(lhs, redefined, self.func_ir, typ) lhs_ind = equiv_set._get_ind(lhs.name) if lhs_ind != -1: equiv_set.wrap_map[(shape.slice_size, shape.dim_size)] = lhs_ind return pre, post if isinstance(typ, types.ArrayCompatible): if ( shape == None or isinstance(shape, tuple) or (isinstance(shape, ir.Var) and not equiv_set.has_shape(shape)) ): (shape, post) = self._gen_shape_call(equiv_set, lhs, typ.ndim, shape) elif isinstance(typ, types.UniTuple): if shape and isinstance(typ.dtype, types.Integer): (shape, post) = self._gen_shape_call(equiv_set, lhs, len(typ), shape) if shape != None: equiv_set.insert_equiv(lhs, shape) equiv_set.define(lhs, redefined, self.func_ir, typ) elif isinstance(inst, ir.StaticSetItem) or isinstance(inst, ir.SetItem): index = inst.index if isinstance(inst, ir.SetItem) else inst.index_var result = guard(self._index_to_shape, scope, equiv_set, inst.target, index) if not result: return [], [] if result[0] is not None: assert isinstance(inst, ir.SetItem) inst.index = result[0] # inst.index_var = result[0] result = result[1] (target_shape, pre) = result value_shape = equiv_set.get_shape(inst.value) if value_shape == (): # constant equiv_set.set_shape_setitem(inst, target_shape) return pre, [] elif value_shape != None: target_typ = self.typemap[inst.target.name] require(isinstance(target_typ, types.ArrayCompatible)) target_ndim = target_typ.ndim shapes = [target_shape, value_shape] names = [inst.target.name, inst.value.name] shape, asserts = self._broadcast_assert_shapes( scope, equiv_set, inst.loc, shapes, names ) n = len(shape) # shape dimension must be within target dimension assert target_ndim >= n equiv_set.set_shape_setitem(inst, shape) return pre + asserts, [] else: return pre, [] elif isinstance(inst, ir.Branch): cond_var = inst.cond cond_def = guard(get_definition, self.func_ir, cond_var) if not cond_def: # phi variable has no single definition # We'll use equiv_set to try to find a cond_def instead equivs = equiv_set.get_equiv_set(cond_var) defs = [] for name in equivs: if isinstance(name, str) and name in self.typemap: var_def = guard(get_definition, self.func_ir, name, lhs_only=True) if isinstance(var_def, ir.Var): var_def = var_def.name if var_def: defs.append(var_def) else: defs.append(name) defvars = set(filter(lambda x: isinstance(x, str), defs)) defconsts = set(defs).difference(defvars) if len(defconsts) == 1: cond_def = list(defconsts)[0] elif len(defvars) == 1: cond_def = guard(get_definition, self.func_ir, list(defvars)[0]) if isinstance(cond_def, ir.Expr) and cond_def.op == "binop": br = None if cond_def.fn == operator.eq: br = inst.truebr otherbr = inst.falsebr cond_val = 1 elif cond_def.fn == operator.ne: br = inst.falsebr otherbr = inst.truebr cond_val = 0 lhs_typ = self.typemap[cond_def.lhs.name] rhs_typ = self.typemap[cond_def.rhs.name] if br != None and ( ( isinstance(lhs_typ, types.Integer) and isinstance(rhs_typ, types.Integer) ) or ( isinstance(lhs_typ, types.BaseTuple) and isinstance(rhs_typ, types.BaseTuple) ) ): loc = inst.loc args = (cond_def.lhs, cond_def.rhs) asserts = self._make_assert_equiv(scope, loc, equiv_set, args) asserts.append(ir.Assign(ir.Const(cond_val, loc), cond_var, loc)) self.prepends[(label, br)] = asserts self.prepends[(label, otherbr)] = [ ir.Assign(ir.Const(1 - cond_val, loc), cond_var, loc) ] else: if isinstance(cond_def, ir.Const): cond_def = cond_def.value if isinstance(cond_def, int) or isinstance(cond_def, bool): # condition is always true/false, prune the outgoing edge pruned_br = inst.falsebr if cond_def else inst.truebr if pruned_br in self.pruned_predecessors: self.pruned_predecessors[pruned_br].append(label) else: self.pruned_predecessors[pruned_br] = [label] elif type(inst) in array_analysis_extensions: # let external calls handle stmt if type matches f = array_analysis_extensions[type(inst)] pre, post = f(inst, equiv_set, self.typemap, self) return pre, post
def _analyze_inst(self, label, scope, equiv_set, inst, redefined): pre = [] post = [] if isinstance(inst, ir.Assign): lhs = inst.target typ = self.typemap[lhs.name] shape = None if isinstance(typ, types.ArrayCompatible) and typ.ndim == 0: shape = () elif isinstance(inst.value, ir.Expr): result = self._analyze_expr(scope, equiv_set, inst.value) if result: shape = result[0] pre = result[1] if len(result) > 2: rhs = result[2] inst.value = rhs elif isinstance(inst.value, ir.Var) or isinstance(inst.value, ir.Const): shape = inst.value if isinstance(shape, ir.Const): if isinstance(shape.value, tuple): loc = shape.loc shape = tuple(ir.Const(x, loc) for x in shape.value) elif isinstance(shape.value, int): shape = (shape,) else: shape = None elif isinstance(shape, ir.Var) and isinstance( self.typemap[shape.name], types.Integer ): shape = (shape,) elif isinstance(shape, WrapIndexMeta): """ Here we've got the special WrapIndexMeta object back from analyzing a wrap_index call. We define the lhs and then get it's equivalence class then add the mapping from the tuple of slice size and dimensional size equivalence ids to the lhs equivalence id. """ equiv_set.define(lhs, redefined, self.func_ir, typ) lhs_ind = equiv_set._get_ind(lhs.name) if lhs_ind != -1: equiv_set.wrap_map[(shape.slice_size, shape.dim_size)] = lhs_ind return pre, post if isinstance(typ, types.ArrayCompatible): if ( shape == None or isinstance(shape, tuple) or (isinstance(shape, ir.Var) and not equiv_set.has_shape(shape)) ): (shape, post) = self._gen_shape_call(equiv_set, lhs, typ.ndim, shape) elif isinstance(typ, types.UniTuple): if shape and isinstance(typ.dtype, types.Integer): (shape, post) = self._gen_shape_call(equiv_set, lhs, len(typ), shape) if shape != None: equiv_set.insert_equiv(lhs, shape) equiv_set.define(lhs, redefined, self.func_ir, typ) elif isinstance(inst, ir.StaticSetItem) or isinstance(inst, ir.SetItem): index = inst.index if isinstance(inst, ir.SetItem) else inst.index_var result = guard(self._index_to_shape, scope, equiv_set, inst.target, index) if not result: return [], [] if result[0] is not None: inst.index_var = result[0] result = result[1] (target_shape, pre) = result value_shape = equiv_set.get_shape(inst.value) if value_shape == (): # constant equiv_set.set_shape_setitem(inst, target_shape) return pre, [] elif value_shape != None: target_typ = self.typemap[inst.target.name] require(isinstance(target_typ, types.ArrayCompatible)) target_ndim = target_typ.ndim shapes = [target_shape, value_shape] names = [inst.target.name, inst.value.name] shape, asserts = self._broadcast_assert_shapes( scope, equiv_set, inst.loc, shapes, names ) n = len(shape) # shape dimension must be within target dimension assert target_ndim >= n equiv_set.set_shape_setitem(inst, shape) return pre + asserts, [] else: return pre, [] elif isinstance(inst, ir.Branch): cond_var = inst.cond cond_def = guard(get_definition, self.func_ir, cond_var) if not cond_def: # phi variable has no single definition # We'll use equiv_set to try to find a cond_def instead equivs = equiv_set.get_equiv_set(cond_var) defs = [] for name in equivs: if isinstance(name, str) and name in self.typemap: var_def = guard(get_definition, self.func_ir, name, lhs_only=True) if isinstance(var_def, ir.Var): var_def = var_def.name if var_def: defs.append(var_def) else: defs.append(name) defvars = set(filter(lambda x: isinstance(x, str), defs)) defconsts = set(defs).difference(defvars) if len(defconsts) == 1: cond_def = list(defconsts)[0] elif len(defvars) == 1: cond_def = guard(get_definition, self.func_ir, list(defvars)[0]) if isinstance(cond_def, ir.Expr) and cond_def.op == "binop": br = None if cond_def.fn == operator.eq: br = inst.truebr otherbr = inst.falsebr cond_val = 1 elif cond_def.fn == operator.ne: br = inst.falsebr otherbr = inst.truebr cond_val = 0 lhs_typ = self.typemap[cond_def.lhs.name] rhs_typ = self.typemap[cond_def.rhs.name] if br != None and ( ( isinstance(lhs_typ, types.Integer) and isinstance(rhs_typ, types.Integer) ) or ( isinstance(lhs_typ, types.BaseTuple) and isinstance(rhs_typ, types.BaseTuple) ) ): loc = inst.loc args = (cond_def.lhs, cond_def.rhs) asserts = self._make_assert_equiv(scope, loc, equiv_set, args) asserts.append(ir.Assign(ir.Const(cond_val, loc), cond_var, loc)) self.prepends[(label, br)] = asserts self.prepends[(label, otherbr)] = [ ir.Assign(ir.Const(1 - cond_val, loc), cond_var, loc) ] else: if isinstance(cond_def, ir.Const): cond_def = cond_def.value if isinstance(cond_def, int) or isinstance(cond_def, bool): # condition is always true/false, prune the outgoing edge pruned_br = inst.falsebr if cond_def else inst.truebr if pruned_br in self.pruned_predecessors: self.pruned_predecessors[pruned_br].append(label) else: self.pruned_predecessors[pruned_br] = [label] elif type(inst) in array_analysis_extensions: # let external calls handle stmt if type matches f = array_analysis_extensions[type(inst)] pre, post = f(inst, equiv_set, self.typemap, self) return pre, post
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 gen_explicit_neg( self, arg, arg_rel, arg_typ, size_typ, loc, scope, dsize, stmts, equiv_set ): assert not isinstance(size_typ, int) # Create var to hold the calculated slice size. explicit_neg_var = ir.Var(scope, mk_unique_var("explicit_neg"), loc) explicit_neg_val = ir.Expr.binop(operator.add, dsize, arg, loc=loc) # Determine the type of that var. Can be literal if we know the # literal size of the dimension. explicit_neg_typ = types.intp self.calltypes[explicit_neg_val] = signature(explicit_neg_typ, size_typ, arg_typ) # We'll prepend this slice size calculation to the get/setitem. stmts.append(ir.Assign(value=explicit_neg_val, target=explicit_neg_var, loc=loc)) self._define(equiv_set, explicit_neg_var, explicit_neg_typ, explicit_neg_val) return explicit_neg_var, explicit_neg_typ
def gen_explicit_neg( self, arg, arg_rel, arg_typ, size_typ, loc, scope, dsize, stmts, equiv_set ): # Create var to hold the calculated slice size. explicit_neg_var = ir.Var(scope, mk_unique_var("explicit_neg"), loc) explicit_neg_val = ir.Expr.binop(operator.add, dsize, arg, loc=loc) # Determine the type of that var. Can be literal if we know the # literal size of the dimension. if isinstance(size_typ, int): explicit_neg_typ = types.IntegerLiteral(size_typ + arg_rel) else: explicit_neg_typ = types.intp self.calltypes[explicit_neg_val] = signature(explicit_neg_typ, size_typ, arg_typ) # We'll prepend this slice size calculation to the get/setitem. stmts.append(ir.Assign(value=explicit_neg_val, target=explicit_neg_var, loc=loc)) self._define(equiv_set, explicit_neg_var, explicit_neg_typ, explicit_neg_val) return explicit_neg_var, explicit_neg_typ
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 slice_size(self, index, dsize, equiv_set, scope, stmts): """Reason about the size of a slice represented by the "index" variable, and return a variable that has this size data, or raise GuardException if it cannot reason about it. The computation takes care of negative values used in the slice with respect to the given dimensional size ("dsize"). Extra statments required to produce the result are appended to parent function's stmts list. """ loc = index.loc # Get the definition of the index variable. index_def = get_definition(self.func_ir, index) fname, mod_name = find_callname(self.func_ir, index_def, typemap=self.typemap) require(fname == "slice" and mod_name in ("__builtin__", "builtins")) require(len(index_def.args) == 2) lhs = index_def.args[0] rhs = index_def.args[1] size_typ = self.typemap[dsize.name] lhs_typ = self.typemap[lhs.name] rhs_typ = self.typemap[rhs.name] if config.DEBUG_ARRAY_OPT >= 2: print( "slice_size", "index=", index, "dsize=", dsize, "index_def=", index_def, "lhs=", lhs, "rhs=", rhs, "size_typ=", size_typ, "lhs_typ=", lhs_typ, "rhs_typ=", rhs_typ, ) # Make a deepcopy of the original slice to use as the # replacement slice, which we will modify as necessary # below to convert all negative constants in the slice # to be relative to the dimension size. replacement_slice = copy.deepcopy(index_def) need_replacement = False # Fill in the left side of the slice's ":" with 0 if it wasn't specified. if isinstance(lhs_typ, types.NoneType): zero_var = ir.Var(scope, mk_unique_var("zero"), loc) zero = ir.Const(0, loc) stmts.append(ir.Assign(value=zero, target=zero_var, loc=loc)) self._define(equiv_set, zero_var, types.IntegerLiteral(0), zero) lhs = zero_var lhs_typ = types.IntegerLiteral(0) replacement_slice.args = (lhs, replacement_slice.args[1]) need_replacement = True if config.DEBUG_ARRAY_OPT >= 2: print("Replacing slice because lhs is None.") # Fill in the right side of the slice's ":" with the array # length if it wasn't specified. if isinstance(rhs_typ, types.NoneType): rhs = dsize rhs_typ = size_typ replacement_slice.args = (replacement_slice.args[0], rhs) need_replacement = True if config.DEBUG_ARRAY_OPT >= 2: print("Replacing slice because lhs is None.") lhs_rel = equiv_set.get_rel(lhs) rhs_rel = equiv_set.get_rel(rhs) dsize_rel = equiv_set.get_rel(dsize) if config.DEBUG_ARRAY_OPT >= 2: print("lhs_rel", lhs_rel, "rhs_rel", rhs_rel, "dsize_rel", dsize_rel) # Update replacement slice with the real index value if we can # compute it at compile time. lhs, lhs_typ, lhs_rel, replacement_slice, need_replacement, lhs_known = ( self.update_replacement_slice( lhs, lhs_typ, lhs_rel, dsize_rel, replacement_slice, 0, need_replacement, loc, scope, stmts, equiv_set, size_typ, dsize, ) ) rhs, rhs_typ, rhs_rel, replacement_slice, need_replacement, rhs_known = ( self.update_replacement_slice( rhs, rhs_typ, rhs_rel, dsize_rel, replacement_slice, 1, need_replacement, loc, scope, stmts, equiv_set, size_typ, dsize, ) ) if config.DEBUG_ARRAY_OPT >= 2: print("lhs_known:", lhs_known) print("rhs_known:", rhs_known) # If neither of the parts of the slice were negative constants # then we don't need to do slice replacement in the IR. if not need_replacement: replacement_slice_var = None else: # Create a new var for the replacement slice. replacement_slice_var = ir.Var(scope, mk_unique_var("replacement_slice"), loc) # Create a deepcopy of slice calltype so that when we change it below # the original isn't changed. Make the types of the parts of the slice # intp. new_arg_typs = (types.intp, types.intp) rs_calltype = self.typemap[index_def.func.name].get_call_type( self.context, new_arg_typs, {} ) self.calltypes[replacement_slice] = rs_calltype stmts.append( ir.Assign(value=replacement_slice, target=replacement_slice_var, loc=loc) ) # The type of the replacement slice is the same type as the original. self.typemap[replacement_slice_var.name] = self.typemap[index.name] if config.DEBUG_ARRAY_OPT >= 2: print("after rewriting negatives", "lhs_rel", lhs_rel, "rhs_rel", rhs_rel) if lhs_known and rhs_known: if config.DEBUG_ARRAY_OPT >= 2: print("lhs and rhs known so return static size") return self.gen_static_slice_size( lhs_rel, rhs_rel, loc, scope, stmts, equiv_set ), replacement_slice_var if ( lhs_rel == 0 and isinstance(rhs_rel, tuple) and equiv_set.is_equiv(dsize, rhs_rel[0]) and rhs_rel[1] == 0 ): return dsize, None slice_typ = types.intp orig_slice_typ = slice_typ size_var = ir.Var(scope, mk_unique_var("slice_size"), loc) size_val = ir.Expr.binop(operator.sub, rhs, lhs, loc=loc) self.calltypes[size_val] = signature(slice_typ, rhs_typ, lhs_typ) self._define(equiv_set, size_var, slice_typ, size_val) size_rel = equiv_set.get_rel(size_var) if config.DEBUG_ARRAY_OPT >= 2: print("size_rel", size_rel, type(size_rel)) wrap_var = ir.Var(scope, mk_unique_var("wrap"), loc) wrap_def = ir.Global("wrap_index", wrap_index, loc=loc) fnty = get_global_func_typ(wrap_index) sig = self.context.resolve_function_type( fnty, ( orig_slice_typ, size_typ, ), {}, ) self._define(equiv_set, wrap_var, fnty, wrap_def) def gen_wrap_if_not_known(val, val_typ, known): if not known: var = ir.Var(scope, mk_unique_var("var"), loc) var_typ = types.intp new_value = ir.Expr.call(wrap_var, [val, dsize], {}, loc) self._define(equiv_set, var, var_typ, new_value) self.calltypes[new_value] = sig return (var, var_typ, new_value) else: return (val, val_typ, None) var1, var1_typ, value1 = gen_wrap_if_not_known(lhs, lhs_typ, lhs_known) var2, var2_typ, value2 = gen_wrap_if_not_known(rhs, rhs_typ, rhs_known) post_wrap_size_var = ir.Var(scope, mk_unique_var("post_wrap_slice_size"), loc) post_wrap_size_val = ir.Expr.binop(operator.sub, var2, var1, loc=loc) self.calltypes[post_wrap_size_val] = signature(slice_typ, var2_typ, var1_typ) self._define(equiv_set, post_wrap_size_var, slice_typ, post_wrap_size_val) stmts.append(ir.Assign(value=size_val, target=size_var, loc=loc)) stmts.append(ir.Assign(value=wrap_def, target=wrap_var, loc=loc)) if value1 is not None: stmts.append(ir.Assign(value=value1, target=var1, loc=loc)) if value2 is not None: stmts.append(ir.Assign(value=value2, target=var2, loc=loc)) stmts.append( ir.Assign(value=post_wrap_size_val, target=post_wrap_size_var, loc=loc) ) # rel_map keeps a map of relative sizes that we have seen so # that if we compute the same relative sizes different times # in different ways we can associate those two instances # of the same relative size to the same equivalence class. if isinstance(size_rel, tuple): if config.DEBUG_ARRAY_OPT >= 2: print("size_rel is tuple", equiv_set.rel_map) rel_map_entry = None for rme, rme_tuple in equiv_set.rel_map.items(): if rme[1] == size_rel[1] and equiv_set.is_equiv(rme[0], size_rel[0]): rel_map_entry = rme_tuple break if rel_map_entry is not None: # We have seen this relative size before so establish # equivalence to the previous variable. if config.DEBUG_ARRAY_OPT >= 2: print("establishing equivalence to", rel_map_entry) equiv_set.insert_equiv(size_var, rel_map_entry[0]) equiv_set.insert_equiv(post_wrap_size_var, rel_map_entry[1]) else: # The first time we've seen this relative size so # remember the variable defining that size. equiv_set.rel_map[size_rel] = (size_var, post_wrap_size_var) return post_wrap_size_var, replacement_slice_var
def slice_size(self, index, dsize, equiv_set, scope, stmts): """Reason about the size of a slice represented by the "index" variable, and return a variable that has this size data, or raise GuardException if it cannot reason about it. The computation takes care of negative values used in the slice with respect to the given dimensional size ("dsize"). Extra statments required to produce the result are appended to parent function's stmts list. """ loc = index.loc # Get the definition of the index variable. index_def = get_definition(self.func_ir, index) fname, mod_name = find_callname(self.func_ir, index_def, typemap=self.typemap) require(fname == "slice" and mod_name in ("__builtin__", "builtins")) require(len(index_def.args) == 2) lhs = index_def.args[0] rhs = index_def.args[1] size_typ = self.typemap[dsize.name] lhs_typ = self.typemap[lhs.name] rhs_typ = self.typemap[rhs.name] if config.DEBUG_ARRAY_OPT >= 2: print( "slice_size", "index", index, "dsize", dsize, "index_def", index_def, "lhs", lhs, "rhs", rhs, "size_typ", size_typ, "lhs_typ", lhs_typ, "rhs_typ", rhs_typ, ) # Fill in the left side of the slice's ":" with 0 if it wasn't specified. if isinstance(lhs_typ, types.NoneType): zero_var = ir.Var(scope, mk_unique_var("zero"), loc) zero = ir.Const(0, loc) stmts.append(ir.Assign(value=zero, target=zero_var, loc=loc)) self._define(equiv_set, zero_var, types.IntegerLiteral(0), zero) lhs = zero_var lhs_typ = types.IntegerLiteral(0) # Fill in the right side of the slice's ":" with the array # length if it wasn't specified. if isinstance(rhs_typ, types.NoneType): rhs = dsize rhs_typ = size_typ lhs_rel = equiv_set.get_rel(lhs) rhs_rel = equiv_set.get_rel(rhs) if config.DEBUG_ARRAY_OPT >= 2: print("lhs_rel", lhs_rel, "rhs_rel", rhs_rel) # Make a deepcopy of the original slice to use as the # replacement slice, which we will modify as necessary # below to convert all negative constants in the slice # to be relative to the dimension size. replacement_slice = copy.deepcopy(index_def) need_replacement = False # If the first part of the slice is a constant N then check if N # is negative. If so, then rewrite the first part of the slice # to be "dsize - N". This is necessary because later steps will # try to compute slice size with a subtraction which wouldn't work # if any part of the slice was negative. if isinstance(lhs_rel, int): if lhs_rel < 0: # Indicate we will need to replace the slice var. need_replacement = True explicit_neg_var, explicit_neg_typ = self.gen_explicit_neg( lhs, lhs_rel, lhs_typ, size_typ, loc, scope, dsize, stmts, equiv_set ) replacement_slice.args = (explicit_neg_var, rhs) # Update lhs information with the negative removed. lhs = replacement_slice.args[0] lhs_typ = explicit_neg_typ lhs_rel = equiv_set.get_rel(lhs) # If the second part of the slice is a constant N then check if N # is negative. If so, then rewrite the second part of the slice # to be "dsize - N". This is necessary because later steps will # try to compute slice size with a subtraction which wouldn't work # if any part of the slice was negative. if isinstance(rhs_rel, int): if rhs_rel < 0: # Indicate we will need to replace the slice var. need_replacement = True explicit_neg_var, explicit_neg_typ = self.gen_explicit_neg( rhs, rhs_rel, rhs_typ, size_typ, loc, scope, dsize, stmts, equiv_set ) replacement_slice.args = (lhs, explicit_neg_var) # Update rhs information with the negative removed. rhs = replacement_slice.args[1] rhs_typ = explicit_neg_typ rhs_rel = equiv_set.get_rel(rhs) # If neither of the parts of the slice were negative constants # then we don't need to do slice replacement in the IR. if not need_replacement: replacement_slice_var = None else: # Create a new var for the replacement slice. replacement_slice_var = ir.Var(scope, mk_unique_var("replacement_slice"), loc) # Create a deepcopy of slice calltype so that when we change it below # the original isn't changed. Make the types of the parts of the slice # intp. new_arg_typs = (types.intp, types.intp) rs_calltype = self.typemap[index_def.func.name].get_call_type( self.context, new_arg_typs, {} ) self.calltypes[replacement_slice] = rs_calltype stmts.append( ir.Assign(value=replacement_slice, target=replacement_slice_var, loc=loc) ) # The type of the replacement slice is the same type as the original. self.typemap[replacement_slice_var.name] = self.typemap[index.name] if config.DEBUG_ARRAY_OPT >= 2: print("after rewriting negatives", "lhs_rel", lhs_rel, "rhs_rel", rhs_rel) if ( lhs_rel == 0 and isinstance(rhs_rel, tuple) and equiv_set.is_equiv(dsize, rhs_rel[0]) and rhs_rel[1] == 0 ): return dsize, None slice_typ = types.intp size_var = ir.Var(scope, mk_unique_var("slice_size"), loc) size_val = ir.Expr.binop(operator.sub, rhs, lhs, loc=loc) self.calltypes[size_val] = signature(slice_typ, rhs_typ, lhs_typ) self._define(equiv_set, size_var, slice_typ, size_val) # short cut size_val to a constant if its relation is known to be # a constant size_rel = equiv_set.get_rel(size_var) if config.DEBUG_ARRAY_OPT >= 2: print("size_var", size_var, "size_val", size_val, "size_rel", size_rel) if isinstance(size_rel, int): size_val = ir.Const(size_rel, loc=loc) size_var = ir.Var(scope, mk_unique_var("slice_size"), loc) slice_typ = types.IntegerLiteral(size_rel) self._define(equiv_set, size_var, slice_typ, size_val) if config.DEBUG_ARRAY_OPT >= 2: print("inferred constant size", "size_var", size_var, "size_val", size_val) # rel_map keeps a map of relative sizes that we have seen so # that if we compute the same relative sizes different times # in different ways we can associate those two instances # of the same relative size to the same equivalence class. if isinstance(size_rel, tuple): if config.DEBUG_ARRAY_OPT >= 2: print("size_rel is tuple", size_rel in equiv_set.rel_map) if size_rel in equiv_set.rel_map: # We have seen this relative size before so establish # equivalence to the previous variable. if config.DEBUG_ARRAY_OPT >= 2: print("establishing equivalence to", equiv_set.rel_map[size_rel]) equiv_set.insert_equiv(size_var, equiv_set.rel_map[size_rel]) else: # The first time we've seen this relative size so # remember the variable defining that size. equiv_set.rel_map[size_rel] = size_var wrap_var = ir.Var(scope, mk_unique_var("wrap"), loc) wrap_def = ir.Global("wrap_index", wrap_index, loc=loc) fnty = get_global_func_typ(wrap_index) sig = self.context.resolve_function_type( fnty, ( slice_typ, size_typ, ), {}, ) self._define(equiv_set, wrap_var, fnty, wrap_def) var = ir.Var(scope, mk_unique_var("var"), loc) value = ir.Expr.call(wrap_var, [size_var, dsize], {}, loc) self._define(equiv_set, var, slice_typ, value) self.calltypes[value] = sig stmts.append(ir.Assign(value=size_val, target=size_var, loc=loc)) stmts.append(ir.Assign(value=wrap_def, target=wrap_var, loc=loc)) stmts.append(ir.Assign(value=value, target=var, loc=loc)) return var, replacement_slice_var
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 _analyze_op_build_tuple(self, scope, equiv_set, expr): consts = [] for var in expr.items: x = guard(find_const, self.func_ir, var) if x is not None: consts.append(x) else: break else: out = tuple([ir.Const(x, expr.loc) for x in consts]) return out, [], ir.Const(tuple(consts), expr.loc) # default return for non-const return tuple(expr.items), []
def _analyze_op_build_tuple(self, scope, equiv_set, expr): return tuple(expr.items), []
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_assert_equiv(self, scope, loc, equiv_set, _args, names=None): # filter out those that are already equivalent if config.DEBUG_ARRAY_OPT >= 2: print("make_assert_equiv:", _args, names) if names == None: names = [x.name for x in _args] args = [] arg_names = [] for name, x in zip(names, _args): if config.DEBUG_ARRAY_OPT >= 2: print("name, x:", name, x) seen = False for y in args: if config.DEBUG_ARRAY_OPT >= 2: print("is equiv to?", y, equiv_set.is_equiv(x, y)) if equiv_set.is_equiv(x, y): seen = True break if not seen: args.append(x) arg_names.append(name) # no assertion necessary if there are less than two if len(args) < 2: if config.DEBUG_ARRAY_OPT >= 2: print("Will not insert assert_equiv as args are known to be equivalent.") return [] msg = "Sizes of {} do not match on {}".format(", ".join(arg_names), loc) msg_val = ir.Const(msg, loc) msg_typ = types.StringLiteral(msg) msg_var = ir.Var(scope, mk_unique_var("msg"), loc) self.typemap[msg_var.name] = msg_typ argtyps = tuple([msg_typ] + [self.typemap[x.name] for x in args]) # assert_equiv takes vararg, which requires a tuple as argument type tup_typ = types.BaseTuple.from_types(argtyps) # prepare function variable whose type may vary since it takes vararg assert_var = ir.Var(scope, mk_unique_var("assert"), loc) assert_def = ir.Global("assert_equiv", assert_equiv, loc=loc) fnty = get_global_func_typ(assert_equiv) sig = self.context.resolve_function_type(fnty, (tup_typ,), {}) self._define(equiv_set, assert_var, fnty, assert_def) # The return value from assert_equiv is always of none type. var = ir.Var(scope, mk_unique_var("ret"), loc) value = ir.Expr.call(assert_var, [msg_var] + args, {}, loc=loc) self._define(equiv_set, var, types.none, value) self.calltypes[value] = sig return [ ir.Assign(value=msg_val, target=msg_var, loc=loc), ir.Assign(value=assert_def, target=assert_var, loc=loc), ir.Assign(value=value, target=var, loc=loc), ]
def _make_assert_equiv(self, scope, loc, equiv_set, _args, names=None): # filter out those that are already equivalent if names == None: names = [x.name for x in _args] args = [] arg_names = [] for name, x in zip(names, _args): seen = False for y in args: if equiv_set.is_equiv(x, y): seen = True break if not seen: args.append(x) arg_names.append(name) # no assertion necessary if there are less than two if len(args) < 2: return [] msg = "Sizes of {} do not match on {}".format(", ".join(arg_names), loc) msg_val = ir.Const(msg, loc) msg_typ = types.StringLiteral(msg) msg_var = ir.Var(scope, mk_unique_var("msg"), loc) self.typemap[msg_var.name] = msg_typ argtyps = tuple([msg_typ] + [self.typemap[x.name] for x in args]) # assert_equiv takes vararg, which requires a tuple as argument type tup_typ = types.BaseTuple.from_types(argtyps) # prepare function variable whose type may vary since it takes vararg assert_var = ir.Var(scope, mk_unique_var("assert"), loc) assert_def = ir.Global("assert_equiv", assert_equiv, loc=loc) fnty = get_global_func_typ(assert_equiv) sig = self.context.resolve_function_type(fnty, (tup_typ,), {}) self._define(equiv_set, assert_var, fnty, assert_def) # The return value from assert_equiv is always of none type. var = ir.Var(scope, mk_unique_var("ret"), loc) value = ir.Expr.call(assert_var, [msg_var] + args, {}, loc=loc) self._define(equiv_set, var, types.none, value) self.calltypes[value] = sig return [ ir.Assign(value=msg_val, target=msg_var, loc=loc), ir.Assign(value=assert_def, target=assert_var, loc=loc), ir.Assign(value=value, target=var, loc=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 run(self): """Run a trace over the bytecode over all reachable path. The trace starts at bytecode offset 0 and gathers stack and control- flow information by partially interpreting each bytecode. Each ``State`` instance in the trace corresponds to a basic-block. The State instances forks when a jump instruction is encountered. A newly forked state is then added to the list of pending states. The trace ends when there are no more pending states. """ firststate = State(bytecode=self._bytecode, pc=0, nstack=0, blockstack=()) runner = TraceRunner(debug_filename=self._bytecode.func_id.filename) runner.pending.append(firststate) # Enforce unique-ness on initial PC to avoid re-entering the PC with # a different stack-depth. We don't know if such a case is ever # possible, but no such case has been encountered in our tests. first_encounter = UniqueDict() # Loop over each pending state at a initial PC. # Each state is tracing a basic block while runner.pending: _logger.debug("pending: %s", runner.pending) state = runner.pending.popleft() if state not in runner.finished: _logger.debug("stack: %s", state._stack) first_encounter[state.pc_initial] = state # Loop over the state until it is terminated. while True: runner.dispatch(state) # Terminated? if state.has_terminated(): break elif ( state.has_active_try() and state.get_inst().opname not in _NO_RAISE_OPS ): # Is in a *try* block state.fork(pc=state.get_inst().next) tryblk = state.get_top_block("TRY") state.pop_block_and_above(tryblk) nstack = state.stack_depth kwargs = {} if nstack > tryblk["entry_stack"]: kwargs["npop"] = nstack - tryblk["entry_stack"] handler = tryblk["handler"] kwargs["npush"] = { BlockKind("EXCEPT"): _EXCEPT_STACK_OFFSET, BlockKind("FINALLY"): _FINALLY_POP, }[handler["kind"]] kwargs["extra_block"] = handler state.fork(pc=tryblk["end"], **kwargs) break else: state.advance_pc() # Must the new PC be a new block? if self._is_implicit_new_block(state): state.split_new_block() break _logger.debug("end state. edges=%s", state.outgoing_edges) runner.finished.add(state) out_states = state.get_outgoing_states() runner.pending.extend(out_states) # Complete controlflow self._build_cfg(runner.finished) # Prune redundant PHI-nodes self._prune_phis(runner) # Post process for state in sorted(runner.finished, key=lambda x: x.pc_initial): self.block_infos[state.pc_initial] = si = adapt_state_infos(state) _logger.debug("block_infos %s:\n%s", state, si)
def run(self): """Run a trace over the bytecode over all reachable path. The trace starts at bytecode offset 0 and gathers stack and control- flow information by partially interpreting each bytecode. Each ``State`` instance in the trace corresponds to a basic-block. The State instances forks when a jump instruction is encountered. A newly forked state is then added to the list of pending states. The trace ends when there are no more pending states. """ firststate = State(bytecode=self._bytecode, pc=0, nstack=0, blockstack=()) runner = TraceRunner(debug_filename=self._bytecode.func_id.filename) runner.pending.append(firststate) # Enforce unique-ness on initial PC to avoid re-entering the PC with # a different stack-depth. We don't know if such a case is ever # possible, but no such case has been encountered in our tests. first_encounter = UniqueDict() # Loop over each pending state at a initial PC. # Each state is tracing a basic block while runner.pending: _logger.debug("pending: %s", runner.pending) state = runner.pending.pop() if state not in runner.finished: _logger.debug("stack: %s", state._stack) first_encounter[state.pc_initial] = state # Loop over the state until it is terminated. while True: runner.dispatch(state) # Terminated? if state.has_terminated(): break # Not yet? else: state.advance_pc() # Must the new PC be a new block? if self._is_implicit_new_block(state): state.split_new_block() break _logger.debug("end state. edges=%s", state.outgoing_edges) runner.finished.add(state) out_states = state.get_outgoing_states() runner.pending.extend(out_states) # Complete controlflow self._build_cfg(runner.finished) # Prune redundant PHI-nodes self._prune_phis(runner) # Post process for state in sorted(runner.finished, key=lambda x: x.pc_initial): self.block_infos[state.pc_initial] = si = adapt_state_infos(state) _logger.debug("block_infos %s:\n%s", state, si)
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, debug_filename): self.debug_filename = debug_filename self.pending = deque() self.finished = set()
def __init__(self, debug_filename): self.debug_filename = debug_filename self.pending = [] self.finished = set()
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 dispatch(self, state): inst = state.get_inst() _logger.debug("dispatch pc=%s, inst=%s", state._pc, inst) _logger.debug("stack %s", state._stack) fn = getattr(self, "op_{}".format(inst.opname), None) if fn is not None: fn(state, inst) else: msg = "Use of unsupported opcode (%s) found" % inst.opname raise UnsupportedError(msg, loc=self.get_debug_loc(inst.lineno))
def dispatch(self, state): inst = state.get_inst() _logger.debug("dispatch pc=%s, inst=%s", state._pc, inst) fn = getattr(self, "op_{}".format(inst.opname), None) if fn is not None: fn(state, inst) else: msg = "Use of unsupported opcode (%s) found" % inst.opname raise UnsupportedError(msg, loc=self.get_debug_loc(inst.lineno))
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_BREAK_LOOP(self, state, inst): # NOTE: bytecode removed since py3.8 end = state.get_top_block("LOOP")["end"] state.append(inst, end=end) state.pop_block() state.fork(pc=end)
def op_BREAK_LOOP(self, state, inst): # NOTE: bytecode removed since py3.8 end = state.get_top_block("loop")["end"] state.append(inst, end=end) state.pop_block() state.fork(pc=end)
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, state, inst): in_exc_block = any( [ state.get_top_block("EXCEPT") is not None, state.get_top_block("FINALLY") is not None, ] ) if inst.arg == 0: exc = None if in_exc_block: raise UnsupportedError( "The re-raising of an exception is not yet supported.", loc=self.get_debug_loc(inst.lineno), ) elif inst.arg == 1: exc = state.pop() else: raise ValueError("Multiple argument raise is not supported.") state.append(inst, exc=exc) state.terminate()
def op_RAISE_VARARGS(self, state, inst): if inst.arg == 0: exc = None elif inst.arg == 1: exc = state.pop() else: raise ValueError("Multiple argument raise is not supported.") state.append(inst, exc=exc) state.terminate()
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, state, inst): temps = [] for i in range(_EXCEPT_STACK_OFFSET): tmp = state.make_temp() temps.append(tmp) state.push(tmp) state.append(inst, temps=temps)
def op_BEGIN_FINALLY(self, state, inst): res = state.make_temp() # unused state.push(res) state.append(inst, state=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_END_FINALLY(self, state, inst): blk = state.pop_block() state.reset_stack(blk["entry_stack"])
def op_END_FINALLY(self, state, inst): state.append(inst) # actual bytecode has stack_effect of -6 # we don't emulate the exact stack behavior state.pop() # unsure but seems to work state.pop() # unsure but seems to work
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_SETUP_LOOP(self, state, inst): # NOTE: bytecode removed since py3.8 state.push_block( state.make_block( kind="LOOP", end=inst.get_jump_target(), ) )
def op_SETUP_LOOP(self, state, inst): # NOTE: bytecode removed since py3.8 state.push_block( { "kind": "loop", "end": inst.get_jump_target(), } )
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_SETUP_WITH(self, state, inst): cm = state.pop() # the context-manager yielded = state.make_temp() state.append(inst, contextmanager=cm) state.push_block( state.make_block( kind="WITH_FINALLY", end=inst.get_jump_target(), ) ) state.push(cm) state.push(yielded) state.push_block( state.make_block( kind="WITH", end=inst.get_jump_target(), ) ) # Forces a new block state.fork(pc=inst.next)
def op_SETUP_WITH(self, state, inst): cm = state.pop() # the context-manager state.push(cm) yielded = state.make_temp() state.push(yielded) state.append(inst, contextmanager=cm) state.push_block( { "kind": "with", "end": inst.get_jump_target(), } ) # Forces a new block state.fork(pc=inst.next)
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, state, inst): blk = state.pop_block() if blk["kind"] == BlockKind("TRY"): state.append(inst, kind="try") # Forces a new block state.fork(pc=inst.next)
def op_POP_BLOCK(self, state, inst): state.pop_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, bytecode, pc, nstack, blockstack): """ Parameters ---------- bytecode : numba.bytecode.ByteCode function bytecode pc : int program counter nstack : int stackdepth at entry blockstack : Sequence[Dict] A sequence of dictionary denoting entries on the blockstack. """ self._bytecode = bytecode self._pc_initial = pc self._pc = pc self._nstack_initial = nstack self._stack = [] self._blockstack_initial = tuple(blockstack) self._blockstack = list(blockstack) self._temp_registers = [] self._insts = [] self._outedges = [] self._terminated = False self._phis = {} self._outgoing_phis = UniqueDict() self._used_regs = set() for i in range(nstack): phi = self.make_temp("phi") self._phis[phi] = i self.push(phi)
def __init__(self, bytecode, pc, nstack, blockstack): """ Parameters ---------- bytecode : numba.bytecode.ByteCode function bytecode pc : int program counter nstack : int stackdepth at entry blockstack : Sequence[Dict] A sequence of dictionary denoting entries on the blockstack. """ self._bytecode = bytecode self._pc_initial = pc self._pc = pc self._nstack_initial = nstack self._stack = [] self._blockstack = list(blockstack) self._temp_registers = [] self._insts = [] self._outedges = [] self._terminated = False self._phis = {} self._outgoing_phis = UniqueDict() self._used_regs = set() for i in range(nstack): phi = self.make_temp("phi") self._phis[phi] = i self.push(phi)
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 push_block(self, synblk): """Push a block to blockstack""" assert "stack_depth" in synblk self._blockstack.append(synblk)
def push_block(self, synblk): d = synblk.copy() d["stack_depth"] = len(self._stack) self._blockstack.append(d)
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 pop_block(self): """Pop a block and unwind the stack""" b = self._blockstack.pop() self.reset_stack(b["stack_depth"]) return b
def pop_block(self): b = self._blockstack.pop() new_stack = self._stack[: b["stack_depth"]] _logger.debug("POP_BLOCK:\nold_stack=%s\nnew_stack=%s", self._stack, new_stack) self._stack = new_stack
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_top_block(self, kind): """Find the first block that matches *kind*""" kind = BlockKind(kind) for bs in reversed(self._blockstack): if bs["kind"] == kind: return bs
def get_top_block(self, kind): for bs in reversed(self._blockstack): if bs["kind"] == kind: return bs
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 fork(self, pc, npop=0, npush=0, extra_block=None): """Fork the state""" # Handle changes on the stack stack = list(self._stack) if npop: assert 0 <= npop <= len(self._stack) nstack = len(self._stack) - npop stack = stack[:nstack] if npush: assert 0 <= npush for i in range(npush): stack.append(self.make_temp()) # Handle changes on the blockstack blockstack = list(self._blockstack) if extra_block: blockstack.append(extra_block) self._outedges.append( Edge( pc=pc, stack=tuple(stack), npush=npush, blockstack=tuple(blockstack), ) ) self.terminate()
def fork(self, pc, npop=0): """Fork the state""" assert 0 <= npop <= len(self._stack) nstack = len(self._stack) - npop stack = self._stack[:nstack] self._outedges.append(Edge(pc=pc, stack=stack, blockstack=tuple(self._blockstack))) self.terminate()
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 adapt_state_infos(state): return AdaptBlockInfo( insts=tuple(state.instructions), outgoing_phis=state.outgoing_phis, blockstack=state.blockstack_initial, active_try_block=state.find_initial_try_block(), outgoing_edgepushed=state.get_outgoing_edgepushed(), )
def adapt_state_infos(state): return AdaptBlockInfo( insts=tuple(state.instructions), outgoing_phis=state.outgoing_phis )
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_item_pointer( context, builder, aryty, ary, inds, wraparound=False, boundscheck=False ): # Set boundscheck=True for any pointer access that should be # boundschecked. do_boundscheck() will handle enabling or disabling the # actual boundschecking based on the user config. shapes = unpack_tuple(builder, ary.shape, count=aryty.ndim) strides = unpack_tuple(builder, ary.strides, count=aryty.ndim) return get_item_pointer2( context, builder, data=ary.data, shape=shapes, strides=strides, layout=aryty.layout, inds=inds, wraparound=wraparound, boundscheck=boundscheck, )
def get_item_pointer(builder, aryty, ary, inds, wraparound=False): shapes = unpack_tuple(builder, ary.shape, count=aryty.ndim) strides = unpack_tuple(builder, ary.strides, count=aryty.ndim) return get_item_pointer2( builder, data=ary.data, shape=shapes, strides=strides, layout=aryty.layout, inds=inds, wraparound=wraparound, )
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_item_pointer2( context, builder, data, shape, strides, layout, inds, wraparound=False, boundscheck=False, ): # Set boundscheck=True for any pointer access that should be # boundschecked. do_boundscheck() will handle enabling or disabling the # actual boundschecking based on the user config. if wraparound: # Wraparound indices = [] for ind, dimlen in zip(inds, shape): negative = builder.icmp_signed("<", ind, ind.type(0)) wrapped = builder.add(dimlen, ind) selected = builder.select(negative, wrapped, ind) indices.append(selected) else: indices = inds if boundscheck: for axis, (ind, dimlen) in enumerate(zip(indices, shape)): do_boundscheck(context, builder, ind, dimlen, axis) if not indices: # Indexing with empty tuple return builder.gep(data, [int32_t(0)]) intp = indices[0].type # Indexing code if layout in "CF": steps = [] # Compute steps for each dimension if layout == "C": # C contiguous for i in range(len(shape)): last = intp(1) for j in shape[i + 1 :]: last = builder.mul(last, j) steps.append(last) elif layout == "F": # F contiguous for i in range(len(shape)): last = intp(1) for j in shape[:i]: last = builder.mul(last, j) steps.append(last) else: raise Exception("unreachable") # Compute index loc = intp(0) for i, s in zip(indices, steps): tmp = builder.mul(i, s) loc = builder.add(loc, tmp) ptr = builder.gep(data, [loc]) return ptr else: # Any layout dimoffs = [builder.mul(s, i) for s, i in zip(strides, indices)] offset = functools.reduce(builder.add, dimoffs) return pointer_add(builder, data, offset)
def get_item_pointer2(builder, data, shape, strides, layout, inds, wraparound=False): if wraparound: # Wraparound indices = [] for ind, dimlen in zip(inds, shape): negative = builder.icmp_signed("<", ind, ind.type(0)) wrapped = builder.add(dimlen, ind) selected = builder.select(negative, wrapped, ind) indices.append(selected) else: indices = inds if not indices: # Indexing with empty tuple return builder.gep(data, [int32_t(0)]) intp = indices[0].type # Indexing code if layout in "CF": steps = [] # Compute steps for each dimension if layout == "C": # C contiguous for i in range(len(shape)): last = intp(1) for j in shape[i + 1 :]: last = builder.mul(last, j) steps.append(last) elif layout == "F": # F contiguous for i in range(len(shape)): last = intp(1) for j in shape[:i]: last = builder.mul(last, j) steps.append(last) else: raise Exception("unreachable") # Compute index loc = intp(0) for i, s in zip(indices, steps): tmp = builder.mul(i, s) loc = builder.add(loc, tmp) ptr = builder.gep(data, [loc]) return ptr else: # Any layout dimoffs = [builder.mul(s, i) for s, i in zip(strides, indices)] offset = functools.reduce(builder.add, dimoffs) return pointer_add(builder, data, offset)
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 memset(builder, ptr, size, value): """ Fill *size* bytes starting from *ptr* with *value*. """ fn = builder.module.declare_intrinsic("llvm.memset", (voidptr_t, size.type)) ptr = builder.bitcast(ptr, voidptr_t) if isinstance(value, int): value = int8_t(value) builder.call(fn, [ptr, value, size, bool_t(0)])
def memset(builder, ptr, size, value): """ Fill *size* bytes starting from *ptr* with *value*. """ fn = builder.module.declare_intrinsic("llvm.memset", (voidptr_t, size.type)) ptr = builder.bitcast(ptr, voidptr_t) if isinstance(value, int): value = int8_t(value) builder.call(fn, [ptr, value, size, int32_t(0), bool_t(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 _raw_memcpy(builder, func_name, dst, src, count, itemsize, align): size_t = count.type if isinstance(itemsize, utils.INT_TYPES): itemsize = ir.Constant(size_t, itemsize) memcpy = builder.module.declare_intrinsic(func_name, [voidptr_t, voidptr_t, size_t]) is_volatile = false_bit builder.call( memcpy, [ builder.bitcast(dst, voidptr_t), builder.bitcast(src, voidptr_t), builder.mul(count, itemsize), is_volatile, ], )
def _raw_memcpy(builder, func_name, dst, src, count, itemsize, align): size_t = count.type if isinstance(itemsize, utils.INT_TYPES): itemsize = ir.Constant(size_t, itemsize) memcpy = builder.module.declare_intrinsic(func_name, [voidptr_t, voidptr_t, size_t]) align = ir.Constant(ir.IntType(32), align) is_volatile = false_bit builder.call( memcpy, [ builder.bitcast(dst, voidptr_t), builder.bitcast(src, voidptr_t), builder.mul(count, itemsize), align, is_volatile, ], )
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 unicode_charseq_split(a, sep=None, maxsplit=-1): if not ( maxsplit == -1 or isinstance(maxsplit, (types.Omitted, types.Integer, types.IntegerLiteral)) ): return None if isinstance(a, types.UnicodeCharSeq): if isinstance(sep, types.UnicodeCharSeq): def impl(a, sep=None, maxsplit=-1): return str(a).split(sep=str(sep), maxsplit=maxsplit) return impl if isinstance(sep, types.UnicodeType): def impl(a, sep=None, maxsplit=-1): return str(a).split(sep=sep, maxsplit=maxsplit) return impl if is_nonelike(sep): if is_default(maxsplit, -1): def impl(a, sep=None, maxsplit=-1): return str(a).split() else: def impl(a, sep=None, maxsplit=-1): return str(a).split(maxsplit=maxsplit) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if isinstance(sep, (types.CharSeq, types.Bytes)): def impl(a, sep=None, maxsplit=-1): return _map_bytes(a._to_str().split(sep._to_str(), maxsplit=maxsplit)) return impl if is_nonelike(sep): if is_default(maxsplit, -1): def impl(a, sep=None, maxsplit=-1): return _map_bytes(a._to_str().split()) else: def impl(a, sep=None, maxsplit=-1): return _map_bytes(a._to_str().split(maxsplit=maxsplit)) return impl
def unicode_charseq_split(a, sep=None, maxsplit=-1): if not ( maxsplit == -1 or isinstance(maxsplit, (types.Omitted, types.Integer, types.IntegerLiteral)) ): return None if isinstance(a, types.UnicodeCharSeq): if isinstance(sep, types.UnicodeCharSeq): def impl(a, sep, maxsplit=-1): return str(a).split(sep=str(sep), maxsplit=maxsplit) return impl if isinstance(sep, types.UnicodeType): def impl(a, sep, maxsplit=-1): return str(a).split(sep=sep, maxsplit=maxsplit) return impl if isinstance(sep, types.NoneType) or sep is None: if maxsplit == -1: def impl(a): return str(a).split() else: def impl(a, maxsplit=-1): return str(a).split(maxsplit=maxsplit) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if isinstance(sep, (types.CharSeq, types.Bytes)): def impl(a, sep, maxsplit=-1): return _map_bytes(a._to_str().split(sep._to_str(), maxsplit=maxsplit)) return impl if isinstance(sep, types.NoneType) or sep is None: if maxsplit == -1: def impl(a): return _map_bytes(a._to_str().split()) else: def impl(a, maxsplit=-1): return _map_bytes(a._to_str().split(maxsplit=maxsplit)) 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(a, sep=None, maxsplit=-1): return _map_bytes(a._to_str().split(maxsplit=maxsplit))
def impl(a, maxsplit=-1): return _map_bytes(a._to_str().split(maxsplit=maxsplit))
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 unicode_charseq_ljust(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if is_default(fillchar, " "): def impl(a, width, fillchar=" "): return str(a).ljust(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar=" "): return str(a).ljust(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar=" "): return str(a).ljust(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_default(fillchar, " ") or is_default(fillchar, b" "): def impl(a, width, fillchar=" "): return a._to_str().ljust(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar=" "): return a._to_str().ljust(width, fillchar._to_str())._to_bytes() return impl
def unicode_charseq_ljust(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if fillchar == " ": def impl(a, width): return str(a).ljust(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar): return str(a).ljust(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar): return str(a).ljust(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if fillchar == " " or fillchar == b" ": def impl(a, width): return a._to_str().ljust(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar): return a._to_str().ljust(width, fillchar._to_str())._to_bytes() 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(a, width, fillchar=" "): return str(a).ljust(width, fillchar)
def impl(a, width, fillchar): return str(a).ljust(width, fillchar)
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 unicode_charseq_rjust(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if is_default(fillchar, " "): def impl(a, width, fillchar=" "): return str(a).rjust(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar=" "): return str(a).rjust(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar=" "): return str(a).rjust(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_default(fillchar, " ") or is_default(fillchar, b" "): def impl(a, width, fillchar=" "): return a._to_str().rjust(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar=" "): return a._to_str().rjust(width, fillchar._to_str())._to_bytes() return impl
def unicode_charseq_rjust(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if fillchar == " ": def impl(a, width): return str(a).rjust(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar): return str(a).rjust(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar): return str(a).rjust(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if fillchar == " " or fillchar == b" ": def impl(a, width): return a._to_str().rjust(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar): return a._to_str().rjust(width, fillchar._to_str())._to_bytes() 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(a, width, fillchar=" "): return str(a).rjust(width, fillchar)
def impl(a, width, fillchar): return str(a).rjust(width, fillchar)
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 unicode_charseq_center(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if is_default(fillchar, " "): def impl(a, width, fillchar=" "): return str(a).center(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar=" "): return str(a).center(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar=" "): return str(a).center(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_default(fillchar, " ") or is_default(fillchar, b" "): def impl(a, width, fillchar=" "): return a._to_str().center(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar=" "): return a._to_str().center(width, fillchar._to_str())._to_bytes() return impl
def unicode_charseq_center(a, width, fillchar=" "): if isinstance(a, types.UnicodeCharSeq): if fillchar == " ": def impl(a, width): return str(a).center(width) return impl elif isinstance(fillchar, types.UnicodeCharSeq): def impl(a, width, fillchar): return str(a).center(width, str(fillchar)) return impl elif isinstance(fillchar, types.UnicodeType): def impl(a, width, fillchar): return str(a).center(width, fillchar) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if fillchar == " " or fillchar == b" ": def impl(a, width): return a._to_str().center(width)._to_bytes() return impl elif isinstance(fillchar, (types.CharSeq, types.Bytes)): def impl(a, width, fillchar): return a._to_str().center(width, fillchar._to_str())._to_bytes() 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(a, width, fillchar=" "): return str(a).center(width, fillchar)
def impl(a, width, fillchar): return str(a).center(width, fillchar)
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 unicode_charseq_lstrip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if is_nonelike(chars): def impl(a, chars=None): return str(a).lstrip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars=None): return str(a).lstrip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars=None): return str(a).lstrip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_nonelike(chars): def impl(a, chars=None): return a._to_str().lstrip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars=None): return a._to_str().lstrip(chars._to_str())._to_bytes() return impl
def unicode_charseq_lstrip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if chars is None or isinstance(chars, types.NoneType): def impl(a): return str(a).lstrip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars): return str(a).lstrip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars): return str(a).lstrip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if chars is None or isinstance(chars, types.NoneType): def impl(a): return a._to_str().lstrip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars): return a._to_str().lstrip(chars._to_str())._to_bytes() 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(a, chars=None): return str(a).lstrip(chars)
def impl(a, chars): return str(a).lstrip(chars)
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 unicode_charseq_rstrip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if is_nonelike(chars): def impl(a, chars=None): return str(a).rstrip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars=None): return str(a).rstrip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars=None): return str(a).rstrip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_nonelike(chars): def impl(a, chars=None): return a._to_str().rstrip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars=None): return a._to_str().rstrip(chars._to_str())._to_bytes() return impl
def unicode_charseq_rstrip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if chars is None or isinstance(chars, types.NoneType): def impl(a): return str(a).rstrip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars): return str(a).rstrip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars): return str(a).rstrip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if chars is None or isinstance(chars, types.NoneType): def impl(a): return a._to_str().rstrip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars): return a._to_str().rstrip(chars._to_str())._to_bytes() 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(a, chars=None): return str(a).rstrip(chars)
def impl(a, chars): return str(a).rstrip(chars)
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 unicode_charseq_strip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if is_nonelike(chars): def impl(a, chars=None): return str(a).strip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars=None): return str(a).strip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars=None): return str(a).strip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if is_nonelike(chars): def impl(a, chars=None): return a._to_str().strip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars=None): return a._to_str().strip(chars._to_str())._to_bytes() return impl
def unicode_charseq_strip(a, chars=None): if isinstance(a, types.UnicodeCharSeq): if chars is None or isinstance(chars, types.NoneType): def impl(a): return str(a).strip() return impl elif isinstance(chars, types.UnicodeCharSeq): def impl(a, chars): return str(a).strip(str(chars)) return impl elif isinstance(chars, types.UnicodeType): def impl(a, chars): return str(a).strip(chars) return impl if isinstance(a, (types.CharSeq, types.Bytes)): if chars is None or isinstance(chars, types.NoneType): def impl(a): return a._to_str().strip()._to_bytes() return impl elif isinstance(chars, (types.CharSeq, types.Bytes)): def impl(a, chars): return a._to_str().strip(chars._to_str())._to_bytes() 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(a, chars=None): return str(a).strip(chars)
def impl(a, chars): return str(a).strip(chars)
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 _rebuild( cls, target_context, libdata, fndesc, env, signature, objectmode, interpmode, lifted, typeann, reload_init, ): if reload_init: # Re-run all for fn in reload_init: fn() library = target_context.codegen().unserialize_library(libdata) cfunc = target_context.get_executable(library, fndesc, env) cr = cls( target_context=target_context, typing_context=target_context.typing_context, library=library, environment=env, entry_point=cfunc, fndesc=fndesc, type_annotation=typeann, signature=signature, objectmode=objectmode, interpmode=interpmode, lifted=lifted, typing_error=None, call_helper=None, metadata=None, # Do not store, arbitrary & potentially large! reload_init=reload_init, ) return cr
def _rebuild( cls, target_context, libdata, fndesc, env, signature, objectmode, interpmode, lifted, typeann, reload_init, ): if reload_init: # Re-run all for fn in reload_init: fn() library = target_context.codegen().unserialize_library(libdata) cfunc = target_context.get_executable(library, fndesc, env) cr = cls( target_context=target_context, typing_context=target_context.typing_context, library=library, environment=env, entry_point=cfunc, fndesc=fndesc, type_annotation=typeann, signature=signature, objectmode=objectmode, interpmode=interpmode, lifted=lifted, typing_error=None, call_helper=None, metadata=None, # Do not store, arbitrary and potentially large! reload_init=reload_init, ) return cr
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_subtarget(targetctx, flags): """ Make a new target context from the given target context and flags. """ subtargetoptions = {} if flags.debuginfo: subtargetoptions["enable_debuginfo"] = True if flags.boundscheck: subtargetoptions["enable_boundscheck"] = True if flags.nrt: subtargetoptions["enable_nrt"] = True if flags.auto_parallel: subtargetoptions["auto_parallel"] = flags.auto_parallel if flags.fastmath: subtargetoptions["fastmath"] = flags.fastmath error_model = callconv.create_error_model(flags.error_model, targetctx) subtargetoptions["error_model"] = error_model return targetctx.subtarget(**subtargetoptions)
def _make_subtarget(targetctx, flags): """ Make a new target context from the given target context and flags. """ subtargetoptions = {} if flags.debuginfo: subtargetoptions["enable_debuginfo"] = True if flags.boundcheck: subtargetoptions["enable_boundcheck"] = True if flags.nrt: subtargetoptions["enable_nrt"] = True if flags.auto_parallel: subtargetoptions["auto_parallel"] = flags.auto_parallel if flags.fastmath: subtargetoptions["fastmath"] = flags.fastmath error_model = callconv.create_error_model(flags.error_model, targetctx) subtargetoptions["error_model"] = error_model return targetctx.subtarget(**subtargetoptions)
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 _compile_core(self): """ Populate and run compiler pipeline """ pms = self.define_pipelines() for pm in pms: pipeline_name = pm.pipeline_name func_name = "%s.%s" % ( self.state.func_id.modname, self.state.func_id.func_qualname, ) event("Pipeline: %s for %s" % (pipeline_name, func_name)) self.state.metadata["pipeline_times"] = {pipeline_name: pm.exec_times} is_final_pipeline = pm == pms[-1] res = None try: pm.run(self.state) if self.state.cr is not None: break except _EarlyPipelineCompletion as e: res = e.result break except Exception as e: self.state.status.fail_reason = e if is_final_pipeline: raise e else: raise CompilerError("All available pipelines exhausted") # Pipeline is done, remove self reference to release refs to user code self.state.pipeline = None # organise a return if res is not None: # Early pipeline completion return res else: assert self.state.cr is not None return self.state.cr
def _compile_core(self): """ Populate and run compiler pipeline """ pms = self.define_pipelines() for pm in pms: pipeline_name = pm.pipeline_name event("Pipeline: %s" % pipeline_name) self.state.metadata["pipeline_times"] = {pipeline_name: pm.exec_times} is_final_pipeline = pm == pms[-1] res = None try: pm.run(self.state) if self.state.cr is not None: break except _EarlyPipelineCompletion as e: res = e.result break except Exception as e: self.state.status.fail_reason = e if is_final_pipeline: raise e else: raise CompilerError("All available pipelines exhausted") # Pipeline is done, remove self reference to release refs to user code self.state.pipeline = None # organise a return if res is not None: # Early pipeline completion return res else: assert self.state.cr is not None return self.state.cr
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 define_nopython_pipeline(state, name="nopython"): """Returns an nopython mode pipeline based PassManager""" pm = PassManager(name) if state.func_ir is None: pm.add_pass(TranslateByteCode, "analyzing bytecode") pm.add_pass(FixupArgs, "fix up args") pm.add_pass(IRProcessing, "processing IR") pm.add_pass(WithLifting, "Handle with contexts") # pre typing if not state.flags.no_rewrites: pm.add_pass(GenericRewrites, "nopython rewrites") pm.add_pass(RewriteSemanticConstants, "rewrite semantic constants") pm.add_pass(DeadBranchPrune, "dead branch pruning") pm.add_pass(InlineClosureLikes, "inline calls to locally defined closures") # convert any remaining closures into functions pm.add_pass(MakeFunctionToJitFunction, "convert make_function into JIT functions") # inline functions that have been determined as inlinable and rerun # branch pruning, this needs to be run after closures are inlined as # the IR repr of a closure masks call sites if an inlinable is called # inside a closure pm.add_pass(InlineInlinables, "inline inlinable functions") if not state.flags.no_rewrites: pm.add_pass(DeadBranchPrune, "dead branch pruning") pm.add_pass(FindLiterallyCalls, "find literally calls") pm.add_pass(LiteralUnroll, "handles literal_unroll") # typing pm.add_pass(NopythonTypeInference, "nopython frontend") pm.add_pass(AnnotateTypes, "annotate types") # optimisation pm.add_pass(InlineOverloads, "inline overloaded functions") if state.flags.auto_parallel.enabled: pm.add_pass(PreParforPass, "Preprocessing for parfors") if not state.flags.no_rewrites: pm.add_pass(NopythonRewrites, "nopython rewrites") if state.flags.auto_parallel.enabled: pm.add_pass(ParforPass, "convert to parfors") # legalise pm.add_pass(IRLegalization, "ensure IR is legal prior to lowering") # lower pm.add_pass(NoPythonBackend, "nopython mode backend") pm.add_pass(DumpParforDiagnostics, "dump parfor diagnostics") pm.finalize() return pm
def define_nopython_pipeline(state, name="nopython"): """Returns an nopython mode pipeline based PassManager""" pm = PassManager(name) if state.func_ir is None: pm.add_pass(TranslateByteCode, "analyzing bytecode") pm.add_pass(FixupArgs, "fix up args") pm.add_pass(IRProcessing, "processing IR") pm.add_pass(WithLifting, "Handle with contexts") # pre typing if not state.flags.no_rewrites: pm.add_pass(GenericRewrites, "nopython rewrites") pm.add_pass(RewriteSemanticConstants, "rewrite semantic constants") pm.add_pass(DeadBranchPrune, "dead branch pruning") pm.add_pass(InlineClosureLikes, "inline calls to locally defined closures") # convert any remaining closures into functions pm.add_pass(MakeFunctionToJitFunction, "convert make_function into JIT functions") # inline functions that have been determined as inlinable and rerun # branch pruning this needs to be run after closures are inlined as # the IR repr of a closure masks call sites if an inlinable is called # inside a closure pm.add_pass(InlineInlinables, "inline inlinable functions") if not state.flags.no_rewrites: pm.add_pass(DeadBranchPrune, "dead branch pruning") pm.add_pass(FindLiterallyCalls, "find literally calls") # typing pm.add_pass(NopythonTypeInference, "nopython frontend") pm.add_pass(AnnotateTypes, "annotate types") # optimisation pm.add_pass(InlineOverloads, "inline overloaded functions") if state.flags.auto_parallel.enabled: pm.add_pass(PreParforPass, "Preprocessing for parfors") if not state.flags.no_rewrites: pm.add_pass(NopythonRewrites, "nopython rewrites") if state.flags.auto_parallel.enabled: pm.add_pass(ParforPass, "convert to parfors") # legalise pm.add_pass(IRLegalization, "ensure IR is legal prior to lowering") # lower pm.add_pass(NoPythonBackend, "nopython mode backend") pm.add_pass(DumpParforDiagnostics, "dump parfor diagnostics") pm.finalize() return pm
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 define_objectmode_pipeline(state, name="object"): """Returns an object-mode pipeline based PassManager""" pm = PassManager(name) if state.func_ir is None: pm.add_pass(TranslateByteCode, "analyzing bytecode") pm.add_pass(FixupArgs, "fix up args") pm.add_pass(IRProcessing, "processing IR") if utils.PYVERSION >= (3, 7): # The following passes are needed to adjust for looplifting pm.add_pass(CanonicalizeLoopEntry, "canonicalize loop entry") pm.add_pass(CanonicalizeLoopExit, "canonicalize loop exit") pm.add_pass(ObjectModeFrontEnd, "object mode frontend") pm.add_pass(InlineClosureLikes, "inline calls to locally defined closures") # convert any remaining closures into functions pm.add_pass(MakeFunctionToJitFunction, "convert make_function into JIT functions") pm.add_pass(AnnotateTypes, "annotate types") pm.add_pass(IRLegalization, "ensure IR is legal prior to lowering") pm.add_pass(ObjectModeBackEnd, "object mode backend") pm.finalize() return pm
def define_objectmode_pipeline(state, name="object"): """Returns an object-mode pipeline based PassManager""" pm = PassManager(name) if state.func_ir is None: pm.add_pass(TranslateByteCode, "analyzing bytecode") pm.add_pass(FixupArgs, "fix up args") pm.add_pass(IRProcessing, "processing IR") pm.add_pass(ObjectModeFrontEnd, "object mode frontend") pm.add_pass(InlineClosureLikes, "inline calls to locally defined closures") # convert any remaining closures into functions pm.add_pass(MakeFunctionToJitFunction, "convert make_function into JIT functions") pm.add_pass(AnnotateTypes, "annotate types") pm.add_pass(IRLegalization, "ensure IR is legal prior to lowering") pm.add_pass(ObjectModeBackEnd, "object mode backend") pm.finalize() return pm
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 debug_print(pass_name, print_condition, printable_condition): if pass_name in print_condition: fid = internal_state.func_id args = ( fid.modname, fid.func_qualname, self.pipeline_name, printable_condition, pass_name, ) print(("%s.%s: %s: %s %s" % args).center(120, "-")) if internal_state.func_ir is not None: internal_state.func_ir.dump() else: print("func_ir is None")
def debug_print(*args, **kwargs): if _DEBUG: print(*args, **kwargs)
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 _debug_init(self): # determine after which passes IR dumps should take place def parse(conf_item): print_passes = [] if conf_item != "none": if conf_item == "all": print_passes = [x.name() for (x, _) in self.passes] else: # we don't validate whether the named passes exist in this # pipeline the compiler may be used reentrantly and # different pipelines may contain different passes splitted = conf_item.split(",") print_passes = [x.strip() for x in splitted] return print_passes ret = ( parse(config.DEBUG_PRINT_AFTER), parse(config.DEBUG_PRINT_BEFORE), parse(config.DEBUG_PRINT_WRAP), ) return ret
def _debug_init(self): # determine after which passes IR dumps should take place print_passes = [] if config.DEBUG_PRINT_AFTER != "none": if config.DEBUG_PRINT_AFTER == "all": print_passes = [x.name() for (x, _) in self.passes] else: # we don't validate whether the named passes exist in this # pipeline the compiler may be used reentrantly and different # pipelines may contain different passes splitted = config.DEBUG_PRINT_AFTER.split(",") print_passes = [x.strip() for x in splitted] return print_passes
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 finalize(self): """ Finalize the PassManager, after which no more passes may be added without re-finalization. """ self._analysis = self.dependency_analysis() self._print_after, self._print_before, self._print_wrap = self._debug_init() self._finalized = True
def finalize(self): """ Finalize the PassManager, after which no more passes may be added without re-finalization. """ self._analysis = self.dependency_analysis() self._print_after = self._debug_init() self._finalized = 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 _runPass(self, index, pss, internal_state): mutated = False def check(func, compiler_state): mangled = func(compiler_state) if mangled not in (True, False): msg = ( "CompilerPass implementations should return True/False. " "CompilerPass with name '%s' did not." ) raise ValueError(msg % pss.name()) return mangled def debug_print(pass_name, print_condition, printable_condition): if pass_name in print_condition: fid = internal_state.func_id args = ( fid.modname, fid.func_qualname, self.pipeline_name, printable_condition, pass_name, ) print(("%s.%s: %s: %s %s" % args).center(120, "-")) if internal_state.func_ir is not None: internal_state.func_ir.dump() else: print("func_ir is None") # debug print before this pass? debug_print(pss.name(), self._print_before + self._print_wrap, "BEFORE") # wire in the analysis info so it's accessible pss.analysis = self._analysis with SimpleTimer() as init_time: mutated |= check(pss.run_initialization, internal_state) with SimpleTimer() as pass_time: mutated |= check(pss.run_pass, internal_state) with SimpleTimer() as finalize_time: mutated |= check(pss.run_finalizer, internal_state) if self._ENFORCING: # TODO: Add in self consistency enforcement for # `func_ir._definitions` etc if _pass_registry.get(pss.__class__).mutates_CFG: if mutated: # block level changes, rebuild all PostProcessor(internal_state.func_ir).run() else: # CFG level changes rebuild CFG internal_state.func_ir.blocks = transforms.canonicalize_cfg( internal_state.func_ir.blocks ) # inject runtimes pt = pass_timings(init_time.elapsed, pass_time.elapsed, finalize_time.elapsed) self.exec_times["%s_%s" % (index, pss.name())] = pt # debug print after this pass? debug_print(pss.name(), self._print_after + self._print_wrap, "AFTER")
def _runPass(self, index, pss, internal_state): mutated = False def check(func, compiler_state): mangled = func(compiler_state) if mangled not in (True, False): msg = ( "CompilerPass implementations should return True/False. " "CompilerPass with name '%s' did not." ) raise ValueError(msg % pss.name()) return mangled # wire in the analysis info so it's accessible pss.analysis = self._analysis with SimpleTimer() as init_time: mutated |= check(pss.run_initialization, internal_state) with SimpleTimer() as pass_time: mutated |= check(pss.run_pass, internal_state) with SimpleTimer() as finalize_time: mutated |= check(pss.run_finalizer, internal_state) if self._ENFORCING: # TODO: Add in self consistency enforcement for # `func_ir._definitions` etc if _pass_registry.get(pss.__class__).mutates_CFG: if mutated: # block level changes, rebuild all PostProcessor(internal_state.func_ir).run() else: # CFG level changes rebuild CFG internal_state.func_ir.blocks = transforms.canonicalize_cfg( internal_state.func_ir.blocks ) # inject runtimes pt = pass_timings(init_time.elapsed, pass_time.elapsed, finalize_time.elapsed) self.exec_times["%s_%s" % (index, pss.name())] = pt # debug print after this pass? if pss.name() in self._print_after: fid = internal_state.func_id args = (fid.modname, fid.func_qualname, self.pipeline_name, pss.name()) print(("%s.%s: %s: %s" % args).center(80, "-")) internal_state.func_ir.dump()
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 process_environ(self, environ): def _readenv(name, ctor, default): value = environ.get(name) if value is None: return default() if callable(default) else default try: return ctor(value) except Exception: warnings.warn( "environ %s defined but failed to parse '%s'" % (name, value), RuntimeWarning, ) return default def optional_str(x): return str(x) if x is not None else None # developer mode produces full tracebacks, disables help instructions DEVELOPER_MODE = _readenv("NUMBA_DEVELOPER_MODE", int, 0) # disable performance warnings, will switch of the generation of # warnings of the class NumbaPerformanceWarning DISABLE_PERFORMANCE_WARNINGS = _readenv( "NUMBA_DISABLE_PERFORMANCE_WARNINGS", int, 0 ) # Flag to enable full exception reporting FULL_TRACEBACKS = _readenv("NUMBA_FULL_TRACEBACKS", int, DEVELOPER_MODE) # Show help text when an error occurs SHOW_HELP = _readenv("NUMBA_SHOW_HELP", int, not DEVELOPER_MODE) # The color scheme to use for error messages, default is no color # just bold fonts in use. COLOR_SCHEME = _readenv("NUMBA_COLOR_SCHEME", str, "no_color") # Whether to globally enable bounds checking. The default None means # to use the value of the flag to @njit. 0 or 1 overrides the flag # globally. BOUNDSCHECK = _readenv("NUMBA_BOUNDSCHECK", int, None) # Debug flag to control compiler debug print DEBUG = _readenv("NUMBA_DEBUG", int, 0) # DEBUG print IR after pass names DEBUG_PRINT_AFTER = _readenv("NUMBA_DEBUG_PRINT_AFTER", str, "none") # DEBUG print IR before pass names DEBUG_PRINT_BEFORE = _readenv("NUMBA_DEBUG_PRINT_BEFORE", str, "none") # DEBUG print IR before and after pass names DEBUG_PRINT_WRAP = _readenv("NUMBA_DEBUG_PRINT_WRAP", str, "none") # Highlighting in intermediate dumps HIGHLIGHT_DUMPS = _readenv("NUMBA_HIGHLIGHT_DUMPS", int, 0) # JIT Debug flag to trigger IR instruction print DEBUG_JIT = _readenv("NUMBA_DEBUG_JIT", int, 0) # Enable debugging of front-end operation # (up to and including IR generation) DEBUG_FRONTEND = _readenv("NUMBA_DEBUG_FRONTEND", int, 0) # How many recently deserialized functions to retain regardless # of external references FUNCTION_CACHE_SIZE = _readenv("NUMBA_FUNCTION_CACHE_SIZE", int, 128) # Enable logging of cache operation DEBUG_CACHE = _readenv("NUMBA_DEBUG_CACHE", int, DEBUG) # Redirect cache directory # Contains path to the directory CACHE_DIR = _readenv("NUMBA_CACHE_DIR", str, "") # Enable tracing support TRACE = _readenv("NUMBA_TRACE", int, 0) # Enable debugging of type inference DEBUG_TYPEINFER = _readenv("NUMBA_DEBUG_TYPEINFER", int, 0) # Configure compilation target to use the specified CPU name # and CPU feature as the host information. # Note: this overrides "host" option for AOT compilation. CPU_NAME = _readenv("NUMBA_CPU_NAME", optional_str, None) CPU_FEATURES = _readenv( "NUMBA_CPU_FEATURES", optional_str, ("" if str(CPU_NAME).lower() == "generic" else None), ) # Optimization level OPT = _readenv("NUMBA_OPT", int, 3) # Force dump of Python bytecode DUMP_BYTECODE = _readenv("NUMBA_DUMP_BYTECODE", int, DEBUG_FRONTEND) # Force dump of control flow graph DUMP_CFG = _readenv("NUMBA_DUMP_CFG", int, DEBUG_FRONTEND) # Force dump of Numba IR DUMP_IR = _readenv("NUMBA_DUMP_IR", int, DEBUG_FRONTEND or DEBUG_TYPEINFER) # print debug info of analysis and optimization on array operations DEBUG_ARRAY_OPT = _readenv("NUMBA_DEBUG_ARRAY_OPT", int, 0) # insert debug stmts to print information at runtime DEBUG_ARRAY_OPT_RUNTIME = _readenv("NUMBA_DEBUG_ARRAY_OPT_RUNTIME", int, 0) # print stats about parallel for-loops DEBUG_ARRAY_OPT_STATS = _readenv("NUMBA_DEBUG_ARRAY_OPT_STATS", int, 0) # prints user friendly information about parllel PARALLEL_DIAGNOSTICS = _readenv("NUMBA_PARALLEL_DIAGNOSTICS", int, 0) # print debug info of inline closure pass DEBUG_INLINE_CLOSURE = _readenv("NUMBA_DEBUG_INLINE_CLOSURE", int, 0) # Force dump of LLVM IR DUMP_LLVM = _readenv("NUMBA_DUMP_LLVM", int, DEBUG) # Force dump of Function optimized LLVM IR DUMP_FUNC_OPT = _readenv("NUMBA_DUMP_FUNC_OPT", int, DEBUG) # Force dump of Optimized LLVM IR DUMP_OPTIMIZED = _readenv("NUMBA_DUMP_OPTIMIZED", int, DEBUG) # Force disable loop vectorize # Loop vectorizer is disabled on 32-bit win32 due to a bug (#649) LOOP_VECTORIZE = _readenv("NUMBA_LOOP_VECTORIZE", int, not (IS_WIN32 and IS_32BITS)) # Force dump of generated assembly DUMP_ASSEMBLY = _readenv("NUMBA_DUMP_ASSEMBLY", int, DEBUG) # Force dump of type annotation ANNOTATE = _readenv("NUMBA_DUMP_ANNOTATION", int, 0) # Dump IR in such as way as to aid in "diff"ing. DIFF_IR = _readenv("NUMBA_DIFF_IR", int, 0) # Dump type annotation in html format def fmt_html_path(path): if path is None: return path else: return os.path.abspath(path) HTML = _readenv("NUMBA_DUMP_HTML", fmt_html_path, None) # Allow interpreter fallback so that Numba @jit decorator will never # fail. Use for migrating from old numba (<0.12) which supported # closure, and other yet-to-be-supported features. COMPATIBILITY_MODE = _readenv("NUMBA_COMPATIBILITY_MODE", int, 0) # x86-64 specific # Enable AVX on supported platforms where it won't degrade performance. def avx_default(): if not _os_supports_avx(): return False else: # There are various performance issues with AVX and LLVM # on some CPUs (list at # http://llvm.org/bugs/buglist.cgi?quicksearch=avx). # For now we'd rather disable it, since it can pessimize code cpu_name = ll.get_host_cpu_name() return cpu_name not in ( "corei7-avx", "core-avx-i", "sandybridge", "ivybridge", ) ENABLE_AVX = _readenv("NUMBA_ENABLE_AVX", int, avx_default) # if set and SVML is available, it will be disabled # By default, it's disabled on 32-bit platforms. DISABLE_INTEL_SVML = _readenv("NUMBA_DISABLE_INTEL_SVML", int, IS_32BITS) # Disable jit for debugging DISABLE_JIT = _readenv("NUMBA_DISABLE_JIT", int, 0) # choose parallel backend to use THREADING_LAYER = _readenv("NUMBA_THREADING_LAYER", str, "default") # CUDA Configs # Force CUDA compute capability to a specific version FORCE_CUDA_CC = _readenv("NUMBA_FORCE_CUDA_CC", _parse_cc, None) # Disable CUDA support DISABLE_CUDA = _readenv("NUMBA_DISABLE_CUDA", int, int(MACHINE_BITS == 32)) # Enable CUDA simulator ENABLE_CUDASIM = _readenv("NUMBA_ENABLE_CUDASIM", int, 0) # CUDA logging level # Any level name from the *logging* module. Case insensitive. # Defaults to CRITICAL if not set or invalid. # Note: This setting only applies when logging is not configured. # Any existing logging configuration is preserved. CUDA_LOG_LEVEL = _readenv("NUMBA_CUDA_LOG_LEVEL", str, "") # Maximum number of pending CUDA deallocations (default: 10) CUDA_DEALLOCS_COUNT = _readenv("NUMBA_CUDA_MAX_PENDING_DEALLOCS_COUNT", int, 10) # Maximum ratio of pending CUDA deallocations to capacity (default: 0.2) CUDA_DEALLOCS_RATIO = _readenv("NUMBA_CUDA_MAX_PENDING_DEALLOCS_RATIO", float, 0.2) # HSA Configs # Disable HSA support DISABLE_HSA = _readenv("NUMBA_DISABLE_HSA", int, 0) # The default number of threads to use. NUMBA_DEFAULT_NUM_THREADS = max(1, multiprocessing.cpu_count()) # Numba thread pool size (defaults to number of CPUs on the system). NUMBA_NUM_THREADS = _readenv("NUMBA_NUM_THREADS", int, NUMBA_DEFAULT_NUM_THREADS) # Profiling support # Indicates if a profiler detected. Only VTune can be detected for now RUNNING_UNDER_PROFILER = "VS_PROFILER" in os.environ # Enables jit events in LLVM to support profiling of dynamic code ENABLE_PROFILING = _readenv( "NUMBA_ENABLE_PROFILING", int, int(RUNNING_UNDER_PROFILER) ) # Debug Info # The default value for the `debug` flag DEBUGINFO_DEFAULT = _readenv("NUMBA_DEBUGINFO", int, ENABLE_PROFILING) CUDA_DEBUGINFO_DEFAULT = _readenv("NUMBA_CUDA_DEBUGINFO", int, 0) # gdb binary location GDB_BINARY = _readenv("NUMBA_GDB_BINARY", str, "/usr/bin/gdb") # Inject the configuration values into the module globals for name, value in locals().copy().items(): if name.isupper(): globals()[name] = value
def process_environ(self, environ): def _readenv(name, ctor, default): value = environ.get(name) if value is None: return default() if callable(default) else default try: return ctor(value) except Exception: warnings.warn( "environ %s defined but failed to parse '%s'" % (name, value), RuntimeWarning, ) return default def optional_str(x): return str(x) if x is not None else None # developer mode produces full tracebacks, disables help instructions DEVELOPER_MODE = _readenv("NUMBA_DEVELOPER_MODE", int, 0) # disable performance warnings, will switch of the generation of # warnings of the class NumbaPerformanceWarning DISABLE_PERFORMANCE_WARNINGS = _readenv( "NUMBA_DISABLE_PERFORMANCE_WARNINGS", int, 0 ) # Flag to enable full exception reporting FULL_TRACEBACKS = _readenv("NUMBA_FULL_TRACEBACKS", int, DEVELOPER_MODE) # Show help text when an error occurs SHOW_HELP = _readenv("NUMBA_SHOW_HELP", int, not DEVELOPER_MODE) # The color scheme to use for error messages, default is no color # just bold fonts in use. COLOR_SCHEME = _readenv("NUMBA_COLOR_SCHEME", str, "no_color") # Debug flag to control compiler debug print DEBUG = _readenv("NUMBA_DEBUG", int, 0) # DEBUG print IR after pass names DEBUG_PRINT_AFTER = _readenv("NUMBA_DEBUG_PRINT_AFTER", str, "none") # JIT Debug flag to trigger IR instruction print DEBUG_JIT = _readenv("NUMBA_DEBUG_JIT", int, 0) # Enable debugging of front-end operation # (up to and including IR generation) DEBUG_FRONTEND = _readenv("NUMBA_DEBUG_FRONTEND", int, 0) # How many recently deserialized functions to retain regardless # of external references FUNCTION_CACHE_SIZE = _readenv("NUMBA_FUNCTION_CACHE_SIZE", int, 128) # Enable logging of cache operation DEBUG_CACHE = _readenv("NUMBA_DEBUG_CACHE", int, DEBUG) # Redirect cache directory # Contains path to the directory CACHE_DIR = _readenv("NUMBA_CACHE_DIR", str, "") # Enable tracing support TRACE = _readenv("NUMBA_TRACE", int, 0) # Enable debugging of type inference DEBUG_TYPEINFER = _readenv("NUMBA_DEBUG_TYPEINFER", int, 0) # Configure compilation target to use the specified CPU name # and CPU feature as the host information. # Note: this overrides "host" option for AOT compilation. CPU_NAME = _readenv("NUMBA_CPU_NAME", optional_str, None) CPU_FEATURES = _readenv( "NUMBA_CPU_FEATURES", optional_str, ("" if str(CPU_NAME).lower() == "generic" else None), ) # Optimization level OPT = _readenv("NUMBA_OPT", int, 3) # Force dump of Python bytecode DUMP_BYTECODE = _readenv("NUMBA_DUMP_BYTECODE", int, DEBUG_FRONTEND) # Force dump of control flow graph DUMP_CFG = _readenv("NUMBA_DUMP_CFG", int, DEBUG_FRONTEND) # Force dump of Numba IR DUMP_IR = _readenv("NUMBA_DUMP_IR", int, DEBUG_FRONTEND or DEBUG_TYPEINFER) # print debug info of analysis and optimization on array operations DEBUG_ARRAY_OPT = _readenv("NUMBA_DEBUG_ARRAY_OPT", int, 0) # insert debug stmts to print information at runtime DEBUG_ARRAY_OPT_RUNTIME = _readenv("NUMBA_DEBUG_ARRAY_OPT_RUNTIME", int, 0) # print stats about parallel for-loops DEBUG_ARRAY_OPT_STATS = _readenv("NUMBA_DEBUG_ARRAY_OPT_STATS", int, 0) # prints user friendly information about parllel PARALLEL_DIAGNOSTICS = _readenv("NUMBA_PARALLEL_DIAGNOSTICS", int, 0) # print debug info of inline closure pass DEBUG_INLINE_CLOSURE = _readenv("NUMBA_DEBUG_INLINE_CLOSURE", int, 0) # Force dump of LLVM IR DUMP_LLVM = _readenv("NUMBA_DUMP_LLVM", int, DEBUG) # Force dump of Function optimized LLVM IR DUMP_FUNC_OPT = _readenv("NUMBA_DUMP_FUNC_OPT", int, DEBUG) # Force dump of Optimized LLVM IR DUMP_OPTIMIZED = _readenv("NUMBA_DUMP_OPTIMIZED", int, DEBUG) # Force disable loop vectorize # Loop vectorizer is disabled on 32-bit win32 due to a bug (#649) LOOP_VECTORIZE = _readenv("NUMBA_LOOP_VECTORIZE", int, not (IS_WIN32 and IS_32BITS)) # Force dump of generated assembly DUMP_ASSEMBLY = _readenv("NUMBA_DUMP_ASSEMBLY", int, DEBUG) # Force dump of type annotation ANNOTATE = _readenv("NUMBA_DUMP_ANNOTATION", int, 0) # Dump IR in such as way as to aid in "diff"ing. DIFF_IR = _readenv("NUMBA_DIFF_IR", int, 0) # Dump type annotation in html format def fmt_html_path(path): if path is None: return path else: return os.path.abspath(path) HTML = _readenv("NUMBA_DUMP_HTML", fmt_html_path, None) # Allow interpreter fallback so that Numba @jit decorator will never # fail. Use for migrating from old numba (<0.12) which supported # closure, and other yet-to-be-supported features. COMPATIBILITY_MODE = _readenv("NUMBA_COMPATIBILITY_MODE", int, 0) # x86-64 specific # Enable AVX on supported platforms where it won't degrade performance. def avx_default(): if not _os_supports_avx(): return False else: # There are various performance issues with AVX and LLVM # on some CPUs (list at # http://llvm.org/bugs/buglist.cgi?quicksearch=avx). # For now we'd rather disable it, since it can pessimize code cpu_name = ll.get_host_cpu_name() return cpu_name not in ( "corei7-avx", "core-avx-i", "sandybridge", "ivybridge", ) ENABLE_AVX = _readenv("NUMBA_ENABLE_AVX", int, avx_default) # if set and SVML is available, it will be disabled # By default, it's disabled on 32-bit platforms. DISABLE_INTEL_SVML = _readenv("NUMBA_DISABLE_INTEL_SVML", int, IS_32BITS) # Disable jit for debugging DISABLE_JIT = _readenv("NUMBA_DISABLE_JIT", int, 0) # choose parallel backend to use THREADING_LAYER = _readenv("NUMBA_THREADING_LAYER", str, "default") # CUDA Configs # Force CUDA compute capability to a specific version FORCE_CUDA_CC = _readenv("NUMBA_FORCE_CUDA_CC", _parse_cc, None) # Disable CUDA support DISABLE_CUDA = _readenv("NUMBA_DISABLE_CUDA", int, int(MACHINE_BITS == 32)) # Enable CUDA simulator ENABLE_CUDASIM = _readenv("NUMBA_ENABLE_CUDASIM", int, 0) # CUDA logging level # Any level name from the *logging* module. Case insensitive. # Defaults to CRITICAL if not set or invalid. # Note: This setting only applies when logging is not configured. # Any existing logging configuration is preserved. CUDA_LOG_LEVEL = _readenv("NUMBA_CUDA_LOG_LEVEL", str, "") # Maximum number of pending CUDA deallocations (default: 10) CUDA_DEALLOCS_COUNT = _readenv("NUMBA_CUDA_MAX_PENDING_DEALLOCS_COUNT", int, 10) # Maximum ratio of pending CUDA deallocations to capacity (default: 0.2) CUDA_DEALLOCS_RATIO = _readenv("NUMBA_CUDA_MAX_PENDING_DEALLOCS_RATIO", float, 0.2) # HSA Configs # Disable HSA support DISABLE_HSA = _readenv("NUMBA_DISABLE_HSA", int, 0) # The default number of threads to use. NUMBA_DEFAULT_NUM_THREADS = max(1, multiprocessing.cpu_count()) # Numba thread pool size (defaults to number of CPUs on the system). NUMBA_NUM_THREADS = _readenv("NUMBA_NUM_THREADS", int, NUMBA_DEFAULT_NUM_THREADS) # Profiling support # Indicates if a profiler detected. Only VTune can be detected for now RUNNING_UNDER_PROFILER = "VS_PROFILER" in os.environ # Enables jit events in LLVM to support profiling of dynamic code ENABLE_PROFILING = _readenv( "NUMBA_ENABLE_PROFILING", int, int(RUNNING_UNDER_PROFILER) ) # Debug Info # The default value for the `debug` flag DEBUGINFO_DEFAULT = _readenv("NUMBA_DEBUGINFO", int, ENABLE_PROFILING) CUDA_DEBUGINFO_DEFAULT = _readenv("NUMBA_CUDA_DEBUGINFO", int, 0) # gdb binary location GDB_BINARY = _readenv("NUMBA_GDB_BINARY", str, "/usr/bin/gdb") # Inject the configuration values into the module globals for name, value in locals().copy().items(): if name.isupper(): globals()[name] = 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 add_edge(self, src, dest, data=None): """ Add an edge from node *src* to node *dest*, with optional per-edge *data*. If such an edge already exists, it is replaced (duplicate edges are not possible). """ if src not in self._nodes: raise ValueError( "Cannot add edge as src node %s not in nodes %s" % (src, self._nodes) ) if dest not in self._nodes: raise ValueError( "Cannot add edge as dest node %s not in nodes %s" % (dest, self._nodes) ) self._add_edge(src, dest, data)
def add_edge(self, src, dest, data=None): """ Add an edge from node *src* to node *dest*, with optional per-edge *data*. If such an edge already exists, it is replaced (duplicate edges are not possible). """ assert src in self._nodes assert dest in self._nodes self._add_edge(src, dest, data)
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): for inst in self._iter_inst(): fname = "op_%s" % inst.opname fn = getattr(self, fname, None) if fn is not None: fn(inst) elif inst.is_jump: # this catches e.g. try... except l = Loc(self.bytecode.func_id.filename, inst.lineno) if inst.opname in {"SETUP_EXCEPT", "SETUP_FINALLY"}: msg = "'try' block not supported until python3.7 or later" else: msg = "Use of unsupported opcode (%s) found" % inst.opname raise UnsupportedError(msg, loc=l) else: # Non-jump instructions are ignored pass # intentionally # Close all blocks for cur, nxt in zip(self.blockseq, self.blockseq[1:]): blk = self.blocks[cur] if not blk.outgoing_jumps and not blk.terminating: blk.outgoing_jumps[nxt] = 0 graph = CFGraph() for b in self.blocks: graph.add_node(b) for b in self.blocks.values(): for out, pops in b.outgoing_jumps.items(): graph.add_edge(b.offset, out, pops) graph.set_entry_point(min(self.blocks)) graph.process() self.graph = graph # Fill incoming for b in utils.itervalues(self.blocks): for out, pops in b.outgoing_jumps.items(): self.blocks[out].incoming_jumps[b.offset] = pops # Find liveblocks self.liveblocks = dict((i, self.blocks[i]) for i in self.graph.nodes()) for lastblk in reversed(self.blockseq): if lastblk in self.liveblocks: break else: raise AssertionError("No live block that exits!?") # Find backbone backbone = self.graph.backbone() # Filter out in loop blocks (Assuming no other cyclic control blocks) # This is to unavoid variable defined in loops to be considered as # function scope. inloopblocks = set() for b in self.blocks.keys(): if self.graph.in_loops(b): inloopblocks.add(b) self.backbone = backbone - inloopblocks
def run(self): for inst in self._iter_inst(): fname = "op_%s" % inst.opname fn = getattr(self, fname, None) if fn is not None: fn(inst) else: # this catches e.g. try... except if inst.is_jump: l = Loc(self.bytecode.func_id.filename, inst.lineno) msg = "Use of unsupported opcode (%s) found" % inst.opname raise UnsupportedError(msg, loc=l) # Close all blocks for cur, nxt in zip(self.blockseq, self.blockseq[1:]): blk = self.blocks[cur] if not blk.outgoing_jumps and not blk.terminating: blk.outgoing_jumps[nxt] = 0 graph = CFGraph() for b in self.blocks: graph.add_node(b) for b in self.blocks.values(): for out, pops in b.outgoing_jumps.items(): graph.add_edge(b.offset, out, pops) graph.set_entry_point(min(self.blocks)) graph.process() self.graph = graph # Fill incoming for b in utils.itervalues(self.blocks): for out, pops in b.outgoing_jumps.items(): self.blocks[out].incoming_jumps[b.offset] = pops # Find liveblocks self.liveblocks = dict((i, self.blocks[i]) for i in self.graph.nodes()) for lastblk in reversed(self.blockseq): if lastblk in self.liveblocks: break else: raise AssertionError("No live block that exits!?") # Find backbone backbone = self.graph.backbone() # Filter out in loop blocks (Assuming no other cyclic control blocks) # This is to unavoid variable defined in loops to be considered as # function scope. inloopblocks = set() for b in self.blocks.keys(): if self.graph.in_loops(b): inloopblocks.add(b) self.backbone = backbone - inloopblocks
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 __eq__(self, other): if not isinstance(other, CFGraph): raise NotImplementedError # A few derived items are checked to makes sure process() has been # invoked equally. for x in [ "_nodes", "_edge_data", "_entry_point", "_preds", "_succs", "_doms", "_back_edges", ]: this = getattr(self, x, None) that = getattr(other, x, None) if this != that: return False return True
def __eq__(self, other): return isinstance(other, Loop) and other.header == self.header
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 compile_cuda(pyfunc, return_type, args, debug, inline): # First compilation will trigger the initialization of the CUDA backend. from .descriptor import CUDATargetDesc typingctx = CUDATargetDesc.typingctx targetctx = CUDATargetDesc.targetctx # TODO handle debug flag flags = compiler.Flags() # Do not compile (generate native code), just lower (to LLVM) flags.set("no_compile") flags.set("no_cpython_wrapper") if debug: flags.set("debuginfo") if inline: flags.set("forceinline") # Run compilation pipeline cres = compiler.compile_extra( typingctx=typingctx, targetctx=targetctx, func=pyfunc, args=args, return_type=return_type, flags=flags, locals={}, ) library = cres.library library.finalize() return cres
def compile_cuda(pyfunc, return_type, args, debug, inline): # First compilation will trigger the initialization of the CUDA backend. from .descriptor import CUDATargetDesc typingctx = CUDATargetDesc.typingctx targetctx = CUDATargetDesc.targetctx # TODO handle debug flag flags = compiler.Flags() # Do not compile (generate native code), just lower (to LLVM) flags.set("no_compile") flags.set("no_cpython_wrapper") if debug: flags.set("boundcheck") flags.set("debuginfo") if inline: flags.set("forceinline") # Run compilation pipeline cres = compiler.compile_extra( typingctx=typingctx, targetctx=targetctx, func=pyfunc, args=args, return_type=return_type, flags=flags, locals={}, ) library = cres.library library.finalize() return cres
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 _atomic_dispatcher(dispatch_fn): def imp(context, builder, sig, args): # The common argument handling code aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype indty, indices = _normalize_indices(context, builder, indty, inds) if dtype != valty: raise TypeError("expect %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) # dispatcher to implementation base on dtype return dispatch_fn(context, builder, dtype, ptr, val) return imp
def _atomic_dispatcher(dispatch_fn): def imp(context, builder, sig, args): # The common argument handling code aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype indty, indices = _normalize_indices(context, builder, indty, inds) if dtype != valty: raise TypeError("expect %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) # dispatcher to implementation base on dtype return dispatch_fn(context, builder, dtype, ptr, val) return 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 imp(context, builder, sig, args): # The common argument handling code aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype indty, indices = _normalize_indices(context, builder, indty, inds) if dtype != valty: raise TypeError("expect %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) # dispatcher to implementation base on dtype return dispatch_fn(context, builder, dtype, ptr, val)
def imp(context, builder, sig, args): # The common argument handling code aryty, indty, valty = sig.args ary, inds, val = args dtype = aryty.dtype indty, indices = _normalize_indices(context, builder, indty, inds) if dtype != valty: raise TypeError("expect %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) # dispatcher to implementation base on dtype return dispatch_fn(context, builder, dtype, ptr, 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 ptx_atomic_cas_tuple(context, builder, sig, args): aryty, oldty, valty = sig.args ary, old, val = args dtype = aryty.dtype lary = context.make_array(aryty)(context, builder, ary) zero = context.get_constant(types.intp, 0) ptr = cgutils.get_item_pointer(context, builder, aryty, lary, (zero,)) if aryty.dtype == types.int32: lmod = builder.module return builder.call(nvvmutils.declare_atomic_cas_int32(lmod), (ptr, old, val)) else: raise TypeError("Unimplemented atomic compare_and_swap with %s array" % dtype)
def ptx_atomic_cas_tuple(context, builder, sig, args): aryty, oldty, valty = sig.args ary, old, val = args dtype = aryty.dtype lary = context.make_array(aryty)(context, builder, ary) zero = context.get_constant(types.intp, 0) ptr = cgutils.get_item_pointer(builder, aryty, lary, (zero,)) if aryty.dtype == types.int32: lmod = builder.module return builder.call(nvvmutils.declare_atomic_cas_int32(lmod), (ptr, old, val)) else: raise TypeError("Unimplemented atomic compare_and_swap with %s array" % 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 jit( func_or_sig=None, argtypes=None, device=False, inline=False, bind=True, link=[], debug=None, **kws, ): """ JIT compile a python function conforming to the CUDA Python specification. If a signature is supplied, then a function is returned that takes a function to compile. If :param func_or_sig: A function to JIT compile, or a signature of a function to compile. If a function is supplied, then an :class:`AutoJitCUDAKernel` is returned. If a signature is supplied, then a function which takes a function to compile and returns an :class:`AutoJitCUDAKernel` is returned. .. note:: A kernel cannot have any return value. :type func_or_sig: function or numba.typing.Signature :param device: Indicates whether this is a device function. :type device: bool :param bind: Force binding to CUDA context immediately :type bind: bool :param link: A list of files containing PTX source to link with the function :type link: list :param debug: If True, check for exceptions thrown when executing the kernel. Since this degrades performance, this should only be used for debugging purposes. Defaults to False. (The default value can be overriden by setting environment variable ``NUMBA_CUDA_DEBUGINFO=1``.) :param fastmath: If true, enables flush-to-zero and fused-multiply-add, disables precise division and square root. This parameter has no effect on device function, whose fastmath setting depends on the kernel function from which they are called. :param max_registers: Limit the kernel to using at most this number of registers per thread. Useful for increasing occupancy. """ debug = config.CUDA_DEBUGINFO_DEFAULT if debug is None else debug if link and config.ENABLE_CUDASIM: raise NotImplementedError("Cannot link PTX in the simulator") if "boundscheck" in kws: raise NotImplementedError("bounds checking is not supported for CUDA") fastmath = kws.get("fastmath", False) if argtypes is None and not sigutils.is_signature(func_or_sig): if func_or_sig is None: if config.ENABLE_CUDASIM: def autojitwrapper(func): return FakeCUDAKernel( func, device=device, fastmath=fastmath, debug=debug ) else: def autojitwrapper(func): return jit(func, device=device, bind=bind, debug=debug, **kws) return autojitwrapper # func_or_sig is a function else: if config.ENABLE_CUDASIM: return FakeCUDAKernel( func_or_sig, device=device, fastmath=fastmath, debug=debug ) elif device: return jitdevice(func_or_sig, debug=debug, **kws) else: targetoptions = kws.copy() targetoptions["debug"] = debug return AutoJitCUDAKernel( func_or_sig, bind=bind, targetoptions=targetoptions ) else: if config.ENABLE_CUDASIM: def jitwrapper(func): return FakeCUDAKernel( func, device=device, fastmath=fastmath, debug=debug ) return jitwrapper restype, argtypes = convert_types(func_or_sig, argtypes) if restype and not device and restype != types.void: raise TypeError("CUDA kernel must have void return type.") def kernel_jit(func): kernel = compile_kernel( func, argtypes, link=link, debug=debug, inline=inline, fastmath=fastmath ) # Force compilation for the current context if bind: kernel.bind() return kernel def device_jit(func): return compile_device(func, restype, argtypes, inline=inline, debug=debug) if device: return device_jit else: return kernel_jit
def jit( func_or_sig=None, argtypes=None, device=False, inline=False, bind=True, link=[], debug=None, **kws, ): """ JIT compile a python function conforming to the CUDA Python specification. If a signature is supplied, then a function is returned that takes a function to compile. If :param func_or_sig: A function to JIT compile, or a signature of a function to compile. If a function is supplied, then an :class:`AutoJitCUDAKernel` is returned. If a signature is supplied, then a function which takes a function to compile and returns an :class:`AutoJitCUDAKernel` is returned. .. note:: A kernel cannot have any return value. :type func_or_sig: function or numba.typing.Signature :param device: Indicates whether this is a device function. :type device: bool :param bind: Force binding to CUDA context immediately :type bind: bool :param link: A list of files containing PTX source to link with the function :type link: list :param debug: If True, check for exceptions thrown when executing the kernel. Since this degrades performance, this should only be used for debugging purposes. Defaults to False. (The default value can be overriden by setting environment variable ``NUMBA_CUDA_DEBUGINFO=1``.) :param fastmath: If true, enables flush-to-zero and fused-multiply-add, disables precise division and square root. This parameter has no effect on device function, whose fastmath setting depends on the kernel function from which they are called. :param max_registers: Limit the kernel to using at most this number of registers per thread. Useful for increasing occupancy. """ debug = config.CUDA_DEBUGINFO_DEFAULT if debug is None else debug if link and config.ENABLE_CUDASIM: raise NotImplementedError("Cannot link PTX in the simulator") fastmath = kws.get("fastmath", False) if argtypes is None and not sigutils.is_signature(func_or_sig): if func_or_sig is None: if config.ENABLE_CUDASIM: def autojitwrapper(func): return FakeCUDAKernel( func, device=device, fastmath=fastmath, debug=debug ) else: def autojitwrapper(func): return jit(func, device=device, bind=bind, debug=debug, **kws) return autojitwrapper # func_or_sig is a function else: if config.ENABLE_CUDASIM: return FakeCUDAKernel( func_or_sig, device=device, fastmath=fastmath, debug=debug ) elif device: return jitdevice(func_or_sig, debug=debug, **kws) else: targetoptions = kws.copy() targetoptions["debug"] = debug return AutoJitCUDAKernel( func_or_sig, bind=bind, targetoptions=targetoptions ) else: if config.ENABLE_CUDASIM: def jitwrapper(func): return FakeCUDAKernel( func, device=device, fastmath=fastmath, debug=debug ) return jitwrapper restype, argtypes = convert_types(func_or_sig, argtypes) if restype and not device and restype != types.void: raise TypeError("CUDA kernel must have void return type.") def kernel_jit(func): kernel = compile_kernel( func, argtypes, link=link, debug=debug, inline=inline, fastmath=fastmath ) # Force compilation for the current context if bind: kernel.bind() return kernel def device_jit(func): return compile_device(func, restype, argtypes, inline=inline, debug=debug) if device: return device_jit else: return kernel_jit
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 jit( func_or_sig=None, device=False, debug=False, argtypes=None, inline=False, restype=None, fastmath=False, link=None, boundscheck=None, ): # Here for API compatibility if boundscheck is not None: raise NotImplementedError("bounds checking is not supported for CUDA") if link is not None: raise NotImplementedError("Cannot link PTX in the simulator") # Check for first argument specifying types - in that case the # decorator is not being passed a function if func_or_sig is None or isinstance(func_or_sig, (str, tuple, Signature)): def jitwrapper(fn): return FakeCUDAKernel(fn, device=device, fastmath=fastmath) return jitwrapper return FakeCUDAKernel(func_or_sig, device=device)
def jit( func_or_sig=None, device=False, debug=False, argtypes=None, inline=False, restype=None, fastmath=False, link=None, ): if link is not None: raise NotImplementedError("Cannot link PTX in the simulator") # Check for first argument specifying types - in that case the # decorator is not being passed a function if func_or_sig is None or isinstance(func_or_sig, (str, tuple, Signature)): def jitwrapper(fn): return FakeCUDAKernel(fn, device=device, fastmath=fastmath) return jitwrapper return FakeCUDAKernel(func_or_sig, device=device)
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 jit( signature_or_function=None, locals={}, target="cpu", cache=False, pipeline_class=None, boundscheck=False, **options, ): """ This decorator is used to compile a Python function into native code. Args ----- signature_or_function: The (optional) signature or list of signatures to be compiled. If not passed, required signatures will be compiled when the decorated function is called, depending on the argument values. As a convenience, you can directly pass the function to be compiled instead. locals: dict Mapping of local variable names to Numba types. Used to override the types deduced by Numba's type inference engine. target: str Specifies the target platform to compile for. Valid targets are cpu, gpu, npyufunc, and cuda. Defaults to cpu. pipeline_class: type numba.compiler.CompilerBase The compiler pipeline type for customizing the compilation stages. options: For a cpu target, valid options are: nopython: bool Set to True to disable the use of PyObjects and Python API calls. The default behavior is to allow the use of PyObjects and Python API. Default value is False. forceobj: bool Set to True to force the use of PyObjects for every value. Default value is False. looplift: bool Set to True to enable jitting loops in nopython mode while leaving surrounding code in object mode. This allows functions to allocate NumPy arrays and use Python objects, while the tight loops in the function can still be compiled in nopython mode. Any arrays that the tight loop uses should be created before the loop is entered. Default value is True. error_model: str The error-model affects divide-by-zero behavior. Valid values are 'python' and 'numpy'. The 'python' model raises exception. The 'numpy' model sets the result to *+/-inf* or *nan*. Default value is 'python'. inline: str or callable The inline option will determine whether a function is inlined at into its caller if called. String options are 'never' (default) which will never inline, and 'always', which will always inline. If a callable is provided it will be called with the call expression node that is requesting inlining, the caller's IR and callee's IR as arguments, it is expected to return Truthy as to whether to inline. NOTE: This inlining is performed at the Numba IR level and is in no way related to LLVM inlining. boundscheck: bool Set to True to enable bounds checking for array indices. Out of bounds accesses will raise IndexError. The default is to not do bounds checking. If bounds checking is disabled, out of bounds accesses can produce garbage results or segfaults. However, enabling bounds checking will slow down typical functions, so it is recommended to only use this flag for debugging. You can also set the NUMBA_BOUNDSCHECK environment variable to 0 or 1 to globally override this flag. Returns -------- A callable usable as a compiled function. Actual compiling will be done lazily if no explicit signatures are passed. Examples -------- The function can be used in the following ways: 1) jit(signatures, target='cpu', **targetoptions) -> jit(function) Equivalent to: d = dispatcher(function, targetoptions) for signature in signatures: d.compile(signature) Create a dispatcher object for a python function. Then, compile the function with the given signature(s). Example: @jit("int32(int32, int32)") def foo(x, y): return x + y @jit(["int32(int32, int32)", "float32(float32, float32)"]) def bar(x, y): return x + y 2) jit(function, target='cpu', **targetoptions) -> dispatcher Create a dispatcher function object that specializes at call site. Examples: @jit def foo(x, y): return x + y @jit(target='cpu', nopython=True) def bar(x, y): return x + y """ if "argtypes" in options: raise DeprecationError(_msg_deprecated_signature_arg.format("argtypes")) if "restype" in options: raise DeprecationError(_msg_deprecated_signature_arg.format("restype")) options["boundscheck"] = boundscheck # Handle signature if signature_or_function is None: # No signature, no function pyfunc = None sigs = None elif isinstance(signature_or_function, list): # A list of signatures is passed pyfunc = None sigs = signature_or_function elif sigutils.is_signature(signature_or_function): # A single signature is passed pyfunc = None sigs = [signature_or_function] else: # A function is passed pyfunc = signature_or_function sigs = None dispatcher_args = {} if pipeline_class is not None: dispatcher_args["pipeline_class"] = pipeline_class wrapper = _jit( sigs, locals=locals, target=target, cache=cache, targetoptions=options, **dispatcher_args, ) if pyfunc is not None: return wrapper(pyfunc) else: return wrapper
def jit( signature_or_function=None, locals={}, target="cpu", cache=False, pipeline_class=None, **options, ): """ This decorator is used to compile a Python function into native code. Args ----- signature_or_function: The (optional) signature or list of signatures to be compiled. If not passed, required signatures will be compiled when the decorated function is called, depending on the argument values. As a convenience, you can directly pass the function to be compiled instead. locals: dict Mapping of local variable names to Numba types. Used to override the types deduced by Numba's type inference engine. target: str Specifies the target platform to compile for. Valid targets are cpu, gpu, npyufunc, and cuda. Defaults to cpu. pipeline_class: type numba.compiler.CompilerBase The compiler pipeline type for customizing the compilation stages. options: For a cpu target, valid options are: nopython: bool Set to True to disable the use of PyObjects and Python API calls. The default behavior is to allow the use of PyObjects and Python API. Default value is False. forceobj: bool Set to True to force the use of PyObjects for every value. Default value is False. looplift: bool Set to True to enable jitting loops in nopython mode while leaving surrounding code in object mode. This allows functions to allocate NumPy arrays and use Python objects, while the tight loops in the function can still be compiled in nopython mode. Any arrays that the tight loop uses should be created before the loop is entered. Default value is True. error_model: str The error-model affects divide-by-zero behavior. Valid values are 'python' and 'numpy'. The 'python' model raises exception. The 'numpy' model sets the result to *+/-inf* or *nan*. Default value is 'python'. inline: str or callable The inline option will determine whether a function is inlined at into its caller if called. String options are 'never' (default) which will never inline, and 'always', which will always inline. If a callable is provided it will be called with the call expression node that is requesting inlining, the caller's IR and callee's IR as arguments, it is expected to return Truthy as to whether to inline. NOTE: This inlining is performed at the Numba IR level and is in no way related to LLVM inlining. Returns -------- A callable usable as a compiled function. Actual compiling will be done lazily if no explicit signatures are passed. Examples -------- The function can be used in the following ways: 1) jit(signatures, target='cpu', **targetoptions) -> jit(function) Equivalent to: d = dispatcher(function, targetoptions) for signature in signatures: d.compile(signature) Create a dispatcher object for a python function. Then, compile the function with the given signature(s). Example: @jit("int32(int32, int32)") def foo(x, y): return x + y @jit(["int32(int32, int32)", "float32(float32, float32)"]) def bar(x, y): return x + y 2) jit(function, target='cpu', **targetoptions) -> dispatcher Create a dispatcher function object that specializes at call site. Examples: @jit def foo(x, y): return x + y @jit(target='cpu', nopython=True) def bar(x, y): return x + y """ if "argtypes" in options: raise DeprecationError(_msg_deprecated_signature_arg.format("argtypes")) if "restype" in options: raise DeprecationError(_msg_deprecated_signature_arg.format("restype")) # Handle signature if signature_or_function is None: # No signature, no function pyfunc = None sigs = None elif isinstance(signature_or_function, list): # A list of signatures is passed pyfunc = None sigs = signature_or_function elif sigutils.is_signature(signature_or_function): # A single signature is passed pyfunc = None sigs = [signature_or_function] else: # A function is passed pyfunc = signature_or_function sigs = None dispatcher_args = {} if pipeline_class is not None: dispatcher_args["pipeline_class"] = pipeline_class wrapper = _jit( sigs, locals=locals, target=target, cache=cache, targetoptions=options, **dispatcher_args, ) if pyfunc is not None: return wrapper(pyfunc) else: return wrapper
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_extent(self): firstidx = [0] * self.ndim lastidx = [s - 1 for s in self.shape] start = compute_index(firstidx, self.dims) stop = compute_index(lastidx, self.dims) + self.itemsize stop = max(stop, start) # ensure positive extent return Extent(start, stop)
def _compute_extent(self): firstidx = [0] * self.ndim lastidx = [s - 1 for s in self.shape] start = compute_index(firstidx, self.dims) stop = compute_index(lastidx, self.dims) + self.itemsize stop = max(stop, start) # ensure postive extent return Extent(start, stop)
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 ravel(self, order="C"): if order not in "CFA": raise ValueError("order not C|F|A") if self.ndim <= 1: return self elif order in "CA" and self.is_c_contig or order in "FA" and self.is_f_contig: newshape = (self.size,) newstrides = (self.itemsize,) arr = self.from_desc(self.extent.begin, newshape, newstrides, self.itemsize) return arr, list(self.iter_contiguous_extent()) else: raise NotImplementedError("ravel on non-contiguous array")
def ravel(self, order="C"): if order not in "CFA": raise ValueError("order not C|F|A") if self.ndim <= 1: return self elif order == "C" and self.is_c_contig or order == "F" and self.is_f_contig: newshape = (self.size,) newstrides = (self.itemsize,) arr = self.from_desc(self.extent.begin, newshape, newstrides, self.itemsize) return arr, list(self.iter_contiguous_extent()) else: raise NotImplementedError("ravel on non-contiguous array")
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 overload_attribute(typ, attr, **kwargs): """ A decorator marking the decorated function as typing and implementing attribute *attr* for the given Numba type in nopython mode. *kwargs* are passed to the underlying `@overload` call. Here is an example implementing .nbytes for array types:: @overload_attribute(types.Array, 'nbytes') def array_nbytes(arr): def get(arr): return arr.size * arr.itemsize return get """ # TODO implement setters from .typing.templates import make_overload_attribute_template def decorate(overload_func): template = make_overload_attribute_template( typ, attr, overload_func, inline=kwargs.get("inline", "never"), ) infer_getattr(template) overload(overload_func, **kwargs)(overload_func) return overload_func return decorate
def overload_attribute(typ, attr): """ A decorator marking the decorated function as typing and implementing attribute *attr* for the given Numba type in nopython mode. Here is an example implementing .nbytes for array types:: @overload_attribute(types.Array, 'nbytes') def array_nbytes(arr): def get(arr): return arr.size * arr.itemsize return get """ # TODO implement setters from .typing.templates import make_overload_attribute_template def decorate(overload_func): template = make_overload_attribute_template(typ, attr, overload_func) infer_getattr(template) return overload_func return decorate
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 decorate(overload_func): template = make_overload_attribute_template( typ, attr, overload_func, inline=kwargs.get("inline", "never"), ) infer_getattr(template) overload(overload_func, **kwargs)(overload_func) return overload_func
def decorate(overload_func): template = make_overload_attribute_template(typ, attr, overload_func) infer_getattr(template) return overload_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 overload_method(typ, attr, **kwargs): """ A decorator marking the decorated function as typing and implementing attribute *attr* for the given Numba type in nopython mode. *kwargs* are passed to the underlying `@overload` call. Here is an example implementing .take() for array types:: @overload_method(types.Array, 'take') def array_take(arr, indices): if isinstance(indices, types.Array): def take_impl(arr, indices): n = indices.shape[0] res = np.empty(n, arr.dtype) for i in range(n): res[i] = arr[indices[i]] return res return take_impl """ from .typing.templates import make_overload_method_template def decorate(overload_func): template = make_overload_method_template( typ, attr, overload_func, inline=kwargs.get("inline", "never"), ) infer_getattr(template) overload(overload_func, **kwargs)(overload_func) return overload_func return decorate
def overload_method(typ, attr): """ A decorator marking the decorated function as typing and implementing attribute *attr* for the given Numba type in nopython mode. Here is an example implementing .take() for array types:: @overload_method(types.Array, 'take') def array_take(arr, indices): if isinstance(indices, types.Array): def take_impl(arr, indices): n = indices.shape[0] res = np.empty(n, arr.dtype) for i in range(n): res[i] = arr[indices[i]] return res return take_impl """ from .typing.templates import make_overload_method_template def decorate(overload_func): template = make_overload_method_template(typ, attr, overload_func) infer_getattr(template) return overload_func return decorate
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 decorate(overload_func): template = make_overload_method_template( typ, attr, overload_func, inline=kwargs.get("inline", "never"), ) infer_getattr(template) overload(overload_func, **kwargs)(overload_func) return overload_func
def decorate(overload_func): template = make_overload_method_template(typ, attr, overload_func) infer_getattr(template) return overload_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 _get_callee_args(call_expr, callee, loc, func_ir): """Get arguments for calling 'callee', including the default arguments. keyword arguments are currently only handled when 'callee' is a function. """ if call_expr.op == "call": args = list(call_expr.args) elif call_expr.op == "getattr": args = [call_expr.value] else: raise TypeError("Unsupported ir.Expr.{}".format(call_expr.op)) debug_print = _make_debug_print("inline_closure_call default handling") # handle defaults and kw arguments using pysignature if callee is function if isinstance(callee, pytypes.FunctionType): pysig = numba.utils.pysignature(callee) normal_handler = lambda index, param, default: default default_handler = lambda index, param, default: ir.Const(default, loc) # Throw error for stararg # TODO: handle stararg def stararg_handler(index, param, default): raise NotImplementedError( "Stararg not supported in inliner for arg {} {}".format(index, param) ) if call_expr.op == "call": kws = dict(call_expr.kws) else: kws = {} return numba.typing.fold_arguments( pysig, args, kws, normal_handler, default_handler, stararg_handler ) else: # TODO: handle arguments for make_function case similar to function # case above callee_defaults = ( callee.defaults if hasattr(callee, "defaults") else callee.__defaults__ ) if callee_defaults: debug_print("defaults = ", callee_defaults) if isinstance(callee_defaults, tuple): # Python 3.5 defaults_list = [] for x in callee_defaults: if isinstance(x, ir.Var): defaults_list.append(x) else: # this branch is predominantly for kwargs from # inlinable functions defaults_list.append(ir.Const(value=x, loc=loc)) args = args + defaults_list elif isinstance(callee_defaults, ir.Var) or isinstance( callee_defaults, str ): default_tuple = func_ir.get_definition(callee_defaults) assert isinstance(default_tuple, ir.Expr) assert default_tuple.op == "build_tuple" const_vals = [func_ir.get_definition(x) for x in default_tuple.items] args = args + const_vals else: raise NotImplementedError( "Unsupported defaults to make_function: {}".format(defaults) ) return args
def _get_callee_args(call_expr, callee, loc, func_ir): """Get arguments for calling 'callee', including the default arguments. keyword arguments are currently only handled when 'callee' is a function. """ args = list(call_expr.args) debug_print = _make_debug_print("inline_closure_call default handling") # handle defaults and kw arguments using pysignature if callee is function if isinstance(callee, pytypes.FunctionType): pysig = numba.utils.pysignature(callee) normal_handler = lambda index, param, default: default default_handler = lambda index, param, default: ir.Const(default, loc) # Throw error for stararg # TODO: handle stararg def stararg_handler(index, param, default): raise NotImplementedError( "Stararg not supported in inliner for arg {} {}".format(index, param) ) kws = dict(call_expr.kws) return numba.typing.fold_arguments( pysig, args, kws, normal_handler, default_handler, stararg_handler ) else: # TODO: handle arguments for make_function case similar to function # case above callee_defaults = ( callee.defaults if hasattr(callee, "defaults") else callee.__defaults__ ) if callee_defaults: debug_print("defaults = ", callee_defaults) if isinstance(callee_defaults, tuple): # Python 3.5 defaults_list = [] for x in callee_defaults: if isinstance(x, ir.Var): defaults_list.append(x) else: # this branch is predominantly for kwargs from # inlinable functions defaults_list.append(ir.Const(value=x, loc=loc)) args = args + defaults_list elif isinstance(callee_defaults, ir.Var) or isinstance( callee_defaults, str ): defaults = func_ir.get_definition(callee_defaults) assert isinstance(defaults, ir.Const) loc = defaults.loc args = args + [ir.Const(value=v, loc=loc) for v in defaults.value] else: raise NotImplementedError( "Unsupported defaults to make_function: {}".format(defaults) ) return args
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 _inline_const_arraycall(block, func_ir, context, typemap, calltypes): """Look for array(list) call where list is a constant list created by build_list, and turn them into direct array creation and initialization, if the following conditions are met: 1. The build_list call immediate precedes the array call; 2. The list variable is no longer live after array call; If any condition check fails, no modification will be made. """ debug_print = _make_debug_print("inline_const_arraycall") scope = block.scope def inline_array(array_var, expr, stmts, list_vars, dels): """Check to see if the given "array_var" is created from a list of constants, and try to inline the list definition as array initialization. Extra statements produced with be appended to "stmts". """ callname = guard(find_callname, func_ir, expr) require(callname and callname[1] == "numpy" and callname[0] == "array") require(expr.args[0].name in list_vars) ret_type = calltypes[expr].return_type require(isinstance(ret_type, types.ArrayCompatible) and ret_type.ndim == 1) loc = expr.loc list_var = expr.args[0] # Get the type of the array to be created. array_typ = typemap[array_var.name] debug_print("inline array_var = ", array_var, " list_var = ", list_var) # Get the element type of the array to be created. dtype = array_typ.dtype # Get the sequence of operations to provide values to the new array. seq, _ = find_build_sequence(func_ir, list_var) size = len(seq) # Create a tuple to pass to empty below to specify the new array size. size_var = ir.Var(scope, mk_unique_var("size"), loc) size_tuple_var = ir.Var(scope, mk_unique_var("size_tuple"), loc) size_typ = types.intp size_tuple_typ = types.UniTuple(size_typ, 1) typemap[size_var.name] = size_typ typemap[size_tuple_var.name] = size_tuple_typ stmts.append(_new_definition(func_ir, size_var, ir.Const(size, loc=loc), loc)) stmts.append( _new_definition( func_ir, size_tuple_var, ir.Expr.build_tuple(items=[size_var], loc=loc), loc, ) ) # The general approach is to create an empty array and then fill # the elements in one-by-one from their specificiation. # Get the numpy type to pass to empty. nptype = types.DType(dtype) # Create a variable to hold the numpy empty function. empty_func = ir.Var(scope, mk_unique_var("empty_func"), loc) fnty = get_np_ufunc_typ(np.empty) sig = context.resolve_function_type(fnty, (size_typ,), {"dtype": nptype}) typemap[empty_func.name] = fnty stmts.append( _new_definition( func_ir, empty_func, ir.Global("empty", np.empty, loc=loc), loc ) ) # We pass two arguments to empty, first the size tuple and second # the dtype of the new array. Here, we created typ_var which is # the dtype argument of the new array. typ_var in turn is created # by getattr of the dtype string on the numpy module. # Create var for numpy module. g_np_var = ir.Var(scope, mk_unique_var("$np_g_var"), loc) typemap[g_np_var.name] = types.misc.Module(np) g_np = ir.Global("np", np, loc) stmts.append(_new_definition(func_ir, g_np_var, g_np, loc)) # Create var for result of numpy.<dtype>. typ_var = ir.Var(scope, mk_unique_var("$np_typ_var"), loc) typemap[typ_var.name] = nptype dtype_str = str(dtype) if dtype_str == "bool": dtype_str = "bool_" # Get dtype attribute of numpy module. np_typ_getattr = ir.Expr.getattr(g_np_var, dtype_str, loc) stmts.append(_new_definition(func_ir, typ_var, np_typ_getattr, loc)) # Create the call to numpy.empty passing the size tuple and dtype var. empty_call = ir.Expr.call(empty_func, [size_var, typ_var], {}, loc=loc) calltypes[empty_call] = typing.signature(array_typ, size_typ, nptype) stmts.append(_new_definition(func_ir, array_var, empty_call, loc)) # Fill in the new empty array one-by-one. for i in range(size): index_var = ir.Var(scope, mk_unique_var("index"), loc) index_typ = types.intp typemap[index_var.name] = index_typ stmts.append(_new_definition(func_ir, index_var, ir.Const(i, loc), loc)) setitem = ir.SetItem(array_var, index_var, seq[i], loc) calltypes[setitem] = typing.signature( types.none, array_typ, index_typ, dtype ) stmts.append(setitem) stmts.extend(dels) return True class State(object): """ This class is used to hold the state in the following loop so as to make it easy to reset the state of the variables tracking the various statement kinds """ def __init__(self): # list_vars keep track of the variable created from the latest # build_list instruction, as well as its synonyms. self.list_vars = [] # dead_vars keep track of those in list_vars that are considered dead. self.dead_vars = [] # list_items keep track of the elements used in build_list. self.list_items = [] self.stmts = [] # dels keep track of the deletion of list_items, which will need to be # moved after array initialization. self.dels = [] # tracks if a modification has taken place self.modified = False def reset(self): """ Resets the internal state of the variables used for tracking """ self.list_vars = [] self.dead_vars = [] self.list_items = [] self.dels = [] def list_var_used(self, inst): """ Returns True if the list being analysed is used between the build_list and the array call. """ return any([x.name in self.list_vars for x in inst.list_vars()]) state = State() for inst in block.body: if isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Var): if inst.value.name in state.list_vars: state.list_vars.append(inst.target.name) state.stmts.append(inst) continue elif isinstance(inst.value, ir.Expr): expr = inst.value if expr.op == "build_list": # new build_list encountered, reset state state.reset() state.list_items = [x.name for x in expr.items] state.list_vars = [inst.target.name] state.stmts.append(inst) continue elif expr.op == "call" and expr in calltypes: arr_var = inst.target if guard( inline_array, inst.target, expr, state.stmts, state.list_vars, state.dels, ): state.modified = True continue elif isinstance(inst, ir.Del): removed_var = inst.value if removed_var in state.list_items: state.dels.append(inst) continue elif removed_var in state.list_vars: # one of the list_vars is considered dead. state.dead_vars.append(removed_var) state.list_vars.remove(removed_var) state.stmts.append(inst) if state.list_vars == []: # if all list_vars are considered dead, we need to filter # them out from existing stmts to completely remove # build_list. # Note that if a translation didn't take place, dead_vars # will also be empty when we reach this point. body = [] for inst in state.stmts: if ( isinstance(inst, ir.Assign) and inst.target.name in state.dead_vars ) or ( isinstance(inst, ir.Del) and inst.value in state.dead_vars ): continue body.append(inst) state.stmts = body state.dead_vars = [] state.modified = True continue state.stmts.append(inst) # If the list is used in any capacity between build_list and array # call, then we must call off the translation for this list because # it could be mutated and list_items would no longer be applicable. if state.list_var_used(inst): state.reset() return state.stmts if state.modified else None
def _inline_const_arraycall(block, func_ir, context, typemap, calltypes): """Look for array(list) call where list is a constant list created by build_list, and turn them into direct array creation and initialization, if the following conditions are met: 1. The build_list call immediate preceeds the array call; 2. The list variable is no longer live after array call; If any condition check fails, no modification will be made. """ debug_print = _make_debug_print("inline_const_arraycall") scope = block.scope def inline_array(array_var, expr, stmts, list_vars, dels): """Check to see if the given "array_var" is created from a list of constants, and try to inline the list definition as array initialization. Extra statements produced with be appended to "stmts". """ callname = guard(find_callname, func_ir, expr) require(callname and callname[1] == "numpy" and callname[0] == "array") require(expr.args[0].name in list_vars) ret_type = calltypes[expr].return_type require(isinstance(ret_type, types.ArrayCompatible) and ret_type.ndim == 1) loc = expr.loc list_var = expr.args[0] # Get the type of the array to be created. array_typ = typemap[array_var.name] debug_print("inline array_var = ", array_var, " list_var = ", list_var) # Get the element type of the array to be created. dtype = array_typ.dtype # Get the sequence of operations to provide values to the new array. seq, _ = find_build_sequence(func_ir, list_var) size = len(seq) # Create a tuple to pass to empty below to specify the new array size. size_var = ir.Var(scope, mk_unique_var("size"), loc) size_tuple_var = ir.Var(scope, mk_unique_var("size_tuple"), loc) size_typ = types.intp size_tuple_typ = types.UniTuple(size_typ, 1) typemap[size_var.name] = size_typ typemap[size_tuple_var.name] = size_tuple_typ stmts.append(_new_definition(func_ir, size_var, ir.Const(size, loc=loc), loc)) stmts.append( _new_definition( func_ir, size_tuple_var, ir.Expr.build_tuple(items=[size_var], loc=loc), loc, ) ) # The general approach is to create an empty array and then fill # the elements in one-by-one from their specificiation. # Get the numpy type to pass to empty. nptype = types.DType(dtype) # Create a variable to hold the numpy empty function. empty_func = ir.Var(scope, mk_unique_var("empty_func"), loc) fnty = get_np_ufunc_typ(np.empty) sig = context.resolve_function_type(fnty, (size_typ,), {"dtype": nptype}) typemap[empty_func.name] = fnty stmts.append( _new_definition( func_ir, empty_func, ir.Global("empty", np.empty, loc=loc), loc ) ) # We pass two arguments to empty, first the size tuple and second # the dtype of the new array. Here, we created typ_var which is # the dtype argument of the new array. typ_var in turn is created # by getattr of the dtype string on the numpy module. # Create var for numpy module. g_np_var = ir.Var(scope, mk_unique_var("$np_g_var"), loc) typemap[g_np_var.name] = types.misc.Module(np) g_np = ir.Global("np", np, loc) stmts.append(_new_definition(func_ir, g_np_var, g_np, loc)) # Create var for result of numpy.<dtype>. typ_var = ir.Var(scope, mk_unique_var("$np_typ_var"), loc) typemap[typ_var.name] = nptype dtype_str = str(dtype) if dtype_str == "bool": dtype_str = "bool_" # Get dtype attribute of numpy module. np_typ_getattr = ir.Expr.getattr(g_np_var, dtype_str, loc) stmts.append(_new_definition(func_ir, typ_var, np_typ_getattr, loc)) # Create the call to numpy.empty passing the size tuple and dtype var. empty_call = ir.Expr.call(empty_func, [size_var, typ_var], {}, loc=loc) calltypes[empty_call] = typing.signature(array_typ, size_typ, nptype) stmts.append(_new_definition(func_ir, array_var, empty_call, loc)) # Fill in the new empty array one-by-one. for i in range(size): index_var = ir.Var(scope, mk_unique_var("index"), loc) index_typ = types.intp typemap[index_var.name] = index_typ stmts.append(_new_definition(func_ir, index_var, ir.Const(i, loc), loc)) setitem = ir.SetItem(array_var, index_var, seq[i], loc) calltypes[setitem] = typing.signature( types.none, array_typ, index_typ, dtype ) stmts.append(setitem) stmts.extend(dels) return True class State(object): """ This class is used to hold the state in the following loop so as to make it easy to reset the state of the variables tracking the various statement kinds """ def __init__(self): # list_vars keep track of the variable created from the latest # build_list instruction, as well as its synonyms. self.list_vars = [] # dead_vars keep track of those in list_vars that are considered dead. self.dead_vars = [] # list_items keep track of the elements used in build_list. self.list_items = [] self.stmts = [] # dels keep track of the deletion of list_items, which will need to be # moved after array initialization. self.dels = [] # tracks if a modification has taken place self.modified = False def reset(self): """ Resets the internal state of the variables used for tracking """ self.list_vars = [] self.dead_vars = [] self.list_items = [] self.dels = [] def list_var_used(self, inst): """ Returns True if the list being analysed is used between the build_list and the array call. """ return any([x.name in self.list_vars for x in inst.list_vars()]) state = State() for inst in block.body: if isinstance(inst, ir.Assign): if isinstance(inst.value, ir.Var): if inst.value.name in state.list_vars: state.list_vars.append(inst.target.name) state.stmts.append(inst) continue elif isinstance(inst.value, ir.Expr): expr = inst.value if expr.op == "build_list": # new build_list encountered, reset state state.reset() state.list_items = [x.name for x in expr.items] state.list_vars = [inst.target.name] state.stmts.append(inst) continue elif expr.op == "call" and expr in calltypes: arr_var = inst.target if guard( inline_array, inst.target, expr, state.stmts, state.list_vars, state.dels, ): state.modified = True continue elif isinstance(inst, ir.Del): removed_var = inst.value if removed_var in state.list_items: state.dels.append(inst) continue elif removed_var in state.list_vars: # one of the list_vars is considered dead. state.dead_vars.append(removed_var) state.list_vars.remove(removed_var) state.stmts.append(inst) if state.list_vars == []: # if all list_vars are considered dead, we need to filter # them out from existing stmts to completely remove # build_list. # Note that if a translation didn't take place, dead_vars # will also be empty when we reach this point. body = [] for inst in state.stmts: if ( isinstance(inst, ir.Assign) and inst.target.name in state.dead_vars ) or ( isinstance(inst, ir.Del) and inst.value in state.dead_vars ): continue body.append(inst) state.stmts = body state.dead_vars = [] state.modified = True continue state.stmts.append(inst) # If the list is used in any capacity between build_list and array # call, then we must call off the translation for this list because # it could be mutated and list_items would no longer be applicable. if state.list_var_used(inst): state.reset() return state.stmts if state.modified else 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 __init__(self, func_id): self.func_id = func_id self.arg_count = func_id.arg_count self.arg_names = func_id.arg_names self.loc = self.first_loc = ir.Loc.from_function_id(func_id) self.is_generator = func_id.is_generator # { inst offset : ir.Block } self.blocks = {} # { name: [definitions] } of local variables self.definitions = collections.defaultdict(list) # A set to keep track of all exception variables. # To be used in _legalize_exception_vars() self._exception_vars = set()
def __init__(self, func_id): self.func_id = func_id self.arg_count = func_id.arg_count self.arg_names = func_id.arg_names self.loc = self.first_loc = ir.Loc.from_function_id(func_id) self.is_generator = func_id.is_generator # { inst offset : ir.Block } self.blocks = {} # { name: [definitions] } of local variables self.definitions = collections.defaultdict(list)
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 interpret(self, bytecode): """ Generate IR for this bytecode. """ self.bytecode = bytecode self.scopes = [] global_scope = ir.Scope(parent=None, loc=self.loc) self.scopes.append(global_scope) if PYVERSION < (3, 7): # Control flow analysis self.cfa = controlflow.ControlFlowAnalysis(bytecode) self.cfa.run() if config.DUMP_CFG: self.cfa.dump() # Data flow analysis self.dfa = dataflow.DataFlowAnalysis(self.cfa) self.dfa.run() else: flow = Flow(bytecode) flow.run() self.dfa = AdaptDFA(flow) self.cfa = AdaptCFA(flow) if config.DUMP_CFG: self.cfa.dump() # Temp states during interpretation self.current_block = None self.current_block_offset = None self.syntax_blocks = [] self.dfainfo = None firstblk = min(self.cfa.blocks.keys()) self.scopes.append(ir.Scope(parent=self.current_scope, loc=self.loc)) # Interpret loop for inst, kws in self._iter_inst(): self._dispatch(inst, kws) self._legalize_exception_vars() # Prepare FunctionIR fir = ir.FunctionIR( self.blocks, self.is_generator, self.func_id, self.first_loc, self.definitions, self.arg_count, self.arg_names, ) _logger.debug(fir.dump_to_string()) return fir
def interpret(self, bytecode): """ Generate IR for this bytecode. """ self.bytecode = bytecode self.scopes = [] global_scope = ir.Scope(parent=None, loc=self.loc) self.scopes.append(global_scope) if PYVERSION < (3, 7): # Control flow analysis self.cfa = controlflow.ControlFlowAnalysis(bytecode) self.cfa.run() if config.DUMP_CFG: self.cfa.dump() # Data flow analysis self.dfa = dataflow.DataFlowAnalysis(self.cfa) self.dfa.run() else: flow = Flow(bytecode) flow.run() self.dfa = AdaptDFA(flow) self.cfa = AdaptCFA(flow) if config.DUMP_CFG: self.cfa.dump() # Temp states during interpretation self.current_block = None self.current_block_offset = None self.syntax_blocks = [] self.dfainfo = None firstblk = min(self.cfa.blocks.keys()) self.scopes.append(ir.Scope(parent=self.current_scope, loc=self.loc)) # Interpret loop for inst, kws in self._iter_inst(): self._dispatch(inst, kws) fir = ir.FunctionIR( self.blocks, self.is_generator, self.func_id, self.first_loc, self.definitions, self.arg_count, self.arg_names, ) _logger.debug(fir.dump_to_string()) return fir
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 _start_new_block(self, offset): oldblock = self.current_block self.insert_block(offset) # Ensure the last block is terminated if oldblock is not None and not oldblock.is_terminated: # Handle ending try block. tryblk = self.dfainfo.active_try_block # If there's an active try-block and the handler block is live. if tryblk is not None and tryblk["end"] in self.cfa.graph.nodes(): # We are in a try-block, insert a branch to except-block. # This logic cannot be in self._end_current_block() # because we the non-raising next block-offset. branch = ir.Branch( cond=self.get("$exception_check"), truebr=tryblk["end"], falsebr=offset, loc=self.loc, ) oldblock.append(branch) # Handle normal case else: jmp = ir.Jump(offset, loc=self.loc) oldblock.append(jmp) # Get DFA block info self.dfainfo = self.dfa.infos[self.current_block_offset] self.assigner = Assigner() # Check out-of-scope syntactic-block while self.syntax_blocks: if offset >= self.syntax_blocks[-1].exit: self.syntax_blocks.pop() else: break
def _start_new_block(self, offset): oldblock = self.current_block self.insert_block(offset) # Ensure the last block is terminated if oldblock is not None and not oldblock.is_terminated: jmp = ir.Jump(offset, loc=self.loc) oldblock.append(jmp) # Get DFA block info self.dfainfo = self.dfa.infos[self.current_block_offset] self.assigner = Assigner() # Check out-of-scope syntactic-block while self.syntax_blocks: if offset >= self.syntax_blocks[-1].exit: self.syntax_blocks.pop() else: 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 _end_current_block(self): # Handle try block if not self.current_block.is_terminated: tryblk = self.dfainfo.active_try_block if tryblk is not None: self._insert_exception_check() # Handle normal block cleanup self._remove_unused_temporaries() self._insert_outgoing_phis()
def _end_current_block(self): self._remove_unused_temporaries() self._insert_outgoing_phis()
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 store(self, value, name, redefine=False): """ Store *value* (a Expr or Var instance) into the variable named *name* (a str object). Returns the target variable. """ if redefine or self.current_block_offset in self.cfa.backbone: rename = not (name in self.code_cellvars) target = self.current_scope.redefine(name, loc=self.loc, rename=rename) else: target = self.current_scope.get_or_define(name, loc=self.loc) if isinstance(value, ir.Var): value = self.assigner.assign(value, target) stmt = ir.Assign(value=value, target=target, loc=self.loc) self.current_block.append(stmt) self.definitions[target.name].append(value) return target
def store(self, value, name, redefine=False): """ Store *value* (a Expr or Var instance) into the variable named *name* (a str object). """ if redefine or self.current_block_offset in self.cfa.backbone: rename = not (name in self.code_cellvars) target = self.current_scope.redefine(name, loc=self.loc, rename=rename) else: target = self.current_scope.get_or_define(name, loc=self.loc) if isinstance(value, ir.Var): value = self.assigner.assign(value, target) stmt = ir.Assign(value=value, target=target, loc=self.loc) self.current_block.append(stmt) self.definitions[target.name].append(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