diff options
author | Armin Rigo <armin.rigo@gmail.com> | 2017-04-13 18:08:15 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2017-04-13 18:08:15 (GMT) |
commit | 22a594a0047d7706537ff2ac676cdc0f1dcb329c (patch) | |
tree | 14ab2ea85e7a28adb9d40f185006308d87a67f47 /Lib/pathlib.py | |
parent | 5908300e4b0891fc5ab8bd24fba8fac72012eaa7 (diff) | |
download | cpython-22a594a0047d7706537ff2ac676cdc0f1dcb329c.zip cpython-22a594a0047d7706537ff2ac676cdc0f1dcb329c.tar.gz cpython-22a594a0047d7706537ff2ac676cdc0f1dcb329c.tar.bz2 |
bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089)
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index fc7ce5e..1914229 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1217,8 +1217,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 |