[Python-Dev] close() questions (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Thu Jun 12 15:16:38 CEST 2014
- Previous message: [Python-Dev] Why does IOBase.__del__ call .close?
- Next message: [Python-Dev] Issue #21205: add __qualname__ to generators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
11.06.14 05:28, Antoine Pitrou написав(ла):
close() should indeed be idempotent on all bundled IO class implementations (otherwise it's a bug), and so should it preferably on third-party IO class implementations.
There are some questions about close().
If object owns several resources, should close() try to clean up all them if error is happened during cleaning up some resource. E.g. should BufferedRWPair.close() close reader if closing writer failed?
If close() raises an exception, should repeated call of close() raise an exception or do nothing? E.g. if GzipFile.close() fails during writing gzip tail (CRC and size), should repeated call of it try to write this tail again?
If close() raises an exception, should the closed attribute (if exists) be True or False?
- Previous message: [Python-Dev] Why does IOBase.__del__ call .close?
- Next message: [Python-Dev] Issue #21205: add __qualname__ to generators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]