-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Done
-
Affects Version/s: 5.12.4, 5.13.0
-
Fix Version/s: 5.13.1
-
Platform/s:
-
Commits:cd6172063756a59e02f1a7857bc60a1737214ad1 (pyside/pyside-setup/5.13) 0add41759ad3346a8ea93863e347e73e98700bec (pyside/pyside-setup/5.12)
We have a singleton metaclass based on type(QtCore.QObject) in the __call__
method we create a new instance of the class and return it
def __call__(self, *args, **kwargs): instance = self.__new__(self, *args, **kwargs) instance.__init__(*args, **kwargs) return instance
or, if you want the one-liner version:
QtCore.QObject.__new__(QtCore.QObject, "", (), {})
the error obtained running this code on Python2 is:
TypeError: PySide2.QtCore.QObject.__new__(PySide2.QtCore.QObject) is not safe, use object.__new__()
the same one-liner works on Python3, I think it is related to PYSIDE-816 and heap types.
- is related to
-
PYSIDE-816 Unable to call type(QtWidgets.QWidget).__new__ in Python 2.7
-
- Closed
-