bpo-31546: Fix input hook integration (GH-7978)

This commit is contained in:
Thomas A Caswell 2018-06-28 12:29:44 -04:00 committed by Steve Dower
parent 4d26c8a177
commit 9b9d58f0d8
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,3 @@
Restore running PyOS_InputHook while waiting for user input at the prompt.
The restores integration of interactive GUI windows (such as Matplotlib
figures) with the prompt on Windows.

View File

@ -114,6 +114,9 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn)
wbuf = wbuf_local; wbuf = wbuf_local;
wbuflen = sizeof(wbuf_local) / sizeof(wbuf_local[0]) - 1; wbuflen = sizeof(wbuf_local) / sizeof(wbuf_local[0]) - 1;
while (1) { while (1) {
if (PyOS_InputHook != NULL) {
(void)(PyOS_InputHook)();
}
if (!ReadConsoleW(hStdIn, &wbuf[total_read], wbuflen - total_read, &n_read, NULL)) { if (!ReadConsoleW(hStdIn, &wbuf[total_read], wbuflen - total_read, &n_read, NULL)) {
err = GetLastError(); err = GetLastError();
goto exit; goto exit;