summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_taskgroups.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and ↵Thomas Grainger2024-10-141-2/+100
| | | | | | | | | _PyFuture refcycles ... (#125486) * Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)" This reverts commit e99650b80ace3893c2a80b3f2a4aca99cb305191. * fix incompatability with gh-124392
* gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ↵Kirill Podoprigora2024-10-141-90/+2
| | | | | | | (#12… (#125476) Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)" This reverts commit d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9.
* gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)Thomas Grainger2024-10-141-2/+90
|
* gh-116720: Fix corner cases of taskgroups (#117407)Guido van Rossum2024-04-091-0/+66
| | | | | | | | | | This prevents external cancellations of a task group's parent task to be dropped when an internal cancellation happens at the same time. Also strengthen the semantics of uncancel() to clear self._must_cancel when the cancellation count reaches zero. Co-Authored-By: Tin Tvrtković <tinchester@gmail.com> Co-Authored-By: Arthur Tacca
* gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009)Jason Zhang2024-03-061-16/+25
|
* gh-111085: Fix invalid state handling in TaskGroup and Timeout (#111111)Serhiy Storchaka2023-10-211-0/+45
| | | | | | | | | | | | | | | | asyncio.TaskGroup and asyncio.Timeout classes now raise proper RuntimeError if they are improperly used. * When they are used without entering the context manager. * When they are used after finishing. * When the context manager is entered more than once (simultaneously or sequentially). * If there is no current task when entering the context manager. They now remain in a consistent state after an exception is thrown, so subsequent operations can be performed correctly (if they are allowed). Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* GH-95704: Don't suppress errors from tasks when TG is cancelled (#95761)Guido van Rossum2022-08-171-24/+30
| | | | | | | | | | | | | When a task catches CancelledError and raises some other error, the other error should not silently be suppressed. Any scenario where a task crashes in cleanup upon cancellation will now result in an ExceptionGroup wrapping the crash(es) instead of propagating CancelledError and ignoring the side errors. NOTE: This represents a change in behavior (hence the need to change several tests). But it is only an edge case. Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* gh-95724: Clarify taskgroups.py license. (#95847)Yury Selivanov2022-08-111-1/+2
|
* GH-95289: Always call uncancel() when parent cancellation is requested (#95602)Kumar Aditya2022-08-041-1/+32
| | | Co-authored-by: Guido van Rossum <guido@python.org>
* GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400)Guido van Rossum2022-06-301-4/+23
| | | | | | | Once the task group is shutting down, it should not be possible to create a new task. Here "shutting down" means `self._aborting` is set, indicating that at least one task has failed and we have cancelled all others. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-46829: Deprecate passing a message into Future.cancel() and ↵Andrew Svetlov2022-03-231-6/+2
| | | | | Task.cancel() (GH-31840) After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
* bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API ↵Andrew Svetlov2022-03-141-0/+18
| | | | (GH-31837)
* Taskgroup tweaks (GH-31559)Tin Tvrtković2022-02-261-7/+19
| | | Now uses .cancel()/.uncancel(), for even fewer broken edge cases.
* Reduce flakiness of taskgroups test 13 (GH-31411)Guido van Rossum2022-02-181-1/+1
|
* bpo-46752: Slight improvements to TaskGroup API (GH-31398)Guido van Rossum2022-02-181-6/+13
| | | | | | | | | | | | | | | | | * Remove task group names (for now) We're not sure that they are needed, and once in the code we would never be able to get rid of them. Yury wrote: > Ideally, there should be a way for someone to build a "trace" > of taskgroups/task leading to the current running task. > We could do that using contextvars, but I'm not sure we should > do that in 3.11. * Pass optional name on to task in create_task() * Remove a bunch of unused stuff
* bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)Guido van Rossum2022-02-151-0/+694
asyncio/taskgroups.py is an adaptation of taskgroup.py from EdgeDb, with the following key changes: - Allow creating new tasks as long as the last task hasn't finished - Raise [Base]ExceptionGroup (directly) rather than TaskGroupError deriving from MultiError - Instead of monkey-patching the parent task's cancel() method, add a new public API to Task The Task class has a new internal flag, `_cancel_requested`, which is set when `.cancel()` is called successfully. The `.cancelling()` method returns the value of this flag. Further `.cancel()` calls while this flag is set return False. To reset this flag, call `.uncancel()`. Thus, a Task that catches and ignores `CancelledError` should call `.uncancel()` if it wants to be cancellable again; until it does so, it is deemed to be busy with uninterruptible cleanup. This new Task API helps solve the problem where TaskGroup needs to distinguish between whether the parent task being cancelled "from the outside" vs. "from inside". Co-authored-by: Yury Selivanov <yury@edgedb.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>