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 f8c58ba..d07aa69 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -165,7 +165,10 @@
}
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 */
}
}