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 gvanrossum
Recipients benhoyt, gvanrossum, serhiy.storchaka, vstinner
Date 2016-01-11.21:08:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452546487.15.0.536345791142.issue25994@psf.upfronthosting.co.za>
In-reply-to
Content
Note there's also a nasty corner case related to generators and GC. If a generator contains a with-block or finally-clause, and the generator is not run until its end because the caller hit an exception on one of the items returned, and the generator object is somehow kept alive (either because it's stored in some longer-living state or because the Python implementation doesn't use reference counting) then the close() call in the finally-clause or in the __exit__ method doesn't run until the generator object is garbage-collected.

IOW even making it a context manager doesn't completely solve this issue (though it can certainly help).
History
Date User Action Args
2016-01-11 21:08:07gvanrossumsetrecipients: + gvanrossum, vstinner, benhoyt, serhiy.storchaka
2016-01-11 21:08:07gvanrossumsetmessageid: <1452546487.15.0.536345791142.issue25994@psf.upfronthosting.co.za>
2016-01-11 21:08:07gvanrossumlinkissue25994 messages
2016-01-11 21:08:07gvanrossumcreate