Issue 5970: sys.exc_info leaks into a generator (original) (raw)

Created on 2009-05-08 17:44 by jyasskin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
exc_info.patch jyasskin,2009-05-08 17:43 New test illustrating the bug review
Messages (6)
msg87452 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2009-05-08 17:43
There's an obscure bug in sys.exc_info after a yield statement. def test(): def raising_generator(): try: raise IndexError("inner exception") except IndexError: yield 3 # Here, sys.exc_info() ought to refer to the inner # exception, but instead it refers to the outer one. try: raise ValueError("outer exception") except ValueError: for i in raising_generator(): pass sys.exc_info gets reset even if there's no outer exception. The attached (failing) patch highlights this problem, and tests other sys.exc_info behavior around function calls.
msg87454 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2009-05-08 17:49
I think we should _not_ backport any fix for this bug to the 2.6 series, since any changes to user behavior would be pretty subtle. To prevent that backport, I'd like to apply exc_info_26.patch to the 2.6 branch, with Barry's approval.
msg87522 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-10 11:56
Adding some tests to check that a bug is /not/ fixed looks weird to me. If we did that for every trunk change that we don't want to end up in the stable branch, there'd be lots of new tests of dubious utility. Besides, py3k isn't affected ;)
msg87523 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2009-05-10 12:06
I agree with Antoine.
msg87529 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2009-05-10 16:40
Re py3k: oops, thanks for checking. Re 2.6: Fine with me, second patch removed.
msg185424 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-03-28 10:25
Out of date now that 2.7 is also in maintenance mode.
History
Date User Action Args
2022-04-11 14:56:48 admin set github: 50220
2013-03-28 10:25:40 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: out of date
2009-05-10 16:40:47 jyasskin set files: - exc_info_26.patch
2009-05-10 16:40:41 jyasskin set assignee: barry -> messages: +
2009-05-10 12:06:40 barry set messages: + versions: - Python 2.6
2009-05-10 11:56:48 pitrou set nosy: + pitroumessages: + versions: - Python 3.1
2009-05-08 17:49:55 jyasskin set files: + exc_info_26.patchnosy: + barrymessages: + assignee: barry
2009-05-08 17:44:00 jyasskin create