]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885)
authorNikita Sobolev <mail@sobolevn.me>
Thu, 3 Nov 2022 17:14:12 +0000 (20:14 +0300)
committerGitHub <noreply@github.com>
Thu, 3 Nov 2022 17:14:12 +0000 (17:14 +0000)
Lib/pathlib.py

index 1498ce08be401223ae599178a24b4a3375da9aed..db1c7c9618efbe8a6b109022c4f94c82eb3153e0 100644 (file)
@@ -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