[issue808164] socket.close() doesn't play well with __del__

Daniel Stutzbach report at bugs.python.org
Wed Apr 28 02:09:37 CEST 2010


Daniel Stutzbach <daniel at stutzbachenterprises.com> added the comment:

The purpose of calling .close() in __del__ is to close the socket when the owner is destroyed yet the program is still running.

This prevents the socket from staying open if some other part of the program has somehow acquired a reference to it.  telnetlib, urllib, and even the socket module itself contain classes that call .close() within __del__ for this purpose.

Unfortunately, that can result in ugly error messages when the interpreter is exiting.

----------

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


More information about the Python-bugs-list mailing list