mirror of
https://github.com/python/cpython.git
synced 2025-10-05 22:51:56 +00:00
(cherry picked from commit b879fe82e7
)
This commit is contained in:
parent
ae0915e42d
commit
fa25f16a44
11 changed files with 47 additions and 45 deletions
|
@ -1534,11 +1534,11 @@ bytes_subscript(PyBytesObject* self, PyObject* item)
|
|||
char* result_buf;
|
||||
PyObject* result;
|
||||
|
||||
if (PySlice_GetIndicesEx(item,
|
||||
PyBytes_GET_SIZE(self),
|
||||
&start, &stop, &step, &slicelength) < 0) {
|
||||
if (PySlice_Unpack(item, &start, &stop, &step) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
slicelength = PySlice_AdjustIndices(PyBytes_GET_SIZE(self), &start,
|
||||
&stop, step);
|
||||
|
||||
if (slicelength <= 0) {
|
||||
return PyBytes_FromStringAndSize("", 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue