[Python-checkins] python/dist/src/Python bltinmodule.c,2.316,2.317

loewis at users.sourceforge.net loewis at users.sourceforge.net
Thu Aug 12 16:42:41 CEST 2004


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

Modified Files:
	bltinmodule.c 
Log Message:
Patch #1005468: Disambiguate "min() or max()" exception string.


Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.316
retrieving revision 2.317
diff -C2 -d -r2.316 -r2.317
*** bltinmodule.c	7 Aug 2004 19:20:05 -0000	2.316
--- bltinmodule.c	12 Aug 2004 14:42:37 -0000	2.317
***************
*** 1117,1125 ****
  min_max(PyObject *args, int op)
  {
  	PyObject *v, *w, *x, *it;
  
  	if (PyTuple_Size(args) > 1)
  		v = args;
! 	else if (!PyArg_UnpackTuple(args, (op==Py_LT) ? "min" : "max", 1, 1, &v))
  		return NULL;
  
--- 1117,1126 ----
  min_max(PyObject *args, int op)
  {
+ 	const char *name = op == Py_LT ? "min" : "max";
  	PyObject *v, *w, *x, *it;
  
  	if (PyTuple_Size(args) > 1)
  		v = args;
! 	else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v))
  		return NULL;
  
***************
*** 1159,1164 ****
  	}
  	if (w == NULL)
! 		PyErr_SetString(PyExc_ValueError,
! 				"min() or max() arg is an empty sequence");
  	Py_DECREF(it);
  	return w;
--- 1160,1165 ----
  	}
  	if (w == NULL)
! 		PyErr_Format(PyExc_ValueError,
! 			     "%s() arg is an empty sequence", name);
  	Py_DECREF(it);
  	return w;



More information about the Python-checkins mailing list