[PyQt] Bug? SIP appears to generate wrong code

Mathias.Born at gmx.de Mathias.Born at gmx.de
Sun Jan 26 15:27:33 GMT 2014


Phil,

I've upgraded to SIP 4.15.4 and PyQt 5.2 (Windows7, VS2012).
Now I get an error that wasn't there before. I was able to trace
it down to the code generated by SIP which is clearly wrong.
Have you changed the code generator? It may be very difficult
to produce a simple example demonstrating the problem.

I have a class described in a sip file as:

class SchematicView: QQuickView /NoDefaultCtors/
{
...
};

This is part of a module "ltse_app". Thus, sip creates the file
"sipltse_appSchemticView.cpp". It containes the lines

/* Define this type's super-types. */
static sipEncodedTypeDef supers_SchematicView[] = {{14, 4, 1}};

The "14" is wrong. According to "sipQtQuickcmodule.cpp" of PyQt,
which defines:

/*
 * This defines each type in this module.
 */
static sipTypeDef *typesTable[] = {
    &sipTypeDef_QtQuick_QList_0101QQuickItem.mtd_base,
    &sipTypeDef_QtQuick_QQuickFramebufferObject.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickFramebufferObject_Renderer.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickImageProvider.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickItem.super.ctd_base,
    &enumTypes[16].etd_base,
    &sipTypeDef_QtQuick_QQuickItem_Flags.super.ctd_base,
    &enumTypes[15].etd_base,
    &sipTypeDef_QtQuick_QQuickItem_ItemChangeData.super.ctd_base,
    &enumTypes[14].etd_base,
    &sipTypeDef_QtQuick_QQuickItem_UpdatePaintNodeData.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickPaintedItem.super.ctd_base,
    &enumTypes[12].etd_base,
    &sipTypeDef_QtQuick_QQuickPaintedItem_PerformanceHints.super.ctd_base,
    &enumTypes[13].etd_base,
    &sipTypeDef_QtQuick_QQuickTextDocument.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickTextureFactory.super.ctd_base,
    &sipTypeDef_QtQuick_QQuickView.super.ctd_base,
    &enumTypes[11].etd_base,
    &enumTypes[10].etd_base,
    &sipTypeDef_QtQuick_QQuickWindow.super.ctd_base,
    &enumTypes[9].etd_base,
    &sipTypeDef_QtQuick_QQuickWindow_CreateTextureOptions.super.ctd_base,
    &sipTypeDef_QtQuick_QSGBasicGeometryNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGClipNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGDynamicTexture.super.ctd_base,
    &sipTypeDef_QtQuick_QSGFlatColorMaterial.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometry.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometry_Attribute.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometry_AttributeSet.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometry_ColoredPoint2D.super.ctd_base,
    &enumTypes[8].etd_base,
    &sipTypeDef_QtQuick_QSGGeometry_Point2D.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometry_TexturedPoint2D.super.ctd_base,
    &sipTypeDef_QtQuick_QSGGeometryNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGMaterial.super.ctd_base,
    &enumTypes[6].etd_base,
    &sipTypeDef_QtQuick_QSGMaterial_Flags.super.ctd_base,
    &sipTypeDef_QtQuick_QSGMaterialShader.super.ctd_base,
    &sipTypeDef_QtQuick_QSGMaterialShader_RenderState.super.ctd_base,
    &enumTypes[7].etd_base,
    &sipTypeDef_QtQuick_QSGMaterialShader_RenderState_DirtyStates.super.ctd_base,
    &sipTypeDef_QtQuick_QSGMaterialType.super.ctd_base,
    &sipTypeDef_QtQuick_QSGNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGNode_DirtyState.super.ctd_base,
    &enumTypes[3].etd_base,
    &enumTypes[4].etd_base,
    &sipTypeDef_QtQuick_QSGNode_Flags.super.ctd_base,
    &enumTypes[5].etd_base,
    &sipTypeDef_QtQuick_QSGOpacityNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGOpaqueTextureMaterial.super.ctd_base,
    &sipTypeDef_QtQuick_QSGSimpleRectNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGSimpleTextureNode.super.ctd_base,
    &enumTypes[2].etd_base,
    &sipTypeDef_QtQuick_QSGSimpleTextureNode_TextureCoordinatesTransformMode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGTexture.super.ctd_base,
    &enumTypes[0].etd_base,
    &enumTypes[1].etd_base,
    &sipTypeDef_QtQuick_QSGTextureMaterial.super.ctd_base,
    &sipTypeDef_QtQuick_QSGTextureProvider.super.ctd_base,
    &sipTypeDef_QtQuick_QSGTransformNode.super.ctd_base,
    &sipTypeDef_QtQuick_QSGVertexColorMaterial.super.ctd_base,
};

"14" points to

    &enumTypes[13].etd_base,

and not to

    &sipTypeDef_QtQuick_QQuickView.super.ctd_base,

(index 17).

If I remove the class completely, the same just happens to another one. I'd appreciate any
advise on this.
I could also simply send you the entire set of files if you'd like to investigate yourself.

Thanks and Best Regards,
Mathias







More information about the PyQt mailing list