From e3b9832e57227c4565fd1a51795e0a7722625e82 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 3 Nov 2022 20:14:12 +0300 Subject: gh-98884: [pathlib] remove `hasattr` check for `lru_cache` (#98885) --- Lib/pathlib.py | 4 +--- 1 file changed, 1 insertion(+), 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 -- cgit v0.12