Issue #29416: Prevent infinite loop in pathlib.Path.mkdir

This commit is contained in:
Steve Dower 2017-02-04 14:55:16 -08:00
commit 1add96f1b6
3 changed files with 14 additions and 1 deletions

View file

@ -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)