New submission from Travis A. Everett:

When BaseException.with_traceback(tb) is used, the __traceback__ property is 
properly set, but the property gets overwritten when the exception is raised. 

The attached file demonstrates the issue by raising exception a, which doesn't 
use with_traceback, and exception b, which uses 
with_traceback(a.__traceback__). It also demonstrates that the exception object 
can't observe this change. Executing the attached file produces output like:

a.__traceback__ before raise: [None]
a.__traceback__ after raise : [<traceback object at 0x7f95c5a21708>]
b.__traceback__ before raise: [<traceback object at 0x7f95c5a21708>]
b.__traceback__ after raise : [<traceback object at 0x7f95c5a21748>]

----------
files: exctest.py
messages: 240483
nosy: abathur
priority: normal
severity: normal
status: open
title: traceback set with BaseException.with_traceback() overwritten on raise
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file38898/exctest.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23915>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to