[New-bugs-announce] [issue29416] Path.mkdir can get into a recursive error loop

Dan Buchoff report at bugs.python.org
Wed Feb 1 17:46:32 EST 2017


New submission from Dan Buchoff:

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

----------
components: Library (Lib), Windows
messages: 286717
nosy: Dan Buchoff, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Path.mkdir can get into a recursive error loop
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29416>
_______________________________________


More information about the New-bugs-announce mailing list