I'm not sure what to do with this knowledge nor I am precisely sure of the 
issue. I was hoping others on the list would know the code better than I.

While finding the cause of what became issue PYSIDE-80 (shiboken cannot handle 
"extern" variables in a namespace), I came across an invalid cast of a 
TypeEntry 
to a PrimitiveTypeEntry. Other than this one case, all casts of a TypeEntry to 
a 
PrimitiveTypeEntry are preceded by a call to TypeEntry::isPrimitive.

In ShibokenGenerator::converterObject, checks are done on the type. However, 
the 
logic is slightly flawed. The code goes as follows:

1. Is it a CppPrimitive? If yes, then return the conversion. Otherwise 
continue. 
Note that this check does call TypeEntry::isPrimitive but only to make sure the 
object is not a CppPrimitive.

2. Is it a wrapper or enum or flag? Yes, then return the conversion. Otherwise 
continue.

3. Assume it is a primitive type and cast it appropriately

The problem is, you really need to check TypeEntry::isPrimitive() before doing 
that cast. I'm just not sure what to return if it comes back false. I also 
struggle because it appears that all my test cases that led to the invalid cast 
are manifestations of PYSIDE-80.

I'd be glad to submit a patch via gerrit if I new the correct conversion string 
to return.

John Cummings
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to