From 7b1e5f7079c2e19ebac367710b0a2d701ac93e8b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 23 Feb 2017 11:48:23 +0100 Subject: [PATCH] python: use Py_TYPE instead of looking directly into PyObject_HEAD MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- tools/python/xen/lowlevel/xc/xc.c | 2 +- tools/python/xen/lowlevel/xs/xs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 = { -- 2.30.2