diff -r 18432e8885e0 Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py Sun May 22 17:35:48 2011 +0200 +++ b/Lib/test/test_urllib.py Sun May 22 20:50:54 2011 +0300 @@ -1155,14 +1155,14 @@ support.run_unittest( urlopen_FileTests, urlopen_HttpTests, - urlretrieve_FileTests, - ProxyTests, - QuotingTests, - UnquotingTests, - urlencode_Tests, - Pathname_Tests, - Utility_Tests, - URLopener_Tests, + #urlretrieve_FileTests, + #ProxyTests, + #QuotingTests, + #UnquotingTests, + #urlencode_Tests, + #Pathname_Tests, + #Utility_Tests, + #URLopener_Tests, #FTPWrapperTests, ) diff -r 18432e8885e0 Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py Sun May 22 17:35:48 2011 +0200 +++ b/Lib/test/test_urllib2.py Sun May 22 20:50:54 2011 +0300 @@ -318,6 +318,9 @@ 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 diff -r 18432e8885e0 Lib/urllib/request.py --- a/Lib/urllib/request.py Sun May 22 17:35:48 2011 +0200 +++ b/Lib/urllib/request.py Sun May 22 20:50:54 2011 +0300 @@ -1146,6 +1146,9 @@ r = h.getresponse() # an HTTPResponse instance except socket.error as err: raise URLError(err) + finally: + print('h', h) + h.close() r.url = req.get_full_url() # This line replaces the .msg attribute of the HTTPResponse @@ -1700,6 +1703,9 @@ except http.client.BadStatusLine: # something went wrong with the HTTP status line raise URLError("http protocol error: bad status line") + finally: + print(http_conn) + http_conn.close() # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted.