summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-10-30 13:48:26 (GMT)
committerGitHub <noreply@github.com>2018-10-30 13:48:26 (GMT)
commit3c09dca4b5de9fe8c8756251d02f49cf093b88c1 (patch)
tree7d0fd98cd5ced4a4655db5b5e2245277851b035b /Objects
parente1b29950bf751381538e3c8ea6a3e0a98d01dbfb (diff)
downloadcpython-3c09dca4b5de9fe8c8756251d02f49cf093b88c1.zip
cpython-3c09dca4b5de9fe8c8756251d02f49cf093b88c1.tar.gz
cpython-3c09dca4b5de9fe8c8756251d02f49cf093b88c1.tar.bz2
bpo-35059: Convert _Py_Dealloc() to static inline function (GH-10223)
Convert _Py_Dealloc() macro into a static inline function. Moreover, it is now also defined as a static inline function if Py_TRACE_REFS is defined.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/Objects/object.c b/Objects/object.c
index de9eb2c..b72ad01 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1964,14 +1964,6 @@ _Py_ForgetReference(PyObject *op)
_Py_INC_TPFREES(op);
}
-void
-_Py_Dealloc(PyObject *op)
-{
- destructor dealloc = Py_TYPE(op)->tp_dealloc;
- _Py_ForgetReference(op);
- (*dealloc)(op);
-}
-
/* Print all live objects. Because PyObject_Print is called, the
* interpreter must be in a healthy state.
*/
@@ -2265,18 +2257,20 @@ _PyObject_AssertFailed(PyObject *obj, const char *msg, const char *expr,
Py_FatalError("_PyObject_AssertFailed");
}
-#ifndef Py_TRACE_REFS
-/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
- Define this here, so we can undefine the macro. */
+
#undef _Py_Dealloc
-void _Py_Dealloc(PyObject *);
+
void
_Py_Dealloc(PyObject *op)
{
- _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA
- (*Py_TYPE(op)->tp_dealloc)(op);
-}
+ destructor dealloc = Py_TYPE(op)->tp_dealloc;
+#ifdef Py_TRACE_REFS
+ _Py_ForgetReference(op);
+#else
+ _Py_INC_TPFREES(op);
#endif
+ (*dealloc)(op);
+}
#ifdef __cplusplus
}