]> granicus.if.org Git - python/commitdiff
Correcting issue 12576 fix, which resulted in buildbot failures.
authorSenthil Kumaran <senthil@uthcode.com>
Wed, 27 Jul 2011 01:31:03 +0000 (09:31 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Wed, 27 Jul 2011 01:31:03 +0000 (09:31 +0800)
Lib/urllib/request.py

index 534408d815c5bd9b5d0a18640bbc944be98bab1f..1dda966a23b314b26fae744348569d9df1f2e4c9 100644 (file)
@@ -1135,13 +1135,10 @@ class AbstractHTTPHandler(BaseHandler):
         try:
             h.request(req.get_method(), req.selector, req.data, headers)
         except socket.error as err: # timeout error
+            h.close()
             raise URLError(err)
-        finally:
-            try:
-                r = h.getresponse() # an HTTPResponse instance
-            except Exception as exp:
-                h.close()
-                raise exp
+        else:
+            r = h.getresponse()
 
         r.url = req.get_full_url()
         # This line replaces the .msg attribute of the HTTPResponse