mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
(cherry picked from commit b879fe82e7
)
This commit is contained in:
parent
d0d575a6db
commit
c26b19d5c7
11 changed files with 47 additions and 45 deletions
|
@ -1715,10 +1715,10 @@ init_slice(Py_buffer *base, PyObject *key, int dim)
|
|||
{
|
||||
Py_ssize_t start, stop, step, slicelength;
|
||||
|
||||
if (PySlice_GetIndicesEx(key, base->shape[dim],
|
||||
&start, &stop, &step, &slicelength) < 0) {
|
||||
if (PySlice_Unpack(key, &start, &stop, &step) < 0) {
|
||||
return -1;
|
||||
}
|
||||
slicelength = PySlice_AdjustIndices(base->shape[dim], &start, &stop, step);
|
||||
|
||||
|
||||
if (base->suboffsets == NULL || dim == 0) {
|
||||
|
@ -1935,9 +1935,10 @@ slice_indices(PyObject *self, PyObject *args)
|
|||
"first argument must be a slice object");
|
||||
return NULL;
|
||||
}
|
||||
if (PySlice_GetIndicesEx(key, len, &s[0], &s[1], &s[2], &s[3]) < 0) {
|
||||
if (PySlice_Unpack(key, &s[0], &s[1], &s[2]) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
s[3] = PySlice_AdjustIndices(len, &s[0], &s[1], s[2]);
|
||||
|
||||
ret = PyTuple_New(4);
|
||||
if (ret == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue