Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2844

Multiple inheritance gives TypeError in __init__

    XMLWordPrintable

Details

    • Windows

    Description

      With multi inheritance application is crashing. Following code can be used to crash it:

      from PySide6 import QtCore
      
      class CommunicationBase(object):
          def __init__(self, engine):
              self._engine = engine
      
      class SiteCommunication(QtCore.QObject, CommunicationBase):
          proxy_closing = QtCore.Signal()
          proxy_created = QtCore.Signal()
      
          def __init__(self, engine):
              CommunicationBase.__init__(self, engine)
              QtCore.QObject.__init__(self)
      
      class DesktopEngineSiteImplementation(object):
          def __init__(self, engine):
              site_comm = SiteCommunication(engine)
              site_comm.proxy_closing.connect(self._on_proxy_closing)
              site_comm.proxy_created.connect(self._on_proxy_created)
      
          def _on_proxy_closing(self):
              print("Proxy closing")
      
          def _on_proxy_created(self):
              print("Proxy created")
      
      engine = "foo"
      DesktopEngineSiteImplementation(engine)
      

      Following is stack trace:

      024-06-05 14:01:44,034 [342828 ERROR sgtk.ext.shotgun_desktop.startup] Fatal error, user will be logged out.
      Traceback (most recent call last):
          File "${PATH_TO}/python/shotgun_desktop/startup.py", line 951, in main
              exit_code = __launch_app(app, splash, user, app_bootstrap, settings)
          File "${PATH_TO}/python/shotgun_desktop/startup.py", line 425, in __launch_app
              engine = __start_engine_in_zero_config(app, app_bootstrap, splash, user)
          File "${PATH_TO}/python/shotgun_desktop/startup.py", line 597, in __start_engine_in_zero_config
              return mgr.bootstrap_engine("tk-desktop")
          File "${PATH_TO}/sgtk/tk-core/python/tank/bootstrap/manager.py", line 492, in bootstrap_engine
              engine = self._start_engine(tk, engine_name, entity)
          File "${PATH_TO}/sgtk/tk-core/python/tank/bootstrap/manager.py", line 1217, in _start_engine
              engine = tank.platform.start_engine(engine_name, tk, ctx)
          File "${PATH_TO}/install/core/python/tank/platform/engine.py", line 3044, in start_engine
              return _start_engine(engine_name, tk, None, context)
          File "${PATH_TO}/install/core/python/tank/platform/engine.py", line 3204, in _start_engine
              engine = class_obj(tk, new_context, engine_name, env)
          File "${PATH_TO}/sgtk/tk-desktop/engine.py", line 62, in __init__
              Engine.__init__(self, tk, *args, **kwargs)
          File "${PATH_TO}/install/core/python/tank/platform/engine.py", line 172, in __init__
              self.init_engine()
          File "${PATH_TO}/sgtk/tk-desktop/engine.py", line 142, in init_engine
              self.__impl = tk_desktop.get_engine_implementation(interface_type)(self)
          File "${PATH_TO}/sgtk/tk-desktop/python/tk_desktop/desktop_engine_site_implementation.py", line 40, in __init__
              self.site_comm = SiteCommunication(engine)
          File "${PATH_TO}/sgtk/tk-desktop/python/tk_desktop/site_communication.py", line 43, in __init__
              QtCore.QObject.__init__(self)
      TypeError: CommunicationBase.__init__() missing 1 required positional argument: 'engine' 
      

      There are similar bugs which has been fixed earlier 

      https://bugreports.qt.io/browse/PYSIDE-2654
      https://bugreports.qt.io/browse/PYSIDE-1564

       

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              irfan.omair@digia.com Irfan Omair
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes