[issue10883] urllib: socket is not closed explicitly

Nadeem Vawda report at bugs.python.org
Mon Mar 21 02:38:14 CET 2011

Nadeem Vawda <nadeem.vawda at gmail.com> added the comment:

> I saw the partial fix suggested by the patch, but for some reason I
> did not see ResourceWarning being shutup.

Do you mean that you aren't getting ResourceWarnings in the first place?
Or that you are getting warnings, and the partial fix isn't getting rid
of any of them?

Note: it doesn't get rid of *all* of the warnings for test_urllib2net;
only some of them.

About the remaining warnings, it seems that FTPHandler.ftp_open() creates
an ftpwrapper object to connect to the server, and then the ftpwrapper
doesn't get closed anywhere. It has to stay open until the caller has
finished reading from the connection, so finding the right place to close
it might be a bit tricky.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list