STINNER Victor added the comment: 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." ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1565525> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com