From: Guido van Rossum Date: Tue, 26 Aug 1997 19:06:40 +0000 (+0000) Subject: Explicitly close the socket and temp file in URLopener.retrieve(), so X-Git-Tag: v1.5a4~306 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ab0abdcef8dac933d838cb584dd4b728c2474b1e;p=thirdparty%2FPython%2Fcpython.git Explicitly close the socket and temp file in URLopener.retrieve(), so that multiple retrievals using the same connection will work. This leaves open the more general problem that after f = urlopen("ftp://...") f must be closed before another retrieval from the same host should be attempted. --- diff --git a/Lib/urllib.py b/Lib/urllib.py index 337015fed00d..82a26b3b2e6d 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -191,6 +191,8 @@ class URLopener: while block: tfp.write(block) block = fp.read(bs) + fp.close() + tfp.close() del fp del tfp return result