diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 14:54:56 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 14:54:56 -0800 |
commit | e1ac7d87afad9c07ec25e5705bb135b71347b581 (patch) | |
tree | ff1c76fa294a5c1ee5f8750b66808cd9af35ffc3 /Lib/pathlib.py | |
parent | 8e053336f6bba25a3c3bbfa11f33e8b3c072915a (diff) | |
download | cpython-e1ac7d87afad9c07ec25e5705bb135b71347b581.tar.gz |
Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 2 |
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) |