[issue33066] raise an exception from multiple positions break the traceback frames

2021-01-12 Thread Irit Katriel


Irit Katriel  added the comment:

See this documentation of with_traceback() regarding an API to set the 
traceback on an exception object.
 https://docs.python.org/3/library/exceptions.html#BaseException.with_traceback

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33066] raise an exception from multiple positions break the traceback frames

2020-12-07 Thread Irit Katriel


Irit Katriel  added the comment:

When an exception has a __traceback__ and you raise it, the current frame is 
added to that traceback. What do you expect the behavior to be when you raise 
the same exception instance twice, from two different locations?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue33066] raise an exception from multiple positions break the traceback frames

2018-03-13 Thread hubo

New submission from hubo :

The attachment is a script that demonstrates the behavior. The simple unittest 
script should exit very quickly, but in fact, it runs indefinitely.

It uses asyncio to reproduce the result, but other concurrent technologies are 
also affected.

In Python 3, traceback of an exception is mutable. When the exception is 
re-raised, current frames are appended to the traceback. But when the same 
exception object is raised in multiple position (e.g. passed to different 
coroutines with futures), the frames are appended in the same list, so the 
tracebacks are mixed together.

assertRaises in unittest calls traceback.clear_frames internally. When the 
tracebacks are mixed, it may clear a running frame (in a generator), producing 
strange behaviors.

--
files: test1.py
messages: 313735
nosy: hubo1016
priority: normal
severity: normal
status: open
title: raise an exception from multiple positions break the traceback frames
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47480/test1.py

___
Python tracker 

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