summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-31 09:15:51 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-31 09:15:51 +0300
commit8f56565544be60dc94d92e2244a456eb36c991de (patch)
tree496b356071c1716b0a7b49a52646f5c481c2ea92 /Objects/unicodeobject.c
parent7e2a108bcf33d9f8c9412bb44dcd496457266123 (diff)
downloadcpython-8f56565544be60dc94d92e2244a456eb36c991de.tar.gz
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/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 84e67e6f28..1eaf2e977d 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);