diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-02-25 15:57:45 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-02-25 15:57:45 (GMT) |
commit | c5ceb251b395c207ed0411d1e94f0fd3703157ea (patch) | |
tree | ad2998a0f0e4c4610cf28c2a0b5cb610be63854c /Python | |
parent | 7218c2d2f44548e0b4bf14db1ff892662db00b1f (diff) | |
download | cpython-c5ceb251b395c207ed0411d1e94f0fd3703157ea.zip cpython-c5ceb251b395c207ed0411d1e94f0fd3703157ea.tar.gz cpython-c5ceb251b395c207ed0411d1e94f0fd3703157ea.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index ffdc75b..9e06302 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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)) |