I'm using the Python C API to call a method. At present I am using PyObject_CallMethodObjArgs
to do this. This is a variadic function:
PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL)
This is absolutely fine when the number of arguments is known at compile time. However, I have a scenario where the number of arguments is not known until runtime, they are supplied as an array.
In essence my issue is precisely the same as in this question: How can I pass an array as parameters to a vararg function?
The accepted answer there tells me that there is no solution to my problem.
Is there are way around this hurdle. If I cannot solve the problem using PyObject_CallMethodObjArgs
is there an alternative function in the Python C API that can meet my needs?
For instance, PyObject_Call
accepts parameters as a Python sequence object. Is it possible to use this function, or one with a similar interface?