diff --git a/stdlib/contextvars.pyi b/stdlib/contextvars.pyi index e97f62188..08c354c0d 100644 --- a/stdlib/contextvars.pyi +++ b/stdlib/contextvars.pyi @@ -1,11 +1,13 @@ import sys from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, overload +from typing_extensions import ParamSpec if sys.version_info >= (3, 9): from types import GenericAlias _T = TypeVar("_T") _D = TypeVar("_D") +_P = ParamSpec("_P") class ContextVar(Generic[_T]): def __init__(self, name: str, *, default: _T = ...) -> None: ... @@ -39,7 +41,7 @@ class Context(Mapping[ContextVar[Any], Any]): def get(self, __key: ContextVar[Any]) -> Any | None: ... @overload def get(self, __key: ContextVar[Any], __default: Any | None) -> Any: ... - def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ... + def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... def copy(self) -> Context: ... def __getitem__(self, key: ContextVar[Any]) -> Any: ... def __iter__(self) -> Iterator[ContextVar[Any]]: ...