[Python-checkins] commit of r41783 - in python/branches/ssize_t: Include/stringobject.h Objects/stringobject.c

martin.v.loewis python-checkins at python.org
Wed Dec 21 00:58:05 CET 2005


Author: martin.v.loewis
Date: Wed Dec 21 00:58:03 2005
New Revision: 41783

Modified:
   python/branches/ssize_t/Include/stringobject.h
   python/branches/ssize_t/Objects/stringobject.c
Log:
Use Py_ssize_t in most places.


Modified: python/branches/ssize_t/Include/stringobject.h
==============================================================================
--- python/branches/ssize_t/Include/stringobject.h	(original)
+++ python/branches/ssize_t/Include/stringobject.h	Wed Dec 21 00:58:03 2005
@@ -101,7 +101,7 @@
 
 PyAPI_FUNC(PyObject*) PyString_Decode(
     const char *s,              /* encoded string */
-    int size,                   /* size of buffer */
+    Py_ssize_t size,            /* size of buffer */
     const char *encoding,       /* encoding */
     const char *errors          /* error handling */
     );
@@ -111,7 +111,7 @@
 
 PyAPI_FUNC(PyObject*) PyString_Encode(
     const char *s,              /* string char buffer */
-    int size,                   /* number of chars to encode */
+    Py_ssize_t size,            /* number of chars to encode */
     const char *encoding,       /* encoding */
     const char *errors          /* error handling */
     );
@@ -171,7 +171,7 @@
 PyAPI_FUNC(int) PyString_AsStringAndSize(
     register PyObject *obj,	/* string or Unicode object */
     register char **s,		/* pointer to buffer variable */
-    register int *len		/* pointer to length variable or NULL
+    register Py_ssize_t *len	/* pointer to length variable or NULL
 				   (only possible for 0-terminated
 				   strings) */
     );

Modified: python/branches/ssize_t/Objects/stringobject.c
==============================================================================
--- python/branches/ssize_t/Objects/stringobject.c	(original)
+++ python/branches/ssize_t/Objects/stringobject.c	Wed Dec 21 00:58:03 2005
@@ -331,7 +331,7 @@
 
 
 PyObject *PyString_Decode(const char *s,
-			  int size,
+			  Py_ssize_t size,
 			  const char *encoding,
 			  const char *errors)
 {
@@ -411,7 +411,7 @@
 }
 
 PyObject *PyString_Encode(const char *s,
-			  int size,
+			  Py_ssize_t size,
 			  const char *encoding,
 			  const char *errors)
 {
@@ -543,7 +543,7 @@
 				PyObject *u, *w;
 				char *r;
 				const char* t;
-				int rn;
+				Py_ssize_t rn;
 				t = s;
 				/* Decode non-ASCII bytes as UTF-8. */
 				while (t < end && (*t & 0x80)) t++;
@@ -659,7 +659,7 @@
 		}
 	}
 	if (p-buf < newlen)
-		_PyString_Resize(&v, (int)(p - buf));
+		_PyString_Resize(&v, p - buf);
 	return v;
   failed:
 	Py_DECREF(v);
