# Buggy code
def as_method(self):
    """
    Convert this signature to a bound method signature.
    """
    if self.recvr is not None:
        return self
    sig = signature(self.return_type, *self.args[1:], recvr=self.args[0])
    return sig


# Traceback (TypeError)
Traceback (most recent call last):
File "<path>/numba/numba/errors.py", line 601, in new_error_context
yield
File "<path>/numba/numba/lowering.py", line 257, in lower_block
self.lower_inst(inst)
File "<path>/numba/numba/lowering.py", line 306, in lower_inst
val = self.lower_assign(ty, inst)
File "<path>/numba/numba/lowering.py", line 452, in lower_assign
return self.lower_expr(ty, value)
File "<path>/numba/numba/lowering.py", line 875, in lower_expr
res = self.lower_call(resty, expr)
File "<path>/numba/numba/lowering.py", line 841, in lower_call
res = impl(self.builder, argvals, self.loc)
File "<path>/numba/numba/targets/base.py", line 1116, in __call__
return self._imp(self._context, builder, self._sig, args)
File "<path>/numba/numba/typing/templates.py", line 532, in method_impl
return call(builder, args)
File "<path>/numba/numba/targets/base.py", line 1116, in __call__
return self._imp(self._context, builder, self._sig, args)
File "<path>/numba/numba/targets/imputils.py", line 192, in imp
builder, func, fndesc.restype, fndesc.argtypes, args)
File "<path>/numba/numba/targets/callconv.py", line 479, in call_function
args = list(arginfo.as_arguments(builder, args))
File "<path>/numba/numba/datamodel/packer.py", line 94, in as_arguments
% (self._nargs, len(values)))
TypeError: invalid number of args: expected 2, got 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test_pr3468.py", line 17, in <module>
bar(Z)
File "<path>/numba/numba/dispatcher.py", line 367, in _compile_for_args
raise e
File "<path>/numba/numba/dispatcher.py", line 324, in _compile_for_args
return self.compile(tuple(argtypes))
File "<path>/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "<path>/numba/numba/dispatcher.py", line 655, in compile
cres = self._compiler.compile(args, return_type)
File "<path>/numba/numba/dispatcher.py", line 82, in compile
pipeline_class=self.pipeline_class)
File "<path>/numba/numba/compiler.py", line 905, in compile_extra
return pipeline.compile_extra(func)
File "<path>/numba/numba/compiler.py", line 367, in compile_extra
return self._compile_bytecode()
File "<path>/numba/numba/compiler.py", line 836, in _compile_bytecode
return self._compile_core()
File "<path>/numba/numba/compiler.py", line 823, in _compile_core
res = pm.run(self.status)
File "<path>/numba/numba/compiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "<path>/numba/numba/compiler.py", line 253, in run
raise patched_exception
File "<path>/numba/numba/compiler.py", line 244, in run
stage()
File "<path>/numba/numba/compiler.py", line 697, in stage_nopython_backend
self._backend(lowerfn, objectmode=False)
File "<path>/numba/numba/compiler.py", line 647, in _backend
lowered = lowerfn()
File "<path>/numba/numba/compiler.py", line 634, in backend_nopython_mode
self.flags)
File "<path>/numba/numba/compiler.py", line 1026, in native_lowering_stage
lower.lower()
File "<path>/numba/numba/lowering.py", line 176, in lower
self.lower_normal_function(self.fndesc)
File "<path>/numba/numba/lowering.py", line 217, in lower_normal_function
entry_block_tail = self.lower_function_body()
File "<path>/numba/numba/lowering.py", line 242, in lower_function_body
self.lower_block(block)
File "<path>/numba/numba/lowering.py", line 257, in lower_block
self.lower_inst(inst)
File "<env>/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "<path>/numba/numba/errors.py", line 609, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "<path>/numba/numba/six.py", line 659, in reraise
raise value
numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
invalid number of args: expected 2, got 1

# Fixed code
def as_method(self):
    """
    Convert this signature to a bound method signature.
    """
    if self.recvr is not None:
        return self
    sig = signature(self.return_type, *self.args[1:], recvr=self.args[0])

    # Adjust the python signature
    params = list(self.pysig.parameters.values())[1:]
    sig.pysig = utils.pySignature(
        parameters=params,
        return_annotation=self.pysig.return_annotation,
    )
    return sig