pyldb: Use "O!" to specify the type of py_ldb
authorAndrew Bartlett <abartlet@samba.org>
Mon, 4 Dec 2023 22:53:58 +0000 (11:53 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 3 Mar 2024 22:33:35 +0000 (22:33 +0000)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/ldb/pyldb.c

index 059e0240c5711e65fa4b5b21b87bf3ca5b683eea..51a5a689f1953d986cd87861afe9b2a883a04155 100644 (file)
@@ -1013,15 +1013,11 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa
        PyLdbDnObject *py_ret = NULL;
        const char * const kwnames[] = { "ldb", "dn", NULL };
 
-       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O"PYARG_STR_UNI,
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!"PYARG_STR_UNI,
                                         discard_const_p(char *, kwnames),
-                                        &py_ldb, "utf8", &str))
+                                        &PyLdb, &py_ldb, "utf8", &str))
                goto out;
 
-       if (!PyLdb_Check(py_ldb)) {
-               PyErr_SetString(PyExc_TypeError, "Expected Ldb");
-               goto out;
-       }
        ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(py_ldb);
 
        mem_ctx = talloc_new(NULL);