diff options
author | Guido van Rossum <guido@python.org> | 1998-03-06 15:32:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-03-06 15:32:40 (GMT) |
commit | f8b4de02a4895391483836448852ca9e65f6b2ee (patch) | |
tree | c9cf6231fd6884c2d769103aab17908fa7f5cca1 /Objects/fileobject.c | |
parent | 22ffac1b1f8288bac7a277a8caa04ca731a54b81 (diff) | |
download | cpython-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.c | 5 |
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 */ } } |