From a7069ac5e21a255e9af659da2291c5a09791699f Mon Sep 17 00:00:00 2001 From: muhamedfazalps Date: Sat, 4 Jul 2026 15:40:44 +0530 Subject: [PATCH] Widen dict_keys/dict_items isdisjoint parameter type Change dict_keys.isdisjoint and dict_items.isdisjoint parameter types from Iterable[_KT_co]/Iterable[tuple[_KT_co, _VT_co]] to Iterable[object]. This matches the pattern used by set.isdisjoint and frozenset.isdisjoint, and fixes false positives when using TypedDict with closed=True where the key type is a union of string literals. Fixes #15888 --- stdlib/_collections_abc.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/_collections_abc.pyi b/stdlib/_collections_abc.pyi index 6fc32078532e..d172db94109d 100644 --- a/stdlib/_collections_abc.pyi +++ b/stdlib/_collections_abc.pyi @@ -75,7 +75,7 @@ class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented def __reversed__(self) -> Iterator[_KT_co]: ... __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): - def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ... + def isdisjoint(self, other: Iterable[object], /) -> bool: ... @property def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... @@ -92,7 +92,7 @@ class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): - def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ... + def isdisjoint(self, other: Iterable[object], /) -> bool: ... @property def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...