Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Calling glob.glob(pattern, recursive=True), where pattern contains two or more **/ segments, can yield the same paths multiple times:
>>> import glob
>>> len(glob.glob('**/**', recursive=True))
314206
>>> len(set(glob.glob('**/**', recursive=True)))
44849Linked PRs
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
barneygale commentedon May 7, 2023
Reasonably minor bug I think as these patterns are pretty rare. A note in the docs might be the best solution.
pythonGH-106747: Prepare pathlib globbing for dir_fd support.
gh-104269: Document `glob.glob` duplicates when using multiple `**` p…
pythongh-104269: Document `glob.glob` duplicates when using multiple …
[3.12] gh-104269: Document `glob.glob` duplicates when using multiple…
barneygale commentedon Apr 11, 2024
Thanks for sorting this, @tomasr8!
pythongh-104269: Document `glob.glob` duplicates when using multiple …