@@ -670,7 +670,7 @@
 string_getsize(register PyObject *op)
 {
     	char *s;
-    	int len;
+    	Py_ssize_t len;
 	if (PyString_AsStringAndSize(op, &s, &len))
 		return -1;
 	return len;
@@ -680,7 +680,7 @@
 string_getbuffer(register PyObject *op)
 {
     	char *s;
-    	int len;
+    	Py_ssize_t len;
 	if (PyString_AsStringAndSize(op, &s, &len))
 		return NULL;
 	return s;
@@ -705,7 +705,7 @@
 int
 PyString_AsStringAndSize(register PyObject *obj,
 			 register char **s,
-			 register int *len)
+			 register Py_ssize_t *len)
 {
 	if (s == NULL) {
 		PyErr_BadInternalCall();
@@ -732,7 +732,7 @@
 	*s = PyString_AS_STRING(obj);
 	if (len != NULL)
 		*len = PyString_GET_SIZE(obj);
-	else if ((int)strlen(*s) != PyString_GET_SIZE(obj)) {
+	else if (strlen(*s) != PyString_GET_SIZE(obj)) {
 		PyErr_SetString(PyExc_TypeError,
 				"expected string without null bytes");
 		return -1;
@@ -745,7 +745,7 @@
 static int
 string_print(PyStringObject *op, FILE *fp, int flags)
 {
-	int i;
+	Py_ssize_t i;
 	char c;
 	int quote;
 
@@ -810,7 +810,7 @@
 		return NULL;
 	}
 	else {
-		register int i;
+		register Py_ssize_t i;
 		register char c;
 		register char *p;
 		int quote;
@@ -918,8 +918,8 @@
 	PyObject_INIT_VAR(op, &PyString_Type, size);
 	op->ob_shash = -1;
 	op->ob_sstate = SSTATE_NOT_INTERNED;
-	memcpy(op->ob_sval, a->ob_sval, (int) a->ob_size);
-	memcpy(op->ob_sval + a->ob_size, b->ob_sval, (int) b->ob_size);
+	memcpy(op->ob_sval, a->ob_sval, a->ob_size);
+	memcpy(op->ob_sval + a->ob_size, b->ob_sval, b->ob_size);
 	op->ob_sval[size] = '\0';
 	return (PyObject *) op;
 #undef b
@@ -928,8 +928,8 @@
 static PyObject *
 string_repeat(register PyStringObject *a, register Py_ssize_t n)
 {
-	register int i;
-	register int j;
+	register Py_ssize_t i;
+	register Py_ssize_t j;
 	register Py_ssize_t size;
 	register PyStringObject *op;
 	size_t nbytes;
@@ -968,8 +968,8 @@
 	}
 	i = 0;
 	if (i < size) {
-		memcpy(op->ob_sval, a->ob_sval, (int) a->ob_size);
-		i = (int) a->ob_size;
+		memcpy(op->ob_sval, a->ob_sval, a->ob_size);
+		i = a->ob_size;
 	}
 	while (i < size) {
 		j = (i <= size-i)  ?  i  :  size-i;
@@ -999,7 +999,7 @@
 	}
 	if (j < i)
 		j = i;
-	return PyString_FromStringAndSize(a->ob_sval + i, (int) (j-i));
+	return PyString_FromStringAndSize(a->ob_sval + i, j-i);
 }
 
 static int
@@ -1008,7 +1008,7 @@
 	char *s = PyString_AS_STRING(a);
 	const char *sub = PyString_AS_STRING(el);
 	char *last;
-	int len_sub = PyString_GET_SIZE(el);
+	Py_ssize_t len_sub = PyString_GET_SIZE(el);
 	int shortsub;
 	char firstchar, lastchar;
 
@@ -1075,8 +1075,8 @@
 string_richcompare(PyStringObject *a, PyStringObject *b, int op)
 {
 	int c;
-	int len_a, len_b;
-	int min_len;
+	Py_ssize_t len_a, len_b;
+	Py_ssize_t min_len;
 	PyObject *result;
 
 	/* Make sure both arguments are strings. */
@@ -1148,7 +1148,7 @@
 static long
 string_hash(PyStringObject *a)
 {
-	register int len;
+	register Py_ssize_t len;
 	register unsigned char *p;
 	register long x;
 
@@ -1223,7 +1223,7 @@
 }
 
 static int
-string_buffer_getreadbuf(PyStringObject *self, int index, const void **ptr)
+string_buffer_getreadbuf(PyStringObject *self, /*XXX*/int index, const void **ptr)
 {
 	if ( index != 0 ) {
 		PyErr_SetString(PyExc_SystemError,
@@ -1322,9 +1322,9 @@
 		Py_DECREF(str);
 
 static PyObject *
-split_whitespace(const char *s, int len, int maxsplit)
+split_whitespace(const char *s, Py_ssize_t len, int maxsplit)
 {
-	int i, j;
+	Py_ssize_t i, j;
 	PyObject *str;
 	PyObject *list = PyList_New(0);
 
@@ -1356,9 +1356,9 @@
 }
 
 static PyObject *
-split_char(const char *s, int len, char ch, int maxcount)
+split_char(const char *s, Py_ssize_t len, char ch, int maxcount)
 {
-	register int i, j;
+	register Py_ssize_t i, j;
 	PyObject *str;
 	PyObject *list = PyList_New(0);
 
@@ -1395,7 +1395,8 @@
 static PyObject *
 string_split(PyStringObject *self, PyObject *args)
 {
-	int len = PyString_GET_SIZE(self), n, i, j, err;
+	Py_ssize_t len = PyString_GET_SIZE(self), n, i, j;
+	int err;
 	int maxsplit = -1;
 	const char *s = PyString_AS_STRING(self), *sub;
 	PyObject *list, *item, *subobj = Py_None;
@@ -1433,7 +1434,7 @@
 		if (s[i] == sub[0] && memcmp(s+i, sub, n) == 0) {
 			if (maxsplit-- <= 0)
 				break;
-			item = PyString_FromStringAndSize(s+j, (int)(i-j));
+			item = PyString_FromStringAndSize(s+j, i-j);
 			if (item == NULL)
 				goto fail;
 			err = PyList_Append(list, item);
@@ -1445,7 +1446,7 @@
 		else
 			i++;
 	}
-	item = PyString_FromStringAndSize(s+j, (int)(len-j));
+	item = PyString_FromStringAndSize(s+j, len-j);
 	if (item == NULL)
 		goto fail;
 	err = PyList_Append(list, item);
@@ -1461,9 +1462,9 @@
 }
 
 static PyObject *
-rsplit_whitespace(const char *s, int len, int maxsplit)
+rsplit_whitespace(const char *s, Py_ssize_t len, int maxsplit)
 {
-	int i, j;
+	Py_ssize_t i, j;
 	PyObject *str;
 	PyObject *list = PyList_New(0);
 
@@ -1495,9 +1496,9 @@
 }
 
 static PyObject *
-rsplit_char(const char *s, int len, char ch, int maxcount)
+rsplit_char(const char *s, Py_ssize_t len, char ch, int maxcount)
 {
-	register int i, j;
+	register Py_ssize_t i, j;
 	PyObject *str;
 	PyObject *list = PyList_New(0);
 
@@ -1535,7 +1536,8 @@
 static PyObject *
 string_rsplit(PyStringObject *self, PyObject *args)
 {
-	int len = PyString_GET_SIZE(self), n, i, j, err;
+	Py_ssize_t len = PyString_GET_SIZE(self), n, i, j;
+	int err;
 	int maxsplit = -1;
 	const char *s = PyString_AS_STRING(self), *sub;
 	PyObject *list, *item, *subobj = Py_None;
@@ -1574,7 +1576,7 @@
 		if (s[i] == sub[0] && memcmp(s+i, sub, n) == 0) {
 			if (maxsplit-- <= 0)
 				break;
-			item = PyString_FromStringAndSize(s+i+n, (int)(j-i-n));
+			item = PyString_FromStringAndSize(s+i+n, j-i-n);
 			if (item == NULL)
 				goto fail;
 			err = PyList_Insert(list, 0, item);
@@ -1613,12 +1615,12 @@
 string_join(PyStringObject *self, PyObject *orig)
 {
 	char *sep = PyString_AS_STRING(self);
-	const int seplen = PyString_GET_SIZE(self);
+	const Py_ssize_t seplen = PyString_GET_SIZE(self);
 	PyObject *res = NULL;
 	char *p;
-	int seqlen = 0;
+	Py_ssize_t seqlen = 0;
 	size_t sz = 0;
-	int i;
+	Py_ssize_t i;
 	PyObject *seq, *item;
 
 	seq = PySequence_Fast(orig, "");
@@ -1666,7 +1668,7 @@
 			PyErr_Format(PyExc_TypeError,
 				     "sequence item %i: expected string,"
 				     " %.80s found",
-				     i, item->ob_type->tp_name);
+				     /*XXX*/(int)i, item->ob_type->tp_name);
 			Py_DECREF(seq);
 			return NULL;
 		}
@@ -1682,7 +1684,7 @@
 	}
 
 	/* Allocate result space. */
-	res = PyString_FromStringAndSize((char*)NULL, (int)sz);
+	res = PyString_FromStringAndSize((char*)NULL, sz);
 	if (res == NULL) {
 		Py_DECREF(seq);
 		return NULL;
@@ -1715,7 +1717,7 @@
 }
 
 static void
-string_adjust_indices(int *start, int *end, int len)
+string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len)
 {
 	if (*end > len)
 		*end = len;
@@ -1729,12 +1731,12 @@
 		*start = 0;
 }
 
-static long
+static Py_ssize_t
 string_find_internal(PyStringObject *self, PyObject *args, int dir)
 {
 	const char *s = PyString_AS_STRING(self), *sub;
-	int len = PyString_GET_SIZE(self);
-	int n, i = 0, last = INT_MAX;
+	Py_ssize_t len = PyString_GET_SIZE(self);
+	Py_ssize_t n, i = 0, last = INT_MAX;
 	PyObject *subobj;
 
 	/* XXX ssize_t i */
@@ -1763,13 +1765,13 @@
 				return (long)i;
 	}
 	else {
-		int j;
+		Py_ssize_t j;
 
         	if (n == 0 && i <= last)
-			return (long)last;
+			return last;
 		for (j = last-n; j >= i; --j)
 			if (s[j] == sub[0] && memcmp(&s[j], sub, n) == 0)
-				return (long)j;
+				return j;
 	}
 
 	return -1;
@@ -1788,10 +1790,10 @@
 static PyObject *
 string_find(PyStringObject *self, PyObject *args)
 {
-	long result = string_find_internal(self, args, +1);
+	Py_ssize_t result = string_find_internal(self, args, +1);
 	if (result == -2)
 		return NULL;
-	return PyInt_FromLong(result);
+	return PyInt_FromSsize_t(result);
 }
 
 
@@ -1803,7 +1805,7 @@
 static PyObject *
 string_index(PyStringObject *self, PyObject *args)
 {
-	long result = string_find_internal(self, args, +1);
+	Py_ssize_t result = string_find_internal(self, args, +1);
 	if (result == -2)
 		return NULL;
 	if (result == -1) {
@@ -1811,7 +1813,7 @@
 				"substring not found");
 		return NULL;
 	}
-	return PyInt_FromLong(result);
+	return PyInt_FromSsize_t(result);
 }
 
 
@@ -1827,10 +1829,10 @@
 static PyObject *
 string_rfind(PyStringObject *self, PyObject *args)
 {
-	long result = string_find_internal(self, args, -1);
+	Py_ssize_t result = string_find_internal(self, args, -1);
 	if (result == -2)
 		return NULL;
-	return PyInt_FromLong(result);
+	return PyInt_FromSsize_t(result);
 }
 
 
@@ -1842,7 +1844,7 @@
 static PyObject *
 string_rindex(PyStringObject *self, PyObject *args)
 {
-	long result = string_find_internal(self, args, -1);
+	Py_ssize_t result = string_find_internal(self, args, -1);
 	if (result == -2)
 		return NULL;
 	if (result == -1) {
@@ -1850,7 +1852,7 @@
 				"substring not found");
 		return NULL;
 	}
-	return PyInt_FromLong(result);
+	return PyInt_FromSsize_t(result);
 }
 
 
@@ -1858,10 +1860,10 @@
 do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj)
 {
 	char *s = PyString_AS_STRING(self);
-	int len = PyString_GET_SIZE(self);
+	Py_ssize_t len = PyString_GET_SIZE(self);
 	char *sep = PyString_AS_STRING(sepobj);
-	int seplen = PyString_GET_SIZE(sepobj);
-	int i, j;
+	Py_ssize_t seplen = PyString_GET_SIZE(sepobj);
+	Py_ssize_t i, j;
 
 	i = 0;
 	if (striptype != RIGHTSTRIP) {
@@ -1891,7 +1893,7 @@
 do_strip(PyStringObject *self, int striptype)
 {
 	char *s = PyString_AS_STRING(self);
-	int len = PyString_GET_SIZE(self), i, j;
+	Py_ssize_t len = PyString_GET_SIZE(self), i, j;
 
 	i = 0;
 	if (striptype != RIGHTSTRIP) {
@@ -2018,7 +2020,7 @@
 string_lower(PyStringObject *self)
 {
 	char *s = PyString_AS_STRING(self), *s_new;
-	int i, n = PyString_GET_SIZE(self);
+	Py_ssize_t i, n = PyString_GET_SIZE(self);
 	PyObject *new;
 
 	new = PyString_FromStringAndSize(NULL, n);
@@ -2046,7 +2048,7 @@
 string_upper(PyStringObject *self)
 {
 	char *s = PyString_AS_STRING(self), *s_new;
-	int i, n = PyString_GET_SIZE(self);
+	Py_ssize_t i, n = PyString_GET_SIZE(self);
 	PyObject *new;
 
 	new = PyString_FromStringAndSize(NULL, n);
@@ -2075,7 +2077,7 @@
 string_title(PyStringObject *self)
 {
 	char *s = PyString_AS_STRING(self), *s_new;
-	int i, n = PyString_GET_SIZE(self);
+	Py_ssize_t i, n = PyString_GET_SIZE(self);
 	int previous_is_cased = 0;
 	PyObject *new;
 
@@ -2110,7 +2112,7 @@
 string_capitalize(PyStringObject *self)
 {
 	char *s = PyString_AS_STRING(self), *s_new;
-	int i, n = PyString_GET_SIZE(self);
+	Py_ssize_t i, n = PyString_GET_SIZE(self);
 	PyObject *new;
 
 	new = PyString_FromStringAndSize(NULL, n);
@@ -2148,9 +2150,9 @@
 string_count(PyStringObject *self, PyObject *args)
 {
 	const char *s = PyString_AS_STRING(self), *sub, *t;
-	int len = PyString_GET_SIZE(self), n;
-	int i = 0, last = INT_MAX;
-	int m, r;
+	Py_ssize_t len = PyString_GET_SIZE(self), n;
+	Py_ssize_t i = 0, last = INT_MAX;
+	Py_ssize_t m, r;
 	PyObject *subobj;
 
 	if (!PyArg_ParseTuple(args, "O|O&O&:count", &subobj,
@@ -2163,7 +2165,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	else if (PyUnicode_Check(subobj)) {
-		int count;
+		Py_ssize_t count;
 		count = PyUnicode_Count((PyObject *)self, subobj, i, last);
 		if (count == -1)
 			return NULL;
@@ -2178,7 +2180,7 @@
 
 	m = last + 1 - n;
 	if (n == 0)
-		return PyInt_FromLong((long) (m-i));
+		return PyInt_FromSsize_t(m-i);
 
 	r = 0;
 	while (i < m) {
@@ -2195,7 +2197,7 @@
 			break;
 		i = t - s;
 	}
-	return PyInt_FromLong((long) r);
+	return PyInt_FromSsize_t(r);
 }
 
 PyDoc_STRVAR(swapcase__doc__,
@@ -2208,7 +2210,7 @@
 string_swapcase(PyStringObject *self)
 {
 	char *s = PyString_AS_STRING(self), *s_new;
-	int i, n = PyString_GET_SIZE(self);
+	Py_ssize_t i, n = PyString_GET_SIZE(self);
 	PyObject *new;
 
 	new = PyString_FromStringAndSize(NULL, n);
@@ -2244,10 +2246,10 @@
 {
 	register char *input, *output;
 	register const char *table;
-	register int i, c, changed = 0;
+	register Py_ssize_t i, c, changed = 0;
 	PyObject *input_obj = (PyObject*)self;
 	const char *table1, *output_start, *del_table=NULL;
-	int inlen, tablen, dellen = 0;
+	Py_ssize_t inlen, tablen, dellen = 0;
 	PyObject *result;
 	int trans_table[256];
 	PyObject *tableobj, *delobj = NULL;
@@ -2361,10 +2363,10 @@
   found, or -1 if not found.  If len of PAT is greater than length of
   MEM, the function returns -1.
 */
-static int
-mymemfind(const char *mem, int len, const char *pat, int pat_len)
+static Py_ssize_t
+mymemfind(const char *mem, Py_ssize_t len, const char *pat, Py_ssize_t pat_len)
 {
-	register int ii;
+	register Py_ssize_t ii;
 
 	/* pattern can not occur in the last pat_len-1 chars */
 	len -= pat_len;
@@ -2384,11 +2386,11 @@
    meaning mem=1111 and pat==11 returns 2.
            mem=11111 and pat==11 also return 2.
  */
-static int
-mymemcnt(const char *mem, int len, const char *pat, int pat_len)
+static Py_ssize_t
+mymemcnt(const char *mem, Py_ssize_t len, const char *pat, Py_ssize_t pat_len)
 {
-	register int offset = 0;
-	int nfound = 0;
+	register Py_ssize_t offset = 0;
+	Py_ssize_t nfound = 0;
 
 	while (len >= 0) {
 		offset = mymemfind(mem, len, pat, pat_len);
@@ -2421,15 +2423,15 @@
        NULL if an error occurred.
 */
 static char *
-mymemreplace(const char *str, int len,		/* input string */
-             const char *pat, int pat_len,	/* pattern string to find */
-             const char *sub, int sub_len,	/* substitution string */
-             int count,				/* number of replacements */
-	     int *out_len)
+mymemreplace(const char *str, Py_ssize_t len,		/* input string */
+             const char *pat, Py_ssize_t pat_len,	/* pattern string to find */
+             const char *sub, Py_ssize_t sub_len,	/* substitution string */
+             Py_ssize_t count,				/* number of replacements */
+	     Py_ssize_t *out_len)
 {
 	char *out_s;
 	char *new_s;
-	int nfound, offset, new_len;
+	Py_ssize_t nfound, offset, new_len;
 
 	if (len == 0 || (pat_len == 0 && sub_len == 0) || pat_len > len)
 		goto return_same;
@@ -2512,8 +2514,8 @@
 {
 	const char *str = PyString_AS_STRING(self), *sub, *repl;
 	char *new_s;
-	const int len = PyString_GET_SIZE(self);
-	int sub_len, repl_len, out_len;
+	const Py_ssize_t len = PyString_GET_SIZE(self);
+	Py_ssize_t sub_len, repl_len, out_len;
 	int count = -1;
 	PyObject *new;
 	PyObject *subobj, *replobj;
@@ -2582,11 +2584,11 @@
 string_startswith(PyStringObject *self, PyObject *args)
 {
 	const char* str = PyString_AS_STRING(self);
-	int len = PyString_GET_SIZE(self);
+	Py_ssize_t len = PyString_GET_SIZE(self);
 	const char* prefix;
-	int plen;
-	int start = 0;
-	int end = INT_MAX;
+	Py_ssize_t plen;
+	Py_ssize_t start = 0;
+	Py_ssize_t end = INT_MAX;
 	PyObject *subobj;
 
 	if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj,
@@ -2598,7 +2600,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	else if (PyUnicode_Check(subobj)) {
-	    	int rc;
+	    	Py_ssize_t rc;
 		rc = PyUnicode_Tailmatch((PyObject *)self,
 					  subobj, start, end, -1);
 		if (rc == -1)
@@ -2633,11 +2635,11 @@
 string_endswith(PyStringObject *self, PyObject *args)
 {
 	const char* str = PyString_AS_STRING(self);
-	int len = PyString_GET_SIZE(self);
+	Py_ssize_t len = PyString_GET_SIZE(self);
 	const char* suffix;
-	int slen;
-	int start = 0;
-	int end = INT_MAX;
+	Py_ssize_t slen;
+	Py_ssize_t start = 0;
+	Py_ssize_t end = INT_MAX;
 	PyObject *subobj;
 
 	if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj,
@@ -2649,7 +2651,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	else if (PyUnicode_Check(subobj)) {
-	    	int rc;
+	    	Py_ssize_t rc;
 		rc = PyUnicode_Tailmatch((PyObject *)self,
 					  subobj, start, end, +1);
 		if (rc == -1)
@@ -2760,7 +2762,7 @@
 {
     const char *e, *p;
     char *q;
-    int i, j;
+    Py_ssize_t i, j;
     PyObject *u;
     int tabsize = 8;
 
@@ -2811,7 +2813,7 @@
 }
 
 static PyObject *
-pad(PyStringObject *self, int left, int right, char fill)
+pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill)
 {
     PyObject *u;
 
@@ -3213,9 +3215,9 @@
 static PyObject*
 string_splitlines(PyStringObject *self, PyObject *args)
 {
-    register int i;
-    register int j;
-    int len;
+    register Py_ssize_t i;
+    register Py_ssize_t j;
+    Py_ssize_t len;
     int keepends = 0;
     PyObject *list;
     PyObject *str;
@@ -3344,7 +3346,7 @@
 str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	PyObject *tmp, *pnew;
-	int n;
+	Py_ssize_t n;
 
 	assert(PyType_IsSubtype(type, &PyString_Type));
 	tmp = string_new(&PyString_Type, args, kwds);
@@ -3659,7 +3661,7 @@
 {
 	PyObject *result = NULL;
 	char *buf;
-	int i;
+	Py_ssize_t i;
 	int sign;	/* 1 if '-', else 0 */
 	int len;	/* number of characters */
 	int numdigits;	/* len == numnondigits + numdigits */


More information about the Python-checkins mailing list