diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 38be452e8d49..4b3d5ff7a70f 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -79,7 +79,8 @@ if sys.version_info >= (3, 14): from _typeshed import AnnotateFunc _T = TypeVar("_T") -_I = TypeVar("_I", default=int) +# Type ignore needed because of https://github.com/python/mypy/issues/20184. +_I = TypeVar("_I", int, bytes, float, bool, default=Any) # type: ignore[misc] # possibly memoryview types _T_co = TypeVar("_T_co", covariant=True) _T_contra = TypeVar("_T_contra", contravariant=True) _R_co = TypeVar("_R_co", covariant=True) @@ -919,7 +920,7 @@ class memoryview(Sequence[_I]): @overload def cast(self, format: Literal["?"], shape: list[int] | tuple[int, ...] = ...) -> memoryview[bool]: ... @overload - def cast(self, format: _IntegerFormats, shape: list[int] | tuple[int, ...] = ...) -> memoryview: ... + def cast(self, format: _IntegerFormats, shape: list[int] | tuple[int, ...] = ...) -> memoryview[int]: ... @overload def __getitem__(self, key: SupportsIndex | tuple[SupportsIndex, ...], /) -> _I: ... @overload