Fix bug if tmpcache is None

This commit is contained in:
Guido van Rossum 1994-09-21 11:36:19 +00:00
parent 798199d8a6
commit fa59e83813
1 changed files with 2 additions and 1 deletions

View File

@ -123,8 +123,9 @@ class URLopener:
headers = fp.info() headers = fp.info()
import tempfile import tempfile
tfn = tempfile.mktemp() tfn = tempfile.mktemp()
result = tfn, headers
if self.tempcache is not None: if self.tempcache is not None:
self.tempcache[url] = result = tfn, headers self.tempcache[url] = result
tfp = open(tfn, 'w') tfp = open(tfn, 'w')
bs = 1024*8 bs = 1024*8
block = fp.read(bs) block = fp.read(bs)