summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-06 15:32:40 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-06 15:32:40 (GMT)
commitf8b4de02a4895391483836448852ca9e65f6b2ee (patch)
treec9cf6231fd6884c2d769103aab17908fa7f5cca1 /Objects/fileobject.c
parent22ffac1b1f8288bac7a277a8caa04ca731a54b81 (diff)
downloadcpython-f8b4de02a4895391483836448852ca9e65f6b2ee.zip
cpython-f8b4de02a4895391483836448852ca9e65f6b2ee.tar.gz
cpython-f8b4de02a4895391483836448852ca9e65f6b2ee.tar.bz2
When we have no setvbuf(), make the file totally unbuffered using
setbuf() if a buffer size of 0 or 1 byte is requested.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index f8c58ba..d07aa69 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -165,7 +165,10 @@ PyFile_SetBufSize(f, bufsize)
}
setvbuf(((PyFileObject *)f)->f_fp, (char *)NULL,
type, bufsize);
-#endif /* HAVE_SETVBUF */
+#else /* !HAVE_SETVBUF */
+ if (bufsize <= 1)
+ setbuf(((PyFileObject *)f)->f_fp, (char *)NULL);
+#endif /* !HAVE_SETVBUF */
}
}