bpo-39573: Convert Py_REFCNT and Py_SIZE to functions by vstinner · Pull Request #20429 · python/cpython (original) (raw)

Convert Py_REFCNT() and Py_SIZE() macros to static inline functions.
They cannot be used as l-value anymore: use Py_SET_REFCNT() and
Py_SET_SIZE() to set an object reference count and size.

Replace &Py_SIZE(self) with &((PyVarObject*)self)->ob_size
in arraymodule.c.

This change is backward incompatible on purpose, to prepare the C API
for a fully opaque PyObject structure.

https://bugs.python.org/issue39573