diff Python/bltinmodule.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 d1777f51923b
children a75815e31545
line wrap: on
line diff
--- a/Python/bltinmodule.c	Mon Aug 02 06:24:59 2004 +0000
+++ b/Python/bltinmodule.c	Mon Aug 02 08:30:07 2004 +0000
@@ -539,11 +539,15 @@
 	PyCompilerFlags cf;
 	int exists;
 
-	if (!PyArg_ParseTuple(args, "s|O!O!:execfile",
+	if (!PyArg_ParseTuple(args, "s|O!O:execfile",
 			&filename,
 			&PyDict_Type, &globals,
-			&PyDict_Type, &locals))
+			&locals))
 		return NULL;
+	if (locals != Py_None && !PyMapping_Check(locals)) {
+		PyErr_SetString(PyExc_TypeError, "locals must be a mapping");
+		return NULL;
+	}
 	if (globals == Py_None) {
 		globals = PyEval_GetGlobals();
 		if (locals == Py_None)