Open
@zackw

Description

Bug description:

In the Windows-specific implementation of time.sleep there appears this code:

// Check for pending SIGINT signal before resetting the event
if (PyErr_CheckSignals()) {
goto error;
}
ResetEvent(sigint_event);

If a control-C event happens after PyErr_CheckSignals returns, but before ResetEvent is called, I believe that event may be lost.

This is probably a hard race window to hit, and I don't have a Windows development environment, so I have not confirmed that it is possible.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows