mirror of https://github.com/python/cpython.git
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 @@ def close(self):
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
import os
|
|
||||||
if self.tempcache:
|
if self.tempcache:
|
||||||
|
import os
|
||||||
for url in self.tempcache.keys():
|
for url in self.tempcache.keys():
|
||||||
try:
|
try:
|
||||||
os.unlink(self.tempcache[url][0])
|
os.unlink(self.tempcache[url][0])
|
||||||
|
|
Loading…
Reference in New Issue