From 2f499c7e90dd5194ba267efc42d27e14dbcb8949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Gr=C3=BCbel?= Date: Fri, 20 Aug 2021 17:46:34 +0900 Subject: [PATCH] add ParamSpec to trace.runfunc (#5940) --- stdlib/trace.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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: ...