@@ -36,8 +36,6 @@ extern grammar _PyParser_Grammar; /* From graminit.c */
3636/* Forward */
3737static void initmain (void );
3838static void initsite (void );
39- static PyObject * run_err_mod (mod_ty , const char * , PyObject * , PyObject * ,
40- PyCompilerFlags * , PyArena * arena );
4139static PyObject * run_mod (mod_ty , const char * , PyObject * , PyObject * ,
4240 PyCompilerFlags * , PyArena * );
4341static PyObject * run_pyc_file (FILE * , const char * , PyObject * , PyObject * ,
@@ -1159,11 +1157,12 @@ PyObject *
11591157PyRun_StringFlags (const char * str , int start , PyObject * globals ,
11601158 PyObject * locals , PyCompilerFlags * flags )
11611159{
1162- PyObject * ret ;
1160+ PyObject * ret = NULL ;
11631161 PyArena * arena = PyArena_New ();
11641162 mod_ty mod = PyParser_ASTFromString (str , "<string>" , start , flags ,
11651163 arena );
1166- ret = run_err_mod (mod , "<string>" , globals , locals , flags , arena );
1164+ if (mod != NULL )
1165+ ret = run_mod (mod , "<string>" , globals , locals , flags , arena );
11671166 PyArena_Free (arena );
11681167 return ret ;
11691168}
@@ -1182,20 +1181,11 @@ PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals,
11821181 }
11831182 if (closeit )
11841183 fclose (fp );
1185- ret = run_err_mod (mod , filename , globals , locals , flags , arena );
1184+ ret = run_mod (mod , filename , globals , locals , flags , arena );
11861185 PyArena_Free (arena );
11871186 return ret ;
11881187}
11891188
1190- static PyObject *
1191- run_err_mod (mod_ty mod , const char * filename , PyObject * globals ,
1192- PyObject * locals , PyCompilerFlags * flags , PyArena * arena )
1193- {
1194- if (mod == NULL )
1195- return NULL ;
1196- return run_mod (mod , filename , globals , locals , flags , arena );
1197- }
1198-
11991189static PyObject *
12001190run_mod (mod_ty mod , const char * filename , PyObject * globals , PyObject * locals ,
12011191 PyCompilerFlags * flags , PyArena * arena )
0 commit comments