[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov
Andrei Kulakov added the comment: By the way note that path.glob('**/my_symlink') also does return the dangling symlink match. And glob.glob('my_symlink') also returns a dangling symlink. -- ___ Python tracker

[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov
Andrei Kulakov added the comment: Rasmus: thanks for the report, it does seem like a bug to me. -- ___ Python tracker ___ ___ Pytho

[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov
Andrei Kulakov added the comment: The issue is that _PreciseSelector follows the symlink when it checks if a path exists before yielding it as a result. I've put up a PR with a fix; I've also added a *follow_symlinks* arg to `exists()` method because it seems more logical to be able to test

[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-11-19 Thread Andrei Kulakov
Change by Andrei Kulakov : -- keywords: +patch nosy: +andrei.avk nosy_count: 1.0 -> 2.0 pull_requests: +27897 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29655 ___ Python tracker

[issue45606] pathlib.Path.glob() does not list dangling symlink when pattern is the exact filenane

2021-10-25 Thread Rasmus Bondesson
New submission from Rasmus Bondesson : 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")) []