Issue #28991:  Fix obscure reentrancy bug in functools.lru_cache().
diff --git a/Lib/functools.py b/Lib/functools.py
index 214523c..60cf3c4 100644
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -516,14 +516,16 @@
                     last = root[PREV]
                     link = [last, root, key, result]
                     last[NEXT] = root[PREV] = cache[key] = link
-                    full = (len(cache) >= maxsize)
+                    # Use the __len__() method instead of the len() function
+                    # which could potentially be wrapped in an lru_cache itself.
+                    full = (cache.__len__() >= maxsize)
                 misses += 1
             return result
 
     def cache_info():
         """Report cache statistics"""
         with lock:
-            return _CacheInfo(hits, misses, maxsize, len(cache))
+            return _CacheInfo(hits, misses, maxsize, cache.__len__())
 
     def cache_clear():
         """Clear the cache and cache statistics"""