[Python-checkins] r80720 - in python/trunk: Lib/_pyio.pyLib/test/test_io.py Misc/NEWS Modules/_io/bufferedio.c Modules/_io/bytesio.cModules/_io/iobase.cModules/_io/textio.c

Antoine Pitrou solipsis at pitrou.net
Tue May 4 01:20:38 CEST 2010


Nick Coghlan <ncoghlan <at> gmail.com> writes:
> 
> I believe silencing errors in file.close() was a conscious decision
> (although I may just be remembering the discussions about __del__).

Yes, I think you are remembering the discussions about __del__ :)

There's no excuse for silencing errors in flush() when close() is called. These
errors indicate that not everything was committed to disk and the file contents
are subsequently corrupted. If the user doesn't get informed about it, we're
clearly doing something wrong.

(of course, these errors rarely happen in modern life - which can make them even
more dangerous if silenced)

> Either way, reverting it should be discussed on python-dev. I definitely
> have grave doubts about backporting this to the maintenance branches,
> and I'm not a particularly big fan of adding it to a release that is
> already in beta either.

Silencing a true and potentially critical error is a bug IMO.
Moreover, we'd better establish sane semantics in the io module before it gets
widespread acceptance - this was the rationale for the truncate() API change,
approved by Guido (while I was a bit reluctant).

Regards

Antoine.




More information about the Python-checkins mailing list