You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pattern matching uses regex feature available only in Python 3.11+ #8
Pathlib's implementation of matching/globbing uses possessive quantifiers, which are new in Python 3.11. This package should support 3.8+, so we need to find another solution.
diff --git a/Lib/pathlib/_abc.py b/Lib/pathlib/_abc.py
index 43e2670c4d..98823b7274 100644
--- a/Lib/pathlib/_abc.py+++ b/Lib/pathlib/_abc.py@@ -64,7 +64,7 @@ def _compile_pattern(pat, sep, case_sensitive):
regex = glob.translate(pat, recursive=True, include_hidden=True, seps=sep)
# The string representation of an empty path is a single dot ('.'). Empty
# paths shouldn't match wildcards, so we consume it with an atomic group.
- regex = r'(\.\Z)?+' + regex+ regex = r'(?=(?P<empty>\.\Z|))(?P=empty)' + regex
return re.compile(regex, flags=flags).match
Activity
barneygale commentedon Dec 22, 2023
Fix via Alex Waygood: