From: Guido van Rossum Date: Fri, 11 Apr 1997 22:19:12 +0000 (+0000) Subject: OK, I lied. On Windows, _IOLBF seems to be the same as full X-Git-Tag: v1.5a1~156 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b31c7dcb43307b57917150d60a64856d5a845fa7;p=thirdparty%2FPython%2Fcpython.git OK, I lied. On Windows, _IOLBF seems to be the same as full buffering, so to get the normal behavior back, I set it to unbuffered. --- diff --git a/Modules/main.c b/Modules/main.c index 3057e46f838c..23a910efbb17 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -204,10 +204,14 @@ main(argc, argv) #endif } else if (Py_InteractiveFlag) { - char *ibuffer = malloc(BUFSIZ); - char *obuffer = malloc(BUFSIZ); - setvbuf(stdin, ibuffer, _IOLBF, BUFSIZ); - setvbuf(stdout, obuffer, _IOLBF, BUFSIZ); +#ifdef MS_WINDOWS + /* Doesn't have to have line-buffered -- use unbuffered */ + setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ); + setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ); +#else + setvbuf(stdin, (char *)NULL, _IOLBF, BUFSIZ); + setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); +#endif /* Leave stderr alone - it should be unbuffered anyway. */ }