mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Make AbstractEventLoop.run_in_executor return an Awaitable, instead of being a coroutine (#4457)
Closes: #3999
This commit is contained in:
@@ -68,11 +68,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
|
||||
else:
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
# run_in_executor is defined as a coroutine in AbstractEventLoop but returns a Future in concrete implementation.
|
||||
# Need to ignore mypy Return type error as a result.
|
||||
def run_in_executor( # type: ignore
|
||||
self, executor: Any, func: Callable[..., _T], *args: Any,
|
||||
) -> Future[_T]: ...
|
||||
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any,) -> Future[_T]: ...
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
async def getaddrinfo(
|
||||
|
||||
@@ -116,7 +116,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
@abstractmethod
|
||||
async def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> _T: ...
|
||||
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Awaitable[_T]: ...
|
||||
@abstractmethod
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
|
||||
Reference in New Issue
Block a user