Move the 'import os' in URLopener.cleanup() to inside the block

guarded by 'if self.tempcache', to reduce the likelihood of this
causing an exception when invoked during __del__...
This commit is contained in:
Guido van Rossum 1997-01-30 15:54:58 +00:00
parent f5c20575cb
commit d23d9409f3

View File

@ -101,8 +101,8 @@ class URLopener:
self.cleanup()
def cleanup(self):
import os
if self.tempcache:
import os
for url in self.tempcache.keys():
try:
os.unlink(self.tempcache[url][0])