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 the.mulhern
Recipients the.mulhern
Date 2014-06-17.19:12:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403032346.55.0.812128446286.issue21794@psf.upfronthosting.co.za>
In-reply-to
Content
>>> def decorator(f):
...     @functools.wraps(f)
...     def new_func(self, junk):
...             stack = inspect.stack()
...             for i, frame in enumerate(stack):
...                     print("%s" % frame[3])
...             f(self, junk)
...     return new_func
... 
>>> @decorator
... def junk(self, p):
...     print("%s" % junk.__name__)
... 
>>> junk("a", "b")
new_func
<module>
junk
>>> junk.__name__
'junk'


Note that the wrapper function itself inspects the stack, printing out the names of methods on the stack.
Note that "junk", the name of the wrapped function does not appear on the stack, it is only printed out by the junk method itself.

I think that the name of the function at the top of the stack should be the name of the wrapped function, not of its wrapper. The name of the wrapper function should not appear at all.
History
Date User Action Args
2014-06-17 19:12:26the.mulhernsetrecipients: + the.mulhern
2014-06-17 19:12:26the.mulhernsetmessageid: <1403032346.55.0.812128446286.issue21794@psf.upfronthosting.co.za>
2014-06-17 19:12:26the.mulhernlinkissue21794 messages
2014-06-17 19:12:26the.mulherncreate