From a472116686dd77d6295f462063dab5ab7d2b6a2d Mon Sep 17 00:00:00 2001 From: nocturn9x Date: Fri, 27 Aug 2021 09:04:26 +0200 Subject: [PATCH] The loop now removes exited tasks from self.tasks --- giambio/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/giambio/core.py b/giambio/core.py index 9067b75..023da2a 100644 --- a/giambio/core.py +++ b/giambio/core.py @@ -228,6 +228,7 @@ class AsyncScheduler: self.current_task.result = ret.value self.current_task.finished = True self.join(self.current_task) + self.tasks.remove(self.current_task) except BaseException as err: # Our handy join mechanism will handle all the hassle of # rescheduling joiners and propagating errors, so we @@ -235,6 +236,7 @@ class AsyncScheduler: # self.join() work its magic self.current_task.exc = err self.join(self.current_task) + self.tasks.remove(self.current_task) def create_task(self, corofunc: types.FunctionType, pool, *args, **kwargs) -> Task: """ @@ -687,6 +689,7 @@ class AsyncScheduler: task.status = "cancelled" self.io_release_task(self.current_task) self.debugger.after_cancel(task) + self.tasks.remove(self.current_task) else: # If the task ignores our exception, we'll # raise it later again