If a BaseException which is not an Exception is thrown inside a job (for example, KeyboardInterrupt), the Scheduler._wait_failed() task fails to catch this exception after re-raising it, and this exception gets raised from the Scheduler.close() method (due to await self._failed_task), which is totally unexpected.
Probably the intended invariant in Scheduler._wait_failed() was to never raise an exception.
If a
BaseExceptionwhich is not anExceptionis thrown inside a job (for example,KeyboardInterrupt), theScheduler._wait_failed()task fails to catch this exception after re-raising it, and this exception gets raised from theScheduler.close()method (due toawait self._failed_task), which is totally unexpected.Probably the intended invariant in
Scheduler._wait_failed()was to never raise an exception.