add ParamSpec to trace.runfunc (#5940)

This commit is contained in:
Anton Grübel
2021-08-20 17:46:34 +09:00
committed by GitHub
parent 918c7d0b84
commit 2f499c7e90

View File

@@ -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: ...