Message197396
| Author |
vstinner |
| Recipients |
akuchling, ghazel, loewis, pconnell, pitrou, r.david.murray, terry.reedy, tim.peters, vstinner |
| Date |
2013年09月09日.20:20:37 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1378758037.76.0.250965571302.issue1565525@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I tried to implement the feature as a new traceback.clear_frames() method. I tried to follow the chain of frame objects (using frame.f_back), but it does not work as expected. The method needs to follow the chain of traceback objects (tb.tb_next). So it makes sense to define a function instead of a method (a method usually only affect the object, not a chain of objects).
clear-tb-frames-2.txt:
- I didn't see the "tb" abbreviation in other places in Python, except for traceback attributes. I prefer clear_traceback_frames(). The name clear_frames() is maybe better because traceback is already known by the context (the module is called "tracback". Example: traceback.clear_frames(tb) instead of traceback.clear_traceback_frames(tb).
- The documentation is wrong: frame.clear() does not guarantee to clear *all* locals, but only *most* locals:
"F.clear(): clear most references held by the frame");
So I suggest a more permissive documentation:
"Clear most reference held by frames." |
|