mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
[3.6] bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089). (GH-1126)
(cherry picked from commit 22a594a004
)
This commit is contained in:
parent
2cdf087d1f
commit
cbc46afa59
3 changed files with 36 additions and 2 deletions
|
@ -1230,8 +1230,8 @@ class Path(PurePath):
|
|||
except FileNotFoundError:
|
||||
if not parents or self.parent == self:
|
||||
raise
|
||||
self.parent.mkdir(parents=True)
|
||||
self._accessor.mkdir(self, mode)
|
||||
self.parent.mkdir(parents=True, exist_ok=True)
|
||||
self.mkdir(mode, parents=False, exist_ok=exist_ok)
|
||||
except OSError:
|
||||
# Cannot rely on checking for EEXIST, since the operating system
|
||||
# could give priority to other errors like EACCES or EROFS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue