Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 40903:882b9c14895c legacy-trunk
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.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Sun, 25 Feb 2007 15:57:45 +0000 |
| parents | bd3739a87259 |
| children | 191c48ca8bf9 |
line wrap: on
line diff
--- a/Python/ceval.c Sun Feb 25 15:53:36 2007 +0000 +++ b/Python/ceval.c Sun Feb 25 15:57:45 2007 +0000 @@ -4202,6 +4202,8 @@ 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))
