From: Douglas Bagnall Date: Fri, 15 Mar 2024 00:50:40 +0000 (+1300) Subject: pyldb: py_ldb_msg_keys() uses PyErr_LDB_MESSAGE_OR_RAISE X-Git-Tag: tdb-1.4.11~1200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acba42b126cdc4b6c165a0075bc3986a72bfe5eb;p=thirdparty%2Fsamba.git pyldb: py_ldb_msg_keys() uses PyErr_LDB_MESSAGE_OR_RAISE We change the [unused, because it always cast] signature of py_ldb_msg_iter() in the same commit, because that is just a wrapper around _keys() and this maintains bisectability with the least fuss. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 46add1e0c41..eeba4470277 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -3711,12 +3711,16 @@ static PyObject *py_ldb_msg_remove_attr(PyObject *self, PyObject *args) Py_RETURN_NONE; } -static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self, +static PyObject *py_ldb_msg_keys(PyObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_message *msg = pyldb_Message_AsMessage(self); + struct ldb_message *msg = NULL; Py_ssize_t i, j = 0; - PyObject *obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0)); + PyObject *obj = NULL; + + PyErr_LDB_MESSAGE_OR_RAISE(self, msg); + + obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0)); if (obj == NULL) { return NULL; } @@ -3983,7 +3987,7 @@ static PyMethodDef py_ldb_msg_methods[] = { {0}, }; -static PyObject *py_ldb_msg_iter(PyLdbMessageObject *self) +static PyObject *py_ldb_msg_iter(PyObject *self) { PyObject *list, *iter;