[New-bugs-announce] [issue41078] [C API] Convert PyTuple_GET_ITEM() macro to a static inline function

STINNER Victor report at bugs.python.org
Mon Jun 22 10:50:13 EDT 2020


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

PyTuple_GET_ITEM() can be abused to access directly the PyTupleObject.ob_item member:

   PyObject **items = &PyTuple_GET_ITEM(0);

Giving a direct access to an array or PyObject* (PyObject**) is causing issues with other Python implementations, like PyPy, which don't use PyObject internally.

I propose to convert the PyTuple_GET_ITEM() and PyList_GET_ITEM() macros to static inline functions to disallow that.

----------
components: C API
messages: 372091
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Convert PyTuple_GET_ITEM() macro to a static inline function
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41078>
_______________________________________


More information about the New-bugs-announce mailing list