New submission from Salomon <salomonsmekeco...@gmail.com>:
I am seeing an issue when attempting to use default kwargs in decorated functions. I would post reproduction steps, but instead I have written a snippet which should showcase the issue. Snippet: ```python def decorator(): def inner(f): def wrapper(*args, **kwargs): # Zoinks, Scoob! print('Decorator: {}'.format(''.join(kwargs.values()))) print(f(*args, **kwargs)) return wrapper return inner @decorator() def func(foo='wont print in the decorator'): return 'Func: {}'.format(foo)``` The following calls to 'func' should show you what Im talking about clearly: ``` func() -> Decorator: -> Func: wont print in the decorator func(foo='will print in the decorator') -> Decorator: will print in the decorator -> Func: will print in the decorator ``` I would expect, though correct me if I am wrong, that both of these calls should print in the decorator and the function call. For convenience, some REPL.it links: 3.6.1 -> https://repl.it/@SalomonSmeke/Python3-Decorator-Bug 2.7.10 -> https://repl.it/@SalomonSmeke/Python-Decorator-Bug Using @wrap from functools: 2.7.10 -> https://repl.it/@SalomonSmeke/Python-Decorator-Bug-using-FuncTools Thank you for your time. P.S. This is my first issue submitted to Python, please let me know if there is detail lacking. Im happy to provide what I can. ---------- messages: 318892 nosy: ssmeke priority: normal severity: normal status: open title: Decorated (inner/wrapped) function kwarg defaults dont pass through decorator. type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33790> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com