From cb1729a927f9084060b9966c938820ac52e0afa3 Mon Sep 17 00:00:00 2001 From: apoorvdarshan Date: Sat, 4 Jul 2026 18:26:51 +0530 Subject: [PATCH 1/3] Add functools.partial.__get__ for Python 3.14 partial became a descriptor in 3.14 (python/cpython#121027). --- stdlib/functools.pyi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 5619a64f6ed2..49b8012c9d6a 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -177,6 +177,9 @@ class partial(Generic[_T]): def keywords(self) -> dict[str, Any]: ... def __new__(cls, func: Callable[..., _T], /, *args: Any, **kwargs: Any) -> Self: ... def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ... + if sys.version_info >= (3, 14): + def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> Callable[..., _T]: ... + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... # With protocols, this could change into a generic protocol that defines __get__ and returns _T From 5b0c6f432e514534e65b7576ae60a6e7d9b709d7 Mon Sep 17 00:00:00 2001 From: Apoorv Darshan Date: Thu, 9 Jul 2026 22:11:28 +0530 Subject: [PATCH 2/3] [boltons] Make __get__ overrides compatible with functools.partial base --- stubs/boltons/boltons/funcutils.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 0102bc154b33..47f9cd9e50ea 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -1,6 +1,8 @@ import functools from _typeshed import Incomplete +from collections.abc import Callable from functools import total_ordering as total_ordering +from typing import Any NO_DEFAULT: Incomplete @@ -26,14 +28,14 @@ def copy_function(orig, copy_dict: bool = True): ... def partial_ordering(cls): ... class InstancePartial(functools.partial[Incomplete]): - def __get__(self, obj, obj_type): ... + def __get__(self, obj: Any, obj_type: type[Any] | None = None, /) -> Callable[..., Incomplete]: ... class CachedInstancePartial(functools.partial[Incomplete]): __name__: Incomplete def __set_name__(self, obj_type, name) -> None: ... __doc__: Incomplete __module__: Incomplete - def __get__(self, obj, obj_type): ... + def __get__(self, obj: Any, obj_type: type[Any] | None = None, /) -> Callable[..., Incomplete]: ... partial = CachedInstancePartial From 2f0fc650358eb0c0cfa241c933e766d84deb79d9 Mon Sep 17 00:00:00 2001 From: Apoorv Darshan Date: Thu, 9 Jul 2026 22:19:12 +0530 Subject: [PATCH 3/3] Fix boltons __get__ stubtest: match runtime signature + ignore[override] --- stubs/boltons/boltons/funcutils.pyi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stubs/boltons/boltons/funcutils.pyi b/stubs/boltons/boltons/funcutils.pyi index 47f9cd9e50ea..810bd5a0c7b1 100644 --- a/stubs/boltons/boltons/funcutils.pyi +++ b/stubs/boltons/boltons/funcutils.pyi @@ -1,8 +1,6 @@ import functools from _typeshed import Incomplete -from collections.abc import Callable from functools import total_ordering as total_ordering -from typing import Any NO_DEFAULT: Incomplete @@ -28,14 +26,14 @@ def copy_function(orig, copy_dict: bool = True): ... def partial_ordering(cls): ... class InstancePartial(functools.partial[Incomplete]): - def __get__(self, obj: Any, obj_type: type[Any] | None = None, /) -> Callable[..., Incomplete]: ... + def __get__(self, obj, obj_type): ... # type: ignore[override] class CachedInstancePartial(functools.partial[Incomplete]): __name__: Incomplete def __set_name__(self, obj_type, name) -> None: ... __doc__: Incomplete __module__: Incomplete - def __get__(self, obj: Any, obj_type: type[Any] | None = None, /) -> Callable[..., Incomplete]: ... + def __get__(self, obj, obj_type): ... # type: ignore[override] partial = CachedInstancePartial