[New-bugs-announce] [issue33192] asyncio should use signal.set_wakeup_fd on Windows

Nathaniel Smith report at bugs.python.org
Sat Mar 31 18:44:55 EDT 2018


New submission from Nathaniel Smith <njs at pobox.com>:

I thought there was already a bug for this, but it came up in conversation again and I can't find one, so, here you go...

It looks like originally there was this bug for making control-C wake up the asyncio event loop in Windows: https://github.com/python/asyncio/issues/191

This required some changes to signal.set_wakeup_fd to work on Windows, which was done in bpo-22018.

But I guess the last step got lost in the shuffle: right now signal.set_wakeup_fd works fine on Windows, but asyncio doesn't actually use it. This means that on Windows you can't wake up this program using control-C:

>>> import asyncio
>>> asyncio.run(asyncio.sleep(100000000))

Both of the Windows event loops should register a wakeup socket with signal.set_wakeup_fd, and arrange for the loop to wake up when data arrives on that socket, and read from it until it's empty again. (And once the loop is awake, Python's normal control-C handling will kick in.) That will make control-C on Windows work similarly to how it does on Unix.

----------
messages: 314749
nosy: asvetlov, giampaolo.rodola, njs, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: asyncio should use signal.set_wakeup_fd on Windows
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33192>
_______________________________________


More information about the New-bugs-announce mailing list