This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ssmeke
Recipients ssmeke
Date 2018-06-07.05:12:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528348345.08.0.592728768989.issue33790@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-06-07 05:12:25ssmekesetrecipients: + ssmeke
2018-06-07 05:12:25ssmekesetmessageid: <1528348345.08.0.592728768989.issue33790@psf.upfronthosting.co.za>
2018-06-07 05:12:25ssmekelinkissue33790 messages
2018-06-07 05:12:24ssmekecreate