From a19c15d7544068ef3745967c796f5b5e89424f60 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Thu, 12 Feb 2026 13:12:10 +0200 Subject: [PATCH] [typing] Add missing `_from_iterable` classmethod to `Set` ABCs (#15331) --- stdlib/typing.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 369af41a7..83e114aac 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -704,6 +704,8 @@ class AbstractSet(Collection[_T_co]): def __contains__(self, x: object) -> bool: ... def _hash(self) -> int: ... # Mixin methods + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> AbstractSet[_S]: ... def __le__(self, other: AbstractSet[Any]) -> bool: ... def __lt__(self, other: AbstractSet[Any]) -> bool: ... def __gt__(self, other: AbstractSet[Any]) -> bool: ... @@ -736,6 +738,8 @@ class MappingView(Sized): class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]): def __init__(self, mapping: SupportsGetItemViewable[_KT_co, _VT_co]) -> None: ... # undocumented + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ... def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, item: tuple[object, object]) -> bool: ... # type: ignore[override] @@ -749,6 +753,8 @@ class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, class KeysView(MappingView, AbstractSet[_KT_co]): def __init__(self, mapping: Viewable[_KT_co]) -> None: ... # undocumented + @classmethod + def _from_iterable(cls, it: Iterable[_S]) -> set[_S]: ... def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ... def __rand__(self, other: Iterable[_T]) -> set[_T]: ... def __contains__(self, key: object) -> bool: ...