# Buggy code
def _infer_call(self, func, expr):
    if expr.kws or expr.vararg:
        self._fail(expr)
    # Check supported callables
    _slice = func in (slice,)
    _exc = isinstance(func, type) and issubclass(func, BaseException)
    if _slice or _exc:
        args = [self.infer_constant(a.name) for a in expr.args]
        if _slice:
            return func(*args)
        elif _exc:
            # If the exception class is user defined it may implement a ctor
            # that does not pass the args to the super. Therefore return the
            # raw class and the args so this can be instantiated at the call
            # site in the way the user source expects it to be.
            return func, args
        else:
            assert 0, "Unreachable"

    self._fail(expr)


# Traceback (ConstantInferenceError)
---------------------------------------------------------------------------
ConstantInferenceError                    Traceback (most recent call last)
<ipython-input-29-41c708083646> in <module>
5     return a*b
6
----> 7 problem(1,2)

~/.virtualenvs/dl4cv/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
358             # this is from trying to infer something as constant when it isn't
359             # or isn't supported as a constant
--> 360             error_rewrite(e, 'constant_inference')
361         except Exception as e:
362             if config.SHOW_HELP:

~/.virtualenvs/dl4cv/lib/python3.7/site-packages/numba/dispatcher.py in error_rewrite(e, issue_type)
313                 raise e
314             else:
--> 315                 reraise(type(e), e, None)
316
317         argtypes = []

~/.virtualenvs/dl4cv/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb)
656             value = tp()
657         if value.__traceback__ is not tb:
--> 658             raise value.with_traceback(tb)
659         raise value
660

ConstantInferenceError: Failed in nopython mode pipeline (step: nopython rewrites)
Cannot make a constant from: Cannot make a constant from: Cannot make a constant from: constant inference not possible for arg(0, name=a)
Numba could not make a constant out of something that it decided should be
a constant. This could well be a current limitation in Numba's internals,
please either raise a bug report along with a minimal reproducer at:
https://github.com/numba/numba/issues/new

# Fixed code
def _infer_call(self, func, expr):
    if expr.kws or expr.vararg:
        self._fail(expr)
    # Check supported callables
    _slice = func in (slice,)
    _exc = isinstance(func, type) and issubclass(func, BaseException)
    if _slice or _exc:
        args = [self.infer_constant(a.name, loc=expr.loc) for a in expr.args]
        if _slice:
            return func(*args)
        elif _exc:
            # If the exception class is user defined it may implement a ctor
            # that does not pass the args to the super. Therefore return the
            # raw class and the args so this can be instantiated at the call
            # site in the way the user source expects it to be.
            return func, args
        else:
            assert 0, "Unreachable"

    self._fail(expr)