Hi Matthias,
On Thu, Oct 01, 2009 at 07:00:46AM -0500, Matthias Dieter Wallnöfer wrote:
> diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
> index 0fe4da9..0dac61b 100644
> --- a/source4/lib/ldb/pyldb.c
> +++ b/source4/lib/ldb/pyldb.c
> @@ -956,6 +956,10 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self,
> PyObject *args)
> }
> diff = ldb_msg_diff(PyLdb_AsLdbContext(self),
> PyLdbMessage_AsMessage(py_msg_old), PyLdbMessage_AsMessage(py_msg_new));
> + if (!diff) {
> + PyErr_SetString(PyExc_KeyError, "Failed to generate the Ldb
> Message diff");
> + return NULL;
> + }
Please don't use KeyError for anything other than a key somewhere not
being found (e.g. trying to access an entry in a dictionary that
doesn't exist). In this particular case RuntimeError should be more
appropriate.
Cheers,
Jelmer