Wojciech Walczak wrote:
> Hello,
>
> py3k's print() is not flushing when end is set to '' and all it has to
> print is one-character-long string:
Good catch! I tried to reproduce the debug in a unit test but it's not
easy. Your patch was a good head start but I didn't like the fact that
it was calling flush() when end is set. It should only call flush when
end is an empty string.
Comments?
if (end == NULL || end == Py_None) {
err = PyFile_WriteString("\n", file);
}
/* case: end='', the existence of stdout.flush is not mandatory. */
else if (*PyUnicode_AsString(end) == '\0') {
tmp = PyObject_CallMethod(file, "flush", "");
if (tmp == NULL)
PyErr_Clear();
else
Py_DECREF(tmp);
}
else {
err = PyFile_WriteObject(end, file, Py_PRINT_RAW);
}
Christian
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com