diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-07-27 01:32:04 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-07-27 01:32:04 (GMT) |
commit | 4d90b19373a7ed83dee2291f82167842ed738bf2 (patch) | |
tree | feddb212683c19d790820dae6e5ee6b382b23211 | |
parent | 12aa1aea670de34ab88bfdf41c8aace394975fd5 (diff) | |
parent | 45686b472bf1f9e5ce1ef6953c4b123d271b2dc7 (diff) | |
download | cpython-4d90b19373a7ed83dee2291f82167842ed738bf2.zip cpython-4d90b19373a7ed83dee2291f82167842ed738bf2.tar.gz cpython-4d90b19373a7ed83dee2291f82167842ed738bf2.tar.bz2 |
merge from 3.2 - Correcting issue 12576 fix, which resulted in buildbot failures.
-rw-r--r-- | Lib/urllib/request.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index ca643eb..d1acae1 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1144,13 +1144,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 |