summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 22:56:57 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 22:56:57 (GMT)
commit479d96c694ea5158e5c00a86ca121c19ff43352e (patch)
treeec1d2d1b24d8195eee082ec01e2a76db786ff5ad /Lib/pathlib.py
parentef5176769d5e54374d84b44f8be2c94f6ab909fa (diff)
parent1add96f1b669436ca96dc8adf24276adea6aea4c (diff)
downloadcpython-479d96c694ea5158e5c00a86ca121c19ff43352e.zip
cpython-479d96c694ea5158e5c00a86ca121c19ff43352e.tar.gz
cpython-479d96c694ea5158e5c00a86ca121c19ff43352e.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 0484dac..9f34721 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)