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

QSocketNotifier.activated slot signature changed in 5.15

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.1
    • 5.15.0
    • PySide
    • None
    • macOS, tested on 10.15 and 10.13
      pyside 5.15.0
      python 3.8.2
    • 387ea2999c6d30aebfed30ec565e88ffae368b9c (pyside/pyside-setup/5.15)

    Description

      The documentation suggests that "The socket identifier is passed in the socket parameter"
      but, unlike in v<5.15, I'm running into issues connecting slots that take the socket ID as their argument.

      This example code worked in 5.14.2.2

      import os
      from PySide2.QtCore import QSocketNotifier, QTimer
      from PySide2.QtWidgets import QApplication
      
      app = QApplication([])
      reader, writer = os.pipe()
      notifier = QSocketNotifier(reader, QSocketNotifier.Read)
      notifier.activated.connect(lambda x: print(x))  # works on < 5.15
      os.close(writer)
      QTimer().singleShot(1000, app.exit)
      app.exec_()
      

      but in 5.15.0 will throw

      TypeError: Can't call meta function because I have no idea how to handle QSocketDescriptor
      

      I see that QSocketNotifier.activated is now an overloaded signal in 5.15... but there doesn't seem to be any way (in PySide at least) to specify the overload with something like:

      notifier.activated[socket_descriptor].connect
      
      # ... IndexError: Signature activated() not found for signal: activated
      

      Is this an intentional breaking change and backwards incompatibility of the slot signature for QSocketNotifier.activated? And is it no longer possible to get the socket id in the slot?

      for external reference, this issue came up in IPython in issue #12355

      Thanks!

      Attachments

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

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            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