Backport 53901 and 53902 to prevent crash when there is an error decoding unicode filenames

This commit is contained in:
Neal Norwitz 2007-02-25 16:19:21 +00:00
parent d621a6e8dc
commit a5f5f14783
2 changed files with 4 additions and 0 deletions

View file

@ -4173,6 +4173,8 @@ exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
FILE *fp = PyFile_AsFile(prog);
char *name = PyString_AsString(PyFile_Name(prog));
PyCompilerFlags cf;
if (name == NULL)
return -1;
cf.cf_flags = 0;
if (PyEval_MergeCompilerFlags(&cf))
v = PyRun_FileFlags(fp, name, Py_file_input, globals,