summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-27 01:31:03 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-07-27 01:31:03 (GMT)
commit45686b472bf1f9e5ce1ef6953c4b123d271b2dc7 (patch)
treef7fd2505285be64989919000ec9a1c808c8f460a /Lib/urllib/request.py
parentf25e3d527820489cf83c80d7e497da6ee0a75da3 (diff)
downloadcpython-45686b472bf1f9e5ce1ef6953c4b123d271b2dc7.zip
cpython-45686b472bf1f9e5ce1ef6953c4b123d271b2dc7.tar.gz
cpython-45686b472bf1f9e5ce1ef6953c4b123d271b2dc7.tar.bz2
Correcting issue 12576 fix, which resulted in buildbot failures.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 534408d..1dda966 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -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