PyErr_LDB_ERROR_IS_ERR_RAISE
Jelmer Vernooij
jelmer at samba.org
Thu Mar 1 13:32:48 MST 2012
Am 29/02/12 16:24, schrieb Julia Lawall:
> It is probably not vary important, but the following code in
> source4/lib/ldb/pyldb.c is a bit sloppy:
>
> if (ret != LDB_SUCCESS) {
> PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret,
> ldb_ctx);
> talloc_free(mem_ctx);
> return NULL;
> }
>
> PyErr_LDB_ERROR_IS_ERR_RAISE tests ret again in the same way and if
> the test succeeds returns, making the rest dead code.
PyErr_LDB_ERROR_IS_ERR_RAISE is unnecessary in this case, as it is
itself a wrapper that only returns in case ret != LDB_SUCCESS. I've
changed this code (and a few other places) to use PyErr_SetLdbError instead.
Thanks for catching this.
Cheers,
Jelmer
More information about the samba-technical
mailing list