[issue32038] Add API to intercept socket.close()

STINNER Victor report at bugs.python.org
Thu Nov 16 11:38:50 EST 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

>From my example: "finally: sock._io_refs -= 1"

Oh, sock._decref_socketios() must be uesd here to really close the socket if it was closed in the meanwhile:

    def _decref_socketios(self):
        if self._io_refs > 0:
            self._io_refs -= 1
        if self._closed:
            self.close()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32038>
_______________________________________


More information about the Python-bugs-list mailing list