mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
This commit is contained in:
commit
1add96f1b6
3 changed files with 14 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue