[PyQt] [sip] some low level issues with meta enum and flags
denis.rouzaud at gmail.com
Fri May 25 16:49:58 BST 2018
Le ven. 25 mai 2018 à 10:26, Phil Thompson <phil at riverbankcomputing.com> a
> 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
> > 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.
I am failing at doing a minimal example.
The issue occurs when calling this QgsSettings::value method with
SIP_PYOBJECT value( const QString &key, const QVariant
&defaultValue = QVariant(),
SIP_PYOBJECT type = 0,
QgsSettings::Section section =
QgsSettings::NoSection ) const / ReleaseGIL /;
typedef PyObject *( *pyqt5_from_qvariant_by_type )( QVariant
&value, PyObject *type );
// QSettings has an internal mutex so release the GIL to avoid the
possibility of deadlocks.
value = sipCpp->value( *a0, *a1, a3 );
pyqt5_from_qvariant_by_type f = ( pyqt5_from_qvariant_by_type )
sipImportSymbol( "pyqt5_from_qvariant_by_type" );
sipRes = f( value, a2 );
sipIsErr = !sipRes;
No idea what is the issue, but it's no big deal.
> > 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt