Lines Matching refs:stop

116 PySlice_New(PyObject *start, PyObject *stop, PyObject *step)  in PySlice_New()  argument
133 if (stop == NULL) stop = Py_None; in PySlice_New()
134 Py_INCREF(stop); in PySlice_New()
138 obj->stop = stop; in PySlice_New()
165 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
182 if (r->stop == Py_None) { in PySlice_GetIndices()
183 *stop = *step < 0 ? -1 : length; in PySlice_GetIndices()
185 if (!PyLong_Check(r->stop)) return -1; in PySlice_GetIndices()
186 *stop = PyLong_AsSsize_t(r->stop); in PySlice_GetIndices()
187 if (*stop < 0) *stop += length; in PySlice_GetIndices()
189 if (*stop > length) return -1; in PySlice_GetIndices()
197 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_Unpack() argument
230 if (r->stop == Py_None) { in PySlice_Unpack()
231 *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; in PySlice_Unpack()
234 if (!_PyEval_SliceIndex(r->stop, stop)) return -1; in PySlice_Unpack()
242 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in PySlice_AdjustIndices() argument
259 if (*stop < 0) { in PySlice_AdjustIndices()
260 *stop += length; in PySlice_AdjustIndices()
261 if (*stop < 0) { in PySlice_AdjustIndices()
262 *stop = (step < 0) ? -1 : 0; in PySlice_AdjustIndices()
265 else if (*stop >= length) { in PySlice_AdjustIndices()
266 *stop = (step < 0) ? length - 1 : length; in PySlice_AdjustIndices()
270 if (*stop < *start) { in PySlice_AdjustIndices()
271 return (*start - *stop - 1) / (-step) + 1; in PySlice_AdjustIndices()
275 if (*start < *stop) { in PySlice_AdjustIndices()
276 return (*stop - *start - 1) / step + 1; in PySlice_AdjustIndices()
286 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, in PySlice_GetIndicesEx() argument
289 if (PySlice_Unpack(_r, start, stop, step) < 0) in PySlice_GetIndicesEx()
291 *slicelength = PySlice_AdjustIndices(length, start, stop, *step); in PySlice_GetIndicesEx()
298 PyObject *start, *stop, *step; in slice_new() local
300 start = stop = step = NULL; in slice_new()
305 if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) in slice_new()
310 if (stop == NULL) { in slice_new()
311 stop = start; in slice_new()
314 return PySlice_New(start, stop, step); in slice_new()
329 Py_DECREF(r->stop); in slice_dealloc()
339 return PyUnicode_FromFormat("slice(%R, %R, %R)", r->start, r->stop, r->step); in slice_repr()
344 {"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY},
375 PyObject *start=NULL, *stop=NULL, *step=NULL; in _PySlice_GetLongIndices() local
456 if (self->stop == Py_None) { in _PySlice_GetLongIndices()
457 stop = step_is_negative ? lower : upper; in _PySlice_GetLongIndices()
458 Py_INCREF(stop); in _PySlice_GetLongIndices()
461 stop = evaluate_slice_index(self->stop); in _PySlice_GetLongIndices()
462 if (stop == NULL) in _PySlice_GetLongIndices()
465 if (_PyLong_Sign(stop) < 0) { in _PySlice_GetLongIndices()
467 PyObject *tmp = PyNumber_Add(stop, length); in _PySlice_GetLongIndices()
468 Py_DECREF(stop); in _PySlice_GetLongIndices()
469 stop = tmp; in _PySlice_GetLongIndices()
470 if (stop == NULL) in _PySlice_GetLongIndices()
473 cmp_result = PyObject_RichCompareBool(stop, lower, Py_LT); in _PySlice_GetLongIndices()
478 Py_DECREF(stop); in _PySlice_GetLongIndices()
479 stop = lower; in _PySlice_GetLongIndices()
483 cmp_result = PyObject_RichCompareBool(stop, upper, Py_GT); in _PySlice_GetLongIndices()
488 Py_DECREF(stop); in _PySlice_GetLongIndices()
489 stop = upper; in _PySlice_GetLongIndices()
495 *stop_ptr = stop; in _PySlice_GetLongIndices()
504 Py_XDECREF(stop); in _PySlice_GetLongIndices()
516 PyObject *start, *stop, *step; in slice_indices() local
532 error = _PySlice_GetLongIndices(self, length, &start, &stop, &step); in slice_indices()
537 return Py_BuildValue("(NNN)", start, stop, step); in slice_indices()
551 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
591 ((PySliceObject *)v)->stop, in slice_richcompare()
599 ((PySliceObject *)w)->stop, in slice_richcompare()
616 Py_VISIT(v->stop); in slice_traverse()