[Python-ideas] feature to make traceback objects usable without references to frame locals and globals

ghazel at gmail.com ghazel at gmail.com
Tue Jun 29 03:34:39 CEST 2010

On Mon, Jun 28, 2010 at 6:26 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 6/28/2010 8:39 AM, Antoine Pitrou wrote:
>> However, as the OP argued, most often you need the traceback in order
>> to display file names and line numbers, but you don't need the attached
>> variables (locals and globals).
> It then seems to me that one should extract the file name and line number
> info one wants to save before exiting the exception clause and let the
> traceback exception and traceback go on exit. Is a library function needed
> to make extraction easier?

Unfortunately this is only half of the task. To re-raise the exception
with the traceback later, a real traceback object is needed. To my
knowledge there is no way to create a real traceback object from
Python given only file name and line numbers.


More information about the Python-ideas mailing list