Author vstinner
Recipients akuchling, ghazel, loewis, tim.peters, vstinner
Date 2009-01-14.01:09:19
SpamBayes Score 0.00160684
Marked as misclassified No
Message-id <1231895363.78.0.128452246045.issue1565525@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-01-14 01:09:24vstinnersetrecipients: + vstinner, tim.peters, loewis, akuchling, ghazel
2009-01-14 01:09:23vstinnersetmessageid: <1231895363.78.0.128452246045.issue1565525@psf.upfronthosting.co.za>
2009-01-14 01:09:22vstinnerlinkissue1565525 messages
2009-01-14 01:09:20vstinnercreate