[PyQt] SIP support for keyword arguments in __call__ ?

Ravi kumar ravi.kumar.039 at gmail.com
Mon Mar 8 03:13:31 GMT 2010


Hello

I was trying to pass keyword arguments to operator ()
of a class from python. The class was extended using SIP.
The name of the class is Signal (it is not Qt's signal).

At first i tried /NoArgParser/ on __call__ but it was
not producing the code i wanted. So, just to give it a try,
i manually removed all the argument parsing code from the
generated function, and added another PyObject* to the
argument list to slot_Signal___call__. But soon i realized
that anything done on it results in segmentation fault, which
means nothing is being passed to it.

Then i investigated the source code of sip. In siplib/siplib.c
i found this function :
static PyObject *slot_call (PyObject *self, PyObject *args, PyObject *kwargs)

With trivial changes to this function, and recompiling sip
the keyword arguments were working fine, though still code
generated by sip needed to be modified.

But the main question i wanted to ask, is that i found a note
written in siplib.c just above that slot_call function :

"The type call slot. Note that keyword arguments aren't supported".

Was there any specific reason to avoid support for keyword
arguments ? If not, then i am willing to write a patch for
code generator (sipgen) so that it honors /NoArgParser/ and provides
an additional argument for keywords, should i go ahead ?

Thanks


More information about the PyQt mailing list