mirror of
https://github.com/python/cpython.git
synced 2024-12-22 00:04:12 +08:00
Avoid AttributeError(_closed) when a TemporaryDirectory is deallocated whose mkdtemp call failed.
This commit is contained in:
parent
dd5909725c
commit
ab3734fd97
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user