Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Continue reading when SIGINT is ignored.
6 changes: 4 additions & 2 deletions Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,16 @@ read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
break;
err = 0;
HANDLE hInterruptEvent = _PyOS_SigintEvent();
if (WaitForSingleObjectEx(hInterruptEvent, 100, FALSE)
== WAIT_OBJECT_0) {
DWORD state = WaitForSingleObjectEx(hInterruptEvent, 100, FALSE);
if (state == WAIT_OBJECT_0 || state == WAIT_TIMEOUT) {
ResetEvent(hInterruptEvent);
Py_BLOCK_THREADS
sig = PyErr_CheckSignals();
Py_UNBLOCK_THREADS
if (sig < 0)
break;
else
continue;
}
}
*readlen += n;
Expand Down
20 changes: 11 additions & 9 deletions Parser/myreadline.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn)
goto exit;
err = 0;
HANDLE hInterruptEvent = _PyOS_SigintEvent();
if (WaitForSingleObjectEx(hInterruptEvent, 100, FALSE)
== WAIT_OBJECT_0) {
ResetEvent(hInterruptEvent);
PyEval_RestoreThread(_PyOS_ReadlineTState);
s = PyErr_CheckSignals();
PyEval_SaveThread();
if (s < 0)
goto exit;
}
DWORD state = WaitForSingleObjectEx(hInterruptEvent, 100, FALSE);
if (state == WAIT_OBJECT_0 || state == WAIT_TIMEOUT) {
ResetEvent(hInterruptEvent);
PyEval_RestoreThread(_PyOS_ReadlineTState);
s = PyErr_CheckSignals();
PyEval_SaveThread();
if (s < 0)
goto exit;
else
continue;
}
break;
}

Expand Down