Lines Matching full:start
56 start, stop, and step are python objects with None indicating no
61 PySlice_New(PyObject *start, PyObject *stop, PyObject *step) in PySlice_New() argument
70 if (start == NULL) start = Py_None; in PySlice_New()
71 Py_INCREF(start); in PySlice_New()
76 obj->start = start; in PySlice_New()
86 PyObject *start, *end, *slice; in _PySlice_FromIndices() local
87 start = PyInt_FromSsize_t(istart); in _PySlice_FromIndices()
88 if (!start) in _PySlice_FromIndices()
92 Py_DECREF(start); in _PySlice_FromIndices()
96 slice = PySlice_New(start, end, NULL); in _PySlice_FromIndices()
97 Py_DECREF(start); in _PySlice_FromIndices()
104 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in PySlice_GetIndices() argument
113 if (r->start == Py_None) { in PySlice_GetIndices()
114 *start = *step < 0 ? length-1 : 0; in PySlice_GetIndices()
116 if (!_PyAnyInt_Check(r->start)) return -1; in PySlice_GetIndices()
117 *start = PyInt_AsSsize_t(r->start); in PySlice_GetIndices()
118 if (*start < 0) *start += length; in PySlice_GetIndices()
128 if (*start >= length) return -1; in PySlice_GetIndices()
135 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) in _PySlice_Unpack() argument
161 if (r->start == Py_None) { in _PySlice_Unpack()
162 *start = *step < 0 ? PY_SSIZE_T_MAX : 0; in _PySlice_Unpack()
165 if (!_PyEval_SliceIndex(r->start, start)) return -1; in _PySlice_Unpack()
180 Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) in _PySlice_AdjustIndices() argument
187 if (*start < 0) { in _PySlice_AdjustIndices()
188 *start += length; in _PySlice_AdjustIndices()
189 if (*start < 0) { in _PySlice_AdjustIndices()
190 *start = (step < 0) ? -1 : 0; in _PySlice_AdjustIndices()
193 else if (*start >= length) { in _PySlice_AdjustIndices()
194 *start = (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()
246 /* This swapping of stop and start is to maintain similarity with in slice_new()
249 stop = start; in slice_new()
250 start = NULL; in slice_new()
252 return PySlice_New(start, stop, step); in slice_new()
257 slice(start, stop[, step])\n\
266 Py_DECREF(r->start); in slice_dealloc()
278 PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); in slice_repr()
289 {"start", T_OBJECT, offsetof(PySliceObject, start), 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()
315 "S.indices(len) -> (start, stop, stride)\n\
317 Assuming a sequence of length len, calculate the start and stop\n\
325 return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); in slice_reduce()
346 if (PyObject_Cmp(v->start, w->start, &result) < 0) in slice_compare()
369 Py_VISIT(v->start); in slice_traverse()