From: Marek Marczykowski-Górecki Date: Thu, 23 Feb 2017 10:48:23 +0000 (+0100) Subject: python: use Py_TYPE instead of looking directly into PyObject_HEAD X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2706 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7b1e5f7079c2e19ebac367710b0a2d701ac93e8b;p=xen.git 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 Acked-by: Wei Liu --- diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index c8ffbe44a7..5d21c38879 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -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 = { diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c index e9eef7380c..74a80cade7 100644 --- a/tools/python/xen/lowlevel/xs/xs.c +++ b/tools/python/xen/lowlevel/xs/xs.c @@ -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 = {