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 was already fixed in 2.3, but this adds some more test
cases.
This commit is contained in:
Guido van Rossum 2002-08-20 17:29:29 +00:00
parent c230b0e1f9
commit 76afbd9aa4
4 changed files with 11 additions and 4 deletions

View file

@ -2891,9 +2891,6 @@ int findstring(PyUnicodeObject *self,
if (start < 0)
start = 0;
if (substring->length == 0)
return start;
if (end > self->length)
end = self->length;
if (end < 0)
@ -2901,6 +2898,9 @@ int findstring(PyUnicodeObject *self,
if (end < 0)
end = 0;
if (substring->length == 0)
return (direction > 0) ? start : end;
end -= substring->length;
if (direction < 0) {