[issue24080] asyncio.Event.wait() Task was destroyed but it is pending

Marco Paolini report at bugs.python.org
Thu Apr 30 22:34:45 CEST 2015


Marco Paolini added the comment:

KeyboardInterrupt is not handled gently by asyncio (see https://groups.google.com/d/msg/python-tulip/sovg7EIBoXs/m7U-0UXqzSQJ)

you could cancel all tasks in the signal handler:

...

def sig_interrupt():
    print('interrupt')
    for task in asyncio.Task.all_tasks():
        task.cancel()

loop.add_signal_handler(signal.SIGINT, sig_interrupt)
...

----------
nosy: +mpaolini

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24080>
_______________________________________


More information about the Python-bugs-list mailing list