Mark LRU cache wrappers as method descriptors (#9072)

Match the Python 3.14 wrapper type flag and enable the existing guarded method-call fast path. Keep the partial vectorcall changes separate.

Assisted-by: OpenAI Codex:model identifier unavailable
This commit is contained in:
youknowdot authored and GitHub committed 2026-10-10 21:17:08 +00:00
1 parent 44858012f4
commit eb6cefd765
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -842,7 +842,7 @@ mod _functools {
#[pyclass(
with(Constructor, Callable, GetDescriptor),
flags(HAS_DICT, HAS_WEAKREF)
flags(HAS_DICT, HAS_WEAKREF, METHOD_DESCRIPTOR)
)]
impl Py<PyLruCacheWrapper> {
#[pymethod]
+4
View File
@@ -1,9 +1,13 @@
import gc
import weakref
from _functools import _lru_cache_wrapper
from functools import cache, cmp_to_key, lru_cache, partial, reduce
from testutils import assert_raises
# Cached wrappers support method-descriptor lookup and binding.
assert _lru_cache_wrapper.__flags__ & (1 << 17)
class Squares:
def __init__(self, max):