Lines Matching full:stop

112 /* start, stop, and step are python objects with None indicating no
117 PySlice_New(PyObject *start, PyObject *stop, PyObject *step) in PySlice_New() argument
134 if (stop == NULL) stop = Py_None; in PySlice_New()
135 Py_INCREF(stop); in PySlice_New()
139 obj->stop = stop; in PySlice_New()
166 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
183 if (r->stop == Py_None) { in PySlice_GetIndices()
184 *stop = *step < 0 ? -1 : length; in PySlice_GetIndices()
186 if (!PyLong_Check(r->stop)) return -1; in PySlice_GetIndices()
187 *stop = PyLong_AsSsize_t(r->stop); in PySlice_GetIndices()
188 if (*stop < 0) *stop += length; in PySlice_GetIndices()
190 if (*stop > length) return -1; in PySlice_GetIndices()
198 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_Unpack() argument
231 if (r->stop == Py_None) { in PySlice_Unpack()
232 *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; in PySlice_Unpack()
235 if (!_PyEval_SliceIndex(r->stop, stop)) return -1; in PySlice_Unpack()
243 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in PySlice_AdjustIndices() argument
260 if (*stop < 0) { in PySlice_AdjustIndices()
261 *stop += length; in PySlice_AdjustIndices()
262 if (*stop < 0) { in PySlice_AdjustIndices()
263 *stop = (step < 0) ? -1 : 0; in PySlice_AdjustIndices()
266 else if (*stop >= length) { in PySlice_AdjustIndices()
267 *stop = (step < 0) ? length - 1 : length; in PySlice_AdjustIndices()
271 if (*stop < *start) { in PySlice_AdjustIndices()
272 return (*start - *stop - 1) / (-step) + 1; in PySlice_AdjustIndices()
276 if (*start < *stop) { in PySlice_AdjustIndices()
277 return (*stop - *start - 1) / step + 1; in PySlice_AdjustIndices()
287 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, in PySlice_GetIndicesEx() argument
290 if (PySlice_Unpack(_r, start, stop, step) < 0) in PySlice_GetIndicesEx()
292 *slicelength = PySlice_AdjustIndices(length, start, stop, *step); in PySlice_GetIndicesEx()
299 PyObject *start, *stop, *step; in slice_new() local
301 start = stop = step = NULL; in slice_new()
306 if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) in slice_new()
309 /* This swapping of stop and start is to maintain similarity with in slice_new()
311 if (stop == NULL) { in slice_new()
312 stop = start; in slice_new()
315 return PySlice_New(start, stop, step); in slice_new()
319 "slice(stop)\n\
320 slice(start, stop[, step])\n\
330 Py_DECREF(r->stop); in slice_dealloc()
340 return PyUnicode_FromFormat("slice(%R, %R, %R)", r->start, r->stop, r->step); in slice_repr()
345 {"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY},
376 PyObject *start=NULL, *stop=NULL, *step=NULL; in _PySlice_GetLongIndices() local
400 /* Find lower and upper bounds for start and stop. */ in _PySlice_GetLongIndices()
456 /* Compute stop. */ in _PySlice_GetLongIndices()
457 if (self->stop == Py_None) { in _PySlice_GetLongIndices()
458 stop = step_is_negative ? lower : upper; in _PySlice_GetLongIndices()
459 Py_INCREF(stop); in _PySlice_GetLongIndices()
462 stop = evaluate_slice_index(self->stop); in _PySlice_GetLongIndices()
463 if (stop == NULL) in _PySlice_GetLongIndices()
466 if (_PyLong_Sign(stop) < 0) { in _PySlice_GetLongIndices()
467 /* stop += length */ in _PySlice_GetLongIndices()
468 PyObject *tmp = PyNumber_Add(stop, length); in _PySlice_GetLongIndices()
469 Py_DECREF(stop); in _PySlice_GetLongIndices()
470 stop = tmp; in _PySlice_GetLongIndices()
471 if (stop == NULL) in _PySlice_GetLongIndices()
474 cmp_result = PyObject_RichCompareBool(stop, lower, Py_LT); in _PySlice_GetLongIndices()
479 Py_DECREF(stop); in _PySlice_GetLongIndices()
480 stop = lower; in _PySlice_GetLongIndices()
484 cmp_result = PyObject_RichCompareBool(stop, upper, Py_GT); in _PySlice_GetLongIndices()
489 Py_DECREF(stop); in _PySlice_GetLongIndices()
490 stop = upper; in _PySlice_GetLongIndices()
496 *stop_ptr = stop; in _PySlice_GetLongIndices()
505 Py_XDECREF(stop); in _PySlice_GetLongIndices()
517 PyObject *start, *stop, *step; in slice_indices() local
533 error = _PySlice_GetLongIndices(self, length, &start, &stop, &step); in slice_indices()
538 return Py_BuildValue("(NNN)", start, stop, step); in slice_indices()
542 "S.indices(len) -> (start, stop, stride)\n\
544 Assuming a sequence of length len, calculate the start and stop\n\
552 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
592 ((PySliceObject *)v)->stop, in slice_richcompare()
600 ((PySliceObject *)w)->stop, in slice_richcompare()
617 Py_VISIT(v->stop); in slice_traverse()