Skip to content

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

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.11only security fixes
    3.12only security fixes
    3.13only security fixes
    on May 7, 2023
  2. barneygale commented on May 7, 2023

    @barneygale
    ContributorAuthor

    Reasonably minor bug I think as these patterns are pretty rare. A note in the docs might be the best solution.

  3. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 24, 2023
  4. added a commit that references this issue on Mar 4, 2024
  5. added a commit that references this issue on Apr 11, 2024
  6. added a commit that references this issue on Apr 11, 2024
  7. added a commit that references this issue on Apr 11, 2024
  8. barneygale commented on Apr 11, 2024

    @barneygale
    ContributorAuthor

    Thanks for sorting this, @tomasr8!

  9. added a commit that references this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions