--- ../../../oryg/Python-3.0a1/Python/bltinmodule.c 2007-08-31 16:35:59.000000000 +0200 +++ bltinmodule.c 2007-11-07 11:36:55.000000000 +0100 @@ -1180,7 +1180,7 @@ { static char *kwlist[] = {"sep", "end", "file", 0}; static PyObject *dummy_args; - PyObject *sep = NULL, *end = NULL, *file = NULL; + PyObject *sep = NULL, *end = NULL, *file = NULL, *tmp = NULL; int i, err; if (dummy_args == NULL) { @@ -1224,8 +1224,16 @@ if (end == NULL || end == Py_None) err = PyFile_WriteString("\n", file); - else + else { err = PyFile_WriteObject(end, file, Py_PRINT_RAW); + tmp = PyObject_CallMethod(file,"flush",""); + if(tmp == NULL) + PyErr_Clear(); + else + Py_DECREF(tmp); + } + + if (err) return NULL;