Message262344
Attached patch modifies _pyio to mimick better the reference io module:
* Add IOBase._finalizing
* IOBase.__del__() sets _finalizing to True
* Add FileIO._dealloc_warn()
* Remove FileIO.__del__()
* FileIO.close(), _BufferedIOMixin.close() and TextIOWrapper.close() now calls _dealloc_warn() if _finalizing is true
* Override closed() method in FileIO: needed because FileIO.close() now calls super().close() before logging the ResourceWarning, and the file is expected to see open in the warning
* FileIO.close() now calls super().close() *before* closing the file descriptor
I added hasattr(.., '_dealloc_warn') sanity checks because _dealloc_warn() are added to concrete classes, not to base classes. |
|
| Date |
User |
Action |
Args |
| 2016-03-24 14:15:58 | vstinner | set | recipients:
+ vstinner, pitrou, Arfrever, akira, martin.panter, piotr.dobrogost, serhiy.storchaka |
| 2016-03-24 14:15:58 | vstinner | set | messageid: <1458828958.46.0.629459261211.issue19829@psf.upfronthosting.co.za> |
| 2016-03-24 14:15:58 | vstinner | link | issue19829 messages |
| 2016-03-24 14:15:58 | vstinner | create | |
|