[Python-checkins] CVS: python/dist/src/Objects listobject.c,2.69,2.70 stringobject.c,2.65,2.66 tupleobject.c,2.33,2.34

Fred L. Drake python-dev@python.org
Wed, 31 May 2000 20:12:15 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv10833

Modified Files:
	listobject.c stringobject.c tupleobject.c 
Log Message:
Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.


Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.69
retrieving revision 2.70
diff -C2 -r2.69 -r2.70
*** listobject.c	2000/05/03 23:44:35	2.69
--- listobject.c	2000/06/01 03:12:13	2.70
***************
*** 389,393 ****
  	PyListObject *np;
  	if (!PyList_Check(bb)) {
! 		PyErr_BadArgument();
  		return NULL;
  	}
--- 389,395 ----
  	PyListObject *np;
  	if (!PyList_Check(bb)) {
! 		PyErr_Format(PyExc_TypeError,
! 			     "can only append list (not \"%.200s\") to list",
! 			     bb->ob_type->tp_name);
  		return NULL;
  	}
***************
*** 470,474 ****
  	}
  	else {
! 		PyErr_BadArgument();
  		return -1;
  	}
--- 472,478 ----
  	}
  	else {
! 		PyErr_Format(PyExc_TypeError,
! 			     "must assign list (not \"%.200s\") to slice",
! 			     v->ob_type->tp_name);
  		return -1;
  	}

Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.65
retrieving revision 2.66
diff -C2 -r2.65 -r2.66
*** stringobject.c	2000/05/08 14:08:05	2.65
--- stringobject.c	2000/06/01 03:12:13	2.66
***************
*** 294,298 ****
  		if (PyUnicode_Check(bb))
  		    return PyUnicode_Concat((PyObject *)a, bb);
! 		PyErr_BadArgument();
  		return NULL;
  	}
--- 294,300 ----
  		if (PyUnicode_Check(bb))
  		    return PyUnicode_Concat((PyObject *)a, bb);
! 		PyErr_Format(PyExc_TypeError, 
! 			     "cannot add type \"%.200s\" to string",
! 			     bb->ob_type->tp_name);
  		return NULL;
  	}

Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.33
retrieving revision 2.34
diff -C2 -r2.33 -r2.34
*** tupleobject.c	2000/05/03 23:44:36	2.33
--- tupleobject.c	2000/06/01 03:12:13	2.34
***************
*** 362,366 ****
  	PyTupleObject *np;
  	if (!PyTuple_Check(bb)) {
! 		PyErr_BadArgument();
  		return NULL;
  	}
--- 362,368 ----
  	PyTupleObject *np;
  	if (!PyTuple_Check(bb)) {
! 		PyErr_Format(PyExc_TypeError,
!        		     "can only append tuple (not \"%.200s\") to tuple",
! 			     bb->ob_type->tp_name);
  		return NULL;
  	}