From: Guido van Rossum Date: Fri, 6 Mar 1998 15:32:40 +0000 (+0000) Subject: When we have no setvbuf(), make the file totally unbuffered using X-Git-Tag: v1.5.1~482 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8b4de02a4895391483836448852ca9e65f6b2ee;p=python When we have no setvbuf(), make the file totally unbuffered using setbuf() if a buffer size of 0 or 1 byte is requested. --- diff --git a/Objects/fileobject.c b/Objects/fileobject.c index f8c58ba454..d07aa69e61 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 */ } }