From 8e0a37662a4244a5cc4348a10f55e2d036834526 Mon Sep 17 00:00:00 2001 From: Ruan Comelli Date: Thu, 8 Sep 2022 19:06:52 -0300 Subject: [PATCH 1/2] fix: annotate `pstats.FunctionProfile.ncalls` as `str` Correctly annotate `pstats.FunctionProfile.ncalls` as `str` instead of `int`. --- stdlib/pstats.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 7629cd63438f..10d817b59630 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -30,7 +30,7 @@ if sys.version_info >= (3, 9): @dataclass(unsafe_hash=True) class FunctionProfile: - ncalls: int + ncalls: str tottime: float percall_tottime: float cumtime: float From 37e3afc08a9737c5d32abf3b050d3aefa220e46b Mon Sep 17 00:00:00 2001 From: Ruan Comelli Date: Sat, 10 Sep 2022 14:45:17 -0300 Subject: [PATCH 2/2] Add comment pointing out the difference to CPython Since this change introduces a difference between typeshed and CPython, add a comment pointing that out and linking to this PR. Co-authored-by: Alex Waygood --- stdlib/pstats.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 10d817b59630..3876fff5e188 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -30,6 +30,7 @@ if sys.version_info >= (3, 9): @dataclass(unsafe_hash=True) class FunctionProfile: + # Note: the annotation in the CPython codebase is "int", but the annotation in CPython is wrong! See #8712 ncalls: str tottime: float percall_tottime: float