Commit d797c5d2 authored by Guido van Rossum's avatar Guido van Rossum

When we have no setvbuf(), make the file totally unbuffered using

setbuf() if a buffer size of 0 or 1 byte is requested.
parent cd2b49b3
...@@ -165,7 +165,10 @@ PyFile_SetBufSize(f, bufsize) ...@@ -165,7 +165,10 @@ PyFile_SetBufSize(f, bufsize)
} }
setvbuf(((PyFileObject *)f)->f_fp, (char *)NULL, setvbuf(((PyFileObject *)f)->f_fp, (char *)NULL,
type, bufsize); type, bufsize);
#endif /* HAVE_SETVBUF */ #else /* !HAVE_SETVBUF */
if (bufsize <= 1)
setbuf(((PyFileObject *)f)->f_fp, (char *)NULL);
#endif /* !HAVE_SETVBUF */
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment