]> granicus.if.org Git - python/commitdiff
Move the 'import os' in URLopener.cleanup() to inside the block
authorGuido van Rossum <guido@python.org>
Thu, 30 Jan 1997 15:54:58 +0000 (15:54 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 30 Jan 1997 15:54:58 +0000 (15:54 +0000)
guarded by 'if self.tempcache', to reduce the likelihood of this
causing an exception when invoked during __del__...

Lib/urllib.py

index e44f6b1435d3b70ba7eedda272eba18cb5192549..b410bd89a76017bd710062f30f4d4878470cc691 100644 (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])