C extensions: fix use of self->ob_type everywhere

Part of general preparations for the python3 port.
This commit is contained in:
Eli Schwartz 2019-02-25 02:46:02 -05:00
parent acd683b3ac
commit 2761fd5bd0
5 changed files with 36 additions and 40 deletions

View File

@ -184,7 +184,7 @@ Device_dealloc(Device* self)
Py_XDECREF(self->serial_number); self->serial_number = NULL;
Py_XDECREF(self->device_version); self->device_version = NULL;
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static int

View File

@ -32,7 +32,7 @@ dealloc(Device* self)
Py_XDECREF(self->device_information); self->device_information = NULL;
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static int
@ -244,4 +244,3 @@ PyTypeObject wpd::DeviceType = { // {{{
0, /* tp_alloc */
0, /* tp_new */
}; // }}}

View File

@ -47,7 +47,7 @@ Face_dealloc(Face* self)
Py_XDECREF(self->data);
self->data = NULL;
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static int
@ -160,7 +160,7 @@ dealloc(FreeType* self)
}
self->library = NULL;
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static int
@ -319,4 +319,3 @@ initfreetype(void) {
PyModule_AddObject(m, "FreeType", (PyObject *)&FreeTypeType);
PyModule_AddObject(m, "Face", (PyObject *)&FaceType);
}

View File

@ -14,7 +14,7 @@ static void
PDFDoc_dealloc(PDFDoc* self)
{
if (self->doc != NULL) delete self->doc;
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *

View File

@ -13,7 +13,7 @@ using namespace pdf;
static void
dealloc(PDFOutlineItem* self)
{
self->ob_type->tp_free((PyObject*)self);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
@ -138,5 +138,3 @@ PyTypeObject pdf::PDFOutlineItemType = {
};
// }}}