Lines Matching refs:step

61 PySlice_New(PyObject *start, PyObject *stop, PyObject *step)  in PySlice_New()  argument
68 if (step == NULL) step = Py_None; in PySlice_New()
69 Py_INCREF(step); in PySlice_New()
75 obj->step = step; in PySlice_New()
104 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
107 if (r->step == Py_None) { in PySlice_GetIndices()
108 *step = 1; in PySlice_GetIndices()
110 if (!_PyAnyInt_Check(r->step)) return -1; in PySlice_GetIndices()
111 *step = PyInt_AsSsize_t(r->step); in PySlice_GetIndices()
114 *start = *step < 0 ? length-1 : 0; in PySlice_GetIndices()
121 *stop = *step < 0 ? -1 : length; in PySlice_GetIndices()
129 if (*step == 0) return -1; in PySlice_GetIndices()
135 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in _PySlice_Unpack() argument
142 if (r->step == Py_None) { in _PySlice_Unpack()
143 *step = 1; in _PySlice_Unpack()
146 if (!_PyEval_SliceIndex(r->step, step)) return -1; in _PySlice_Unpack()
147 if (*step == 0) { in _PySlice_Unpack()
157 if (*step < -PY_SSIZE_T_MAX) in _PySlice_Unpack()
158 *step = -PY_SSIZE_T_MAX; in _PySlice_Unpack()
162 *start = *step < 0 ? PY_SSIZE_T_MAX : 0; in _PySlice_Unpack()
169 *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; in _PySlice_Unpack()
180 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in _PySlice_AdjustIndices() argument
184 assert(step != 0); in _PySlice_AdjustIndices()
185 assert(step >= -PY_SSIZE_T_MAX); in _PySlice_AdjustIndices()
190 *start = (step < 0) ? -1 : 0; in _PySlice_AdjustIndices()
194 *start = (step < 0) ? length - 1 : length; in _PySlice_AdjustIndices()
200 *stop = (step < 0) ? -1 : 0; in _PySlice_AdjustIndices()
204 *stop = (step < 0) ? length - 1 : length; in _PySlice_AdjustIndices()
207 if (step < 0) { in _PySlice_AdjustIndices()
209 return (*start - *stop - 1) / (-step) + 1; in _PySlice_AdjustIndices()
214 return (*stop - *start - 1) / step + 1; in _PySlice_AdjustIndices()
224 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, in PySlice_GetIndicesEx() argument
227 if (_PySlice_Unpack((PyObject *)r, start, stop, step) < 0) in PySlice_GetIndicesEx()
229 *slicelength = _PySlice_AdjustIndices(length, start, stop, *step); in PySlice_GetIndicesEx()
236 PyObject *start, *stop, *step; in slice_new() local
238 start = stop = step = NULL; in slice_new()
243 if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) in slice_new()
252 return PySlice_New(start, stop, step); in slice_new()
265 Py_DECREF(r->step); in slice_dealloc()
282 PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); in slice_repr()
291 {"step", T_OBJECT, offsetof(PySliceObject, step), READONLY},
298 Py_ssize_t ilen, start, stop, step; in slice_indices() local
306 if (_PySlice_Unpack((PyObject *)self, &start, &stop, &step) < 0) { in slice_indices()
309 _PySlice_AdjustIndices(ilen, &start, &stop, step); in slice_indices()
311 return Py_BuildValue("(nnn)", start, stop, step); in slice_indices()
325 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
354 if (PyObject_Cmp(v->step, w->step, &result) < 0) in slice_compare()
371 Py_VISIT(v->step); in slice_traverse()