Splice decorator out of exception stack trace?
Ben Weaver
ben.e.weaver at gmail.com
Wed Apr 22 14:19:52 EDT 2009
Hi,
Is there any way to "splice" a decorator out of an exception stack
trace? For example:
>>> def decorator(proc):
... def internal(*args, **kwargs):
... return proc(*args, **kwargs)
... return internal
>>> @decorator
... def foo():
... assert False, 'simulate failure'
>>> foo()
Traceback (most recent call last):
...
File "<...>", line 1, in <module>
File "<...>", line 3, in internal
File "<...>", line 3, in foo
AssertionError: simulate failure
I would like to know if it's possible to somehow end up with this
stack trace instead:
File "<...>", line 1, in <module>
File "<...>", line 3, in foo
Thanks in advance,
-Ben
More information about the Python-list
mailing list