@@ -54,6 +54,7 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
54
54
static void initmain (void );
55
55
static void initsite (void );
56
56
static int initstdio (void );
57
+ static void flush_io (void );
57
58
static PyObject * run_mod (mod_ty , const char * , PyObject * , PyObject * ,
58
59
PyCompilerFlags * , PyArena * );
59
60
static PyObject * run_pyc_file (FILE * , const char * , PyObject * , PyObject * ,
@@ -992,6 +993,7 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags
992
993
d = PyModule_GetDict (m );
993
994
v = run_mod (mod , filename , d , d , flags , arena );
994
995
PyArena_Free (arena );
996
+ flush_io ();
995
997
if (v == NULL ) {
996
998
PyErr_Print ();
997
999
return -1 ;
@@ -1082,6 +1084,7 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
1082
1084
v = PyRun_FileExFlags (fp , filename , Py_file_input , d , d ,
1083
1085
closeit , flags );
1084
1086
}
1087
+ flush_io ();
1085
1088
if (v == NULL ) {
1086
1089
PyErr_Print ();
1087
1090
ret = -1 ;
@@ -1513,7 +1516,6 @@ run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
1513
1516
return NULL ;
1514
1517
v = PyEval_EvalCode (co , globals , locals );
1515
1518
Py_DECREF (co );
1516
- flush_io ();
1517
1519
return v ;
1518
1520
}
1519
1521
@@ -1546,7 +1548,6 @@ run_pyc_file(FILE *fp, const char *filename, PyObject *globals,
1546
1548
if (v && flags )
1547
1549
flags -> cf_flags |= (co -> co_flags & PyCF_MASK );
1548
1550
Py_DECREF (co );
1549
- flush_io ();
1550
1551
return v ;
1551
1552
}
1552
1553
0 commit comments