]> granicus.if.org Git - python/commitdiff
bpo-31546: Fix input hook integration (GH-7978)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 28 Jun 2018 17:47:54 +0000 (10:47 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Jun 2018 17:47:54 +0000 (10:47 -0700)
(cherry picked from commit 9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39)

Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
Misc/NEWS.d/next/Windows/2018-06-27-23-33-54.bpo-31546.zJlap-.rst [new file with mode: 0644]
Parser/myreadline.c

diff --git a/Misc/NEWS.d/next/Windows/2018-06-27-23-33-54.bpo-31546.zJlap-.rst b/Misc/NEWS.d/next/Windows/2018-06-27-23-33-54.bpo-31546.zJlap-.rst
new file mode 100644 (file)
index 0000000..8f48763
--- /dev/null
@@ -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.
index 9f3c2e343c032cf7af9a68149cacee6bbb317e68..bb02631357206abcf349cb21ac83e6213f6fc99e 100644 (file)
@@ -119,6 +119,9 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn)
     wbuf = wbuf_local;
     wbuflen = sizeof(wbuf_local) / sizeof(wbuf_local[0]) - 1;
     while (1) {
+        if (PyOS_InputHook != NULL) {
+            (void)(PyOS_InputHook)();
+        }
         if (!ReadConsoleW(hStdIn, &wbuf[total_read], wbuflen - total_read, &n_read, NULL)) {
             err = GetLastError();
             goto exit;