Original file line numberDiff line numberDiff line change@@ -320,11 +320,11 @@ def translate(pat, *, recursive=False, include_hidden=False, seps=None):
[email protected]_cache(maxsize=512)
323-def_compile_pattern(pat, sep, case_sensitive, recursive=True):
323+def_compile_pattern(pat, seps, case_sensitive, recursive=True):
324324"""Compile given glob pattern to a re.Pattern object (observing case
325325 sensitivity)."""
326326flags=re.NOFLAGifcase_sensitiveelsere.IGNORECASE
327-regex=translate(pat, recursive=recursive, include_hidden=True, seps=sep)
327+regex=translate(pat, recursive=recursive, include_hidden=True, seps=seps)
328328returnre.compile(regex, flags=flags).match
329329330330@@ -360,8 +360,9 @@ def concat_path(path, text):
360360361361# High-level methods
362362363-defcompile(self, pat):
364-return_compile_pattern(pat, self.sep, self.case_sensitive, self.recursive)
363+defcompile(self, pat, altsep=None):
364+seps= (self.sep, altsep) ifaltsepelseself.sep
365+return_compile_pattern(pat, seps, self.case_sensitive, self.recursive)
365366366367defselector(self, parts):
367368"""Returns a function that selects from a given path, walking and
Original file line numberDiff line numberDiff line change@@ -14,7 +14,7 @@
1414fromglobimport_PathGlobber, _no_recurse_symlinks
1515frompathlibimportPurePath, Path
1616frompathlib._osimportmagic_open, ensure_distinct_paths, copy_file
17-fromtypingimportProtocol, runtime_checkable
17+fromtypingimportOptional, Protocol, runtime_checkable
181819192020def_explode_path(path):
@@ -44,6 +44,7 @@ class _PathParser(Protocol):
4444 """
45454646sep: str
47+altsep: Optional[str]
4748defsplit(self, path: str) ->tuple[str, str]: ...
4849defsplitext(self, path: str) ->tuple[str, str]: ...
4950defnormcase(self, path: str) ->str: ...
@@ -225,7 +226,7 @@ def full_match(self, pattern, *, case_sensitive=None):
225226ifcase_sensitiveisNone:
226227case_sensitive=self.parser.normcase('Aa') =='Aa'
227228globber=_PathGlobber(pattern.parser.sep, case_sensitive, recursive=True)
228-match=globber.compile(str(pattern))
229+match=globber.compile(str(pattern), altsep=pattern.parser.altsep)
229230returnmatch(str(self)) isnotNone
230231231232