Fix scope cancellation bug
This commit is contained in:
parent
c4e07a0da1
commit
1a32550e9f
|
@ -540,13 +540,15 @@ class DefaultKernel(Kernel):
|
|||
# so there is nowhere to throw an exception
|
||||
# to: instead, we delay the cancellation until
|
||||
# the next tick
|
||||
if self.current_task in scope.tasks:
|
||||
self.current_task.pending_cancellation = True
|
||||
self.reschedule(self.current_task)
|
||||
self.current_task.pending_cancellation = True
|
||||
self.reschedule(self.current_task)
|
||||
else:
|
||||
self.cancel_task(task)
|
||||
if scope.done():
|
||||
scope.cancelled = True
|
||||
# All inner tasks cancelled: reschedule
|
||||
# scope owner so it can keep going
|
||||
self.reschedule(scope.owner)
|
||||
|
||||
def init_pool(self, pool: TaskPool):
|
||||
pool.outer = self.current_pool
|
||||
|
|
Loading…
Reference in New Issue