mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Fix crash in exec when unicode filename can't be decoded.
I can't think of an easy way to test this behavior. It only occurs when the file system default encoding and the interpreter default encoding are different, such that you can open the file but not decode its name.
This commit is contained in:
parent
7218c2d2f4
commit
c5ceb251b3
2 changed files with 3 additions and 0 deletions
|
@ -4202,6 +4202,8 @@ exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
|
|||
else if (PyFile_Check(prog)) {
|
||||
FILE *fp = PyFile_AsFile(prog);
|
||||
char *name = PyString_AsString(PyFile_Name(prog));
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
PyCompilerFlags cf;
|
||||
cf.cf_flags = 0;
|
||||
if (PyEval_MergeCompilerFlags(&cf))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue