[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:04:46 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:

#define PyIter_Check(obj) \
    (Py_TYPE(obj)->tp_iternext != NULL && \
     Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented)

#define PySequence_ITEM(o, i)\
    ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )

----------

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


More information about the Python-bugs-list mailing list