Message301619
Issue 29988 covers the fact that with the default SIGINT handler installed, a poorly timed Ctrl-C can lead to context managers failing to even start running their __(a)exit__ methods, let alone complete them.
For the asynchronous case, the problem is even worse, as the *event loop* may be interrupted at arbitrary points if the default SIGINT handler is left in place.
To handle this robustly, it's desirable to make it easy to switch event-driven programs over to cooperative Ctrl-C handling by installing an asyncio SIGINT handler while the event loop is running, rather than leaving the default SIGINT handler in place.
(Note: while installing a cooperative SIGINT handler will enable more robust event-loop managed resource cleanup, it will have the downside that Ctrl-C won't be able to interrupt a coroutine that has incorrectly blocked the main thread) |
|
| Date |
User |
Action |
Args |
| 2017-09-07 19:37:30 | ncoghlan | set | recipients:
+ ncoghlan, gregory.p.smith, vstinner, giampaolo.rodola, njs, yselivanov |
| 2017-09-07 19:37:30 | ncoghlan | set | messageid: <1504813050.77.0.505378891387.issue31387@psf.upfronthosting.co.za> |
| 2017-09-07 19:37:30 | ncoghlan | link | issue31387 messages |
| 2017-09-07 19:37:30 | ncoghlan | create | |
|