[Python-Dev] Silencing IO errors on del/dealloc? (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Feb 22 21:24:44 CET 2009


Greg Ewing <greg.ewing canterbury.ac.nz> writes:

I would hope that the C version could at least ensure that buffers are flushed properly without having to rely on any global variables, so that this would not be so much of an issue.

The C version cleans up after itself just fine :) The issue is when someone defines a Python class derived from IOBase or one of its descendants (RawIOBase, BufferedIOBase, TextIOBase), and overrides the close() method. (see e.g. SocketIO in socket.py, which incidentally defined its own del while it could perhaps rely on RawIOBase to do the right thing)



More information about the Python-Dev mailing list