Open davidbrochart opened 1 month ago
Thanks for the bug report. This is a known issue, but I'm not sure how to solve it. I believe ipykernel suffers from the same problem — actually I see you reported it there too :)
If you have
import asyncio
await asyncio.sleep(10)
print(1)
and interrupt the sleep, the cell doesn't actually run until complete — 1
won't be printed. But the sleep()
can't be interrupted.
Actually, I think I know how to fix this, by adding the interrupt handler to the event loop when a coroutine is being awaited.
Describe the bug
The following code:
cannot be interrupted: the cell runs until complete and then shows a
CancelledError
.Environment
Code to reproduce