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

Multiple inheritance with mixin class get TypeError in __init__

XMLWordPrintable

    • 7b709cf59 (dev), a5a2e97aa (6.7), 706260d75 (6.6), aa36a32e3 (tqtc/lts-6.5)

      I have the following minimum test code

      from PySide6.QtCore import *
      from PySide6.QtWidgets import *
      from PySide6.QtWidgets import *
      
      
      class Ui_Form(object):
          pass
      
      
      class Mixin:
          def __init__(self, **kwargs) -> None:
              super().__init__(**kwargs)
      
      
      class Card(Mixin, QWidget):
          def __init__(self, parent=None) -> None:
              super().__init__(parent=parent)
      
      
      class Demo(Card, Ui_Form):
          def __init__(self) -> None:
              super().__init__()
      
      
      app = QApplication([])
      d = Demo()
      
      

      And this code will get

      TypeError: object._init_() takes exactly one argument (the instance to initialize)

      in PySide6.6.2 but work correctly in PySide6.4.2

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

            crmaurei Cristian Maureira-Fredes
            alexzh alex alex
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes