asyncio CancelledError and KeyboardInterrupt
task.cancel() itself doesn’t finish the task: it just says to task that CancelledError should be raised inside it and returns immediately. You should call it and await while task would be actually cancelled (while it’ll raise CancelledError). You also shouldn’t suppress CancelledError inside task. Read this answer where I tried to show different ways of … Read more