python renderer: Try out function parameters

This commit is contained in:
Mario Hüttel 2019-11-17 16:18:03 +01:00
parent a4d84cff43
commit 95f6b31e4b

View File

@ -27,16 +27,19 @@
static PyObject *test(PyObject *self, PyObject *args) static PyObject *test(PyObject *self, PyObject *args)
{ {
if(!PyArg_ParseTuple(args, ":numargs")) long int i;
return NULL;
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[] = { static PyMethodDef gds_render_methods[] = {
{"get_number", test, METH_VARARGS, {"get_number", test, METH_VARARGS, "Return the number of arguments received by the process."},
"Return the number of arguments received by the process."}, {NULL, NULL, 0, NULL}
{NULL, NULL, 0, NULL}
}; };
static PyModuleDef gds_render_module = { static PyModuleDef gds_render_module = {