pyregistry: Use talloc.Object.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 30 Nov 2010 23:03:08 +0000 (00:03 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 1 Dec 2010 00:48:25 +0000 (01:48 +0100)
source4/lib/registry/pyregistry.c

index 8b75bbb60da18179b078d4596f8dfe87cc1f763a..b93258a8562a6b639b470aa90f509d49d88db4d0 100644 (file)
@@ -159,7 +159,6 @@ PyTypeObject PyRegistry = {
        .tp_methods = registry_methods,
        .tp_new = registry_new,
        .tp_basicsize = sizeof(py_talloc_Object),
-       .tp_dealloc = py_talloc_dealloc,
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
 
@@ -297,14 +296,12 @@ PyTypeObject PyHiveKey = {
        .tp_methods = hive_key_methods,
        .tp_new = hive_new,
        .tp_basicsize = sizeof(py_talloc_Object),
-       .tp_dealloc = py_talloc_dealloc,
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
 
 PyTypeObject PyRegistryKey = {
        .tp_name = "RegistryKey",
        .tp_basicsize = sizeof(py_talloc_Object),
-       .tp_dealloc = py_talloc_dealloc,
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
 
@@ -354,7 +351,7 @@ static PyObject *py_open_samba(PyObject *self, PyObject *args, PyObject *kwargs)
                PyErr_SetWERROR(result);
                return NULL;
        }
-       
+
        return py_talloc_steal(&PyRegistry, reg_ctx);
 }
 
@@ -474,6 +471,14 @@ static PyMethodDef py_registry_methods[] = {
 void initregistry(void)
 {
        PyObject *m;
+       PyTypeObject *talloc_type = PyTalloc_GetObjectType();
+
+       if (talloc_type == NULL)
+               return;
+
+       PyHiveKey.tp_base = talloc_type;
+       PyRegistry.tp_base = talloc_type;
+       PyRegistryKey.tp_base = talloc_type;
 
        if (PyType_Ready(&PyHiveKey) < 0)
                return;