[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-833-g54ea150

Jelmer Vernooij jelmer at samba.org
Thu Oct 1 06:52:11 MDT 2009


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


More information about the samba-technical mailing list