diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 13a0e4f707cb..437c997cae3c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -929,6 +929,9 @@ class slice: __hash__: ClassVar[None] # type: ignore[assignment] def indices(self, len: SupportsIndex, /) -> tuple[int, int, int]: ... +class _GetItemIterable(Protocol[_T_co]): + def __getitem__(self, i: int, /) -> _T_co: ... + class tuple(Sequence[_T_co]): def __new__(cls, iterable: Iterable[_T_co] = ..., /) -> Self: ... def __len__(self) -> int: ... @@ -1188,7 +1191,7 @@ class frozenset(AbstractSet[_T_co]): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... class enumerate(Iterator[tuple[int, _T]]): - def __new__(cls, iterable: Iterable[_T], start: int = ...) -> Self: ... + def __new__(cls, iterable: Iterable[_T] | _GetItemIterable[_T], start: int = ...) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> tuple[int, _T]: ... if sys.version_info >= (3, 9): @@ -1417,10 +1420,6 @@ def help(request: object = ...) -> None: ... def hex(number: int | SupportsIndex, /) -> str: ... def id(obj: object, /) -> int: ... def input(prompt: object = "", /) -> str: ... - -class _GetItemIterable(Protocol[_T_co]): - def __getitem__(self, i: int, /) -> _T_co: ... - @overload def iter(object: SupportsIter[_SupportsNextT], /) -> _SupportsNextT: ... @overload