summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-26 19:06:40 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-26 19:06:40 (GMT)
commitab0abdcef8dac933d838cb584dd4b728c2474b1e (patch)
tree4514f15ac2574473fdf6807aa5a3b0325fe7bc4b /Lib
parent36b8f945e794e8483a185db3b6847c083a724e44 (diff)
downloadcpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.zip
cpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.tar.gz
cpython-ab0abdcef8dac933d838cb584dd4b728c2474b1e.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 337015f..82a26b3 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