• Home
  • Raw
  • Download

Lines Matching refs:step

114 PySlice_New(PyObject *start, PyObject *stop, PyObject *step)  in PySlice_New()  argument
116 if (step == NULL) { in PySlice_New()
117 step = Py_None; in PySlice_New()
140 Py_INCREF(step); in PySlice_New()
141 obj->step = step; in PySlice_New()
172 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
176 if (r->step == Py_None) { in PySlice_GetIndices()
177 *step = 1; in PySlice_GetIndices()
179 if (!PyLong_Check(r->step)) return -1; in PySlice_GetIndices()
180 *step = PyLong_AsSsize_t(r->step); in PySlice_GetIndices()
183 *start = *step < 0 ? length-1 : 0; in PySlice_GetIndices()
190 *stop = *step < 0 ? -1 : length; in PySlice_GetIndices()
198 if (*step == 0) return -1; in PySlice_GetIndices()
204 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_Unpack() argument
211 if (r->step == Py_None) { in PySlice_Unpack()
212 *step = 1; in PySlice_Unpack()
215 if (!_PyEval_SliceIndex(r->step, step)) return -1; in PySlice_Unpack()
216 if (*step == 0) { in PySlice_Unpack()
226 if (*step < -PY_SSIZE_T_MAX) in PySlice_Unpack()
227 *step = -PY_SSIZE_T_MAX; in PySlice_Unpack()
231 *start = *step < 0 ? PY_SSIZE_T_MAX : 0; in PySlice_Unpack()
238 *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; in PySlice_Unpack()
249 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in PySlice_AdjustIndices() argument
253 assert(step != 0); in PySlice_AdjustIndices()
254 assert(step >= -PY_SSIZE_T_MAX); in PySlice_AdjustIndices()
259 *start = (step < 0) ? -1 : 0; in PySlice_AdjustIndices()
263 *start = (step < 0) ? length - 1 : length; in PySlice_AdjustIndices()
269 *stop = (step < 0) ? -1 : 0; in PySlice_AdjustIndices()
273 *stop = (step < 0) ? length - 1 : length; in PySlice_AdjustIndices()
276 if (step < 0) { in PySlice_AdjustIndices()
278 return (*start - *stop - 1) / (-step) + 1; in PySlice_AdjustIndices()
283 return (*stop - *start - 1) / step + 1; in PySlice_AdjustIndices()
293 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, in PySlice_GetIndicesEx() argument
296 if (PySlice_Unpack(_r, start, stop, step) < 0) in PySlice_GetIndicesEx()
298 *slicelength = PySlice_AdjustIndices(length, start, stop, *step); in PySlice_GetIndicesEx()
305 PyObject *start, *stop, *step; in slice_new() local
307 start = stop = step = NULL; in slice_new()
312 if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) in slice_new()
321 return PySlice_New(start, stop, step); in slice_new()
335 Py_DECREF(r->step); in slice_dealloc()
349 return PyUnicode_FromFormat("slice(%R, %R, %R)", r->start, r->stop, r->step); in slice_repr()
355 {"step", T_OBJECT, offsetof(PySliceObject, step), READONLY},
385 PyObject *start=NULL, *stop=NULL, *step=NULL; in _PySlice_GetLongIndices() local
390 if (self->step == Py_None) { in _PySlice_GetLongIndices()
391 step = _PyLong_GetOne(); in _PySlice_GetLongIndices()
392 Py_INCREF(step); in _PySlice_GetLongIndices()
397 step = evaluate_slice_index(self->step); in _PySlice_GetLongIndices()
398 if (step == NULL) in _PySlice_GetLongIndices()
400 step_sign = _PyLong_Sign(step); in _PySlice_GetLongIndices()
506 *step_ptr = step; in _PySlice_GetLongIndices()
515 Py_XDECREF(step); in _PySlice_GetLongIndices()
526 PyObject *start, *stop, *step; in slice_indices() local
542 error = _PySlice_GetLongIndices(self, length, &start, &stop, &step); in slice_indices()
547 return Py_BuildValue("(NNN)", start, stop, step); in slice_indices()
561 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
602 ((PySliceObject *)v)->step); in slice_richcompare()
610 ((PySliceObject *)w)->step); in slice_richcompare()
627 Py_VISIT(v->step); in slice_traverse()