commit | ab3734fd97cb060b3e39d0350df0e741ad3b7b11 | [log] [tgz] |
---|---|---|
author | Georg Brandl <georg@python.org> | Sat Dec 11 19:10:30 2010 +0000 |
committer | Georg Brandl <georg@python.org> | Sat Dec 11 19:10:30 2010 +0000 |
tree | 3ffd7f083bcc7730cfaecc9d83cdae9fd3f72e46 | |
parent | dd5909725cf742574f5bd196c5ed338c43664457 [diff] |
Avoid AttributeError(_closed) when a TemporaryDirectory is deallocated whose mkdtemp call failed.
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 @@ """ 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