From 5b45601ed37c61ecfc4b18407f002475d4226e1d Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Mon, 24 Jan 2022 00:34:26 +0300 Subject: [PATCH] Use `ParamSpec` in `cProfile.Profile.runcall` (#7008) --- stdlib/cProfile.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index e79524aa7..79d59ce4c 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -2,6 +2,7 @@ import sys from _typeshed import Self, StrOrBytesPath from types import CodeType from typing import Any, Callable, TypeVar +from typing_extensions import ParamSpec def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... def runctx( @@ -9,6 +10,7 @@ def runctx( ) -> None: ... _T = TypeVar("_T") +_P = ParamSpec("_P") _Label = tuple[str, int, str] class Profile: @@ -24,7 +26,7 @@ class Profile: def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... - def runcall(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... if sys.version_info >= (3, 8): def __enter__(self: Self) -> Self: ... def __exit__(self, *exc_info: Any) -> None: ...