mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)
Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
This commit is contained in:
parent
869c0c99b9
commit
c6e5c1123b
34 changed files with 24 additions and 469 deletions
27
Python/clinic/sysmodule.c.h
generated
27
Python/clinic/sysmodule.c.h
generated
|
@ -758,27 +758,6 @@ exit:
|
|||
return return_value;
|
||||
}
|
||||
|
||||
#if defined(COUNT_ALLOCS)
|
||||
|
||||
PyDoc_STRVAR(sys_getcounts__doc__,
|
||||
"getcounts($module, /)\n"
|
||||
"--\n"
|
||||
"\n");
|
||||
|
||||
#define SYS_GETCOUNTS_METHODDEF \
|
||||
{"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS, sys_getcounts__doc__},
|
||||
|
||||
static PyObject *
|
||||
sys_getcounts_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
sys_getcounts(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return sys_getcounts_impl(module);
|
||||
}
|
||||
|
||||
#endif /* defined(COUNT_ALLOCS) */
|
||||
|
||||
PyDoc_STRVAR(sys__getframe__doc__,
|
||||
"_getframe($module, depth=0, /)\n"
|
||||
"--\n"
|
||||
|
@ -988,11 +967,7 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||
#define SYS_GETTOTALREFCOUNT_METHODDEF
|
||||
#endif /* !defined(SYS_GETTOTALREFCOUNT_METHODDEF) */
|
||||
|
||||
#ifndef SYS_GETCOUNTS_METHODDEF
|
||||
#define SYS_GETCOUNTS_METHODDEF
|
||||
#endif /* !defined(SYS_GETCOUNTS_METHODDEF) */
|
||||
|
||||
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#define SYS_GETANDROIDAPILEVEL_METHODDEF
|
||||
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
|
||||
/*[clinic end generated code: output=decd687b7631de4b input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -73,9 +73,6 @@ static const char usage_3[] = "\
|
|||
tracemalloc module. By default, only the most recent frame is stored in a\n\
|
||||
traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a\n\
|
||||
traceback limit of NFRAME frames\n\
|
||||
-X showalloccount: output the total count of allocated objects for each\n\
|
||||
type when the program finishes. This only works when Python was built with\n\
|
||||
COUNT_ALLOCS defined\n\
|
||||
-X importtime: show how long each import takes. It shows module name,\n\
|
||||
cumulative time (including nested imports) and self time (excluding\n\
|
||||
nested imports). Note that its output may be broken in multi-threaded\n\
|
||||
|
@ -800,7 +797,6 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2)
|
|||
COPY_ATTR(tracemalloc);
|
||||
COPY_ATTR(import_time);
|
||||
COPY_ATTR(show_ref_count);
|
||||
COPY_ATTR(show_alloc_count);
|
||||
COPY_ATTR(dump_refs);
|
||||
COPY_ATTR(malloc_stats);
|
||||
|
||||
|
@ -903,7 +899,6 @@ config_as_dict(const PyConfig *config)
|
|||
SET_ITEM_INT(tracemalloc);
|
||||
SET_ITEM_INT(import_time);
|
||||
SET_ITEM_INT(show_ref_count);
|
||||
SET_ITEM_INT(show_alloc_count);
|
||||
SET_ITEM_INT(dump_refs);
|
||||
SET_ITEM_INT(malloc_stats);
|
||||
SET_ITEM_WSTR(filesystem_encoding);
|
||||
|
@ -1691,9 +1686,6 @@ config_read(PyConfig *config)
|
|||
if (config_get_xoption(config, L"showrefcount")) {
|
||||
config->show_ref_count = 1;
|
||||
}
|
||||
if (config_get_xoption(config, L"showalloccount")) {
|
||||
config->show_alloc_count = 1;
|
||||
}
|
||||
|
||||
status = config_read_complex_options(config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
|
|
|
@ -1173,10 +1173,6 @@ Py_Initialize(void)
|
|||
}
|
||||
|
||||
|
||||
#ifdef COUNT_ALLOCS
|
||||
extern void _Py_dump_counts(FILE*);
|
||||
#endif
|
||||
|
||||
/* Flush stdout and stderr */
|
||||
|
||||
static int
|
||||
|
@ -1393,13 +1389,6 @@ Py_FinalizeEx(void)
|
|||
* XXX I haven't seen a real-life report of either of these.
|
||||
*/
|
||||
_PyGC_CollectIfEnabled();
|
||||
#ifdef COUNT_ALLOCS
|
||||
/* With COUNT_ALLOCS, it helps to run GC multiple times:
|
||||
each collection might release some types from the type
|
||||
list, so they become garbage. */
|
||||
while (_PyGC_CollectIfEnabled() > 0)
|
||||
/* nothing */;
|
||||
#endif
|
||||
|
||||
/* Clear all loghooks */
|
||||
/* We want minimal exposure of this function, so define the extern
|
||||
|
@ -1451,10 +1440,6 @@ Py_FinalizeEx(void)
|
|||
/* unload faulthandler module */
|
||||
_PyFaulthandler_Fini();
|
||||
|
||||
/* Debugging stuff */
|
||||
#ifdef COUNT_ALLOCS
|
||||
_Py_dump_counts(stderr);
|
||||
#endif
|
||||
/* dump hash stats */
|
||||
_PyHash_Fini();
|
||||
|
||||
|
|
|
@ -1685,20 +1685,6 @@ sys_getallocatedblocks_impl(PyObject *module)
|
|||
return _Py_GetAllocatedBlocks();
|
||||
}
|
||||
|
||||
#ifdef COUNT_ALLOCS
|
||||
/*[clinic input]
|
||||
sys.getcounts
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
sys_getcounts_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=20df00bc164f43cb input=ad2ec7bda5424953]*/
|
||||
{
|
||||
extern PyObject *_Py_get_counts(void);
|
||||
|
||||
return _Py_get_counts();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*[clinic input]
|
||||
sys._getframe
|
||||
|
@ -1879,7 +1865,6 @@ static PyMethodDef sys_methods[] = {
|
|||
SYS_GETDEFAULTENCODING_METHODDEF
|
||||
SYS_GETDLOPENFLAGS_METHODDEF
|
||||
SYS_GETALLOCATEDBLOCKS_METHODDEF
|
||||
SYS_GETCOUNTS_METHODDEF
|
||||
#ifdef DYNAMIC_EXECUTION_PROFILE
|
||||
{"getdxp", _Py_GetDXProfile, METH_VARARGS},
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue