[New-bugs-announce] [issue39543] Py_DECREF(): use inlined _Py_Dealloc()

STINNER Victor report at bugs.python.org
Mon Feb 3 11:53:48 EST 2020

New submission from STINNER Victor <vstinner at python.org>:

In bpo-35059, I converted Py_DECREF() macro to a static inline function (commit 2aaf0c12041bcaadd7f2cc5a54450eefd7a6ff12).

Then in bpo-35134, I moved _Py_Dealloc() macro to the newly created Include/cpython/object.h header file (commit 6eb996685e25c09499858bee4be258776e603c6f).

The problem is that when Py_DECREF() was converted to a static inline function, it stopped to use the *redefine* _Py_Dealloc() fast macro, but instead use the slow regular function call:

PyAPI_FUNC(void) _Py_Dealloc(PyObject *);

Py_DECREF() performance is critical for overall Python performance.

I will work on a PR to fix this issue.

See also bpo-39542 which updates object.h and cpython/object.h.

components: C API
messages: 361310
nosy: vstinner
priority: normal
severity: normal
status: open
title: Py_DECREF(): use inlined _Py_Dealloc()
versions: Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list