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

Reg->6.2.2: Signal/Method namespace clashing with multiple inheritance

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 6.2.2
    • PySide
    • None
    • Python 3.9+ (likely older versions too), macOS/Windows (likely linux as well)
    • All
    • 85799120d0 (pyside/pyside-setup/dev) 85799120d0 (pyside/tqtc-pyside-setup/dev) 3e5399f685 (pyside/pyside-setup/6.2) 3e5399f685 (pyside/tqtc-pyside-setup/6.2) 85799120d0 (pyside/tqtc-pyside-setup/tqtc/dev) 3e5399f685 (pyside/pyside-setup/6.2.3)

    Description

      Note: This issue is new with 6.2.2; but that is not available as a selection from the "Affects Version/s" drop down.

      New in PySide 6.2.2, there is an issue involving multiple inheritance, where a method from the first super-class is the same as a signal from a second-superclass, the signal is called instead of the method regardless of inheritance order.

      Below is a minimum reproducible example

      from PySide6 import QtCore
      
      class Q(QtCore.QObject):
          signal = QtCore.Signal()
          
          def method(self):
              print('Q::method')
      class M:
          def signal(self):
              print('M::signal')
          def method(self):
              print('M::method')
      class C(M, Q):
          def __init__(self):
              Q.__init__(self)
              M.__init__(self)
      c = C()
      c.method() # okay
      c.signal() # problem on PySide6 6.2.2
      

       
      For completeness, a work-around has been identified that works for all our use-cases:

      Python 3.8
      Qt 6.1.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 9.2.1 20191120 (Red Hat 9.2.1-2)) [limited API]
      M::method
      M::signal
      

      versus

      Python 3.8
      Qt 6.2.2 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 9.3.0)
      M::method
      Traceback (most recent call last):
        File "pyside1730.py", line 36, in <module>
          c.signal() # problem on PySide6 6.2.2
      TypeError: native Qt signal is not callable
      

      Attachments

        Issue Links

          For Gerrit Dashboard: PYSIDE-1730
          # Subject Branch Project Status CR V

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              j9ac9k Ognyan Moore
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes