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.
- relates to
- 
                    PYSIDE-816 Unable to call type(QtWidgets.QWidget).__new__ in Python 2.7 -         
- Closed
 
-         
- 
                    PYSIDE-1767 Pyside6/Shiboken and ABCMeta Bug -         
- Reported
 
-