summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-30 15:54:58 (GMT)
committerGuido van Rossum <guido@python.org>1997-01-30 15:54:58 (GMT)
commitd23d9409f311d53e0968fd65a6cdab1777e410ab (patch)
tree85be5a6f64303af4ac56b1c1b7346fbcb91d6e54 /Lib/urllib.py
parentf5c20575cb7aa96490520a88c9c8f7aec6a45f37 (diff)
downloadcpython-d23d9409f311d53e0968fd65a6cdab1777e410ab.zip
cpython-d23d9409f311d53e0968fd65a6cdab1777e410ab.tar.gz
cpython-d23d9409f311d53e0968fd65a6cdab1777e410ab.tar.bz2
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__...
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index e44f6b1..b410bd8 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -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])