mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
@ -255,6 +255,8 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
|
|||
"""
|
||||
if self._num_cancels_requested > 0:
|
||||
self._num_cancels_requested -= 1
|
||||
if self._num_cancels_requested == 0:
|
||||
self._must_cancel = False
|
||||
return self._num_cancels_requested
|
||||
|
||||
def __eager_start(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue