-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path.mkdir can get into a recursive error loop #73602
Comments
If a path has a non-existent anchor, Path.mkdir can get into a RecursionError as it tries to recursively create the parent. I expect a more sane error. This is readily reproducible in Windows with Example execution: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> Path('Z:').mkdir(parents=True)
Traceback (most recent call last):
File "C:\Python36\lib\pathlib.py", line 1231, in mkdir
self._accessor.mkdir(self, mode)
File "C:\Python36\lib\pathlib.py", line 388, in wrapped
return strfunc(str(pathobj), *args)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'Z:'
During handling of the above exception, another exception occurred: ... During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\lib\pathlib.py", line 1238, in mkdir
self.parent.mkdir(parents=True)
File "C:\Python36\lib\pathlib.py", line 1238, in mkdir
self.parent.mkdir(parents=True)
File "C:\Python36\lib\pathlib.py", line 1238, in mkdir
self.parent.mkdir(parents=True)
[Previous line repeated 989 more times]
File "C:\Python36\lib\pathlib.py", line 1231, in mkdir
self._accessor.mkdir(self, mode)
File "C:\Python36\lib\pathlib.py", line 388, in wrapped
return strfunc(str(pathobj), *args)
RecursionError: maximum recursion depth exceeded |
Might be worth checking if this is resolved with bpo-29079, which is already in for 3.6.1. |
This case is similar to bpo-29079. It should only attempt to make the parent to handle ENOENT if self and self.parent aren't equal. Here's the snippet from Path.mkdir:
|
New changeset 8061d0967988 by Steve Dower in branch '3.5': New changeset 3de58a54ed98 by Steve Dower in branch '3.6': New changeset 09c018897fb3 by Steve Dower in branch 'default': |
New changeset 661c40ba59855ebe4967424fcabd41be6f799137 by Steve Dower in branch 'master': New changeset 77da63372461ddeb82dbfdef86e702e43e24e1da by Steve Dower in branch 'master': New changeset c05ffe646dc009c01365db917f0ca6b738fda69b by Steve Dower in branch 'master': |
New changeset 661c40ba59855ebe4967424fcabd41be6f799137 by Steve Dower in branch '3.6': New changeset 77da63372461ddeb82dbfdef86e702e43e24e1da by Steve Dower in branch '3.6': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: