From fa571fb224ab4872e74c194d8dc4c89e1e9b76d0 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Fri, 4 Oct 2019 03:45:41 +0530 Subject: [PATCH] builtins.pyi: Use two type vars (#3291) Fixes: #3201 --- stdlib/2/__builtin__.pyi | 4 +++- stdlib/2and3/builtins.pyi | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 62052cfb7..85b681a52 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1189,7 +1189,9 @@ else: @overload def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... @overload -def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ... +def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ... +@overload +def iter(__function: Callable[[], Any], __sentinel: Any) -> Iterator[Any]: ... def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ... def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ... def len(__o: Sized) -> int: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 62052cfb7..85b681a52 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1189,7 +1189,9 @@ else: @overload def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... @overload -def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ... +def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ... +@overload +def iter(__function: Callable[[], Any], __sentinel: Any) -> Iterator[Any]: ... def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ... def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ... def len(__o: Sized) -> int: ...