fixed python3 stdout/stderr line buffering

This commit is contained in:
Unbit
2013-05-21 14:19:33 +02:00
parent 0e1de3d6e8
commit 5bf55220d4
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -500,7 +500,11 @@ void init_uwsgi_vars() {
#ifdef PYTHREE
// fix stdout and stderr
PyObject *new_stdprint = PyFile_NewStdPrinter(2);
#ifdef HAS_NO_ERRORS_IN_PyFile_FromFd
PyObject *new_stdprint = PyFile_FromFd(2, NULL, "w", _IOLBF, NULL, NULL, 0);
#else
PyObject *new_stdprint = PyFile_FromFd(2, NULL, "w", _IOLBF, NULL, NULL, NULL, 0);
#endif
PyDict_SetItemString(pysys_dict, "stdout", new_stdprint);
PyDict_SetItemString(pysys_dict, "__stdout__", new_stdprint);
PyDict_SetItemString(pysys_dict, "stderr", new_stdprint);