summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@gmail.com>2008-12-11 06:18:33 (GMT)
committerJeffrey Yasskin <jyasskin@gmail.com>2008-12-11 06:18:33 (GMT)
commitb9083f3e303a6c8e30be9c88b1e0e6383dc0593e (patch)
treee58582393bea2bc9600d61f7764c600e5f0e514e /Python/ceval.c
parent708d58179d164087c039ff0548b36d67930df48b (diff)
downloadcpython-b9083f3e303a6c8e30be9c88b1e0e6383dc0593e.zip
cpython-b9083f3e303a6c8e30be9c88b1e0e6383dc0593e.tar.gz
cpython-b9083f3e303a6c8e30be9c88b1e0e6383dc0593e.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/ceval.c')
-rw-r--r--Python/ceval.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 84d18b3..b17d3db 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1120,6 +1120,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:
@@ -1736,6 +1737,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if ((v = f->f_locals) == NULL) {
PyErr_Format(PyExc_SystemError,
"no locals when loading %R", w);
+ why = WHY_EXCEPTION;
break;
}
if (PyDict_CheckExact(v)) {
@@ -2287,7 +2289,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if (x != NULL && opcode == MAKE_CLOSURE) {
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);
}
@@ -2311,7 +2316,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(w);
}
- err = PyFunction_SetAnnotations(x, v);
+ if (PyFunction_SetAnnotations(x, v) != 0) {
+ /* Can't happen unless
+ PyFunction_SetAnnotations changes. */
+ why = WHY_EXCEPTION;
+ }
Py_DECREF(v);
Py_DECREF(u);
}
@@ -2328,7 +2337,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
w = POP();
PyTuple_SET_ITEM(v, posdefaults, 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);
}
if (x != NULL && kwdefaults > 0) {
@@ -2346,7 +2359,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(w);
Py_DECREF(u);
}
- err = PyFunction_SetKwDefaults(x, v);
+ if (PyFunction_SetKwDefaults(x, v) != 0) {
+ /* Can't happen unless
+ PyFunction_SetKwDefaults changes. */
+ why = WHY_EXCEPTION;
+ }
Py_DECREF(v);
}
PUSH(x);