diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-12-11 05:21:18 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-12-11 05:21:18 (GMT) |
commit | 6961498040580af25d30e3ec8358d2674bd31f12 (patch) | |
tree | 2a9609e038eeb9f1ade447aef7a80974f861f2d1 /Python | |
parent | 79c9f76629009ad8f014873437431087832e47d1 (diff) | |
download | cpython-6961498040580af25d30e3ec8358d2674bd31f12.zip cpython-6961498040580af25d30e3ec8358d2674bd31f12.tar.gz cpython-6961498040580af25d30e3ec8358d2674bd31f12.tar.bz2 |
Merged revisions 67666,67685 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67666 | jeffrey.yasskin | 2008-12-08 10:55:24 -0800 (Mon, 08 Dec 2008) | 3 lines
Issue 4597: Fix several cases in EvalFrameEx where an exception could be
"raised" without setting x, err, or why to let the eval loop know.
........
r67685 | jeffrey.yasskin | 2008-12-09 23:35:02 -0800 (Tue, 09 Dec 2008) | 2 lines
Update Misc/NEWS for r67666.
........
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index dd1e171..5bac65f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1041,6 +1041,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } Py_FatalError("invalid argument to DUP_TOPX" " (bytecode corruption?)"); + /* Never returns, so don't bother to set why. */ break; case UNARY_POSITIVE: @@ -1634,9 +1635,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case PRINT_NEWLINE: if (stream == NULL || stream == Py_None) { w = PySys_GetObject("stdout"); - if (w == NULL) + if (w == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + why = WHY_EXCEPTION; + } } if (w != NULL) { /* w.write() may replace sys.stdout, so we @@ -1862,6 +1865,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) PyErr_Format(PyExc_SystemError, "no locals when loading %s", PyObject_REPR(w)); + why = WHY_EXCEPTION; break; } if (PyDict_CheckExact(v)) { @@ -2458,7 +2462,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_DECREF(v); if (x != NULL) { v = POP(); - err = PyFunction_SetClosure(x, v); + if (PyFunction_SetClosure(x, v) != 0) { + /* Can't happen unless bytecode is corrupt. */ + why = WHY_EXCEPTION; + } Py_DECREF(v); } if (x != NULL && oparg > 0) { @@ -2472,7 +2479,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) w = POP(); PyTuple_SET_ITEM(v, oparg, w); } - err = PyFunction_SetDefaults(x, v); + if (PyFunction_SetDefaults(x, v) != 0) { + /* Can't happen unless + PyFunction_SetDefaults changes. */ + why = WHY_EXCEPTION; + } Py_DECREF(v); } PUSH(x); |