Skip to content

Commit 01d4a4c

Browse files
authored
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
1 parent b44cd29 commit 01d4a4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/3/asyncio/futures.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Future(Awaitable[_T], Iterable[_T]):
5151
def cancelled(self) -> bool: ...
5252
def done(self) -> bool: ...
5353
def result(self) -> _T: ...
54-
def exception(self) -> BaseException: ...
54+
def exception(self) -> Optional[BaseException]: ...
5555
def remove_done_callback(self: _S, fn: Callable[[_S], Any]) -> int: ...
5656
def set_result(self, result: _T) -> None: ...
5757
def set_exception(self, exception: Union[type, BaseException]) -> None: ...

0 commit comments

Comments
 (0)