-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
stdlibStandard 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
Bug report
Bug description:
The pattern returned by glob.translate("a/**/c", recursive=True, include_hidden=True) currently does not match paths that have two slashes "//" between two parts:
import glob
pattern = glob.translate("a/**/c", recursive=True, include_hidden=True)
# '(?s:a/(?:.+/)?c)\\Z'
assert re.match(pattern, "a/c") # match
assert re.match(pattern, "a/b/c") # match
assert re.match(pattern, "a//c") # None
assert re.match(pattern, "a///c") # matchIt looks like the fix should be simple and requires replacing .+ with .* in
Line 280 in d2f1b0e
| any_segments = f'(?:.+{any_sep})?' |
I'd be happy to add tests and apply the fix in a PR.
Cheers,
Andreas
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard 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
Status
No status