Skip to content

pathlib.(r)glob cannot correctly search files with a ampersand(&) between [ and ] #131314

@Mizoreeeee

Description

@Mizoreeeee

Bug report

Bug description:

only one file in the directory

$ tree .
.
└── [amper&sand]amper&sand

0 directories, 1 file
>>> from pathlib import Path
>>> a = Path('.')
>>> tuple(a.glob('[amper&sand]*'))
()
>>> tuple(a.glob('[amper&sand*'))
(WindowsPath('[amper&sand]amper&sand'),)
>>>

CPython versions tested on:

3.11, 3.10

Operating systems tested on:

Windows, macOS, Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions