[Python-checkins] CVS: python/dist/src/Python ceval.c,2.178,2.179

Guido van Rossum python-dev@python.org
Mon, 8 May 2000 10:06:53 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Python
In directory eric:/projects/python/develop/guido/src/Python
Modified Files:
	ceval.c 
Log Message:
Trent Mick:
Change static slice_index() to extern _PyEval_SliceIndex() (with
different return value interpretation: 0 for failure, 1 for success).
Index: ceval.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/ceval.c,v
retrieving revision 2.178
retrieving revision 2.179
diff -C2 -r2.178 -r2.179
*** ceval.c	2000年05月04日 00:55:17	2.178
--- ceval.c	2000年05月08日 14:06:50	2.179
***************
*** 81,85 ****
 static PyObject *call_function Py_PROTO((PyObject *, PyObject *, PyObject *));
 static PyObject *loop_subscript Py_PROTO((PyObject *, PyObject *));
- static int slice_index Py_PROTO((PyObject *, int *));
 static PyObject *apply_slice Py_PROTO((PyObject *, PyObject *, PyObject *));
 static int assign_slice Py_PROTO((PyObject *, PyObject *,
--- 81,84 ----
***************
*** 2588,2593 ****
 }
 
! static int
! slice_index(v, pi)
 	PyObject *v;
 	int *pi;
--- 2587,2596 ----
 }
 
! /* Extract a slice index from a PyInt or PyLong, the index is bound to
! the range [-INT_MAX+1, INTMAX]. Returns 0 and an exception if there is
! and error. Returns 1 on success.*/
! 
! int
! _PyEval_SliceIndex(v, pi)
 	PyObject *v;
 	int *pi;
***************
*** 2605,2609 ****
 					/* It's not an overflow error, so just 
 					 signal an error */
! 					return -1;
 				}
 
--- 2608,2612 ----
 					/* It's not an overflow error, so just 
 					 signal an error */
! 					return 0;
 				}
 
***************
*** 2615,2619 ****
 				/* Create a long integer with a value of 0 */
 				long_zero = PyLong_FromLong( 0L );
! 				if (long_zero == NULL) return -1;
 
 				/* Check sign */
--- 2618,2622 ----
 				/* Create a long integer with a value of 0 */
 				long_zero = PyLong_FromLong( 0L );
! 				if (long_zero == NULL) return 0;
 
 				/* Check sign */
***************
*** 2631,2635 ****
 			PyErr_SetString(PyExc_TypeError,
 					"slice index must be int");
! 			return -1;
 		}
 		/* Truncate -- very long indices are truncated anyway */
--- 2634,2638 ----
 			PyErr_SetString(PyExc_TypeError,
 					"slice index must be int");
! 			return 0;
 		}
 		/* Truncate -- very long indices are truncated anyway */
***************
*** 2640,2644 ****
 		*pi = x;
 	}
! 	return 0;
 }
 
--- 2643,2647 ----
 		*pi = x;
 	}
! 	return 1;
 }
 
***************
*** 2648,2654 ****
 {
 	int ilow = 0, ihigh = INT_MAX;
! 	if (slice_index(v, &ilow) != 0)
 		return NULL;
! 	if (slice_index(w, &ihigh) != 0)
 		return NULL;
 	return PySequence_GetSlice(u, ilow, ihigh);
--- 2651,2657 ----
 {
 	int ilow = 0, ihigh = INT_MAX;
! 	if (!_PyEval_SliceIndex(v, &ilow))
 		return NULL;
! 	if (!_PyEval_SliceIndex(w, &ihigh))
 		return NULL;
 	return PySequence_GetSlice(u, ilow, ihigh);
***************
*** 2660,2666 ****
 {
 	int ilow = 0, ihigh = INT_MAX;
! 	if (slice_index(v, &ilow) != 0)
 		return -1;
! 	if (slice_index(w, &ihigh) != 0)
 		return -1;
 	if (x == NULL)
--- 2663,2669 ----
 {
 	int ilow = 0, ihigh = INT_MAX;
! 	if (!_PyEval_SliceIndex(v, &ilow))
 		return -1;
! 	if (!_PyEval_SliceIndex(w, &ihigh))
 		return -1;
 	if (x == NULL)

AltStyle によって変換されたページ (->オリジナル) /