-
Notifications
You must be signed in to change notification settings - Fork 139
Implement 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_BuildValue
is not implemented.Example:
f(7,8,9) =
should be possible with
The text was updated successfully, but these errors were encountered: