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 martin.panter
Recipients martin.panter, ncoghlan, njs, vstinner, yselivanov
Date 2016-11-14.07:59:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479110386.86.0.796859494427.issue28629@psf.upfronthosting.co.za>
In-reply-to
Content
BTW my understanding is that currently, if the garbage collector deletes a generator, it effectively calls its close() method. When close() is called, it throws GeneratorExit into the suspended generator. This is meant to cause all the “with” and “try” statements to clean up.

So, yes, explicitly calling close() should immediately release the resources, call obj.__exit__(), etc. The idea of the ResourceWarning is to tell the programmer they forgot to call close().
History
Date User Action Args
2016-11-14 07:59:46martin.pantersetrecipients: + martin.panter, ncoghlan, vstinner, njs, yselivanov
2016-11-14 07:59:46martin.pantersetmessageid: <1479110386.86.0.796859494427.issue28629@psf.upfronthosting.co.za>
2016-11-14 07:59:46martin.panterlinkissue28629 messages
2016-11-14 07:59:46martin.pantercreate