diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 22:55:16 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 22:55:16 (GMT) |
commit | 1add96f1b669436ca96dc8adf24276adea6aea4c (patch) | |
tree | fbe866bb72d207ba611f8f72b12e7d08d121a0c2 /Lib/pathlib.py | |
parent | 86e42376c2f41e6601b1844fb127f2f2e7b5349a (diff) | |
parent | d3c4853b7869b347462343fd9df99f998e0eb018 (diff) | |
download | cpython-1add96f1b669436ca96dc8adf24276adea6aea4c.zip cpython-1add96f1b669436ca96dc8adf24276adea6aea4c.tar.gz cpython-1add96f1b669436ca96dc8adf24276adea6aea4c.tar.bz2 |
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 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) |