py_panda: Add Dtool_GetPyTypeObject macro
This is a cleaner, future-proof way of accessing a Panda type as PyTypeObject pointer
This commit is contained in:
parent
b8d6c7a2ef
commit
ca7ba4eab3
|
|
@ -161,6 +161,9 @@ static void Dtool_FreeInstance_##CLASS_NAME(PyObject *self) {\
|
|||
Py_TYPE(self)->tp_free(self);\
|
||||
}
|
||||
|
||||
// Extract the PyTypeObject pointer corresponding to a Dtool_PyTypedObject.
|
||||
#define Dtool_GetPyTypeObject(type) (&(type)->_PyType)
|
||||
|
||||
// Use DtoolInstance_Check to check whether a PyObject* is a DtoolInstance.
|
||||
#define DtoolInstance_Check(obj) \
|
||||
(Py_TYPE(obj)->tp_basicsize >= (int)sizeof(Dtool_PyInstDef) && \
|
||||
|
|
|
|||
Loading…
Reference in New Issue