Lines Matching full:start
111 /* start, stop, and step are python objects with None indicating no
116 PySlice_New(PyObject *start, PyObject *stop, PyObject *step) in PySlice_New() argument
131 if (start == NULL) start = Py_None; in PySlice_New()
132 Py_INCREF(start); in PySlice_New()
137 obj->start = start; in PySlice_New()
147 PyObject *start, *end, *slice; in _PySlice_FromIndices() local
148 start = PyLong_FromSsize_t(istart); in _PySlice_FromIndices()
149 if (!start) in _PySlice_FromIndices()
153 Py_DECREF(start); in _PySlice_FromIndices()
157 slice = PySlice_New(start, end, NULL); in _PySlice_FromIndices()
158 Py_DECREF(start); in _PySlice_FromIndices()
165 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
175 if (r->start == Py_None) { in PySlice_GetIndices()
176 *start = *step < 0 ? length-1 : 0; in PySlice_GetIndices()
178 if (!PyLong_Check(r->start)) return -1; in PySlice_GetIndices()
179 *start = PyLong_AsSsize_t(r->start); in PySlice_GetIndices()
180 if (*start < 0) *start += length; in PySlice_GetIndices()
190 if (*start >= length) return -1; in PySlice_GetIndices()
197 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_Unpack() argument
223 if (r->start == Py_None) { in PySlice_Unpack()
224 *start = *step < 0 ? PY_SSIZE_T_MAX : 0; in PySlice_Unpack()
227 if (!_PyEval_SliceIndex(r->start, start)) return -1; in PySlice_Unpack()
242 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in PySlice_AdjustIndices() argument
249 if (*start < 0) { in PySlice_AdjustIndices()
250 *start += length; in PySlice_AdjustIndices()
251 if (*start < 0) { in PySlice_AdjustIndices()
252 *start = (step < 0) ? -1 : 0; in PySlice_AdjustIndices()
255 else if (*start >= length) { in PySlice_AdjustIndices()
256 *start = (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()
308 /* This swapping of stop and start is to maintain similarity with in slice_new()
311 stop = start; in slice_new()
312 start = NULL; in slice_new()
314 return PySlice_New(start, stop, step); in slice_new()
319 slice(start, stop[, step])\n\
328 Py_DECREF(r->start); in slice_dealloc()
339 return PyUnicode_FromFormat("slice(%R, %R, %R)", r->start, r->stop, r->step); in slice_repr()
343 {"start", T_OBJECT, offsetof(PySliceObject, start), READONLY},
375 PyObject *start=NULL, *stop=NULL, *step=NULL; in _PySlice_GetLongIndices() local
399 /* Find lower and upper bounds for start and stop. */ in _PySlice_GetLongIndices()
416 /* Compute start. */ in _PySlice_GetLongIndices()
417 if (self->start == Py_None) { in _PySlice_GetLongIndices()
418 start = step_is_negative ? upper : lower; in _PySlice_GetLongIndices()
419 Py_INCREF(start); in _PySlice_GetLongIndices()
422 start = evaluate_slice_index(self->start); in _PySlice_GetLongIndices()
423 if (start == NULL) in _PySlice_GetLongIndices()
426 if (_PyLong_Sign(start) < 0) { in _PySlice_GetLongIndices()
427 /* start += length */ in _PySlice_GetLongIndices()
428 PyObject *tmp = PyNumber_Add(start, length); in _PySlice_GetLongIndices()
429 Py_DECREF(start); in _PySlice_GetLongIndices()
430 start = tmp; in _PySlice_GetLongIndices()
431 if (start == NULL) in _PySlice_GetLongIndices()
434 cmp_result = PyObject_RichCompareBool(start, lower, Py_LT); in _PySlice_GetLongIndices()
439 Py_DECREF(start); in _PySlice_GetLongIndices()
440 start = lower; in _PySlice_GetLongIndices()
444 cmp_result = PyObject_RichCompareBool(start, upper, Py_GT); in _PySlice_GetLongIndices()
449 Py_DECREF(start); in _PySlice_GetLongIndices()
450 start = upper; in _PySlice_GetLongIndices()
494 *start_ptr = start; in _PySlice_GetLongIndices()
503 Py_XDECREF(start); 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()
541 "S.indices(len) -> (start, stop, stride)\n\
543 Assuming a sequence of length len, calculate the start and stop\n\
551 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
590 ((PySliceObject *)v)->start, in slice_richcompare()
598 ((PySliceObject *)w)->start, in slice_richcompare()
615 Py_VISIT(v->start); in slice_traverse()