aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/QtAsyncio/futures.py
Commit message (Collapse)AuthorAgeFilesLines
* QtAsyncio: Use modern typing syntaxAdrian Herrmann2024-06-281-15/+16
| | | | | | | | | | | We can already use the modern typing syntax introduced with Python 3.10 in 3.9 via future statement definitions, even before we raise the minimum Python version to 3.10. Task-number: PYSIDE-769 Task-number: PYSIDE-2786 Change-Id: I560d0c25f3503217f920906a5b26193282b0247b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-201-0/+1
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* QtAsyncio: Improve documentation (part 2)Adrian Herrmann2024-05-101-2/+4
| | | | | | | | | | Improve the inline documentation of QtAsyncio with more comprehensive comments. Pick-to: 6.7 Task-number: PYSIDE-769 Change-Id: I7306da43d8f1f350dae188f5346cdec8f60a7a06 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Make tasks awaitableAdrian Herrmann2024-01-071-1/+1
| | | | | | | | | | | | Tasks are supposed to be awaitable objects. Fix a leftover from an old misunderstanding of tasks vs futures very early in the development process. Pick-to: 6.6 Fixes: PYSIDE-2561 Task-number: PYSIDE-769 Change-Id: I916d6e235c5e67ea0d03f1df3b1bf8dfd8cb9c83 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Fix cancelling waiting tasksAdrian Herrmann2024-01-071-6/+7
| | | | | | | | | | A task that is awaiting a future must also cancel this future in order for the cancellation to be successful. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I22a9132fc8506e7a007fe625bc9217f0760bdc6b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Catch keyboard interruptsAdrian Herrmann2023-12-191-2/+2
| | | | | | | | | | | | | Catch keyboard interrupts by catching the SIGINT signal and handling it with the default handler. Register the handler with the QAsyncioEventLoopPolicy so that this is always done when using QtAsyncio. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I7b35367a50ab03eb014faabf6b6a3b21a6a3cd6c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Do not raise exception at handle cancelAdrian Herrmann2023-11-241-1/+4
| | | | | | | | | | | Do not raise an exception when cancelling a handle. The exception should be raised later, when retrieving the future's result. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I8243cf16e8be5afe167d69313054e97e9aafc75c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* QtAsyncio: Handle exceptions properly in task stepAdrian Herrmann2023-11-241-1/+1
| | | | | | | | | | | Refactor the task step function to handle exceptions properly, as the self._coro.throw() code path was not usually reachable. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I31d50f700857a47bf1df5f0f02fb2fa313c1c045 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Add _cancel_message to future + taskAdrian Herrmann2023-10-021-0/+2
| | | | | | | | | | This field is assumed by asyncio.gather() to exist in task or future classes despite being undocumented. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: Ieab6f216db95e40bd02625fb9cff69be0ebccd50 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Fix signature of cancel for future/taskAdrian Herrmann2023-09-191-2/+3
| | | | | | | | | | QAsyncioFuture.cancel() and QAsyncioTask.cancel() should both return a bool. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I2b507ad5c44ba9478bdf8a53c0cd5464028d3384 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Add queues testAdrian Herrmann2023-09-121-3/+4
| | | | | | | | | | Add a test for the asyncio queue for consumer/producer scenarios. Additionally, fix a few bugs exposed by this test through the increased code coverage. Task-number: PYSIDE-769 Change-Id: I18e3be6d059b758868a7598b58704db216bcdcc8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement custom asyncio event loop based on QtAdrian Herrmann2023-07-271-0/+107
asyncio is an established library for Python applications with concurrency and asynchronous I/O, and the de facto standard that multiple other async frameworks build upon. Like Qt, it is based on an event loop, so to this end, it offers an extensive API to implement custom event loops that applications using asyncio can then leverage. Task-number: PYSIDE-769 Change-Id: I3daf5d631e2fa0d44fd8c3c272ac5cce96f58653 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>