summaryrefslogtreecommitdiff
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 0484dacd79..9f347216b1 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1235,7 +1235,7 @@ class Path(PurePath):
if not exist_ok or not self.is_dir():
raise
except OSError as e:
- if e.errno != ENOENT:
+ if e.errno != ENOENT or self.parent == self:
raise
self.parent.mkdir(parents=True)
self._accessor.mkdir(self, mode)