From cb293ebd2e1272d8dede00e5e57116d1f47a4d4a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 11 Jun 2018 14:20:31 -0700 Subject: [PATCH] switch order of base classes on awaitable classes (#2125) Fixes #1940. This makes it so that mypy will infer the common base class of these classes to be Awaitable instead of Iterable. I verified that this fixes the errors in the script posted by @neilconway. --- stdlib/3.4/asyncio/futures.pyi | 2 +- stdlib/3/typing.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3.4/asyncio/futures.pyi b/stdlib/3.4/asyncio/futures.pyi index f0c255306..034a9c908 100644 --- a/stdlib/3.4/asyncio/futures.pyi +++ b/stdlib/3.4/asyncio/futures.pyi @@ -26,7 +26,7 @@ class _TracebackLogger: if sys.version_info >= (3, 5): def isfuture(obj: object) -> bool: ... -class Future(Iterable[_T], Awaitable[_T], Generic[_T]): +class Future(Awaitable[_T], Iterable[_T]): _state = ... # type: str _exception = ... # type: BaseException _blocking = False diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index ac350a957..c57f8e9e6 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -173,7 +173,7 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]): # NOTE: This type does not exist in typing.py or PEP 484. # The parameters corrrespond to Generator, but the 4th is the original type. -class AwaitableGenerator(Generator[_T_co, _T_contra, _V_co], Awaitable[_V_co], +class AwaitableGenerator(Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S]): pass