Nick Coghlan added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue29988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com