summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-06 15:32:40 +0000
committerGuido van Rossum <guido@python.org>1998-03-06 15:32:40 +0000
commitd797c5d21536655eb3521376bf3787c49dd6f1c4 (patch)
tree0ea39bf3b058615b779d3578a4d3622e189ee519 /Objects
parentcd2b49b3f22d7305318dc107ec34bfb55ecd2c19 (diff)
downloadcpython-d797c5d21536655eb3521376bf3787c49dd6f1c4.tar.gz
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')
-rw-r--r--Objects/fileobject.c5
1 files changed, 4 insertions, 1 deletions
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 */
}
}