Message280738
| 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:46 | martin.panter | set | recipients:
+ martin.panter, ncoghlan, vstinner, njs, yselivanov |
| 2016年11月14日 07:59:46 | martin.panter | set | messageid: <1479110386.86.0.796859494427.issue28629@psf.upfronthosting.co.za> |
| 2016年11月14日 07:59:46 | martin.panter | link | issue28629 messages |
| 2016年11月14日 07:59:46 | martin.panter | create |
|