[Python-checkins] python/dist/src/Python ceval.c, 2.410, 2.411 bltinmodule.c, 2.313, 2.314

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Mon Aug 2 10:30:10 CEST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25880/Python

Modified Files:
	ceval.c bltinmodule.c 
Log Message:
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.



Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.410
retrieving revision 2.411
diff -C2 -d -r2.410 -r2.411
*** ceval.c	8 Jul 2004 01:49:00 -0000	2.410
--- ceval.c	2 Aug 2004 08:30:07 -0000	2.411
***************
*** 1644,1648 ****
  			v = POP();
  			if ((x = f->f_locals) != NULL) {
! 				if (PyDict_CheckExact(v))
  					err = PyDict_SetItem(x, w, v);
  				else
--- 1644,1648 ----
  			v = POP();
  			if ((x = f->f_locals) != NULL) {
! 				if (PyDict_CheckExact(x))
  					err = PyDict_SetItem(x, w, v);
  				else
***************
*** 4117,4123 ****
  		return -1;
  	}
! 	if (!PyDict_Check(locals)) {
  		PyErr_SetString(PyExc_TypeError,
! 		    "exec: arg 3 must be a dictionary or None");
  		return -1;
  	}
--- 4117,4123 ----
  		return -1;
  	}
! 	if (!PyMapping_Check(locals)) {
  		PyErr_SetString(PyExc_TypeError,
! 		    "exec: arg 3 must be a mapping or None");
  		return -1;
  	}

Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.313
retrieving revision 2.314
diff -C2 -d -r2.313 -r2.314
*** bltinmodule.c	19 Jul 2004 16:29:17 -0000	2.313
--- bltinmodule.c	2 Aug 2004 08:30:07 -0000	2.314
***************
*** 540,548 ****
  	int exists;
  
! 	if (!PyArg_ParseTuple(args, "s|O!O!:execfile",
  			&filename,
  			&PyDict_Type, &globals,
! 			&PyDict_Type, &locals))
  		return NULL;
  	if (globals == Py_None) {
  		globals = PyEval_GetGlobals();
--- 540,552 ----
  	int exists;
  
! 	if (!PyArg_ParseTuple(args, "s|O!O:execfile",
  			&filename,
  			&PyDict_Type, &globals,
! 			&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();



More information about the Python-checkins mailing list