Skip to content

Commit e59db18

Browse files
authored
commit 4
1 parent 1dec643 commit e59db18

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

stdlib/types.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from collections.abc import (
77
Callable,
88
Coroutine,
99
Generator,
10+
Hashable,
1011
ItemsView,
1112
Iterable,
1213
Iterator,
@@ -70,8 +71,9 @@ if sys.version_info >= (3, 15):
7071

7172
_T1 = TypeVar("_T1")
7273
_T2 = TypeVar("_T2")
73-
_KT_co = TypeVar("_KT_co", covariant=True)
74+
_KT_co = TypeVar("_KT_co", bound=Hashable, covariant=True)
7475
_VT_co = TypeVar("_VT_co", covariant=True)
76+
_KT2 = TypeVar("_KT2", bound=Hashable)
7577

7678
# Make sure this class definition stays roughly in line with `builtins.function`
7779
@final
@@ -286,8 +288,8 @@ class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # py
286288
def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
287289
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
288290
def __reversed__(self) -> Iterator[_KT_co]: ...
289-
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
290-
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
291+
def __or__(self, value: Mapping[_KT2, _T1], /) -> dict[_KT_co | _KT2, _VT_co | _T1]: ...
292+
def __ror__(self, value: Mapping[_KT2, _T1], /) -> dict[_KT_co | _KT2, _VT_co | _T1]: ...
291293

292294
if sys.version_info >= (3, 12):
293295
@disjoint_base

0 commit comments

Comments
 (0)