pycredentials: Use pytalloc_BaseObject_PyType_Ready()
authorAndrew Bartlett <abartlet@samba.org>
Mon, 29 Feb 2016 20:27:11 +0000 (09:27 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 8 Mar 2016 00:58:29 +0000 (01:58 +0100)
This changes pycredentials 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>
auth/credentials/pycredentials.c

index 77671d0b4169868968b3148044e8eff9bbb3db9c..13443910ad774e300675e326b1b785852d1e9516 100644 (file)
@@ -459,7 +459,6 @@ static PyMethodDef py_creds_methods[] = {
 
 PyTypeObject PyCredentials = {
        .tp_name = "credentials.Credentials",
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_creds_new,
        .tp_flags = Py_TPFLAGS_DEFAULT,
        .tp_methods = py_creds_methods,
@@ -468,23 +467,16 @@ PyTypeObject PyCredentials = {
 
 PyTypeObject PyCredentialCacheContainer = {
        .tp_name = "credentials.CredentialCacheContainer",
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_flags = Py_TPFLAGS_DEFAULT,
 };
 
 void initcredentials(void)
 {
        PyObject *m;
-       PyTypeObject *talloc_type = pytalloc_GetObjectType();
-       if (talloc_type == NULL)
+       if (pytalloc_BaseObject_PyType_Ready(&PyCredentials) < 0)
                return;
 
-       PyCredentials.tp_base = PyCredentialCacheContainer.tp_base = talloc_type;
-
-       if (PyType_Ready(&PyCredentials) < 0)
-               return;
-
-       if (PyType_Ready(&PyCredentialCacheContainer) < 0)
+       if (pytalloc_BaseObject_PyType_Ready(&PyCredentialCacheContainer) < 0)
                return;
 
        m = Py_InitModule3("credentials", NULL, "Credentials management.");