Details
Description
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 pypi (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__.'>
We're unsure whether this is a bug, or if it's intentional behavior and we're simply doing something that's incorrect by today's standards. Some guidance here would be appreciated!
Attachments
Issue Links
- relates to
-
PYSIDE-1051 Unable to call QtCore.QObject.__new__ in Python 2.7
- Closed
- resulted in
-
PYSIDE-1003 Debug PySide fails to build because of heap type assertion
- Closed
For Gerrit Dashboard: PYSIDE-816 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
252439,5 | Fix Shiboken.ObjectType.__new__ for Python 2.7 | 5.12 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
261332,3 | Fix Shiboken.ObjectType.__new__ for Python 2.7 V2 | 5.12 | pyside/pyside-setup | Status: MERGED | -1 | 0 |