smarie / python-makefun

Dynamically create python functions with a proper signature.
https://smarie.github.io/python-makefun/
BSD 3-Clause "New" or "Revised" License
119 stars 16 forks source link

Support cases where the signature contains a non-representable object #23

Closed smarie closed 5 years ago

smarie commented 5 years ago

From a stack overflow example at https://stackoverflow.com/questions/52126071/decorator-with-arguments-avoid-parenthesis-when-no-arguments

def foo(logger=logging.getLogger('default')):
    pass

@wraps(foo)
def bar(*args, **kwargs):
    pass

bar()

raises SyntaxError: invalid syntax def foo(logger=<logging.Logger object at 0x000001D5844AF518>)