mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
When we have no setvbuf(), make the file totally unbuffered using
setbuf() if a buffer size of 0 or 1 byte is requested.
This commit is contained in:
parent
22ffac1b1f
commit
f8b4de02a4
1 changed files with 4 additions and 1 deletions
|
@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue