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

RecursionError with @Slot decorator when connecting slots by name and slot name is specified via kw list

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • 5.15.0
    • PySide
    • None
    • PySide2 5.15, python 3.7.7
    • All

      I'm reporting this here because I don't remember seeing this under PyQt5. Python gives me a RecursionError with the following code:

      from PySide2.QtCore import Slot, QMetaObjectfrom PySide2.QtCore import Slot, QMetaObject
      from PySide2.QtWidgets import QApplication, QComboBox
      
      class MyCombo(QComboBox):
      
          def __init__(self, *args, **kwargs): 
              super().__init__(*args, **kwargs)
              self.setObjectName('combo') 
              QMetaObject.connectSlotsByName(self)
          
          @Slot(int, name='on_combo_currentIndexChanged') 
          def change_current(self, _):
              print('never')
      
      
      app = QApplication([])
      combo = MyCombo()
      combo.show()
      combo.addItem('Foo')
      app.exec_() 
      

       
      Error:

      RecursionError: maximum recursion depth exceeded while calling a Python object
      

      The error appears when addItem() is called. Strangely, it only happens with the Slot decorator present. If remove the decorator and change the name of the slot to on_combo_currentIndexChanged the error does not appear.

        1. pyside1344_515.py
          0.6 kB
        2. pyside1344_diag.diff
          12 kB
        3. pyside1344_log.txt
          76 kB
        4. pyside1344_no_kw_name.py
          0.6 kB
        5. pyside1344_trace.txt
          74 kB
        6. pyside1344.py
          0.6 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            the compiler Florian Bruhin
            3rdcycle Lukas Heiniger
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes