Message280738
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(). |
|
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 | |
|