diff options
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r-- | Lib/urllib/request.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 5325d62..35fd1f1 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1137,6 +1137,8 @@ class AbstractHTTPHandler(BaseHandler): r = h.getresponse() # an HTTPResponse instance except socket.error as err: raise URLError(err) + finally: + h.close() r.url = req.get_full_url() # This line replaces the .msg attribute of the HTTPResponse |