summaryrefslogtreecommitdiff
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorArmin Rigo <armin.rigo@gmail.com>2017-04-13 20:08:15 +0200
committerMariatta <Mariatta@users.noreply.github.com>2017-04-13 11:08:15 -0700
commit22a594a0047d7706537ff2ac676cdc0f1dcb329c (patch)
tree14ab2ea85e7a28adb9d40f185006308d87a67f47 /Lib/pathlib.py
parent5908300e4b0891fc5ab8bd24fba8fac72012eaa7 (diff)
downloadcpython-git-22a594a0047d7706537ff2ac676cdc0f1dcb329c.tar.gz
bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089)
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index fc7ce5eb2a..19142295c9 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