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

2015-04-11 Thread Travis A. Everett

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 : []
b.__traceback__ before raise: []
b.__traceback__ after raise : []

--
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 
<http://bugs.python.org/issue23915>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2015-04-12 Thread Travis A. Everett

Travis A. Everett added the comment:

Thanks, Martin--I should've thought to check to see if it'd just been pushed 
back in the list. I was just focusing on a workaround for another problem and 
did a double-take when the traceback value didn't match what was set.

This resolution is fine by me, but a note in the doc for with_traceback 
(https://docs.python.org/3/library/exceptions.html#BaseException.with_traceback)
 that it'll be immediately bumped back in the list when raised (as in the 
documentation's usage example) might help clarify for others.

--

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