From 58f13dd87baf260906077426b397c08e80f6a582 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sun, 30 Oct 2022 23:54:01 +0300 Subject: [PATCH] gh-98884: [pathlib] remove `hasattr` check for `lru_cache` --- Lib/pathlib.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 1498ce08be4012..db1c7c9618efbe 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -200,6 +200,7 @@ def make_uri(self, path): # 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