Message96607
Hello,
It seems there is an important difference between the doc of the IO
module, and its implementation so far (until todcay trunk revision 76805)
"buffering is an optional integer used to set the buffering policy. By
default full buffering is on. Pass 0 to switch buffering off (only
allowed in binary mode), 1 to set line buffering, and an integer > 1 for
full buffering."
--> actually full buffering only occurs if a negative buffering
parameter is given, else it seems th current value i kept as the buffer
size - eg. if we give "3", buffering will be 3 bytes...
This seems a fine behaviour to me, so this implementation could just be
documented as is.
-----------
Only case of full buffering in the C iomodule :
if (buffering < 0) {
buffering = DEFAULT_BUFFER_SIZE;
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
{
struct stat st;
long fileno;
PyObject *res = PyObject_CallMethod(raw, "fileno", NULL);
if (res == NULL)
goto error;
fileno = PyInt_AsLong(res);
Py_DECREF(res);
if (fileno == -1 && PyErr_Occurred())
goto error;
if (fstat(fileno, &st) >= 0)
buffering = st.st_blksize;
}
#endif
} |
|
Date |
User |
Action |
Args |
2009-12-19 15:59:11 | pakal | set | recipients:
+ pakal, georg.brandl |
2009-12-19 15:59:11 | pakal | set | messageid: <1261238351.34.0.64888213085.issue7545@psf.upfronthosting.co.za> |
2009-12-19 15:59:10 | pakal | link | issue7545 messages |
2009-12-19 15:59:09 | pakal | create | |
|