This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients corona10, petdance, shihai1991, vstinner
Date 2020-04-04.21:45:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586036749.45.0.667886765597.issue40170@roundup.psfhosted.org>
In-reply-to
Content
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 )
History
Date User Action Args
2020-04-04 21:45:49vstinnersetrecipients: + vstinner, corona10, shihai1991, petdance
2020-04-04 21:45:49vstinnersetmessageid: <1586036749.45.0.667886765597.issue40170@roundup.psfhosted.org>
2020-04-04 21:45:49vstinnerlinkissue40170 messages
2020-04-04 21:45:49vstinnercreate