diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-03-01 21:26:27 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-03-01 23:06:55 +0100 |
commit | e29a9f4af76f15030ba316690bdbb55806081fde (patch) | |
tree | aab9482b9fa725dfae7c917718d17fd399dd9d8f /lib/ldb | |
parent | f5f17b19af0ce46539f150c5dbf232a7f49bccc7 (diff) | |
download | samba-e29a9f4af76f15030ba316690bdbb55806081fde.tar.gz samba-e29a9f4af76f15030ba316690bdbb55806081fde.tar.bz2 samba-e29a9f4af76f15030ba316690bdbb55806081fde.zip |
pyldb: Avoid using PyErr_LDB_ERROR_IS_ERR_RAISE where PyErr_SetLdbError suffices.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Thu Mar 1 23:06:55 CET 2012 on sn-devel-104
Diffstat (limited to 'lib/ldb')
-rw-r--r-- | lib/ldb/pyldb.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 2f99d1404a..a2a5dffd25 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -922,7 +922,8 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa ret = ldb_connect(pyldb_Ldb_AsLdbContext(self), url, flags, options); talloc_free(options); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, pyldb_Ldb_AsLdbContext(self)); + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, + pyldb_Ldb_AsLdbContext(self)); Py_RETURN_NONE; } @@ -970,7 +971,7 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args, PyObject *kwar if (validate) { ret = ldb_msg_sanity_check(ldb_ctx, msg); if (ret != LDB_SUCCESS) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); talloc_free(mem_ctx); return NULL; } @@ -990,7 +991,8 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args, PyObject *kwar ret = ldb_transaction_start(ldb_ctx); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); + return NULL; } ret = ldb_request(ldb_ctx, req); @@ -1117,7 +1119,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args, PyObject *kwargs) ret = ldb_msg_sanity_check(ldb_ctx, msg); if (ret != LDB_SUCCESS) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); talloc_free(mem_ctx); return NULL; } @@ -1136,7 +1138,8 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args, PyObject *kwargs) ret = ldb_transaction_start(ldb_ctx); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); + return NULL; } ret = ldb_request(ldb_ctx, req); @@ -1207,7 +1210,8 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args, PyObject *kwar ret = ldb_transaction_start(ldb_ctx); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); + return NULL; } ret = ldb_request(ldb_ctx, req); @@ -1286,7 +1290,8 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args, PyObject *kwar ret = ldb_transaction_start(ldb_ctx); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); + return NULL; } ret = ldb_request(ldb_ctx, req); @@ -1565,7 +1570,7 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); return NULL; } @@ -1579,7 +1584,7 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); + PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); return NULL; } @@ -1649,10 +1654,8 @@ static PyObject *py_ldb_sequence_number(PyLdbObject *self, PyObject *args) ret = ldb_sequence_number(ldb, type, &value); - if (ret != LDB_SUCCESS) { - PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb); - return NULL; - } + PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb); + return PyLong_FromLongLong(value); } static PyMethodDef py_ldb_methods[] = { |