mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03: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:
parent
3d4a457663
commit
d4ea03c785
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