Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pathlib.PureWindowsPath.match() mishandles path anchors #101360

Closed
Labels
3.10only security fixes3.11only security fixes3.12only security fixesOS-windowstopic-pathlibtype-bugAn unexpected behavior, bug, or error
@barneygale

Description

@barneygale

pathlib.PurePath.match() doesn't usefnmatch() to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is specified in the pattern, it mustexactly match the corresponding drive/root in the path.

This results in the following:

>>>frompathlibimportPureWindowsPathasP>>>P('c:/b.py').match('*:/*.py')False>>>P('c:/b.py').match('c:*.py')True>>>P('c:/b.py').match('/*.py')True>>>P('//some/share/a.py').match('//*/*/*.py')False>>>P('//some/share/a.py').match('/*.py')True

All of these results are wrong IMO.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.11only security fixes3.12only security fixesOS-windowstopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp