From 6f1fe98031665c57eab294b638dfd1ea40bbd740 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Oct 2021 15:55:51 +0200 Subject: [PATCH] PEP 670: List converted macros (#2120) Co-authored-by: Erlend Egeberg Aasland --- pep-0670.rst | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/pep-0670.rst b/pep-0670.rst index 8119d9a85..0549dcd7e 100644 --- a/pep-0670.rst +++ b/pep-0670.rst @@ -284,6 +284,68 @@ single long line. Inside the function, the *op* argument has a well defined type: ``PyObject*``. +Macros converted to functions since Python 3.8 +============================================== + +Macros converted to static inline functions +------------------------------------------- + +Python 3.8: + +* ``Py_DECREF()`` +* ``Py_INCREF()`` +* ``Py_XDECREF()`` +* ``Py_XINCREF()`` +* ``PyObject_INIT()`` +* ``PyObject_INIT_VAR()`` +* ``_PyObject_GC_UNTRACK()`` +* ``_Py_Dealloc()`` + +Python 3.10: + +* ``Py_REFCNT()`` + +Python 3.11: + +* ``Py_TYPE()`` +* ``Py_SIZE()`` + +Macros converted to regular functions +------------------------------------- + +Python 3.9: + +* ``PyIndex_Check()`` +* ``PyObject_CheckBuffer()`` +* ``PyObject_GET_WEAKREFS_LISTPTR()`` +* ``PyObject_IS_GC()`` +* ``PyObject_NEW()``: alias to ``PyObject_New()`` +* ``PyObject_NEW_VAR()``: alias to ``PyObjectVar_New()`` + +To avoid any risk of performance slowdown on Python built without LTO, +private static inline functions have been added to the internal C API: + +* ``_PyIndex_Check()`` +* ``_PyObject_IS_GC()`` +* ``_PyType_HasFeature()`` +* ``_PyType_IS_GC()`` + +Static inline functions converted to regular functions +------------------------------------------------------- + +Python 3.11: + +* ``PyObject_CallOneArg()`` +* ``PyObject_Vectorcall()`` +* ``PyVectorcall_Function()`` +* ``_PyObject_FastCall()`` + +To avoid any risk of performance slowdown on Python built without LTO, a +private static inline function has been added to the internal C API: + +* ``_PyVectorcall_FunctionInline()`` + + References ==========