Skip to content

Commit

Permalink
PEP 670: List converted macros (#2120)
Browse files Browse the repository at this point in the history
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
  • Loading branch information
vstinner and Erlend Egeberg Aasland authored Oct 20, 2021
1 parent 9afa9ee commit 6f1fe98
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions pep-0670.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========

Expand Down

0 comments on commit 6f1fe98

Please sign in to comment.