Lines Matching refs:stop
61 PySlice_New(PyObject *start, PyObject *stop, PyObject *step) in PySlice_New() argument
72 if (stop == NULL) stop = Py_None; in PySlice_New()
73 Py_INCREF(stop); in PySlice_New()
77 obj->stop = stop; in PySlice_New()
104 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
120 if (r->stop == Py_None) { in PySlice_GetIndices()
121 *stop = *step < 0 ? -1 : length; in PySlice_GetIndices()
123 if (!_PyAnyInt_Check(r->stop)) return -1; in PySlice_GetIndices()
124 *stop = PyInt_AsSsize_t(r->stop); in PySlice_GetIndices()
125 if (*stop < 0) *stop += length; in PySlice_GetIndices()
127 if (*stop > length) return -1; in PySlice_GetIndices()
135 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in _PySlice_Unpack() argument
168 if (r->stop == Py_None) { in _PySlice_Unpack()
169 *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; in _PySlice_Unpack()
172 if (!_PyEval_SliceIndex(r->stop, stop)) return -1; in _PySlice_Unpack()
180 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in _PySlice_AdjustIndices() argument
197 if (*stop < 0) { in _PySlice_AdjustIndices()
198 *stop += length; in _PySlice_AdjustIndices()
199 if (*stop < 0) { in _PySlice_AdjustIndices()
200 *stop = (step < 0) ? -1 : 0; in _PySlice_AdjustIndices()
203 else if (*stop >= length) { in _PySlice_AdjustIndices()
204 *stop = (step < 0) ? length - 1 : length; in _PySlice_AdjustIndices()
208 if (*stop < *start) { in _PySlice_AdjustIndices()
209 return (*start - *stop - 1) / (-step) + 1; in _PySlice_AdjustIndices()
213 if (*start < *stop) { 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()
248 if (stop == NULL) { in slice_new()
249 stop = start; in slice_new()
252 return PySlice_New(start, stop, step); in slice_new()
267 Py_DECREF(r->stop); in slice_dealloc()
280 PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); in slice_repr()
290 {"stop", T_OBJECT, offsetof(PySliceObject, stop), 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()
350 if (PyObject_Cmp(v->stop, w->stop, &result) < 0) in slice_compare()
370 Py_VISIT(v->stop); in slice_traverse()