On Mon, Jun 28, 2010 at 6:26 PM, Terry Reedy email@example.com 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.