[PyQt] [sip] some low level issues with meta enum and flags

Phil Thompson phil at riverbankcomputing.com
Fri May 25 15:25:59 BST 2018

On 18 May 2018, at 4:06 pm, Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
> Hi list, hi Phil,
> I have been playing a bit with meta enum and I encountered two issues:
> 1. If you copy the meta enum object, you get a seg fault.
> For instance, doing:
> idx = baseClass.staticMetaObject.indexOfEnumerator(enumClass.__name__)
> meta_enum = baseClass.staticMetaObject.enumerator(idx)
> And then do meta_enum_2 = meta_enum, you'll get a seg fault when trying to use it (calling any method, while sip.dump still seems to return valid output).
> This is not a huge deal, but it can lead to further issue: if you have a method where the meta_enum is provided as argument and get copied there.
> For instance, we have a method with some MethodCode:
> QgsSettings::value( const QString &key, const QVariant &defaultValue = QVariant() )
> While providing the meta enum as default value, if I try to access it later, I do get a seg fault too.

I need a short complete script that demonstrates the problem.

> 2. It seems that flags types are not added to the module itself but to the parant package.
> In other words, __qualname__ returns the same than __name__
> Which gives troubles at retrieving information.
> Can this be fixed?

Should be fixed in tonight's SIP snapshot.


More information about the PyQt mailing list