pyldb: Use the Py_TYPE macro
authorPetr Viktorin <pviktori@redhat.com>
Tue, 3 Mar 2015 21:29:07 +0000 (22:29 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 3 Mar 2015 22:20:06 +0000 (23:20 +0100)
The "ob_type" member of Python objects is going away
in Python 3 for compliance with C's strict aliasing rules.
The Py_TYPE macro should be used instead.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index 9bbd4ba66bcecca4aebdd15b44ea1dea34cbe9e6..4f452fa5e758bb96379cf311966b7033160d19d0 100644 (file)
@@ -88,7 +88,7 @@ static void py_ldb_control_dealloc(PyLdbControlObject *self)
                talloc_free(self->mem_ctx);
        }
        self->data = NULL;
-       self->ob_type->tp_free(self);
+       Py_TYPE(self)->tp_free(self);
 }
 
 static PyObject *py_ldb_control_get_oid(PyLdbControlObject *self)
@@ -1993,7 +1993,7 @@ static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx)
 static void py_ldb_dealloc(PyLdbObject *self)
 {
        talloc_free(self->mem_ctx);
-       self->ob_type->tp_free(self);
+       Py_TYPE(self)->tp_free(self);
 }
 
 static PyTypeObject PyLdb = {
@@ -2017,7 +2017,7 @@ static void py_ldb_result_dealloc(PyLdbResultObject *self)
        Py_DECREF(self->msgs);
        Py_DECREF(self->referals);
        Py_DECREF(self->controls);
-       self->ob_type->tp_free(self);
+       Py_TYPE(self)->tp_free(self);
 }
 
 static PyObject *py_ldb_result_get_msgs(PyLdbResultObject *self, void *closure)