I'm interested in a feature which allows users to discard the locals and globals references from frames held by a traceback object.
I'd like to take this further and remove the need for traceback objects to refer to a frame object at all. The standard traceback printout only needs two pieces of information from the traceback, the file name and line number.
The line number is already present in the traceback object. All it would take is the addition of a file name attribute to the traceback object, and the frame reference could be made optional.
This would be a big help for Pyrex and Cython, which currently have to create entire dummy frame objects in order to add entries to the traceback. Not only is this tedious and inefficient, it ties them to internal details of the frame object that are vulnerable to change. It would be much nicer to have a simple API function such as
to add a frameless traceback object.