[Python-checkins] CVS: python/dist/src/Python ceval.c,2.297,2.298
Tim Peters
tim_one@users.sourceforge.net
Sun, 16 Dec 2001 11:11:47 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv20774/python/Python
Modified Files:
ceval.c
Log Message:
_PyEval_SliceIndex(): Repaired the comments, and added XXX comments
about its dubious treatment of NULL (also opened a bug report on that,
but don't want to risk changing it this late in the 2.2 game).
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.297
retrieving revision 2.298
diff -C2 -d -r2.297 -r2.298
*** ceval.c 2001/12/13 19:51:53 2.297
--- ceval.c 2001/12/16 19:11:44 2.298
***************
*** 3329,3340 ****
}
! /* 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(PyObject *v, int *pi)
{
! if (v != NULL) {
long x;
if (PyInt_Check(v)) {
--- 3329,3344 ----
}
! /* Extract a slice index from a PyInt or PyLong, and store in *pi.
! Silently reduce values larger than INT_MAX to INT_MAX, and silently
! boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
! */
! /* XXX If v is NULL, this goes out of its way to indicate success(!), but
! XXX doesn't store into *pi. Why isn't that an error, or at least v!=NULL
! XXX an asserted precondition?
! */
int
_PyEval_SliceIndex(PyObject *v, int *pi)
{
! if (v != NULL) { /* XXX why isn't this assert(v != NULL()? */
long x;
if (PyInt_Check(v)) {
***************
*** 3363,3367 ****
/* Create a long integer with a value of 0 */
long_zero = PyLong_FromLong(0L);
! if (long_zero == NULL) return 0;
/* Check sign */
--- 3367,3372 ----
/* Create a long integer with a value of 0 */
long_zero = PyLong_FromLong(0L);
! if (long_zero == NULL)
! return 0;
/* Check sign */