I'd like to make a C function which returns a list of tuples, a list of dicts or even better, a list of objects of a class I defined in another python module.
The documentation on the C API («The Python/C API») mentions that to build a complex object, I need to call to Py_BuildValue
which uses a Variable number of parameters or Py_VaBuildValue
which uses a va_list
argument.
Since C cannot dynamically make a call with a variable number of arguments, I cannot use Py_BuildValue
and must use Py_VaBuildValue
, but looking for how to build a va_list
variable, I find replies which the There's no ability to fill a va_list explicitly and tells me to make it from a variable parameters function, which defeats the purpose... and from the tests a made, all I get is segmentation faults and core dumps.
So, how am I Supposed to use those functions ?