[PyQt] [SIP] bug - wrap argument incorrect if argument's default value is static class member

Sébastien Petitdemange sebastien.petitdemange at esrf.fr
Thu Aug 20 10:38:13 BST 2009


Hi Nian,

I have to specify the class :
instead of
void ConvertChildren( KFbxNode* pRoot, const KFbxSystemUnit& pSrcUnit,
const KFbxUnitConversionOptions& pOptions = DefaultConversionOptions )
const;
try
void ConvertChildren( KFbxNode* pRoot, const KFbxSystemUnit& pSrcUnit,
const KFbxUnitConversionOptions& pOptions =
KFbxSystemUnit::DefaultConversionOptions ) const;

Regards,

SEB

Nian Wu wrote:
> Hi,
> 
> I am wrapping our C++ library with SIP. I met a compile failure when I wrapped a class, the sip script is like:
> 
> class KFbxSystemUnit 
> {
> 
> %TypeHeaderCode
> #include <fbxsdk.h>
> %End
> 
> public:
>     struct KFbxUnitConversionOptions
>     {
>         bool mConvertLightIntensity;
>         bool mConvertRrsNodes;  
>     };
>     
>     KFbxSystemUnit(double pScaleFactor, double pMultiplier = 1.0);
>     ~KFbxSystemUnit();    
>     static const KFbxUnitConversionOptions DefaultConversionOptions;
>     void ConvertChildren( KFbxNode* pRoot, const KFbxSystemUnit& pSrcUnit, const KFbxUnitConversionOptions& pOptions = DefaultConversionOptions ) const;
> };
> 
> The argument "pOptions" of method "ConvertChildren" has default value which is a static class member.
> 
> After run sip, the method "ConvertChildren" is wrapped as following:
> ====================================================================================
> 1 extern "C" {static PyObject *meth_KFbxSystemUnit_ConvertChildren(PyObject *, PyObject *);}
> 2 static PyObject *meth_KFbxSystemUnit_ConvertChildren(PyObject *sipSelf,PyObject *sipArgs)
>  {
> 3     int sipArgsParsed = 0;
> 
>     {
> 4        KFbxNode * a0;
> 5        const KFbxSystemUnit * a1;
> 6        const KFbxSystemUnit::KFbxUnitConversionOptions& a2def = DefaultConversionOptions;
> 7        const KFbxSystemUnit::KFbxUnitConversionOptions * a2 = &a2def;
> 8        KFbxSystemUnit *sipCpp;
> 
> 9        if (sipParseArgs(&sipArgsParsed,sipArgs,"BJ8J9|J9",&sipSelf,sipType_KFbxSystemUnit,&sipCpp,sipType_KFbxNode,&a0,sipType_KFbxSystemUnit,&a1,sipType_KFbxSystemUnit_KFbxUnitConversionOptions,&a2))
>         {
> 10            sipCpp->ConvertChildren(a0,*a1,*a2);
> 
> 11            Py_INCREF(Py_None);
> 12           return Py_None;
>         }
>     }
> 
>     /* Raise an exception if the arguments couldn't be parsed. */
>     sipNoMethod(sipArgsParsed,sipName_KFbxSystemUnit,sipName_ConvertChildren);
> 
>     return NULL;
> }
> =====================================================
> 
> Please notice the Line 6, the variable " DefaultConversionOptions" is referred as global variable, so compile failed here.
> 
> Thanks,
> Nian Wu
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sebastien_petitdemange.vcf
Type: text/x-vcard
Size: 218 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090820/3eb2b2a3/sebastien_petitdemange.vcf


More information about the PyQt mailing list