From 3fc1eebb8260dddda5d36520f26e25f8f3574a62 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Tue, 24 Feb 2026 19:32:21 +0400 Subject: [PATCH] [functools] Add __slots__ Python 3.10: https://github.com/python/cpython/blob/3.10/Lib/functools.py Changed PR: https://github.com/python/cpython/pull/119827 Python 3.14: https://github.com/python/cpython/blob/3.14/Lib/functools.py --- stdlib/functools.pyi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 57bc3f179f7a..c99fff60ce30 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -156,6 +156,11 @@ def total_ordering(cls: type[_T]) -> type[_T]: ... def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ... @disjoint_base class partial(Generic[_T]): + if sys.version_info >= (3, 14): + __slots__ = ("func", "args", "keywords", "_phcount", "_merger", "__dict__", "__weakref__") + else: + __slots__ = ("func", "args", "keywords", "__dict__", "__weakref__") + @property def func(self) -> Callable[..., _T]: ... @property @@ -255,7 +260,8 @@ def _make_key( if sys.version_info >= (3, 14): @final - class _PlaceholderType: ... + class _PlaceholderType: + __slots__ = () Placeholder: Final[_PlaceholderType]