From ab0abdcef8dac933d838cb584dd4b728c2474b1e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 26 Aug 1997 19:06:40 +0000 Subject: [PATCH] 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. --- Lib/urllib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/urllib.py b/Lib/urllib.py index 337015fed0..82a26b3b2e 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 -- 2.50.1