| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
Add a few more clarifying comments regarding to previous bug fixes or
non-obvious variable usages.
Pick-to: 6.7
Task-number: PYSIDE-2644
Task-number: PYSIDE-769
Change-Id: Ic4db10510e1adf8141efa83d727f519547d67b24
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is not necessary to cancel a task's handle when cancelling said task,
as the step function already handles the cancellation. Furthermore,
cancelling the handle can cause issues with TaskGroups if an exception
is raised inside the TaskGroup's context, where the tasks inside the
group are not allowed to properly cancel and thus block the program.
Pick-to: 6.7
Task-number: PYSIDE-769
Fixes: PYSIDE-2799
Change-Id: I1ab782380ffbe8c1ec40aba22b9ed2ebdcb1498f
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the QAsyncioTask.uncancel() function and the associated cancel
count.
Note to reader: Unlike what the name suggests, the uncancel() function
on its own does not undo a task cancellation. This must be performed by
consuming the CancelledError exception, at which point uncancel() serves
to remove the cancellation state.
Pick-to: 6.7
Task-number: PYSIDE-769
Fixes: PYSIDE-2790
Change-Id: I4e817e1dd3f49179855432d20ed2f043090fd8f1
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
| |
Add a future statement to all Python source files.
Task-number: PYSIDE-2786
Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
Improve the readability of the QAsyncioTask._step function; avoid nested
try/except blocks.
Pick-to: 6.7
Task-number: PYSIDE-769
Change-Id: Ibb82c50cf93b084b30dd2a5abcc0197ae25802e0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a task was cancelled, then a new future created from this task should
be cancelled as well. Otherwise, in some scenarios like a loop inside
the task and with bad timing, if the new future is not cancelled, the
task would continue running in this loop despite having been cancelled.
This bad timing can occur especially if the first future finishes very
quickly.
Pick-to: 6.7
Fixes: PYSIDE-2644
Task-number: PYSIDE-769
Change-Id: Icfff6e4ad5da565f50e3d89fbf85d1fecbf93650
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
| |
An erroneous self._loop.stop() has sneaked into the end of
QAsyncioTask._step, causing the event loop to stop prematurely in some
scenarios.
Pick-to: 6.6
Task-number: PYSIDE-769
Change-Id: If155e43f81675c660766c00e766e8a8f3bbe8b38
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
- Use asyncio._register_task() and asyncio._unregister_task() as
demanded by the API (extending asyncio, Task lifetime support)
- Add some comments and a missing return type in signature
Pick-to: 6.6
Task-number: PYSIDE-769
Change-Id: I3ffdf0dc5f7b127c0dd9f2fb63eecb057d123744
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
Wrap a QAsyncioTask's step execution with calls to asyncio._enter_task()
and asyncio._leave_task() so that asyncio.current_task() will work.
Pick-to: 6.6
Task-number: PYSIDE-769
Change-Id: I7235c9ab2b8d68b0059b82a366909dc25ea6d60f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
|
|
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>
|