Skip to content

glob.glob('**/**', recursive=True) yields duplicate results #104269

Closed
@barneygale

Description

@barneygale

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)))
44849

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions