pstats.FunctionProfile.ncalls should be str (#8712)

Correctly annotate `pstats.FunctionProfile.ncalls` as `str` instead of `int`.

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 <Alex.Waygood@Gmail.com>
This commit is contained in:
Ruan Comelli
2022-09-10 17:11:45 -03:00
committed by GitHub
parent ab022557e2
commit 04a88d5740

View File

@@ -30,7 +30,8 @@ if sys.version_info >= (3, 9):
@dataclass(unsafe_hash=True)
class FunctionProfile:
ncalls: int
# 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
cumtime: float