diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-31 06:15:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-31 06:15:51 (GMT) |
commit | d4ea03c785d659576e0ae65c12fe5c03ada872d0 (patch) | |
tree | f1df6f933651ff70bb27a72f3cf518ed406844b9 /Objects | |
parent | 3d4a457663d5b211e9357bd2ccfd60e0b5d9e57b (diff) | |
download | cpython-d4ea03c785d659576e0ae65c12fe5c03ada872d0.zip cpython-d4ea03c785d659576e0ae65c12fe5c03ada872d0.tar.gz cpython-d4ea03c785d659576e0ae65c12fe5c03ada872d0.tar.bz2 |
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.
Diffstat (limited to 'Objects')
-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 84e67e6..1eaf2e9 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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); |