]> xenbits.xensource.com Git - xen.git/commitdiff
python: use Py_TYPE instead of looking directly into PyObject_HEAD
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Thu, 23 Feb 2017 10:48:23 +0000 (11:48 +0100)
committerWei Liu <wei.liu2@citrix.com>
Thu, 23 Feb 2017 13:11:12 +0000 (13:11 +0000)
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>
tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/lowlevel/xs/xs.c

index c8ffbe44a76cef16af76ba70a6ff37046a048a61..5d21c38879d65f939107bc30ee867b7915a051ec 100644 (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 = {
index e9eef7380c0b22e6753a1490881ec5c1a1596a32..74a80cade7aa87cb99020e785cb2cfc5c5f1c510 100644 (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 = {