mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
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:
commit
442a894d1e
4 changed files with 17 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue