mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
bpo-29694: race condition in pathlib mkdir with flags parents=True (GH-1089)
This commit is contained in:
parent
5908300e4b
commit
22a594a004
3 changed files with 36 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue