[issue21794] stack frame contains name of wrapper method, not that of wrapped method

Josh Rosenberg report at bugs.python.org
Tue Jun 17 21:23:24 CEST 2014


Josh Rosenberg added the comment:

I don't think you understand how wrapping works. At the time you're enumerating the stack, the wrapped function has not actually been called. Only the wrapper has been called. If the stack included "junk" when junk had not yet been executed, the stack would be a lie.

>From the interpreter's point of view, it doesn't even know that wrapping is in play, aside from the chain of __wrapped__ values attached to the wrapper by functools.wraps (as a convenience). Until you actually call the wrapped function, it's possible you could change your mind and call some other function instead; Python won't stop you, and Python can't tell the difference before the call has been made.

----------
nosy: +josh.rosenberg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21794>
_______________________________________


More information about the Python-bugs-list mailing list