Author ncoghlan
Recipients Mark.Shannon, deleted0524, erik.bray, gregory.p.smith, jdemeyer, ncoghlan, njs, xgdomingo, yselivanov
Date 2017-09-07.18:48:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504810137.79.0.201622687275.issue29988@psf.upfronthosting.co.za>
In-reply-to
Content
Attempting to clarify what Greg & I think the right answer will be for the async context management case: https://docs.python.org/3/library/asyncio-eventloop.html#unix-signals

In practice, that would look something like:

```
>>> loop = asyncio.get_event_loop()
>>> def sigint_handler():
...     raise KeyboardInterrupt
... 
>>> loop.add_signal_handler(signal.SIGINT, sigint_handler)
>>> loop.run_forever()
Traceback (most recent call last):
    ...
KeyboardInterrupt
```

That way, dealing gracefully with KeyboardInterrupt is wholly under the event loop's control, rather than the event loop having to fight with the eval loop as to how Ctrl-C should be handled.
History
Date User Action Args
2017-09-07 18:48:57ncoghlansetrecipients: + ncoghlan, gregory.p.smith, njs, Mark.Shannon, erik.bray, jdemeyer, yselivanov, deleted0524, xgdomingo
2017-09-07 18:48:57ncoghlansetmessageid: <1504810137.79.0.201622687275.issue29988@psf.upfronthosting.co.za>
2017-09-07 18:48:57ncoghlanlinkissue29988 messages
2017-09-07 18:48:57ncoghlancreate