summaryrefslogtreecommitdiff
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 14:54:56 -0800
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 14:54:56 -0800
commite1ac7d87afad9c07ec25e5705bb135b71347b581 (patch)
treeff1c76fa294a5c1ee5f8750b66808cd9af35ffc3 /Lib/pathlib.py
parent8e053336f6bba25a3c3bbfa11f33e8b3c072915a (diff)
downloadcpython-e1ac7d87afad9c07ec25e5705bb135b71347b581.tar.gz
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 1480e2fc71..c0d858ef56 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)