summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-02-17 14:05:38 (GMT)
committerGitHub <noreply@github.com>2023-02-17 14:05:38 (GMT)
commitd401b20630965c0e1d2a5a0d60d5fc51aa5a8d80 (patch)
treee2401d36917725d2bede97de574ccfd906f84a60 /Lib/pathlib.py
parent775f8819e319127f9bfb046773b74bcc62c68b6a (diff)
downloadcpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.zip
cpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.tar.gz
cpython-d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80.tar.bz2
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.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py5
1 files changed, 0 insertions, 5 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 17659bc..d7994a3 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -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)):