summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-11 22:19:12 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-11 22:19:12 (GMT)
commitb31c7dcb43307b57917150d60a64856d5a845fa7 (patch)
tree9895e845588354818e0a80354020897e433aadef
parent2a212191f8bd19c2deab88764b894dd31f39af78 (diff)
downloadcpython-b31c7dcb43307b57917150d60a64856d5a845fa7.zip
cpython-b31c7dcb43307b57917150d60a64856d5a845fa7.tar.gz
cpython-b31c7dcb43307b57917150d60a64856d5a845fa7.tar.bz2
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.
-rw-r--r--Modules/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 3057e46..23a910e 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. */
}