mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
gh-101360: Fix anchor matching in pathlib.PureWindowsPath.match() (GH-101363)
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 commit is contained in:
parent
775f8819e3
commit
d401b20630
4 changed files with 13 additions and 8 deletions
|
|
@ -647,15 +647,10 @@ class PurePath(object):
|
|||
drv, root, pat_parts = self._parse_parts((path_pattern,))
|
||||
if not pat_parts:
|
||||
raise ValueError("empty pattern")
|
||||
elif drv and drv != self._flavour.normcase(self._drv):
|
||||
return False
|
||||
elif root and root != self._root:
|
||||
return False
|
||||
parts = self._parts_normcase
|
||||
if drv or root:
|
||||
if len(pat_parts) != len(parts):
|
||||
return False
|
||||
pat_parts = pat_parts[1:]
|
||||
elif len(pat_parts) > len(parts):
|
||||
return False
|
||||
for part, pat in zip(reversed(parts), reversed(pat_parts)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue