summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/pyldb.c
diff options
context:
space:
mode:
authorJohn H Terpstra <jht@samba.org>2009-07-23 09:33:06 -0500
committerJohn H Terpstra <jht@samba.org>2009-07-23 09:33:06 -0500
commit94717ae8e5dfe2ccdb7f3557d5490708b00ae471 (patch)
treea39f669faf23ad05497963cf5ccf611467d0145b /source4/lib/ldb/pyldb.c
parent14952c72a29ec92badb1bcf16d2a15fe100f060d (diff)
parent7bad4b48c82fed4263c2bfe97a4d00b47913604a (diff)
downloadsamba-94717ae8e5dfe2ccdb7f3557d5490708b00ae471.tar.gz
samba-94717ae8e5dfe2ccdb7f3557d5490708b00ae471.tar.bz2
samba-94717ae8e5dfe2ccdb7f3557d5490708b00ae471.zip
Merge branch 'master' of ssh://jht@git.samba.org/data/git/samba
Diffstat (limited to 'source4/lib/ldb/pyldb.c')
-rw-r--r--source4/lib/ldb/pyldb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 2e0f4fdf36..bcca70eb82 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -41,6 +41,16 @@ typedef intargfunc ssizeargfunc;
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
+static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ctx)
+{
+ if (ret == LDB_ERR_PYTHON_EXCEPTION)
+ return; /* Python exception should already be set, just keep that */
+
+ PyErr_SetObject(error,
+ Py_BuildValue(discard_const_p(char, "(i,s)"), ret,
+ ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx)));
+}
+
static PyObject *PyExc_LdbError;
PyAPI_DATA(PyTypeObject) PyLdbMessage;