pydsdb: Raise TypeError for type errors, rather than incorrectly raising an LdbError
authorAndrew Bartlett <abartlet@samba.org>
Wed, 24 Aug 2016 23:28:32 +0000 (11:28 +1200)
committerGarming Sam <garming@samba.org>
Thu, 1 Sep 2016 03:49:14 +0000 (05:49 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/dsdb/pydsdb.c

index efaf66b93cad907fe155063eecc0904f4a02e104..1fe8c13e6e551112e9d0e7c9411d01fc2db4dff6 100644 (file)
@@ -34,14 +34,14 @@ void initdsdb(void);
 /* FIXME: These should be in a header file somewhere */
 #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
        if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \
-               PyErr_SetString(py_ldb_get_exception(), "Ldb connection object required"); \
+               PyErr_SetString(PyExc_TypeError, "Ldb connection object required"); \
                return NULL; \
        } \
        ldb = pyldb_Ldb_AsLdbContext(py_ldb);
 
 #define PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn) \
        if (!py_check_dcerpc_type(py_ldb_dn, "ldb", "Dn")) { \
-               PyErr_SetString(py_ldb_get_exception(), "ldb Dn object required"); \
+               PyErr_SetString(PyExc_TypeError, "ldb Dn object required"); \
                return NULL; \
        } \
        dn = pyldb_Dn_AsDn(py_ldb_dn);