[issue23915] traceback set with BaseException.with_traceback() overwritten on raise

Martin Panter report at bugs.python.org
Sun Apr 12 01:03:49 CEST 2015


Martin Panter added the comment:

My understanding is that the traceback is a linked list. Every time the exception is raised into a calling function or exception handler, a new traceback object is inserted at the front of the list. Your original traceback is not overwritten, it is just pushed back in the list. See my version of the demonstration script. The output is now:

a.__traceback__ before raise : [None]
a.__traceback__ after raise : [<traceback object at 0xb6fb3b1c>, None]
b.__traceback__ before raise : [<traceback object at 0xb6fb3b1c>, None]
b.__traceback__ after raise : [<traceback object at 0xb6fb3b44>, <traceback object at 0xb6fb3b1c>, None]

----------
nosy: +vadmium
Added file: http://bugs.python.org/file38902/traceback_list.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23915>
_______________________________________


More information about the Python-bugs-list mailing list