[PyKDE] SIP-4.2 problem

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sun Feb 20 03:28:22 GMT 2005


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)

Gerard




More information about the PyQt mailing list