From f6eacfcf1d579242af40820fe284df80c1f2b7bf Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 7 Nov 2009 17:57:50 +0100 Subject: s4:lib/messaging - fix up the python bindings This fixes up the broken "send" method of the python bindings and corrects some other parameter lists in parsing functions (this is only cosmetic). The reason for the bug was a superfluous "|"! --- source4/lib/messaging/pymessaging.c | 11 ++++++----- source4/lib/messaging/tests/bindings.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 33746af26c..0e6fe88b11 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -138,8 +138,9 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa const char *kwnames[] = { "target", "msg_type", "data", NULL }; int length; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#|:send", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#:send", discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) { + return NULL; } @@ -176,7 +177,7 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject NTSTATUS status; const char *kwnames[] = { "callback", "msg_type", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:register", discard_const_p(char *, kwnames), &callback, &msg_type)) { return NULL; } @@ -207,7 +208,7 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec PyObject *callback; const char *kwnames[] = { "callback", "msg_type", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:deregister", discard_const_p(char *, kwnames), &callback, &msg_type)) { return NULL; } @@ -226,7 +227,7 @@ static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject char *name; const char *kwnames[] = { "name", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:add_name", discard_const_p(char *, kwnames), &name)) { return NULL; } @@ -247,7 +248,7 @@ static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObje char *name; const char *kwnames[] = { "name", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:remove_name", discard_const_p(char *, kwnames), &name)) { return NULL; } diff --git a/source4/lib/messaging/tests/bindings.py b/source4/lib/messaging/tests/bindings.py index c89538ddfa..ead7a83afd 100644 --- a/source4/lib/messaging/tests/bindings.py +++ b/source4/lib/messaging/tests/bindings.py @@ -52,6 +52,6 @@ class MessagingTests(TestCase): client_ctx = self.get_context((0, 2)) msg_pong = client_ctx.register(pong_callback) - client_ctx.send((0,1), msg_ping, "testing") - client_ctx.send((0,1), msg_ping, "") + client_ctx.send((0, 1), msg_ping, "testing") + client_ctx.send((0, 1), msg_ping, "") -- cgit