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 r.david.murray
Recipients billyfoster, gvanrossum, r.david.murray, yselivanov
Date 2016-09-25.19:21:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474831306.77.0.95452237023.issue28274@psf.upfronthosting.co.za>
In-reply-to
Content
In the first case, once the loop has run the task it no longer has a reference to it, and it gets GCed.  The __del__ method of the task calls your exception handler.  In the second case, you have a reference to it, so __del__ does not get called.

If you want the exception to be realized in the second case, you have to yield from it somewhere in your program.
History
Date User Action Args
2016-09-25 19:21:46r.david.murraysetrecipients: + r.david.murray, gvanrossum, yselivanov, billyfoster
2016-09-25 19:21:46r.david.murraysetmessageid: <1474831306.77.0.95452237023.issue28274@psf.upfronthosting.co.za>
2016-09-25 19:21:46r.david.murraylinkissue28274 messages
2016-09-25 19:21:46r.david.murraycreate