(Merge 3.2) Issue #12133: fix a ResourceWarning in urllib.request

AbstractHTTPHandler.do_open() of urllib.request closes the HTTP connection if
its getresponse() method fails with a socket error. Patch written by Ezio
Melotti.
This commit is contained in:
Victor Stinner 2011-06-17 14:02:18 +02:00
commit f073dc286c
3 changed files with 9 additions and 0 deletions

View file

@ -318,6 +318,9 @@ class MockHTTPClass:
def getresponse(self):
return MockHTTPResponse(MockFile(), {}, 200, "OK")
def close(self):
pass
class MockHandler:
# useful for testing handler machinery
# see add_ordered_mock_handlers() docstring