New submission from anton-ryzhov:

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.

import functools, inspect

def decorator(func):
    def inner(*args):
        return func(*args)
    return inner

class Foo(object):
    def bar(self, testarg):

f = Foo()
baz = decorator(
assert inspect.signature(baz) == inspect.signature(

components: Library (Lib)
messages: 289879
nosy: anton-ryzhov
priority: normal
severity: normal
status: open
title: inspect.signature includes bound argument for wrappers around decorated 
bound methods
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

Python tracker <>
Python-bugs-list mailing list

Reply via email to