add ParamSpec to asyncio.to_thread (#6668)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Thomas Grainger
2021-12-23 11:29:02 +00:00
committed by GitHub
parent aa329b248b
commit eced701c8b

View File

@@ -1,7 +1,9 @@
import sys
from typing import Any, Callable, TypeVar
from typing import Callable, TypeVar
from typing_extensions import ParamSpec
_T = TypeVar("_T")
_P = ParamSpec("_P")
_R = TypeVar("_R")
if sys.version_info >= (3, 9):
async def to_thread(__func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
async def to_thread(__func: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ...