STINNER Victor <[email protected]> added the comment:
I tried to remove the frame from the traceback type (to keep only the
filename and code name), but many functions rely on the frame object.
Some examples:
Lib/unittest.py:
class TestResult(object):
def _is_relevant_tb_level(self, tb):
return '__unittest' in tb.tb_frame.f_globals
Lib/traceback.py:
print_tb() uses tb.tb_frame.f_globals for linecache.getline()
Doc/tools/jinga/debugger.py:
translate_exception() checks if __jinja_template__ variable is
present in b.tb_frame.f_globals
Lib/idlelib/StackViewer.py:
StackTreeItem.get_stack() stores each tb.tb_frame in a list
FrameTreeItem.GetText() reads frame.f_globals["__name__"] and gets
the filename and code name using frame.f_code
Lib/logging/__init__.py:
currentframe() reads sys.exc_traceback.tb_frame.f_back
Lib/types.py:
Use tb.tb_frame to create the FrameType
(...)
co_name/co_filename can be stored directly in the traceback. But what
about tb.tb_frame.f_back and tb.tb_frame.f_globals? I'm not motivated
enough to change traceback API.
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1565525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com