[PyQt] a small bug in SIP, when using it for C libraries (sorry for previous post, its message was scrubbed)

Ravi kumar ravi.kumar.039 at gmail.com
Thu Dec 10 00:38:07 GMT 2009

Hello, I was trying out the tutorial of SIP from
When i tried the C++ example there, it worked fine. But when i tried
the C example it gave errors.

I searched for the error, in generated file sipwordWord.c, in
array_Word function, this was generated

return sipMalloc(sizeof * (struct Word) * sipNrElem);

i modified it to this (which i hope is correct, according to what is
desired from the function) :

return sipMalloc(sizeof (struct Word) * sipNrElem);

and then it worked fine.

After this i modified the sip source code, and created a diff patchfile:

diff -rup original/sipgen/gencode.c modified/sipgen/gencode.c
--- original/sipgen/gencode.c    2009-12-05 09:03:25.000000000 +0530
+++ modified/sipgen/gencode.c    2009-12-10 05:42:51.000000000 +0530
@@ -5820,7 +5820,7 @@ static void generateClassFunctions(sipSp

         if (generating_c)
-"    return sipMalloc(sizeof * (%S) * sipNrElem);\n"
+"    return sipMalloc(sizeof (%S) * sipNrElem);\n"
                 , classFQCName(cd));

My system specifications are :

os : Ubuntu 9.10
gcc : 4.4.1
python : 3.1
sip : sip-4.10-snapshot-20091204 (my patch is made against this very version)

and finally, thanks for such a great tool :)

More information about the PyQt mailing list