diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index dc2f663d8..c6d993bf6 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -2,8 +2,10 @@ import sys import types from _typeshed import StrPath from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar +from typing_extensions import ParamSpec _T = TypeVar("_T") +_P = ParamSpec("_P") _localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]] _fileModuleFunction = Tuple[str, Optional[str], str] @@ -41,9 +43,9 @@ class Trace: self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ... ) -> None: ... if sys.version_info >= (3, 9): - def runfunc(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore else: - def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ... def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ...