diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index d669aec54e1..6c7215219cf 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1471,7 +1471,7 @@ def retrieve(self, url, filename=None, reporthook=None, data=None): try: fp = self.open_local_file(url1) hdrs = fp.info() - del fp + fp.close() return url2pathname(splithost(url1)[1]), hdrs except IOError as msg: pass @@ -1515,8 +1515,6 @@ def retrieve(self, url, filename=None, reporthook=None, data=None): tfp.close() finally: fp.close() - del fp - del tfp # raise exception if actual size does not match content-length header if size >= 0 and read < size: