summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-08 08:48:57 (GMT)
committerGitHub <noreply@github.com>2017-04-08 08:48:57 (GMT)
commite41390aca51e4e3eb455cf3b70f5d656a2814db9 (patch)
treee90f8b0b47ec38d5dc7871b4e5b0f944c46473a4 /Objects/unicodeobject.c
parent7f85947106aff5b1f166a57f644f987db4d38bf0 (diff)
downloadcpython-e41390aca51e4e3eb455cf3b70f5d656a2814db9.zip
cpython-e41390aca51e4e3eb455cf3b70f5d656a2814db9.tar.gz
cpython-e41390aca51e4e3eb455cf3b70f5d656a2814db9.tar.bz2
bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046)
(cherry picked from commit b879fe8)
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 7986d70..689529a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8008,10 +8008,11 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
Py_UNICODE* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (_PySlice_Unpack((PySliceObject *)item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = _PySlice_AdjustIndices(PyUnicode_GET_SIZE(self), &start,
+ &stop, step);
if (slicelength <= 0) {
return PyUnicode_FromUnicode(NULL, 0);