Issue 29858: inspect.signature includes bound argument for wrappers around decorated bound methods (original) (raw)
If we wrap function with bound method, which is also a wrapper around function, inspect.signature
will not do skip_bound_arg
.
It will use inspect.unwrap
and pass by bound method from outer function to inner one.
Reproduce:
import functools, inspect
def decorator(func):
@functools.wraps(func)
def inner(*args):
return func(*args)
return inner
class Foo(object):
@decorator
def bar(self, testarg):
pass
f = Foo()
baz = decorator(f.bar)
assert inspect.signature(baz) == inspect.signature(f.bar)