GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-101360: Fix anchor matching in pathlib.PureWindowsPath.match() by barneygale · Pull Request #101363 · python/cpython

Conversation

@barneygale

@barneygale barneygale commented Jan 27, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Use fnmatch to match path and pattern anchors, just as we do for other path parts. This allows patterns such as '*:/Users/*' to be matched.

This can't be readily backported as it relies on a feature of pathlib in 3.12: support for non-alphabetic drive letters when parsing paths.

  • Issue: pathlib.PureWindowsPath.match() mishandles path anchors #101360

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@barneygale
pythongh-101360: Fix anchor matching in pathlib.PureWindowsPath.match()
13e9330
Use `fnmatch` to match path and pattern anchors, just as we do for other
path parts. This allows patterns such as `'*:/Users/*'` to be matched.
@barneygale barneygale added OS-windows topic-pathlib labels Jan 27, 2023
@bedevere-bot bedevere-bot added the awaiting review label Jan 27, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jan 27, 2023
pathlib.PureWindowsPath.match() mishandles path anchors #101360
Closed
@barneygale
Fix news blurb syntax
f7b879e
@eryksun

eryksun commented Jan 28, 2023

Copy link
Copy Markdown
Contributor

support for non-alphabetic drive letters when parsing paths.

We need a test in "test_ntpath.py" to ensure that splitroot(' :/foo') == (' :', '/', 'foo') and splitroot('/:/foo') == ('', '/', ':/foo').

WinAPI GetFullPathNameW() will accept any character in the 16-bit BMP as a drive 'letter', except for null, slash, and backslash. For example:

>>> os.getcwd()
'C:\\Temp'
>>> nt._getfullpathname(' :/foo')
' :\\foo'
>>> nt._getfullpathname('/:/foo')
'C:\\:\\foo'
barneygale reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

barneygale added 2 commits January 29, 2023 02:59
@barneygale
Merge branch 'main' into pythongh-101360-fix-match-partial-anchor
ef53ea0
@barneygale
Add splitroot() test cases for slashy and spacey drive letters
6c0468c
@barneygale barneygale mentioned this pull request Jan 29, 2023
Optimize pathlib path construction #101362
Closed
@barneygale barneygale mentioned this pull request Feb 15, 2023
Support recursive wildcards in pathlib.PurePath.match() #73435
Closed
@zooba

zooba commented Feb 16, 2023

Copy link
Copy Markdown
Member

Change looks fine, just rerunning the failed tests.

barneygale and mokko reacted with thumbs up emoji mokko reacted with laugh emoji
All reactions
  • 👍 2 reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zooba
zooba merged commit d401b20 into python:main Feb 17, 2023
@bedevere-bot bedevere-bot removed the awaiting review label Feb 17, 2023
@zware zware mentioned this pull request Mar 21, 2024
gh-117114: Add isdevdrive to posixpath #117115
Merged
This was referenced Apr 2, 2024
Handle /: for ntpath.normpath #117383
Closed
gh-117352: Handle /:/ for ntpath.isabs #117362
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

OS-windows topic-pathlib

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@barneygale @eryksun @zooba @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.