mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 13:32:26 +08:00
Use BaseException for Future.exception() and .set_exception(). (#935)
The concurrent.futures.Future class's set_exception() method might be called with a BaseException that is not an Exception, so change set_exception()'s parameter type from Exception to BaseException. The exception set via set_exception() is returned by exception(), so change exception()'s return type from Exception to BaseException.
This commit is contained in:
committed by
Guido van Rossum
parent
43d7747f59
commit
55d4c08a8e
@@ -27,10 +27,10 @@ class Future(Generic[_T]):
|
||||
def done(self) -> bool: ...
|
||||
def add_done_callback(self, fn: Callable[[Future], Any]) -> None: ...
|
||||
def result(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def exception(self, timeout: Optional[float] = ...) -> Exception: ...
|
||||
def exception(self, timeout: Optional[float] = ...) -> BaseException: ...
|
||||
def set_running_or_notify_cancel(self) -> None: ...
|
||||
def set_result(self, result: _T) -> None: ...
|
||||
def set_exception(self, exception: Exception) -> None: ...
|
||||
def set_exception(self, exception: BaseException) -> None: ...
|
||||
|
||||
class Executor:
|
||||
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
|
||||
|
||||
Reference in New Issue
Block a user