python: use Py_TYPE instead of looking directly into PyObject_HEAD

Py_TYPE works on both Python2 and Python3, while internals of
PyObject_HEAD have changed.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Marek Marczykowski-Górecki authored and Wei Liu committed 2017-02-23 13:11:12 +00:00
1 parent 96d1ee6465
commit 7b1e5f7079
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -2670,7 +2670,7 @@ static void PyXc_dealloc(XcObject *self)
self->xc_handle = NULL;
}
self->ob_type->tp_free((PyObject *)self);
Py_TYPE(self)->tp_free((PyObject *)self);
}
static PyTypeObject PyXcType = {
+1 -1
View File
@@ -922,7 +922,7 @@ static void xshandle_dealloc(XsHandle *self)
Py_XDECREF(self->watches);
self->ob_type->tp_free((PyObject *)self);
Py_TYPE(self)->tp_free((PyObject *)self);
}
static PyTypeObject xshandle_type = {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.