[PyKDE] SIP-4.2 problem

Phil Thompson phil at riverbankcomputing.co.uk
Sun Feb 20 08:39:52 GMT 2005


On Sunday 20 February 2005 3:28 am, Gerard Vermeulen wrote:
> The SIP specification snippet:
>
> typedef unsigned char   GLubyte;        /* 1-byte unsigned */
> const GLubyte * gl_error();
>
> produces the following C++ code:
>
> static PyObject *func_gl_error(PyObject *,PyObject *sipArgs)
> {
>  int sipArgsParsed = 0;
>
>  {
>   if (sipParseArgs(&sipArgsParsed,sipArgs,""))
>   {
>    const unsigned char *sipRes;
>
>    sipRes = gl_error();
>
>    if (PyErr_Occurred())
>     return 0;
>
>    if (sipRes == NULL)
>    {
>     Py_INCREF(Py_None);
>     return Py_None;
>    }
>
>    return PyString_FromString(sipRes);
>   }
>  }
>
>  /* Raise an exception if the arguments couldn't be parsed. */
>  sipNoFunction(sipArgsParsed,sipNm__Qwt3D_gl_error);
>
>  return NULL;
> }
>
> which fails to compile with:
>
> g++ -c -pipe -fPIC -O2 -fomit-frame-pointer -pipe -march=i586
> -mcpu=pentiumpro -Wall -W -D_REENTRANT -DHAS_NUMARRAY -DHAS_NUMERIC
> -DGL2PS_HAVE_ZLIB -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I.
> -I/usr/include/python2.3 -I/usr/lib/qt3/include -I/usr/X11R6/include -o
> sip_Qwt3Dcmodule.o sip_Qwt3Dcmodule.cpp sip_Qwt3Dcmodule.cpp: In function
> `PyObject* func_gl_error(PyObject*, PyObject*)': sip_Qwt3Dcmodule.cpp:3751:
> error: invalid conversion from `const unsigned char*' to `const char*'
>
> This pertains to the conversion in "return PyString_FromString(sipRes);"
>
> Python-2.3.3 (don't think it matters)

It will be fixed in tonight's snapshot - fortunately it doesn't affect PyQt.

Phil




More information about the PyQt mailing list