Commit 4e9a1ea6 authored by Georg Brandl's avatar Georg Brandl

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

parent ea274d31
...@@ -617,6 +617,8 @@ class TemporaryDirectory(object): ...@@ -617,6 +617,8 @@ class TemporaryDirectory(object):
""" """
def __init__(self, suffix="", prefix=template, dir=None): 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.name = mkdtemp(suffix, prefix, dir)
self._closed = False self._closed = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment