diff options
author | Guido van Rossum <guido@python.org> | 2002-08-20 17:29:29 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-20 17:29:29 +0000 |
commit | 76afbd9aa41bf34f488a7a1e759622c7f1830cff (patch) | |
tree | e4fb84ab073d0da8a668381b45dae2cb96c92c6a /Objects/unicodeobject.c | |
parent | c230b0e1f92bdc54318d58a07859bfcd7b03979a (diff) | |
download | cpython-git-76afbd9aa41bf34f488a7a1e759622c7f1830cff.tar.gz |
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.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 4ac12a0551..b2649365ae 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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) { |