]> granicus.if.org Git - python/commitdiff
Explicitly close the socket and temp file in URLopener.retrieve(), so
authorGuido van Rossum <guido@python.org>
Tue, 26 Aug 1997 19:06:40 +0000 (19:06 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 26 Aug 1997 19:06:40 +0000 (19:06 +0000)
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

index 337015fed00d5095a6d52fae75539b366857aa00..82a26b3b2e6d6f9eaffa86edd2f675fe1bfb07cd 100644 (file)
@@ -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