Details
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
For Gerrit Dashboard: PYSIDE-2799 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
574319,4 | QtAsyncio: Don't cancel handle | dev | pyside/pyside-setup | Status: MERGED | -1 | 0 |
576894,2 | QtAsyncio: Don't cancel handle | 6.7 | pyside/pyside-setup | Status: MERGED | -1 | 0 |