[Python-checkins] r87172 - python/branches/py3k/Lib/tempfile.py

georg.brandl python-checkins at python.org
Sat Dec 11 20:10:31 CET 2010


Author: georg.brandl
Date: Sat Dec 11 20:10:30 2010
New Revision: 87172

Log:
Avoid AttributeError(_closed) when a TemporaryDirectory is deallocated whose mkdtemp call failed.

Modified:
   python/branches/py3k/Lib/tempfile.py

Modified: python/branches/py3k/Lib/tempfile.py
==============================================================================
--- python/branches/py3k/Lib/tempfile.py	(original)
+++ python/branches/py3k/Lib/tempfile.py	Sat Dec 11 20:10:30 2010
@@ -617,6 +617,8 @@
     """
 
     def __init__(self, suffix="", prefix=template, dir=None):
+        # cleanup() needs this and is called even when mkdtemp fails
+        self._closed = True
         self.name = mkdtemp(suffix, prefix, dir)
         self._closed = False
 


More information about the Python-checkins mailing list