[PyQt] ANN: MetaSIP v1.0 Released

Shaheed Haque srhaque at theiet.org
Mon Oct 8 21:53:40 BST 2012


I managed to generate a set of SIP files which compile and link
without errors, but when I try to actually instantiate one of the
objects (actually, it is a a widget from the Okteta library), I end up
crashing in siplib.c like this:

5502    in /build/buildd/sip4-4.13.3/siplib/siplib.c

Program received signal SIGSEGV, Segmentation fault.
createClassType (client=client at entry=0x7fffdd5adcc0
<sipModuleAPI_okteta>, ctd=ctd at entry=
    0x7fffdd5b1e40 <sipTypeDef_okteta_Okteta_Character>,
mod_dict=mod_dict at entry=
    {'__name__': 'PyOkteta4.okteta', 'Okteta': <sip.wrappertype at
remote 0x14ec480>, '__doc__': None, '__package__': None})
    at /build/buildd/sip4-4.13.3/siplib/siplib.c:5502
5502    in /build/buildd/sip4-4.13.3/siplib/siplib.c

Looking at the source code, we are in this loop:

  5488         for (sup = ctd->ctd_supers, i = 0; i < nrsupers; ++i, ++sup)
  5489         {
  5490             PyObject *st;
  5491             sipTypeDef *sup_td = getGeneratedType(sup, client);
  5493             /*
  5494              * Initialise the super-class if necessary.  It
will always be in
  5495              * the same module if it needs doing.
  5496              */
  5497             if (createClassType(client, (sipClassTypeDef
*)sup_td, mod_dict) < 0)
  5498                 goto relbases;
  5500             st = (PyObject *)sipTypeAsPyTypeObject(sup_td);
  5502             Py_INCREF(st);
  5503             PyTuple_SET_ITEM(bases, i, st);
  5504         }

Now, i'm a bit out of my comfort zone here ;-), but "st" is NULL and
the immediate cause of the crash, and looking back nrsupers should be
3 because:

(gdb) p ctd.ctd_supers[0]
$86 = {
  sc_type = 24,
  sc_module = 0,
  sc_flag = 1
(gdb) p ctd.ctd_supers[1]
$87 = {
  sc_type = 65535,
  sc_module = 255,
  sc_flag = 1
(gdb) p ctd.ctd_supers[2]
$88 = {
  sc_type = 0,
  sc_module = 0,
  sc_flag = 0
(gdb) p ctd.ctd_supers @ 3
$95 = {0x7fffdd5ad41c <supers_Okteta_Character>, 0x0,
    0x7fffdd3797b0 <init_Okteta_Character(sipSimpleWrapper*,
PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)>}

I'm guessing I've screwed up the bindings in some way to do with the
superclasses of Character, but since that is simply QChar, I'm not
sure what to look at next. Reproduction just requires to try and add
an Okteta::ByteArrayColumnView using designer, but I am guessing that
the error is a very basic one on my part. Any nudges/hints much

Thanks, Shaheed

P.S. The .msp file and the generated .sip files can be found at:


More information about the PyQt mailing list