summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.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/stringobject.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/stringobject.c')
-rw-r--r--Objects/stringobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 9b93898..ef4f8c1 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -1310,11 +1310,11 @@ string_subscript(PyStringObject* self, PyObject* item)
char* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item,
- PyString_GET_SIZE(self),
- &start, &stop, &step, &slicelength) < 0) {
+ if (_PySlice_Unpack((PySliceObject *)item, &start, &stop, &step) < 0) {
return NULL;
}
+ slicelength = _PySlice_AdjustIndices(PyString_GET_SIZE(self), &start,
+ &stop, step);
if (slicelength <= 0) {
return PyString_FromStringAndSize("", 0);