Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 46395:6196529afd73
Add a NEWS entry for issue2221.
Also don't flush stdout on each call to exec() or eval().
Only interactive input really needs it.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Thu, 10 Apr 2008 21:03:09 +0000 |
| parents | 22a74eaf6b22 |
| children | 47d9bbe10897 |
line wrap: on
line diff
--- a/Python/pythonrun.c Thu Apr 10 20:54:35 2008 +0000 +++ b/Python/pythonrun.c Thu Apr 10 21:03:09 2008 +0000 @@ -54,6 +54,7 @@ static void initmain(void); static void initsite(void); static int initstdio(void); +static void flush_io(void); static PyObject *run_mod(mod_ty, const char *, PyObject *, PyObject *, PyCompilerFlags *, PyArena *); static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *, @@ -992,6 +993,7 @@ d = PyModule_GetDict(m); v = run_mod(mod, filename, d, d, flags, arena); PyArena_Free(arena); + flush_io(); if (v == NULL) { PyErr_Print(); return -1; @@ -1082,6 +1084,7 @@ v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, closeit, flags); } + flush_io(); if (v == NULL) { PyErr_Print(); ret = -1; @@ -1513,7 +1516,6 @@ return NULL; v = PyEval_EvalCode(co, globals, locals); Py_DECREF(co); - flush_io(); return v; } @@ -1546,7 +1548,6 @@ if (v && flags) flags->cf_flags |= (co->co_flags & PyCF_MASK); Py_DECREF(co); - flush_io(); return v; }
