From 95f6b31e4be737e469e6c02b90e3bf8f59f3ba33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 17 Nov 2019 16:18:03 +0100 Subject: [PATCH] python renderer: Try out function parameters --- plugins/python-renderer/src/gds-render-module.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/python-renderer/src/gds-render-module.c b/plugins/python-renderer/src/gds-render-module.c index 8edc7e5..e1e17cc 100644 --- a/plugins/python-renderer/src/gds-render-module.c +++ b/plugins/python-renderer/src/gds-render-module.c @@ -27,16 +27,19 @@ static PyObject *test(PyObject *self, PyObject *args) { - if(!PyArg_ParseTuple(args, ":numargs")) - return NULL; + long int i; - return PyLong_FromLong(20UL); + if(!PyArg_ParseTuple(args, "l:get_number", &i)) + return NULL; + + i *= 2; + + return PyLong_FromLong(i); } static PyMethodDef gds_render_methods[] = { - {"get_number", test, METH_VARARGS, - "Return the number of arguments received by the process."}, - {NULL, NULL, 0, NULL} + {"get_number", test, METH_VARARGS, "Return the number of arguments received by the process."}, + {NULL, NULL, 0, NULL} }; static PyModuleDef gds_render_module = {