summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-11-03 17:14:12 (GMT)
committerGitHub <noreply@github.com>2022-11-03 17:14:12 (GMT)
commite3b9832e57227c4565fd1a51795e0a7722625e82 (patch)
treeefdfdb07bf83b41d74b246ad851f4107e56ccf40 /Lib
parente99c5070132c13de41eeafa28307cc7b394e0958 (diff)
downloadcpython-e3b9832e57227c4565fd1a51795e0a7722625e82.zip
cpython-e3b9832e57227c4565fd1a51795e0a7722625e82.tar.gz
cpython-e3b9832e57227c4565fd1a51795e0a7722625e82.tar.bz2
gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/pathlib.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 1498ce0..db1c7c9 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -200,6 +200,7 @@ _posix_flavour = _PosixFlavour()
# Globbing helpers
#
+@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