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:
Victor Stinner 2020-02-03 15:17:15 +01:00 committed by GitHub
parent 869c0c99b9
commit c6e5c1123b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 24 additions and 469 deletions

View file

@ -405,20 +405,6 @@ PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void);
#define _Py_DEC_REFTOTAL
#endif /* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS
PyAPI_FUNC(void) _Py_inc_count(struct _typeobject *);
PyAPI_FUNC(void) _Py_dec_count(struct _typeobject *);
#define _Py_INC_TPALLOCS(OP) _Py_inc_count(Py_TYPE(OP))
#define _Py_INC_TPFREES(OP) _Py_dec_count(Py_TYPE(OP))
#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees--
#define _Py_COUNT_ALLOCS_COMMA ,
#else
#define _Py_INC_TPALLOCS(OP)
#define _Py_INC_TPFREES(OP)
#define _Py_DEC_TPFREES(OP)
#define _Py_COUNT_ALLOCS_COMMA
#endif /* COUNT_ALLOCS */
/* Update the Python traceback of an object. This function must be called
when a memory block is reused from a free list. */
PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op);
@ -438,15 +424,13 @@ static inline void _Py_NewReference(PyObject *op)
if (_Py_tracemalloc_config.tracing) {
_PyTraceMalloc_NewReference(op);
}
_Py_INC_TPALLOCS(op);
_Py_INC_REFTOTAL;
Py_REFCNT(op) = 1;
}
static inline void _Py_ForgetReference(PyObject *op)
static inline void _Py_ForgetReference(PyObject *Py_UNUSED(op))
{
(void)op; /* may be unused, shut up -Wunused-parameter */
_Py_INC_TPFREES(op);
/* nothing to do */
}
#endif /* !Py_TRACE_REFS */