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.

Author ncoghlan
Recipients jcflack, ncoghlan, python-dev
Date 2014-01-22.12:39:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390394345.05.0.362448176368.issue20317@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, that's quite neat. Because of the way _GeneratorContextManager works, the context is actually already set correctly on the thrown exceptions, but ExitStack is assuming it will be wrong.

This means _fix_exception (part of ExitStack.__exit__) ends up setting the first exception's context to itself while handling the second exception, which then creates an infinite loop when attempting to handle the third exception. Hence why three is the magic number :)

The existing tests didn't pick this up, because they just used callbacks for simplicity, and hence the context was wrong as expected.

Commit incoming.
History
Date User Action Args
2014-01-22 12:39:05ncoghlansetrecipients: + ncoghlan, python-dev, jcflack
2014-01-22 12:39:05ncoghlansetmessageid: <1390394345.05.0.362448176368.issue20317@psf.upfronthosting.co.za>
2014-01-22 12:39:05ncoghlanlinkissue20317 messages
2014-01-22 12:39:04ncoghlancreate