some cleanup, some docs

This commit is contained in:
ndparker 2015-03-15 18:30:05 +01:00
parent 8d30069caf
commit ab5b3a12bc
1 changed files with 11 additions and 7 deletions

View File

@ -249,13 +249,17 @@ typedef int Py_ssize_t;
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
#endif
#define DEFINE_GENERIC_DEALLOC(prefix) \
static void prefix##_dealloc(void *self) \
{ \
if (PyType_IS_GC(((PyObject *)self)->ob_type)) \
PyObject_GC_UnTrack(self); \
(void)prefix##_clear(self); \
((PyObject *)self)->ob_type->tp_free((PyObject *)self); \
#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
#define DEFINE_GENERIC_DEALLOC(prefix) \
static void prefix##_dealloc(void *self) \
{ \
if (PyType_IS_GC(Py_TYPE(self))) \
PyObject_GC_UnTrack(self); \
(void)prefix##_clear(self); \
(Py_TYPE(self))->tp_free((PyObject *)self); \
}
#endif /* SETUP_CEXT_H */