mirror of
https://github.com/python/cpython.git
synced 2024-11-28 12:31:14 +08:00
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:
parent
f5c20575cb
commit
d23d9409f3
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user