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

Antoine Pitrou report at bugs.python.org
Wed Apr 28 12:10:44 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

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

The classical solution is to early bind the necessary globals to
argument defaults, such as:

    def __del__(self, _socketclose=_socketclose):
        _socketclose(self._socket)

----------

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


More information about the Python-bugs-list mailing list