[Python-checkins] r67698 - in python/branches/release30-maint: Misc/NEWS Python/ceval.c

jeffrey.yasskin python-checkins at python.org
Thu Dec 11 07:36:26 CET 2008


Author: jeffrey.yasskin
Date: Thu Dec 11 07:36:25 2008
New Revision: 67698

Log:
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.
  ........
................


Modified:
   python/branches/release30-maint/   (props changed)
   python/branches/release30-maint/Misc/NEWS
   python/branches/release30-maint/Python/ceval.c

Modified: python/branches/release30-maint/Misc/NEWS
==============================================================================
--- python/branches/release30-maint/Misc/NEWS	(original)
+++ python/branches/release30-maint/Misc/NEWS	Thu Dec 11 07:36:25 2008
@@ -12,7 +12,10 @@
 Core and Builtins
 -----------------
 
-- Issue #4597: Fixed exception handling when the __exit__ function of a
+- Issue #4597: Fixed several opcodes that weren't always propagating
+  exceptions.
+
+- Issue #4589: Fixed exception handling when the __exit__ function of a
   context manager returns a value that cannot be converted to a bool.
 
 - Issue #4533: File read operation was dreadfully slow due to a slowly

Modified: python/branches/release30-maint/Python/ceval.c
==============================================================================
--- python/branches/release30-maint/Python/ceval.c	(original)
+++ python/branches/release30-maint/Python/ceval.c	Thu Dec 11 07:36:25 2008
@@ -1112,6 +1112,7 @@
 			}
 			Py_FatalError("invalid argument to DUP_TOPX"
 				      " (bytecode corruption?)");
+			/* Never returns, so don't bother to set why. */
 			break;
 
 		case UNARY_POSITIVE:
@@ -1728,6 +1729,7 @@
 			if ((v = f->f_locals) == NULL) {
 				PyErr_Format(PyExc_SystemError,
 					     "no locals when loading %R", w);
+				why = WHY_EXCEPTION;
 				break;
 			}
 			if (PyDict_CheckExact(v)) {
@@ -2279,7 +2281,10 @@
 
 			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);
 			}
 
@@ -2303,7 +2308,11 @@
 					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);
 			}
@@ -2320,7 +2329,11 @@
 					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) {
@@ -2338,7 +2351,11 @@
 					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);


More information about the Python-checkins mailing list