[Python-checkins] gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)
AlexWaygood
webhook-mailer at python.org
Thu Nov 3 13:14:18 EDT 2022
https://github.com/python/cpython/commit/e3b9832e57227c4565fd1a51795e0a7722625e82
commit: e3b9832e57227c4565fd1a51795e0a7722625e82
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: AlexWaygood <Alex.Waygood at Gmail.com>
date: 2022-11-03T17:14:12Z
summary:
gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)
files:
M Lib/pathlib.py
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 1498ce08be40..db1c7c9618ef 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -200,6 +200,7 @@ def make_uri(self, path):
# Globbing helpers
#
+ at functools.lru_cache()
def _make_selector(pattern_parts, flavour):
pat = pattern_parts[0]
child_parts = pattern_parts[1:]
@@ -215,9 +216,6 @@ def _make_selector(pattern_parts, flavour):
cls = _PreciseSelector
return cls(pat, child_parts, flavour)
-if hasattr(functools, "lru_cache"):
- _make_selector = functools.lru_cache()(_make_selector)
-
class _Selector:
"""A selector matches a specific glob pattern part against the children
More information about the Python-checkins
mailing list