Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement Py_BuildValue #59
Comments
|
@elbaro, unfortunately, so, essentially, one would need to implement that said that could be done. PR accepted :P |
|
(note that, according to Python2 C-API |
|
What about a hacky solution where there are a bunch of C wrapping functions with a fixed number of parameters. This code is obviously wrong, but it gets the idea across: PyObject* Py_BuildValue_1(const char *format, PyObject* a1) {
return Py_BuildValue(format, a1);
}
PyObject* Py_BuildValue_2(const char *format, PyObject* a1, PyObject* a2) {
return Py_BuildValue(format, a1, a2);
}
PyObject* Py_BuildValue_3(const char *format, PyObject* a1, PyObject* a2, PyObject* a3) {
return Py_BuildValue(format, a1, a2, a3);
}func Py_BuildValue(format string, args ...*PyObject) *PyObject {
switch len(args) {
case 1:
return C.Py_BuildValue_1(format, args[0])
case 2:
return C.Py_BuildValue_2(format, args[0], args[1])
case 3:
return C.Py_BuildValue_3(format, args[0], args[1], args[3])
default:
return Py_None
}
} |
|
SGTM. |
Py_BuildValueis not implemented.Example:
f(7,8,9) =
should be possible with