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

2014-06-18 Thread Zachary Ware
Zachary Ware added the comment: I agree with Josh; I don't think there's any bug here. To confirm, I expanded on your example, reproduced below. Have a look at and play around with this, and if you still believe something is wrong, ask on python-list and the folks there should be able to hel

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

2014-06-17 Thread Josh Rosenberg
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

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

2014-06-17 Thread the mulhern
New submission from the mulhern: >>> 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) ... retur