Message108665
The objects I do want in the traceback are the objects necessary to print a traceback, but not the locals and globals of each frame.
For example:
def bar():
x = "stuff"
raise Exception("example!")
bar()
prints:
Traceback (most recent call last):
Line 4, in <module>
bar()
Line 3, in bar
raise Exception("example!")
Exception: example!
There is no reason in that example to have a reference to "x" in the traceback, since it's not used in the output. This becomes important when I try to save a reference to the traceback object and raise it later:
import sys
def bar():
x = "stuff"
raise Exception("example!")
try:
bar()
except:
exc_info = sys.exc_info()
def foo(e):
raise e[0], e[1], e[2]
# sometime possibly much later...
foo(exc_info)
Traceback (most recent call last):
Line 12, in <module>
foo(exc_info)
Line 6, in <module>
bar()
Line 4, in bar
raise Exception("example!")
Exception: example!
During that "sometime possibly much later..." comment, a reference to "x" is held, when it will not be used in printing the traceback later. So, I would not like to keep a reference to "x", and currently there is no way to do that without also dropping a reference to the data needed to print the traceback. |
|
Date |
User |
Action |
Args |
2010-06-26 00:45:47 | ghazel | set | recipients:
+ ghazel, tim.peters, loewis, akuchling, terry.reedy, vstinner |
2010-06-26 00:45:46 | ghazel | set | messageid: <1277513146.97.0.871831127478.issue1565525@psf.upfronthosting.co.za> |
2010-06-26 00:45:45 | ghazel | link | issue1565525 messages |
2010-06-26 00:45:45 | ghazel | create | |
|