diff Python/ceval.c @ 32890:b8c2aa2be19a legacy-trunk

Completed the patch for Bug #215126. * Fixes an incorrect variable in a PyDict_CheckExact. * Allow general mapping locals arguments for the execfile() function and exec statement. * Add tests.
author Raymond Hettinger <python@rcn.com>
date Mon, 02 Aug 2004 08:30:07 +0000
parents 87d196e1c2d0
children ac73f6662e11
line wrap: on
line diff
--- a/Python/ceval.c	Mon Aug 02 06:24:59 2004 +0000
+++ b/Python/ceval.c	Mon Aug 02 08:30:07 2004 +0000
@@ -1643,7 +1643,7 @@
 			w = GETITEM(names, oparg);
 			v = POP();
 			if ((x = f->f_locals) != NULL) {
-				if (PyDict_CheckExact(v))
+				if (PyDict_CheckExact(x))
 					err = PyDict_SetItem(x, w, v);
 				else
 					err = PyObject_SetItem(x, w, v);
@@ -4116,9 +4116,9 @@
 		    "exec: arg 2 must be a dictionary or None");
 		return -1;
 	}
-	if (!PyDict_Check(locals)) {
+	if (!PyMapping_Check(locals)) {
 		PyErr_SetString(PyExc_TypeError,
-		    "exec: arg 3 must be a dictionary or None");
+		    "exec: arg 3 must be a mapping or None");
 		return -1;
 	}
 	if (PyDict_GetItemString(globals, "__builtins__") == NULL)