diff options
author | Guido van Rossum <guido@python.org> | 1997-04-11 21:57:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-04-11 21:57:53 (GMT) |
commit | 2a212191f8bd19c2deab88764b894dd31f39af78 (patch) | |
tree | b2f3dc455252fdf4c0642e548c293fccae92ebb0 | |
parent | 7844e38a988243b4f3d59feab0908246d37ea34c (diff) | |
download | cpython-2a212191f8bd19c2deab88764b894dd31f39af78.zip cpython-2a212191f8bd19c2deab88764b894dd31f39af78.tar.gz cpython-2a212191f8bd19c2deab88764b894dd31f39af78.tar.bz2 |
Change in when and how stdin and stdout are set to line-buffering.
This used to be done whenever stdin was interactive. Now we only do
it when the -i flag is given. Also (and this is the real reason for
this fix) we explicitly allocate a buffer -- this seems to be
necessary on Windows.
-rw-r--r-- | Modules/main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/main.c b/Modules/main.c index 0cab825..3057e46 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -203,9 +203,11 @@ main(argc, argv) setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ); #endif } - else if (stdin_is_interactive) { - setvbuf(stdin, (char *)NULL, _IOLBF, BUFSIZ); - setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); + else if (Py_InteractiveFlag) { + char *ibuffer = malloc(BUFSIZ); + char *obuffer = malloc(BUFSIZ); + setvbuf(stdin, ibuffer, _IOLBF, BUFSIZ); + setvbuf(stdout, obuffer, _IOLBF, BUFSIZ); /* Leave stderr alone - it should be unbuffered anyway. */ } |