[issue17852] Built-in module _io can loose data from buffered files at exit

Armin Rigo report at bugs.python.org
Thu Dec 4 13:53:14 CET 2014


Armin Rigo added the comment:

Antoine: sorry if I wasn't clear enough.  Obviously you want to encourage people to close their files, but I think personally that it is very bad for the implementation to *most of the time* work anyway and only rarely fail to flush the files.  So, speaking only about the implementation, it is (imho) a bad idea to rely on finalizers to flush the files, and something else should be done.

Victor: it does not sound complicated to me to keep the BufferedWriter objects in a doubly-chained list.  You're overthinking the issue: there are no multithread issue (we have a GIL) and you don't have to keep track of all 3 objects created by "open".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17852>
_______________________________________


More information about the Python-bugs-list mailing list