summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-08 08:18:14 (GMT)
committerGitHub <noreply@github.com>2017-04-08 08:18:14 (GMT)
commitc26b19d5c7aba51b50a4d7fb5f8291036cb9da24 (patch)
treeafe2017c8c588609b61527577666e340c36fe485 /Objects/unicodeobject.c
parentd0d575a6db8cb3b2a720be9f404af3d754da9a5d (diff)
downloadcpython-c26b19d5c7aba51b50a4d7fb5f8291036cb9da24.zip
cpython-c26b19d5c7aba51b50a4d7fb5f8291036cb9da24.tar.gz
cpython-c26b19d5c7aba51b50a4d7fb5f8291036cb9da24.tar.bz2
Expand the PySlice_GetIndicesEx macro. (#1023) (#1044)
(cherry picked from commit b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8)
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a5ae454..949205a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13915,10 +13915,11 @@ unicode_subscript(PyObject* self, PyObject* item)
int src_kind, dest_kind;
Py_UCS4 ch, max_char, kind_limit;
- if (PySlice_GetIndicesEx(item, PyUnicode_GET_LENGTH(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = PySlice_AdjustIndices(PyUnicode_GET_LENGTH(self),
+ &start, &stop, step);
if (slicelength <= 0) {
_Py_RETURN_UNICODE_EMPTY();