Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 24918:0d5d8e1cdc22 legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 20 Aug 2002 17:29:29 +0000 |
| parents | a602e4878b4e |
| children | 762dd09edb83 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Tue Aug 20 15:43:16 2002 +0000 +++ b/Objects/unicodeobject.c Tue Aug 20 17:29:29 2002 +0000 @@ -2891,9 +2891,6 @@ 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 @@ if (end < 0) end = 0; + if (substring->length == 0) + return (direction > 0) ? start : end; + end -= substring->length; if (direction < 0) {
