We have a metaclass based on type(QtWidgets.QWidget)
-- which resolves to Shiboken.ObjectType
-- that we've had in production dating back to PySide/Qt4 that's breaking in the versions of PySide2 that are on pypy (5.11.x). Earlier alpha versions of PySide2 (2.0.0~alpha0) do not have this problem.
If you call the following from Python 2.7 using a 5.11.x version of PySide2, you'll see that it appears as though Shiboken.ObjectType
is passing through arguments it's given to type.__new__
, which isn't allowed.
This line of code is contrived just to illustrate the problem, hence the empty name, parents, and class_dict arguments, and passing the type in as-is. In our production code, that would be the metaclass we're defining, and the remaining arguments would be passed through from input args/kwargs:
type(QtWidgets.QWidget).__new__(type(QtWidgets.QWidget), "", (), {})
In PySide2 5.11.x, the following is raised:
TypeError: Shiboken.ObjectType.__new__(Shiboken.ObjectType) is not safe, use type.__new__()
In PySide/Qt4 or PySide2 2.0.0~alpha0, the correct return occurs:
<class '__main__.'>
Has anyone run up against this before? Are we doing something fundamentally wrong, or is there a workaround we could employ? Something in shiboken2 has changed, but I'm unsure if it's a bug or if our code is simply incorrect and there's something we can tweak to make it work.