[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

Serhiy Storchaka report at bugs.python.org
Wed Dec 18 13:25:44 CET 2013


Serhiy Storchaka added the comment:

Thank you Martin for clarification. Now I see the problem.

Here is regenerated for Rietveld patch.

Perhaps more safe will be not close socket, but only set the _closed attribute so that it will be closed just after closing SocketIO.

        if h.sock:
            h.sock._closed = True
            h.sock = None

But this is even more tricky.

Yet one approach is to implement __del__() method in the socket.socket class. But this breaks existing tests.

----------
Added file: http://bugs.python.org/file33187/issue19524.diff

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


More information about the Python-bugs-list mailing list