New submission from Rasmus Bondesson <[email protected]>:
Create a symlink that points to file that doesn't exist:
ln -s /nonexisting_file my_symlink
Then try to glob for that symlink from Python using pathlib:
python3
>>> import pathlib
>>> list(pathlib.Path(".").glob("my_symlink"))
[]
>>> list(pathlib.Path(".").glob("my_symlink*"))
[PosixPath('my_symlink')]
I'm a bit surprised that these two globs do not return the same results.
Personally I would expect both to find the symlink.
Is this behaviour a bug or is it intentional?
----------
components: Library (Lib)
messages: 404996
nosy: raek
priority: normal
severity: normal
status: open
title: pathlib.Path.glob() does not list dangling symlink when pattern is the
exact filenane
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45606>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com