From c22d5b708b0f407e02a5444e51d37389b92354ac Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Tue, 7 Jul 2026 15:20:44 +0530 Subject: [PATCH] fix: add __get__ method to functools.partial for Python 3.14+ Since Python 3.14, functools.partial is a descriptor (cpython#121027) but the __get__ method was not added to typeshed. Fixes #15974 --- stdlib/functools.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 5619a64f6ed2..6aab1b7b7b68 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -178,6 +178,8 @@ class partial(Generic[_T]): def __new__(cls, func: Callable[..., _T], /, *args: Any, **kwargs: Any) -> Self: ... def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ... def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + if sys.version_info >= (3, 14): + def __get__(self, instance: Any, owner: type | None = None, /) -> partial[_T]: ... # With protocols, this could change into a generic protocol that defines __get__ and returns _T _Descriptor: TypeAlias = Any