diff options
author | Georg Brandl <georg@python.org> | 2010-12-11 19:10:30 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-12-11 19:10:30 (GMT) |
commit | ab3734fd97cb060b3e39d0350df0e741ad3b7b11 (patch) | |
tree | 3ffd7f083bcc7730cfaecc9d83cdae9fd3f72e46 | |
parent | dd5909725cf742574f5bd196c5ed338c43664457 (diff) | |
download | cpython-ab3734fd97cb060b3e39d0350df0e741ad3b7b11.zip cpython-ab3734fd97cb060b3e39d0350df0e741ad3b7b11.tar.gz cpython-ab3734fd97cb060b3e39d0350df0e741ad3b7b11.tar.bz2 |
Avoid AttributeError(_closed) when a TemporaryDirectory is deallocated whose mkdtemp call failed.
-rw-r--r-- | Lib/tempfile.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index cbaac43..7e03784 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -617,6 +617,8 @@ class TemporaryDirectory(object): """ 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 |