From c35df2915ce35ef42170e6f3068ccd8ffec25561 Mon Sep 17 00:00:00 2001 From: KotlinIsland Date: Fri, 5 Nov 2021 14:34:36 +1000 Subject: [PATCH] make dict KeyType bound to Hashable --- stdlib/builtins.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 4694042cab24..60c1235de91c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -33,6 +33,7 @@ from typing import ( Callable, FrozenSet, Generic, + Hashable, ItemsView, Iterable, Iterator, @@ -71,9 +72,9 @@ class _SupportsTrunc(Protocol): _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) _T_contra = TypeVar("_T_contra", contravariant=True) -_KT = TypeVar("_KT") +_KT = TypeVar("_KT", bound=Hashable) _VT = TypeVar("_VT") -_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. +_KT_co = TypeVar("_KT_co", bound=Hashable, covariant=True) # Key type covariant containers. _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. _S = TypeVar("_S") _T1 = TypeVar("_T1")