]> granicus.if.org Git - python/commitdiff
Issue #28333: Fixes off-by-one error that was adding an extra space.
authorSteve Dower <steve.dower@microsoft.com>
Tue, 25 Oct 2016 18:51:54 +0000 (11:51 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Tue, 25 Oct 2016 18:51:54 +0000 (11:51 -0700)
Parser/myreadline.c

index e40951ca33eecfcb702228a2a2a2c99d78fc73ef..9f3c2e343c032cf7af9a68149cacee6bbb317e68 100644 (file)
@@ -225,7 +225,8 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
                         if (wlen) {
                             DWORD n;
                             fflush(stderr);
-                            WriteConsoleW(hStdErr, wbuf, wlen, &n, NULL);
+                            /* wlen includes null terminator, so subtract 1 */
+                            WriteConsoleW(hStdErr, wbuf, wlen - 1, &n, NULL);
                         }
                         PyMem_RawFree(wbuf);
                     }