]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pyparam: Use pytalloc_BaseObject_PyType_Ready()
authorAndrew Bartlett <abartlet@samba.org>
Mon, 29 Feb 2016 20:31:00 +0000 (09:31 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 8 Mar 2016 00:58:29 +0000 (01:58 +0100)
This changes pyparam to use talloc.BaseObject() just like the PIDL output

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/param/pyparam.c

index 7e7f7a072c3a08efbdc875f1d6308a8684a969e4..fde91e5886e67460fbbda24ab84c72f6e5e89acf 100644 (file)
@@ -418,7 +418,6 @@ static PyMappingMethods py_lp_ctx_mapping = {
 
 PyTypeObject PyLoadparmContext = {
        .tp_name = "param.LoadParm",
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_getset = py_lp_ctx_getset,
        .tp_methods = py_lp_ctx_methods,
        .tp_new = py_lp_ctx_new,
@@ -464,7 +463,6 @@ static PyMethodDef py_lp_service_methods[] = {
 
 PyTypeObject PyLoadparmService = {
        .tp_name = "param.LoadparmService",
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_methods = py_lp_service_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
@@ -511,17 +509,11 @@ static PyMethodDef pyparam_methods[] = {
 void initparam(void)
 {
        PyObject *m;
-       PyTypeObject *talloc_type = pytalloc_GetObjectType();
-       if (talloc_type == NULL)
-               return;
-
-       PyLoadparmContext.tp_base = talloc_type;
-       PyLoadparmService.tp_base = talloc_type;
 
-       if (PyType_Ready(&PyLoadparmContext) < 0)
+       if (pytalloc_BaseObject_PyType_Ready(&PyLoadparmContext) < 0)
                return;
 
-       if (PyType_Ready(&PyLoadparmService) < 0)
+       if (pytalloc_BaseObject_PyType_Ready(&PyLoadparmService) < 0)
                return;
 
        m = Py_InitModule3("param", pyparam_methods, "Parsing and writing Samba configuration files.");