From 22a594a0047d7706537ff2ac676cdc0f1dcb329c Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Thu, 13 Apr 2017 20:08:15 +0200 Subject: bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089) --- Lib/pathlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/pathlib.py') 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 -- cgit v1.2.1