Issue #24284: The startswith and endswith methods of the str class no longer

return True when finding the empty string and the indexes are completely out
of range.
This commit is contained in:
Serhiy Storchaka 2015-05-31 09:16:13 +03:00
commit 442a894d1e
4 changed files with 17 additions and 3 deletions

View file

@ -9280,14 +9280,14 @@ tailmatch(PyObject *self,
PyUnicode_READY(substring) == -1)
return -1;
if (PyUnicode_GET_LENGTH(substring) == 0)
return 1;
ADJUST_INDICES(start, end, PyUnicode_GET_LENGTH(self));
end -= PyUnicode_GET_LENGTH(substring);
if (end < start)
return 0;
if (PyUnicode_GET_LENGTH(substring) == 0)
return 1;
kind_self = PyUnicode_KIND(self);
data_self = PyUnicode_DATA(self);
kind_sub = PyUnicode_KIND(substring);