Skip to content

pathlib.PurePath.match() can incorrectly match empty path #106330

Closed

Description

@barneygale
>>> from pathlib import PurePath
>>> PurePath().match('*')
True

This should be false, because a * segment always consumes exactly one path component, but empty paths have 0 components.

Linked PRs

Activity

  1. added
    type-bug
    3.12
    3.13
    on Jul 2, 2023
  2. changed the title [-]`pathlib.PurePath.match()` can incorrectly match empty patch[/-] [+]`pathlib.PurePath.match()` can incorrectly match empty path[/+] on Jul 2, 2023
  3. barneygale commented on Jul 2, 2023

    @barneygale
    ContributorAuthor

    Caused by #101398. In Python 3.13 this can also affect glob() results.

  4. added 5 commits that reference this issue on Jul 2, 2023
  5. barneygale commented on Jul 4, 2023

    @barneygale
    ContributorAuthor

    Fixed!

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.123.13topic-pathlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions