Skip to content

Commit 50ee0a3

Browse files
author
jeffrey.yasskin
committed
Merged revisions 67697 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r67697 | jeffrey.yasskin | 2008-12-10 22:18:33 -0800 (Wed, 10 Dec 2008) | 14 lines 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. ........ ................ git-svn-id: http://svn.python.org/projects/python/branches/release30-maint@67698 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent aee5ea4 commit 50ee0a3

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ What's New in Python 3.0.1?
1212
Core and Builtins
1313
-----------------
1414

15-
- Issue #4597: Fixed exception handling when the __exit__ function of a
15+
- Issue #4597: Fixed several opcodes that weren't always propagating
16+
exceptions.
17+
18+
- Issue #4589: Fixed exception handling when the __exit__ function of a
1619
context manager returns a value that cannot be converted to a bool.
1720

1821
- Issue #4533: File read operation was dreadfully slow due to a slowly

Python/ceval.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
11121112
}
11131113
Py_FatalError("invalid argument to DUP_TOPX"
11141114
" (bytecode corruption?)");
1115+
/* Never returns, so don't bother to set why. */
11151116
break;
11161117

11171118
case UNARY_POSITIVE:
@@ -1728,6 +1729,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
17281729
if ((v = f->f_locals) == NULL) {
17291730
PyErr_Format(PyExc_SystemError,
17301731
"no locals when loading %R", w);
1732+
why = WHY_EXCEPTION;
17311733
break;
17321734
}
17331735
if (PyDict_CheckExact(v)) {
@@ -2279,7 +2281,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
22792281

22802282
if (x != NULL && opcode == MAKE_CLOSURE) {
22812283
v = POP();
2282-
err = PyFunction_SetClosure(x, v);
2284+
if (PyFunction_SetClosure(x, v) != 0) {
2285+
/* Can't happen unless bytecode is corrupt. */
2286+
why = WHY_EXCEPTION;
2287+
}
22832288
Py_DECREF(v);
22842289
}
22852290

@@ -2303,7 +2308,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
23032308
Py_DECREF(w);
23042309
}
23052310

2306-
err = PyFunction_SetAnnotations(x, v);
2311+
if (PyFunction_SetAnnotations(x, v) != 0) {
2312+
/* Can't happen unless
2313+
PyFunction_SetAnnotations changes. */
2314+
why = WHY_EXCEPTION;
2315+
}
23072316
Py_DECREF(v);
23082317
Py_DECREF(u);
23092318
}
@@ -2320,7 +2329,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
23202329
w = POP();
23212330
PyTuple_SET_ITEM(v, posdefaults, w);
23222331
}
2323-
err = PyFunction_SetDefaults(x, v);
2332+
if (PyFunction_SetDefaults(x, v) != 0) {
2333+
/* Can't happen unless
2334+
PyFunction_SetDefaults changes. */
2335+
why = WHY_EXCEPTION;
2336+
}
23242337
Py_DECREF(v);
23252338
}
23262339
if (x != NULL && kwdefaults > 0) {
@@ -2338,7 +2351,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
23382351
Py_DECREF(w);
23392352
Py_DECREF(u);
23402353
}
2341-
err = PyFunction_SetKwDefaults(x, v);
2354+
if (PyFunction_SetKwDefaults(x, v) != 0) {
2355+
/* Can't happen unless
2356+
PyFunction_SetKwDefaults changes. */
2357+
why = WHY_EXCEPTION;
2358+
}
23422359
Py_DECREF(v);
23432360
}
23442361
PUSH(x);

0 commit comments

Comments
 (0)