[Stackless] Error compiling PyQt

Carlos Eduardo de Paula carlosedp at gmail.com
Fri Oct 24 22:43:45 CEST 2008

Hi all,

I'm trying to compile the latest version of PyQT and found some problems.

When compiling PyQt, I found the following error:

        cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189
-DQT_CORE_LIB -I. -IC:\Carlos\Apps\Python26\include
-IC:\Qt\4.4.3\mkspecs\default -IC:\Qt\4.4.3\include\QtCore
-IC:\Qt\4.4.3\include -Fo @C:\DOCUME~1\cpaula\LOCALS~1\Temp\nmB6E.tmp
sip/QtCore/qobject.sip(1316) : error C2039: 'ht_type' : is not a
member of '_typeobject'
        c:\carlos\apps\python26\include\object.h(325) : see
declaration of '_typeobject'
sip/QtCore/qobject.sip(1316) : error C2228: left of '.tp_name' must
have class/struct/union
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\cl.EXE"' : return code '0x2'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\nmake.exe"' : return code '0x2'

I figured out that this is caused by qobject.sip when it tries to
access a slot in the heap type object:


// Returns a Python object wrapping a qtcore_ArgumentStorage instance.
static PyObject *qtcore_PyArgumentStorage(const char *type, PyObject *data)
    qtcore_ArgumentStorage *as = new qtcore_ArgumentStorage;

    sipParseType(type, &as->type);

    if (as->type.atype == unknown_sat)
        delete as;
        return 0;

    if (data)
        if (qtcore_py_to_cpp(data, &as->type, &as->cpp_storage) < 0)
            delete as;
            return 0;

        // Make sure the Python object doesn't get garbage collected in case we
        // are passing a pointer to it's real data around.
        void *cpp = 0;

        // This is a return value so set up the storage for it.
        switch (as->type.atype)
        case unknown_sat:

        case class_sat:
#if PY_VERSION_HEX >= 0x02050000
                int type =
<------------- RIGHT HERE
                int type = QMetaType::type(as->type.u.wt->super.type.tp_name);


Looking at object.h, stackless defines PyHeapTypeObject as a synonym
to PyTypeObject, but that call tries to access the ht_type.tp_name
property that is not present in the stackless PyHeapTypeObject struct.


/* in Stackless, this is just a synonym */
#define PyHeapTypeObject PyTypeObject

#define PyHeapType_GET_MEMBERS(etype) \
    ((PyMemberDef *)(((char *)etype) + (etype)->ob_type->tp_basicsize))

/* The *real* layout of a type object when allocated on the heap */
typedef struct _heaptypeobject {
	/* Note: there's a dependency on the order of these members
	   in slotptr() in typeobject.c . */
	PyTypeObject ht_type;
	PyNumberMethods as_number;
	PyMappingMethods as_mapping;
	PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
					  so that the mapping wins when both
					  the mapping and the sequence define
					  a given operator (e.g. __getitem__).
					  see add_operators() in typeobject.c . */
	PyBufferProcs as_buffer;
	PyObject *ht_name, *ht_slots;
	/* here are optional user slots, followed by the members. */
} PyHeapTypeObject;

/* access macro to the members which are floating "behind" the object */
#define PyHeapType_GET_MEMBERS(etype) \
    ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))


I dont know what to do because defining the PyHeapTypeObject in
stackless breaks its compilation and dont know if there is something
that could be done in PyQt itself to correct this.

Any ideas?

Visit Stackless Examples Project
Stackless Python - www.stackless.com

More information about the Stackless mailing list