summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-03 14:17:15 (GMT)
committerGitHub <noreply@github.com>2020-02-03 14:17:15 (GMT)
commitc6e5c1123bac6cbb4c85265155af5349dcea522e (patch)
treec9bc04bdd74fbf9d8f86dd1999d8acc0f4655fc3 /Include
parent869c0c99b94ff9527acc1ca060164ab3d1bdcc53 (diff)
downloadcpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.zip
cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.gz
cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.bz2
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
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/initconfig.h1
-rw-r--r--Include/cpython/object.h11
-rw-r--r--Include/object.h20
3 files changed, 2 insertions, 30 deletions
diff --git a/Include/cpython/initconfig.h b/Include/cpython/initconfig.h
index 54e6623..c5fa2b3 100644
--- a/Include/cpython/initconfig.h
+++ b/Include/cpython/initconfig.h
@@ -153,7 +153,6 @@ typedef struct {
int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */
int show_ref_count; /* -X showrefcount */
- int show_alloc_count; /* -X showalloccount */
int dump_refs; /* PYTHONDUMPREFS */
int malloc_stats; /* PYTHONMALLOCSTATS */
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index dc8fd6f..5fcad55 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -255,15 +255,6 @@ typedef struct _typeobject {
destructor tp_finalize;
vectorcallfunc tp_vectorcall;
-
-#ifdef COUNT_ALLOCS
- /* these must be last and never explicitly initialized */
- Py_ssize_t tp_allocs;
- Py_ssize_t tp_frees;
- Py_ssize_t tp_maxalloc;
- struct _typeobject *tp_prev;
- struct _typeobject *tp_next;
-#endif
} PyTypeObject;
/* The *real* layout of a type object when allocated on the heap */
@@ -341,8 +332,6 @@ static inline void _Py_Dealloc_inline(PyObject *op)
destructor dealloc = Py_TYPE(op)->tp_dealloc;
#ifdef Py_TRACE_REFS
_Py_ForgetReference(op);
-#else
- _Py_INC_TPFREES(op);
#endif
(*dealloc)(op);
}
diff --git a/Include/object.h b/Include/object.h
index 7a5f573..1a2e704 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -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 */