Issue29416
Created on 2017-02-01 22:46 by Dan Buchoff, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (7) | |||
|---|---|---|---|
| msg286717 - (view) | Author: Dan Buchoff (Dan Buchoff) | Date: 2017-02-01 22:46 | |
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 `Path('Z:').mkdir(parents=True)`
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
|
|||
| msg286723 - (view) | Author: Steve Dower (steve.dower) * | Date: 2017-02-02 00:09 | |
Might be worth checking if this is resolved with issue29079, which is already in for 3.6.1. |
|||
| msg286734 - (view) | Author: Eryk Sun (eryksun) * | Date: 2017-02-02 01:59 | |
This case is similar to issue 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: try: self._accessor.mkdir(self, mode) except FileExistsError: if not exist_ok or not self.is_dir(): raise except OSError as e: if e.errno != ENOENT: raise self.parent.mkdir(parents=True) self._accessor.mkdir(self, mode) |
|||
| msg286999 - (view) | Author: Roundup Robot (python-dev) | Date: 2017-02-04 22:57 | |
New changeset 8061d0967988 by Steve Dower in branch '3.5': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://hg.python.org/cpython/rev/8061d0967988 New changeset 3de58a54ed98 by Steve Dower in branch '3.6': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://hg.python.org/cpython/rev/3de58a54ed98 New changeset 09c018897fb3 by Steve Dower in branch 'default': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://hg.python.org/cpython/rev/09c018897fb3 |
|||
| msg287000 - (view) | Author: Roundup Robot (python-dev) | Date: 2017-02-04 23:00 | |
New changeset 661c40ba59855ebe4967424fcabd41be6f799137 by Steve Dower in branch 'master': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/661c40ba59855ebe4967424fcabd41be6f799137 New changeset 77da63372461ddeb82dbfdef86e702e43e24e1da by Steve Dower in branch 'master': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/77da63372461ddeb82dbfdef86e702e43e24e1da New changeset c05ffe646dc009c01365db917f0ca6b738fda69b by Steve Dower in branch 'master': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/c05ffe646dc009c01365db917f0ca6b738fda69b |
|||
| msg287001 - (view) | Author: Roundup Robot (python-dev) | Date: 2017-02-04 23:00 | |
New changeset 661c40ba59855ebe4967424fcabd41be6f799137 by Steve Dower in branch '3.6': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/661c40ba59855ebe4967424fcabd41be6f799137 New changeset 77da63372461ddeb82dbfdef86e702e43e24e1da by Steve Dower in branch '3.6': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/77da63372461ddeb82dbfdef86e702e43e24e1da |
|||
| msg287002 - (view) | Author: Roundup Robot (python-dev) | Date: 2017-02-04 23:00 | |
New changeset 661c40ba59855ebe4967424fcabd41be6f799137 by Steve Dower in branch '3.5': Issue #29416: Prevent infinite loop in pathlib.Path.mkdir https://github.com/python/cpython/commit/661c40ba59855ebe4967424fcabd41be6f799137 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:42 | admin | set | github: 73602 |
| 2017-11-09 18:03:53 | serhiy.storchaka | set | status: pending -> closed resolution: fixed stage: commit review -> resolved |
| 2017-04-02 13:51:12 | serhiy.storchaka | set | status: open -> pending |
| 2017-04-01 05:48:30 | serhiy.storchaka | set | pull_requests: - pull_request984 |
| 2017-03-31 16:36:24 | dstufft | set | pull_requests: + pull_request984 |
| 2017-02-04 23:00:30 | python-dev | set | messages: + msg287002 |
| 2017-02-04 23:00:28 | python-dev | set | messages: + msg287001 |
| 2017-02-04 23:00:25 | python-dev | set | messages: + msg287000 |
| 2017-02-04 22:57:46 | steve.dower | set | assignee: steve.dower stage: needs patch -> commit review |
| 2017-02-04 22:57:24 | python-dev | set | nosy:
+ python-dev messages: + msg286999 |
| 2017-02-02 01:59:11 | eryksun | set | versions:
+ Python 3.7 nosy: + eryksun messages: + msg286734 stage: needs patch |
| 2017-02-02 00:09:23 | steve.dower | set | messages: + msg286723 |
| 2017-02-01 22:47:35 | Dan Buchoff | set | type: behavior |
| 2017-02-01 22:46:32 | Dan Buchoff | create | |