summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-10 21:03:09 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-10 21:03:09 (GMT)
commit7fedbe513d5ccc735d36e1da9781fcab1ca5961e (patch)
tree4804f341532dc1fbad96204105208ad72de496a9 /Python/pythonrun.c
parent78520009289a49e7e36338c4f0c16c9f09cb10f4 (diff)
downloadcpython-7fedbe513d5ccc735d36e1da9781fcab1ca5961e.zip
cpython-7fedbe513d5ccc735d36e1da9781fcab1ca5961e.tar.gz
cpython-7fedbe513d5ccc735d36e1da9781fcab1ca5961e.tar.bz2
Add a NEWS entry for issue2221.
Also don't flush stdout on each call to exec() or eval(). Only interactive input really needs it.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 124eaf0..08fa79e 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -54,6 +54,7 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
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 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags
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 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
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 @@ run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
return NULL;
v = PyEval_EvalCode(co, globals, locals);
Py_DECREF(co);
- flush_io();
return v;
}
@@ -1546,7 +1548,6 @@ run_pyc_file(FILE *fp, const char *filename, PyObject *globals,
if (v && flags)
flags->cf_flags |= (co->co_flags & PyCF_MASK);
Py_DECREF(co);
- flush_io();
return v;
}