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

QtAsyncio event loop exception_handler called without self

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.9.1
    • QtAsyncio
    • None
    • Linux/X11

      The event loop for QtAsyncio does not call its exception handler with the signature given in Python's documentation for asyncio, but it should. This will lead to a user setting the exception handler to the wrong signature and result in missing argument TypeError at the exception handler call, after an exception occurs in an async task:

      https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.set_exception_handler

      > handler must be a callable with the signature matching (loop, context), where loop is a reference to the active event loop, and context is a dict object containing the details of the exception

      Observe how it's called in Cpython's BaseEventLoop implementation:

      https://github.com/python/cpython/blob/fe0e921817a7f96c62c91085884ab910859328ce/Lib/asyncio/base_events.py#L1929

      self._exception_handler(self, context)

      Observe how it's called in QtAsyncioEventLoop:

      https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside6/PySide6/QtAsyncio/events.py#n620

      self._exception_handler(context)

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

            crmaurei Cristian Maureira-Fredes
            cromachina Cro Machina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes