[PyKDE] Re: dcop

Stefan Bund l-pykde.z.xalan at xoxy.net
Thu May 27 18:34:01 BST 2004


Stefan Bund <l-pykde.z.xalan at xoxy.net> writes:
> I have however a Problem in my PyDCOP.DCOPClient implementation. I get
> a "SystemError: ../Objects/classobject.c:518: bad argument to internal
> function" when calling DCOPClient::call from python:

After thinking about it a little, I started dissecting the source. I
found classobject.c in the python2.3 source. The above mentioned line
is in PyInstance_NewRaw. This is happily only called from very few
places. Looking at siplib, the only place this can be called from
(indirectly) seems to be sipNewCppToSelf.

Ok. At the other end, I looked at the generated code for
DCOPClient::call in dcop/dcoppart0.cpp. Here I find the call

    return sipBuildResult(0,"(bPP)",sipRes,a4,a5);

looking up sipBuildResult and from there going to buildObject, I find
the following code handling the 'P' conversion:

    case 'P':
            {
                    void *sipCpp = va_arg(va,void *);
                    PyObject *cls = va_arg(va,PyObject *);

                    el = sipNewCppToSelf(sipCpp,cls,SIP_PY_OWNED|SIP_SIMPLE);
            }

            break;

With this in mind, the sipBuildResult call looks pretty fishy to
me. As I read it, it should be

    return sipBuildResult(0,"(bPP)",sipRes,a4,sipClass_QCString,a5,sipClass_QByteArray);

so I manually patched dcoppart0.cpp with above code and voila,
everything working now. I have however *no* knowledge of sip and don't
know, how to really fix this, since dcoppart0.cpp is generated from
sip.

I hope this helps,

Stefan.

-- 
-- *DON'T* TRY TO REACH ME DIRECTLY AT ABOVE EMAIL ADDRESS. Any reply
-- received off-list at that address will be *silently* and
-- *unconditionally* dropped. You can attribute this inconvenience to
-- the proliferation of spammers on the Internet. I hope, you can
-- understand my position and accept my counter measures.




More information about the PyQt mailing list