Skip to content

/a/** is understood by Path.full_match as /a followed by multiple segments, at least one #139580

@macmarrum

Description

@macmarrum

Bug report

Bug description:

/a/** is understood by Path.full_match as "/a followed by multiple segments, at least one", instead of "/a followed by multiple segments, including zero".

From https://docs.python.org/3/library/pathlib.html#pathlib-pattern-language

** (entire segment)
Matches any number of file or directory segments, including zero.
# one segment per **
Path('/a/b').full_match('/a/**') # True
# zero segments per **
Path('/a').full_match('/a/**') # False - expected True
# interestingly
Path('/').full_match('/**') # True

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions