summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 22:54:56 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 22:54:56 (GMT)
commitd3c4853b7869b347462343fd9df99f998e0eb018 (patch)
treea57a8027f52185ab3abf65040e694306e3668163 /Lib/pathlib.py
parent7e10dbbd45503268f7bb3b241e30745df6c91b99 (diff)
downloadcpython-d3c4853b7869b347462343fd9df99f998e0eb018.zip
cpython-d3c4853b7869b347462343fd9df99f998e0eb018.tar.gz
cpython-d3c4853b7869b347462343fd9df99f998e0eb018.tar.bz2
Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
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 1480e2f..c0d858e 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1222,7 +1222,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)