You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying really hard to make a class with a new metaclass in a way that's compatible with both python 2 and 3, and ran into issues both while using six.with_metaclass and future.utils.with_metaclass which is a little bit different. I'm happy to report that the six.add_metaclass decorator did the job, however.
Now I'm sure with_metaclass works fine in most cases, but here is the situation:
I'm trying to subclass a PySide2.QtCore.QObject with a new metaclass. For this, I need my metaclass to inherit from the original metaclass of QObject, which is Shiboken.ObjectType.
I then try to define my class with the new meta, which fails because with_metaclass attempts to use type.__new__ directly, instead of Shiboken.ObjectType.__new__
Hello.
I've been trying really hard to make a class with a new metaclass in a way that's compatible with both python 2 and 3, and ran into issues both while using
six.with_metaclass
andfuture.utils.with_metaclass
which is a little bit different. I'm happy to report that thesix.add_metaclass
decorator did the job, however.Now I'm sure
with_metaclass
works fine in most cases, but here is the situation:I'm using the library
PySide2
https://pypi.org/project/PySide2/I'm trying to subclass a
PySide2.QtCore.QObject
with a new metaclass. For this, I need my metaclass to inherit from the original metaclass ofQObject
, which isShiboken.ObjectType
.I then try to define my class with the new meta, which fails because
with_metaclass
attempts to usetype.__new__
directly, instead ofShiboken.ObjectType.__new__
It does work fine in Python 3
The text was updated successfully, but these errors were encountered: