Details
Description
I know QtAsyncio is still experimental, but it seemed to be working quite well in our application as a replacement for qasync, so I thought I'd report this anyway.
According to the documentation for Tasks (https://docs.python.org/3/library/asyncio-task.html#asyncio.Task), they are "future-like" and while it does not explicitly say they are awaitable, some of the example code does show a task being awaited:
async def main(): # Create a "cancel_me" Task task = asyncio.create_task(cancel_me()) # Wait for 1 second await asyncio.sleep(1) task.cancel() try: await task except asyncio.CancelledError: print("main(): cancel_me is cancelled now")
However, the QtAsyncio implementation of a task (QAsyncioTask) throws an error when the task is awaited "PySide6.QtAsyncio.tasks.QAsyncioTask.QtTaskApiMisuseError: Tasks cannot be awaited" from https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside6/PySide6/QtAsyncio/tasks.py?id=ba4ec692228d9f9d24abe7e99c8612060c1d1de9#n47
There needs to be some way of waiting for a task to complete, so could QAsyncioTask be awaitable?