Skip to content

Commit eb6cefd

Browse files
authored
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
1 parent 4485801 commit eb6cefd

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎crates/vm/src/stdlib/_functools.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ mod _functools {
842842

843843
#[pyclass(
844844
with(Constructor, Callable, GetDescriptor),
845-
flags(HAS_DICT, HAS_WEAKREF)
845+
flags(HAS_DICT, HAS_WEAKREF, METHOD_DESCRIPTOR)
846846
)]
847847
impl Py<PyLruCacheWrapper> {
848848
#[pymethod]

‎extra_tests/snippets/stdlib_functools.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import gc
22
import weakref
3+
from _functools import _lru_cache_wrapper
34
from functools import cache, cmp_to_key, lru_cache, partial, reduce
45

56
from testutils import assert_raises
67

8+
# Cached wrappers support method-descriptor lookup and binding.
9+
assert _lru_cache_wrapper.__flags__ & (1 << 17)
10+
711

812
class Squares:
913
def __init__(self, max):

0 commit comments

Comments
 (0)