mirror of
https://github.com/python/cpython
synced 2026-09-29 09:40:29 +03:00
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.
This commit is contained in:
parent
36b8f945e7
commit
ab0abdcef8
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue