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

Callables inheriting QObject no longer useable as slots in PySide6 6.6.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 6.7.0, 6.6.3
    • 6.6.2
    • PySide
    • None
    • e8b8ca684 (dev), c04fa31cc (6.6)

    Description

      The following code worked fine up until v6.6.2. (I tested as far back as 6.4 and up to 6.6.1 and they all worked)

      from PySide6.QtCore import QObject, Signal
      
      class Emitter(QObject):
          sig = Signal(int)
      
      class CallableObject(QObject):
          def __call__(self, x: int):
              print("emitting", locals())
      
      emitter = Emitter()
      obj = CallableObject()
      
      emitter.sig.connect(obj)
      emitter.sig.emit(1)
      

      as of v6.6.2 you now get an error on connection:

      Traceback (most recent call last):
        File "/Users/talley/dev/self/superqt/x.py", line 16, in <module>
          emitter.sig.connect(obj)
      TypeError: 'PySide6.QtCore.QObject.connect' called with wrong argument types:
        PySide6.QtCore.QObject.connect(Emitter, str, CallableObject)
      Supported signatures:
        PySide6.QtCore.QObject.connect(PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], Union[bytes, bytearray, memoryview], PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(Union[bytes, bytearray, memoryview], Callable, PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(Union[bytes, bytearray, memoryview], PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(PySide6.QtCore.QObject, PySide6.QtCore.QMetaMethod, PySide6.QtCore.QObject, PySide6.QtCore.QMetaMethod, PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], PySide6.QtCore.QObject, Callable, PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], Callable, PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
        PySide6.QtCore.QObject.connect(PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], PySide6.QtCore.QObject, Union[bytes, bytearray, memoryview], PySide6.QtCore.Qt.ConnectionType = Instance(Qt.AutoConnection))
      

      Attachments

        1. pyside2627_diag.diff
          0.6 kB
        2. pyside2627_stack.txt
          4 kB
        3. pyside2627.py
          0.5 kB

        Issue Links

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

          Activity

            People

              adherrma Adrian Herrmann
              talley Talley Lambert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes