[Python-checkins] [3.10] Fix type annotation of `pstats.FunctionProfile.ncalls` (GH-96741) (#96836)

ambv webhook-mailer at python.org
Wed Oct 5 17:57:31 EDT 2022


https://github.com/python/cpython/commit/6f23472345aedbba414620561ba89fa3cf6eda24
commit: 6f23472345aedbba414620561ba89fa3cf6eda24
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-10-05T14:57:26-07:00
summary:

[3.10] Fix type annotation of `pstats.FunctionProfile.ncalls` (GH-96741) (#96836)

This change aligns the type annotation of `pstats.FunctionProfile.ncalls` with its runtime type.
(cherry picked from commit 8e9a37dde44c9fa0b961cb2db5dc8266e1f85d11)

Co-authored-by: Ruan Comelli <ruancomelli at gmail.com>

files:
A Misc/NEWS.d/next/Library/2022-09-15-00-37-33.gh-issue-96741.4b6czN.rst
M Lib/pstats.py

diff --git a/Lib/pstats.py b/Lib/pstats.py
index 0f93ae02c950..ac88c04dee25 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -56,7 +56,7 @@ def __new__(cls, *values):
 
 @dataclass(unsafe_hash=True)
 class FunctionProfile:
-    ncalls: int
+    ncalls: str
     tottime: float
     percall_tottime: float
     cumtime: float
diff --git a/Misc/NEWS.d/next/Library/2022-09-15-00-37-33.gh-issue-96741.4b6czN.rst b/Misc/NEWS.d/next/Library/2022-09-15-00-37-33.gh-issue-96741.4b6czN.rst
new file mode 100644
index 000000000000..e7f53311e589
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-09-15-00-37-33.gh-issue-96741.4b6czN.rst
@@ -0,0 +1 @@
+Corrected type annotation for dataclass attribute ``pstats.FunctionProfile.ncalls`` to be ``str``.



More information about the Python-checkins mailing list