[issue36035] pathlib.Path().rglob() breaks with broken symlinks
Stéphane Wirtel
report at bugs.python.org
Tue Feb 19 07:23:22 EST 2019
Stéphane Wirtel <stephane at wirtel.be> added the comment:
I confirm this issue with python 3.7
but your script is wrong (you declare f and use x in your script)
/tmp$ mkdir demo
/tmp$ cd demo/
/t/demo$ mkdir tmp /t/demo$ touch foo /t/demo$ ln -s foo tmp/foo /t/demo$ cd tmp/ /t/d/tmp$ file foo
foo: broken symbolic link to foo
/t/d/tmp$ python3 mar 19 fév 2019 13:20:15 CET
Python 3.7.2 (default, Jan 16 2019, 19:49:22)
[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> for p in Path().rglob('*'):
... print(p)
...
foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.7/pathlib.py", line 1105, in rglob
for p in selector.select_from(self):
File "/usr/lib64/python3.7/pathlib.py", line 552, in _select_from
for starting_point in self._iterate_directories(parent_path, is_dir, scandir):
File "/usr/lib64/python3.7/pathlib.py", line 536, in _iterate_directories
entry_is_dir = entry.is_dir()
OSError: [Errno 40] Too many levels of symbolic links: './foo'
>>>
----------
nosy: +matrixise
versions: +Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36035>
_______________________________________
More information about the Python-bugs-list
mailing list