diff Objects/stringobject.c @ 24917:886686fc92a9 2.2

Fix some endcase bugs in unicode rfind()/rindex() and endswith(). These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug is already fixed in 2.3; I'll fix the others in 2.3 next.
author Guido van Rossum <guido@python.org>
date Tue, 20 Aug 2002 16:57:58 +0000
parents 9348fa20f214
children 651abcf63fe1
line wrap: on
line diff
--- a/Objects/stringobject.c	Tue Aug 20 13:58:12 2002 +0000
+++ b/Objects/stringobject.c	Tue Aug 20 16:57:58 2002 +0000
@@ -1303,7 +1303,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	else if (PyUnicode_Check(subobj))
-		return PyUnicode_Find((PyObject *)self, subobj, i, last, 1);
+		return PyUnicode_Find((PyObject *)self, subobj, i, last, dir);
 #endif
 	else if (PyObject_AsCharBuffer(subobj, &sub, &n))
 		return -2;
@@ -2145,7 +2145,7 @@
 	const char* prefix;
 	int plen;
 	int start = 0;
-	int end = -1;
+	int end = INT_MAX;
 	PyObject *subobj;
 
 	if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj,
@@ -2204,7 +2204,7 @@
 	const char* suffix;
 	int slen;
 	int start = 0;
-	int end = -1;
+	int end = INT_MAX;
 	int lower, upper;
 	PyObject *subobj;