> The only place in the standard modules I saw that processed a truly > arbitrary number of arguments is the struct_pack method of the > struct module, and it doesn't use PyArg_Parse* to process them. Can > someone point me to an example of marshalling arbitrary numbers of > arguments then calling a varargs function? In a true varargs function, you cannot use PyArg_Parse*. Instead, you have to iterate over the argument tuple with PyTuple_GetItem, fetching one argument after another. Another example of such a function is builtin_max. > (I'll worry about calling gtk_binding_entry_add_signal after I > figure out how to marshal the args.) I'd worry about this first: In C, it is not possible to call a true varargs function in a portable way if the caller doesn't statically (i.e. in source code) know the number of arguments. Only the callee can be variable, not the caller. A slight exception is that you are allowed to pass-through va_list objects from one function to another. However, that requires that the callee expects a va_list argument, i.e. is not a varargs function, plus there is no portable way to create a va_list object from scratch. If you absolutely need to call such a function, you can use the Cygnus libffi function, which, for a certain number of microprocessors and C ABIs, allows to call arbitrary function pointers. However, I'd rather recommend to look for alternatives to gtk_binding_entry_add_signal. E.g. gtk_binding_entry_add_signall accepts a GSList*, which is a chained list of arguments, instead of being varargs. This you can call in a C module - the other one is out of reach. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4