mirror of
https://github.com/python/cpython.git
synced 2025-10-24 02:13:49 +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 @@ def mkdir(self, mode=0o777, parents=False, exist_ok=False):
|
|||
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