[Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.93,2.94 intobject.c,2.71,2.72 longobject.c,1.101,1.102

Tim Peters tim_one@users.sourceforge.net
Tue, 04 Sep 2001 23:25:00 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv17986/python/Objects

Modified Files:
	floatobject.c intobject.c longobject.c 
Log Message:
Make the error msgs in our pow() implementations consistent.


Index: floatobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v
retrieving revision 2.93
retrieving revision 2.94
diff -C2 -d -r2.93 -r2.94
*** floatobject.c	2001/09/04 05:14:19	2.93
--- floatobject.c	2001/09/05 06:24:58	2.94
***************
*** 496,501 ****
  
  	if ((PyObject *)z != Py_None) {
! 		PyErr_SetString(PyExc_TypeError,
! 			"3rd argument to floating pow() must be None");
  		return NULL;
  	}
--- 496,501 ----
  
  	if ((PyObject *)z != Py_None) {
! 		PyErr_SetString(PyExc_TypeError, "pow() 3rd argument not "
! 			"allowed unless all other arguments are integers");
  		return NULL;
  	}

Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.71
retrieving revision 2.72
diff -C2 -d -r2.71 -r2.72
*** intobject.c	2001/09/04 06:17:36	2.71
--- intobject.c	2001/09/05 06:24:58	2.72
***************
*** 590,595 ****
  	if (iw < 0) {
  		if ((PyObject *)z != Py_None) {
! 			PyErr_SetString(PyExc_TypeError, "integer pow() arg "
! 			     "3 must not be specified when arg 2 is < 0");
  			return NULL;
  		}
--- 590,595 ----
  	if (iw < 0) {
  		if ((PyObject *)z != Py_None) {
! 			PyErr_SetString(PyExc_TypeError, "pow() 2nd argument "
! 			     "cannot be negative when 3rd argument specified");
  			return NULL;
  		}
***************
*** 604,608 ****
  		if (iz == 0) {
  			PyErr_SetString(PyExc_ValueError,
! 					"pow() arg 3 cannot be 0");
  			return NULL;
  		}
--- 604,608 ----
  		if (iz == 0) {
  			PyErr_SetString(PyExc_ValueError,
! 					"pow() 3rd argument cannot be 0");
  			return NULL;
  		}

Index: longobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -d -r1.101 -r1.102
*** longobject.c	2001/09/05 05:38:10	1.101
--- longobject.c	2001/09/05 06:24:58	1.102
***************
*** 1686,1690 ****
  		return Py_NotImplemented;
  	}
! 	
  	size_b = b->ob_size;
  	if (size_b < 0) {
--- 1686,1697 ----
  		return Py_NotImplemented;
  	}
! 
! 	if (c != Py_None && ((PyLongObject *)c)->ob_size == 0) {
! 		PyErr_SetString(PyExc_ValueError,
! 				"pow() 3rd argument cannot be 0");
! 		z = NULL;
! 		goto error;
! 	}
! 
  	size_b = b->ob_size;
  	if (size_b < 0) {
***************
*** 1693,1698 ****
  		Py_DECREF(c);
  		if (x != Py_None) {
! 			PyErr_SetString(PyExc_TypeError, "integer pow() arg "
! 			     "3 must not be specified when arg 2 is < 0");
  			return NULL;
  		}
--- 1700,1705 ----
  		Py_DECREF(c);
  		if (x != Py_None) {
! 			PyErr_SetString(PyExc_TypeError, "pow() 2nd argument "
! 			     "cannot be negative when 3rd argument specified");
  			return NULL;
  		}