Change return type of Future.exception to be Optional[BaseException] (#3849)

Future.exception can return None if no exception was capture in the future.
As documented: https://docs.python.org/3/library/asyncio-future.html#asyncio.Future.exception
This commit is contained in:
Ben Leslie
2020-03-13 22:38:58 -05:00
committed by GitHub
parent b44cd294c4
commit 01d4a4c395

View File

@@ -51,7 +51,7 @@ class Future(Awaitable[_T], Iterable[_T]):
def cancelled(self) -> bool: ...
def done(self) -> bool: ...
def result(self) -> _T: ...
def exception(self) -> BaseException: ...
def exception(self) -> Optional[BaseException]: ...
def remove_done_callback(self: _S, fn: Callable[[_S], Any]) -> int: ...
def set_result(self, result: _T) -> None: ...
def set_exception(self, exception: Union[type, BaseException]) -> None: ...