File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3328,14 +3328,18 @@ loop_subscript(PyObject *v, PyObject *w)
33283328 return NULL ;
33293329}
33303330
3331- /* Extract a slice index from a PyInt or PyLong, the index is bound to
3332- the range [-INT_MAX+1, INTMAX]. Returns 0 and an exception if there is
3333- and error. Returns 1 on success.*/
3334-
3331+ /* Extract a slice index from a PyInt or PyLong, and store in *pi.
3332+ Silently reduce values larger than INT_MAX to INT_MAX, and silently
3333+ boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
3334+ */
3335+ /* XXX If v is NULL, this goes out of its way to indicate success(!), but
3336+ XXX doesn't store into *pi. Why isn't that an error, or at least v!=NULL
3337+ XXX an asserted precondition?
3338+ */
33353339int
33363340_PyEval_SliceIndex (PyObject * v , int * pi )
33373341{
3338- if (v != NULL ) {
3342+ if (v != NULL ) { /* XXX why isn't this assert(v != NULL()? */
33393343 long x ;
33403344 if (PyInt_Check (v )) {
33413345 x = PyInt_AsLong (v );
@@ -3362,7 +3366,8 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
33623366
33633367 /* Create a long integer with a value of 0 */
33643368 long_zero = PyLong_FromLong (0L );
3365- if (long_zero == NULL ) return 0 ;
3369+ if (long_zero == NULL )
3370+ return 0 ;
33663371
33673372 /* Check sign */
33683373 cmp = PyObject_RichCompareBool (v , long_zero ,
You can’t perform that action at this time.
0 commit comments