[PyKDE] Are Python extenstions built with SIP and Boost.Python in compatible?

Paul F. Kunz Paul_Kunz at SLAC.Stanford.EDU
Sun Dec 8 02:49:01 GMT 2002

>>>>> On Sun, 08 Dec 2002 01:29:27 +0000, Phil Thompson <phil at river-bank.demon.co.uk> said:

> I don't think it's a known problem because I'd be surprised if
> anybody had tried it before.

   Further investigation of my problem shows that SIP is doing
something strange to Python.   Stepping forward in the trace back of
my segmentation fault, I find...

#6  0x0807705e in eval_frame (f=0x811a974) at Python/ceval.c:1784
#5  0x08056794 in PyObject_GetAttr (v=0x82cc4cc, name=0x815a8e0)
    at Objects/object.c:1108
#4  0x401afa43 in instanceGetAttr ()
   from /usr/local/lib/python2.2/site-packages/libsip.so
Current directory is /usr/local/bin/

This is caused by the second line in The following Python code that is
using PyQt...

wc = WindowController()
cw = wc.newCanvas()

The WindowController class is C++ class wrapped with Boost.Python.
In the second line, it is trying to return another C++ class wrapped
with Boost.Python that creates two Windows created by C++ classes
derived from Qt.

If these classes are using Boost.Python, then why does Python call a
function in libsip.so on them?   The offending line in
PyObject_GetAttr function appears to be...

	if (tp->tp_getattro != NULL)
		return (*tp->tp_getattro)(v, name);

This returns something that is an error, and when python attempts to
report the error messge, its thread state is null.
> The obvious workaround is to re-wrap your widgets using SIP.

   I've already learned on way to expose my C++ to Python, why do I
need to learn another way.   SIP should not be doing things to Python
that is incompatible with other Python extension modules.   Or is
Boost.Python producing something incompatible with other Python
extension modules?   Or is there something I'm doing wrong?   This is
really hard to decyipher

More information about the PyQt mailing list