[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

STINNER Victor report at bugs.python.org
Mon Jun 22 05:10:40 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

> PyIter_Check() and PySequence_ITEM() macros access directly PyTypeObject members and must be converted to opaque functions: (...)

PyIter_Check() and PySequence_ITEM() are declared as functions in the limited C API, but overriden with macros in the CPython C API.

I suggest to simply remove the macros to always declare them as functions.

See bpo-33738 "PyIndex_Check conflicts with PEP 384" which added the functions.

See also Tools/scripts/pep384_macrocheck.py script.

----------

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


More information about the Python-bugs-list mailing list