[Python-checkins] r43562 - python/trunk/Objects/sliceobject.c

neal.norwitz python-checkins at python.org
Mon Apr 3 06:46:05 CEST 2006


Author: neal.norwitz
Date: Mon Apr  3 06:46:04 2006
New Revision: 43562

Modified:
   python/trunk/Objects/sliceobject.c
Log:
Use Py_ssize_t in slices

Modified: python/trunk/Objects/sliceobject.c
==============================================================================
--- python/trunk/Objects/sliceobject.c	(original)
+++ python/trunk/Objects/sliceobject.c	Mon Apr  3 06:46:04 2006
@@ -107,20 +107,20 @@
 		*step = 1;
 	} else {
 		if (!PyInt_Check(r->step)) return -1;
-		*step = PyInt_AsLong(r->step);
+		*step = PyInt_AsSsize_t(r->step);
 	}
 	if (r->start == Py_None) {
 		*start = *step < 0 ? length-1 : 0;
 	} else {
 		if (!PyInt_Check(r->start)) return -1;
-		*start = PyInt_AsLong(r->start);
+		*start = PyInt_AsSsize_t(r->start);
 		if (*start < 0) *start += length;
 	}
 	if (r->stop == Py_None) {
 		*stop = *step < 0 ? -1 : length;
 	} else {
 		if (!PyInt_Check(r->stop)) return -1;
-		*stop = PyInt_AsLong(r->stop);
+		*stop = PyInt_AsSsize_t(r->stop);
 		if (*stop < 0) *stop += length;
 	}
 	if (*stop > length) return -1;
@@ -252,7 +252,7 @@
 {
 	Py_ssize_t ilen, start, stop, step, slicelength;
 
-	ilen = PyInt_AsLong(len);
+	ilen = PyInt_AsSsize_t(len);
 
 	if (ilen == -1 && PyErr_Occurred()) {
 		return NULL;
@@ -263,7 +263,7 @@
 		return NULL;
 	}
 
-	return Py_BuildValue("(iii)", start, stop, step);
+	return Py_BuildValue("(nnn)", start, stop, step);
 }
 
 PyDoc_STRVAR(slice_indices_doc,


More information about the Python-checkins mailing list