homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sys.exc_info leaks into a generator
Type: behavior Stage: needs patch
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: barry, collinwinter, georg.brandl, jyasskin, pitrou
Priority: low Keywords: patch

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:48adminsetgithub: 50220
2013年03月28日 10:25:40georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg185424

resolution: out of date
2009年05月10日 16:40:47jyasskinsetfiles: - exc_info_26.patch
2009年05月10日 16:40:41jyasskinsetassignee: barry ->
messages: + msg87529
2009年05月10日 12:06:40barrysetmessages: + msg87523
versions: - Python 2.6
2009年05月10日 11:56:48pitrousetnosy: + pitrou

messages: + msg87522
versions: - Python 3.1
2009年05月08日 17:49:55jyasskinsetfiles: + exc_info_26.patch

nosy: + barry
messages: + msg87454

assignee: barry
2009年05月08日 17:44:00jyasskincreate

AltStyle によって変換されたページ (->オリジナル) /