From bf8b5ac5fd730f5342f7fc34ebc164fb3ee9dba8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 10 Nov 2016 10:55:29 -0800 Subject: [PATCH] Relax signature of gather() (#677) Fixes #675 --- stdlib/3.4/asyncio/tasks.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/3.4/asyncio/tasks.pyi b/stdlib/3.4/asyncio/tasks.pyi index cd18ba343..d41621b79 100644 --- a/stdlib/3.4/asyncio/tasks.pyi +++ b/stdlib/3.4/asyncio/tasks.pyi @@ -18,8 +18,10 @@ def as_completed(fs: Sequence[Future[_T]], *, loop: AbstractEventLoop = ..., timeout=None) -> Iterator[Generator[Any, None, _T]]: ... def ensure_future(coro_or_future: Union[Future[_T], Generator[Any, None, _T]], *, loop: AbstractEventLoop = ...) -> Future[_T]: ... -def gather(*coros_or_futures: Union[Future[_T], Generator[Any, None, _T], Awaitable[_T]], - loop: AbstractEventLoop = ..., return_exceptions: bool = False) -> Future[List[_T]]: ... +# TODO: gather() should use variadic type vars instead of _TAny. +_TAny = Any +def gather(*coros_or_futures: Union[Future[_TAny], Generator[Any, None, _TAny], Awaitable[_TAny]], + loop: AbstractEventLoop = ..., return_exceptions: bool = False) -> Future[List[_TAny]]: ... def run_coroutine_threadsafe(coro: Union[Generator[Any, None, _T], Coroutine[Any, None, _T], Awaitable[_T]], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ... def shield(arg: Union[Future[_T], Generator[Any, None, _T]],