Nick Coghlan added the comment:

For both of the proposed patches, could we add a test case based on 
contextlib.ExitStack and a variant of Victor's #27122 reproducer script at 
http://bugs.python.org/file42999/hang_bug2.py that uses a deliberately broken 
__exit__ implementation that always re-raises the exception thrown into the 
underlying generator?

As discussed on that issue, I'm wondering if we need some additional defensive 
coding in ExitStack itself, or if resolving this underlying problem will be 
enough to also categorically prevent the hang in ExitStack.

As far as possible resolutions go, I tend to prefer lying about the shape of 
the exception state over changing the type of the raised exception - we already 
know the true exception state is a tree rather than a chain (see #18861 for 
some related discussions), and we should be able to ensure that all active 
exceptions remain somewhere in the chain, even if their order is a bit 
surprising.

----------

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

Reply via email to