mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
gh-116720: Fix corner cases of taskgroups (#117407)
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
This commit is contained in:
parent
22b25d1eba
commit
fa58e75a86
8 changed files with 183 additions and 13 deletions
|
@ -2393,6 +2393,9 @@ _asyncio_Task_uncancel_impl(TaskObj *self)
|
|||
{
|
||||
if (self->task_num_cancels_requested > 0) {
|
||||
self->task_num_cancels_requested -= 1;
|
||||
if (self->task_num_cancels_requested == 0) {
|
||||
self->task_must_cancel = 0;
|
||||
}
|
||||
}
|
||||
return PyLong_FromLong(self->task_num_cancels_requested);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue