STINNER Victor <[email protected]> added the comment:
Macros and static inline functions of the public C API which access directly
PyTypeObject fields. There may be more.
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
static inline vectorcallfunc
PyVectorcall_Function(PyObject *callable)
{
...
tp = Py_TYPE(callable);
offset = tp->tp_vectorcall_offset;
...
}
#define PyObject_CheckBuffer(obj) \
((Py_TYPE(obj)->tp_as_buffer != NULL) && \
(Py_TYPE(obj)->tp_as_buffer->bf_getbuffer != NULL))
#define PyIndex_Check(obj) \
(Py_TYPE(obj)->tp_as_number != NULL && \
Py_TYPE(obj)->tp_as_number->nb_index != NULL)
#define PyObject_GET_WEAKREFS_LISTPTR(o) \
((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset))
static inline int
PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
#ifdef Py_LIMITED_API
return ((PyType_GetFlags(type) & feature) != 0);
#else
return ((type->tp_flags & feature) != 0);
#endif
}
#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40170>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com