Author martin.panter
Recipients barry, martin.panter
Date 2013-12-06.12:50:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here are two patches: a test case, and a fix for my issue. They were done against an installed version of Python 3.3.3.

I’m not entirely happy with the fix because it is accessing the private HTTPConnection.sock attribute from the urllib.request module, which seems a bit hacky. Other ideas would be to let HTTPConnection grow a new public method (or just a flag?) for cleaning itself up while leaving the response object still open. Or some kind of wrapper to augment the HTTPResponse.close() method to explicitly close the connection as well, like I originally mentioned.

Also my test case borrows some classes from the “test_urllib” module into the “test_urllib2”. This is the first time I’ve looked closely at the Python test suite; maybe there is a better to do that as well.

A bonus from my fix: it looks like it resolves a couple warnings running “test_urllib2net”.
Date User Action Args
2013-12-06 12:50:08martin.pantersetrecipients: + martin.panter, barry
2013-12-06 12:50:08martin.pantersetmessageid: <>
2013-12-06 12:50:08martin.panterlinkissue19524 messages
2013-12-06 12:50:08martin.pantercreate