Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6915066

Browse files
authored
bpo-37414: Remove sys.callstats() (GH-14398)
Remove the undocumented sys.callstats() function. Since Python 3.7, it was deprecated and always returned None. It required a special build option CALL_PROFILE which was already removed in Python 3.7.
1 parent 7a177c0 commit 6915066

File tree

4 files changed

+9
-77
lines changed

4 files changed

+9
-77
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ Deprecated
139139
Removed
140140
=======
141141

142+
* The undocumented ``sys.callstats()`` function has been removed. Since Python
143+
3.7, it was deprecated and always returned ``None``. It required a special
144+
build option ``CALL_PROFILE`` which was already removed in Python 3.7.
145+
(Contributed by Victor Stinner in :issue:`37414`.)
146+
142147
* The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have
143148
been removed. They were deprecated since Python 3.2. Use
144149
:func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The undocumented ``sys.callstats()`` function has been removed. Since Python
2+
3.7, it was deprecated and always returned ``None``. It required a special
3+
build option ``CALL_PROFILE`` which was already removed in Python 3.7.

Python/clinic/sysmodule.c.h

Lines changed: 1 addition & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/sysmodule.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,44 +1779,6 @@ sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs)
17791779
return _PyEval_CallTracing(func, funcargs);
17801780
}
17811781

1782-
/*[clinic input]
1783-
sys.callstats
1784-
1785-
Return a tuple of function call statistics.
1786-
1787-
A tuple is returned only if CALL_PROFILE was defined when Python was
1788-
built. Otherwise, this returns None.
1789-
1790-
When enabled, this function returns detailed, implementation-specific
1791-
details about the number of function calls executed. The return value
1792-
is a 11-tuple where the entries in the tuple are counts of:
1793-
0. all function calls
1794-
1. calls to PyFunction_Type objects
1795-
2. PyFunction calls that do not create an argument tuple
1796-
3. PyFunction calls that do not create an argument tuple
1797-
and bypass PyEval_EvalCodeEx()
1798-
4. PyMethod calls
1799-
5. PyMethod calls on bound methods
1800-
6. PyType calls
1801-
7. PyCFunction calls
1802-
8. generator calls
1803-
9. All other calls
1804-
10. Number of stack pops performed by call_function()
1805-
[clinic start generated code]*/
1806-
1807-
static PyObject *
1808-
sys_callstats_impl(PyObject *module)
1809-
/*[clinic end generated code: output=edc4a74957fa8def input=d447d8d224d5d175]*/
1810-
{
1811-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
1812-
"sys.callstats() has been deprecated in Python 3.7 "
1813-
"and will be removed in the future", 1) < 0) {
1814-
return NULL;
1815-
}
1816-
1817-
Py_RETURN_NONE;
1818-
}
1819-
18201782

18211783
#ifdef __cplusplus
18221784
extern "C" {
@@ -1910,7 +1872,6 @@ static PyMethodDef sys_methods[] = {
19101872
{"audit", (PyCFunction)(void(*)(void))sys_audit, METH_FASTCALL, audit_doc },
19111873
{"breakpointhook", (PyCFunction)(void(*)(void))sys_breakpointhook,
19121874
METH_FASTCALL | METH_KEYWORDS, breakpointhook_doc},
1913-
SYS_CALLSTATS_METHODDEF
19141875
SYS__CLEAR_TYPE_CACHE_METHODDEF
19151876
SYS__CURRENT_FRAMES_METHODDEF
19161877
SYS_DISPLAYHOOK_METHODDEF

0 commit comments

Comments
 (0)