[PySide] CONVERTTOPYTHON of struct as object-type? (== SEGV?)

Matthew Woehlke matthew.woehlke at kitware.com
Tue Jun 18 00:14:05 CEST 2013


I have a container conversion like so:

   <container-type name="std::set" type="set">
     <include file-name="set" location="global"/>
     <conversion-rule>
       <native-to-target>
       PyObject* %out = PySet_New(0);
       %INTYPE::const_iterator it;
       for (it = %in.begin(); it != %in.end(); ++it) {
         %INTYPE_0 value = *it;
         PyObject* pyValue = %CONVERTTOPYTHON[%INTYPE_0](value);
         PySet_Add(%out, pyValue);
       }
       return %out;
       </native-to-target>
     </conversion-rule>
   </container-type>

...and a struct like:

   struct MyPointF
   {
     double X;
     double Y;
   }

In my typesystem, I have:

   <object-type name="MyPointF"/>

...and I have some other struct that has a member 'std::set<MyPointF>'. 
When I try to read this member, I get a SEGV.

I tracked this down to '%CONVERTTOPYTHON[%INTYPE_0]' expanding to 
'Shiboken::Conversions::copyToPython((SbkObjectType*)SbkvvIOPythonTypes[SBK_MYPOINTF_IDX]', 
which needs a 'copy' converter function, except that object-type's have 
no such converter (only value-types do). Am I doing something wrong, or 
is this a limitation of the current version of shiboken?

This is with shiboken-1.1.0-3.fc18.x86_64, although from what I could 
tell poking around in the source, it is not different on master.

-- 
Matthew




More information about the PySide mailing list