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

QtAsyncio: Hangs if exception occurs inside TaskGroup body

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.0, 6.7.3
    • 6.7.2
    • QtAsyncio
    • None
    • python 3.12.3
    • Windows
    • d0c80064e (dev), 63887084e (6.7)

    Description

      In the example below, the runtime error that occurs inside the task group body causes the application to never finish and it must be killed.

      When using asyncio.run instead of Qtasyncio.run, the error is raised and wrapped in an exception group as expected.

      import asyncio
      import sys
      
      from PySide6 import QtAsyncio
      from PySide6.QtWidgets import QApplication
      
      
      async def job():
          await asyncio.sleep(1)
      
      
      async def main() -> None:
          async with asyncio.TaskGroup() as tg:
              tg.create_task(job())
              raise RuntimeError("error")
      
      
      if __name__ == "__main__":
          app = QApplication(sys.argv)
      
          QtAsyncio.run(main(), keep_running=False)
      
      

      Attachments

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

        Activity

          People

            adherrma Adrian Herrmann (Inactive)
            damienb damienb
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes