Skip to content

Commit b8ad01f

Browse files
committed
Revert "rename islice parameters"
This reverts commit a984f39.
1 parent c826641 commit b8ad01f

2 files changed

Lines changed: 43 additions & 43 deletions

File tree

‎Modules/clinic/itertoolsmodule.c.h‎

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/itertoolsmodule.c‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,20 +1619,20 @@ typedef struct {
16191619
@classmethod
16201620
itertools.islice.__new__ as islice_new
16211621
iterable: object
1622-
start: object
1623-
stop: object(c_default="NULL") = None
1624-
step: object(c_default="NULL") = None
1622+
a1: object
1623+
a2: object(c_default="NULL") = None
1624+
a3: object(c_default="NULL") = None
16251625
/
16261626
[clinic start generated code]*/
16271627

16281628
static PyObject *
1629-
islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start,
1630-
PyObject *stop, PyObject *step)
1631-
/*[clinic end generated code: output=9291712502695467 input=33c4713c4aa2d211]*/
1629+
islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *a1,
1630+
PyObject *a2, PyObject *a3)
1631+
/*[clinic end generated code: output=7fa28024c01231db input=aac6a09144cead64]*/
16321632
{
16331633
PyObject *it = NULL;
1634-
Py_ssize_t start_val=0, stop_val=-1, step_val=1;
1635-
Py_ssize_t numargs = (stop == NULL) ? 2 : ((step == NULL) ? 3 : 4);
1634+
Py_ssize_t start=0, stop=-1, step=1;
1635+
Py_ssize_t numargs = (a2 == NULL) ? 2 : ((a3 == NULL) ? 3 : 4);
16361636
isliceobject *lz;
16371637

16381638
/* vectorcall passes borrowed references; hold strong references before
@@ -1643,9 +1643,9 @@ islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start,
16431643
Py_XINCREF(step);
16441644

16451645
if (numargs == 2) {
1646-
if (start != Py_None) {
1647-
stop_val = PyNumber_AsSsize_t(start, PyExc_OverflowError);
1648-
if (stop_val == -1) {
1646+
if (a1 != Py_None) {
1647+
stop = PyNumber_AsSsize_t(a1, PyExc_OverflowError);
1648+
if (stop == -1) {
16491649
if (PyErr_Occurred())
16501650
PyErr_Clear();
16511651
PyErr_SetString(PyExc_ValueError,
@@ -1655,13 +1655,13 @@ islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start,
16551655
}
16561656
}
16571657
} else {
1658-
if (start != Py_None)
1659-
start_val = PyNumber_AsSsize_t(start, PyExc_OverflowError);
1660-
if (start_val == -1 && PyErr_Occurred())
1658+
if (a1 != Py_None)
1659+
start = PyNumber_AsSsize_t(a1, PyExc_OverflowError);
1660+
if (start == -1 && PyErr_Occurred())
16611661
PyErr_Clear();
1662-
if (stop != Py_None) {
1663-
stop_val = PyNumber_AsSsize_t(stop, PyExc_OverflowError);
1664-
if (stop_val == -1) {
1662+
if (a2 != Py_None) {
1663+
stop = PyNumber_AsSsize_t(a2, PyExc_OverflowError);
1664+
if (stop == -1) {
16651665
if (PyErr_Occurred())
16661666
PyErr_Clear();
16671667
PyErr_SetString(PyExc_ValueError,
@@ -1671,20 +1671,20 @@ islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start,
16711671
}
16721672
}
16731673
}
1674-
if (start_val<0 || stop_val<-1) {
1674+
if (start<0 || stop<-1) {
16751675
PyErr_SetString(PyExc_ValueError,
16761676
"Indices for islice() must be None or "
16771677
"an integer: 0 <= x <= sys.maxsize.");
16781678
goto error;
16791679
}
16801680

1681-
if (step != NULL) {
1682-
if (step != Py_None)
1683-
step_val = PyNumber_AsSsize_t(step, PyExc_OverflowError);
1684-
if (step_val == -1 && PyErr_Occurred())
1681+
if (a3 != NULL) {
1682+
if (a3 != Py_None)
1683+
step = PyNumber_AsSsize_t(a3, PyExc_OverflowError);
1684+
if (step == -1 && PyErr_Occurred())
16851685
PyErr_Clear();
16861686
}
1687-
if (step_val<1) {
1687+
if (step<1) {
16881688
PyErr_SetString(PyExc_ValueError,
16891689
"Step for islice() must be a positive integer or None.");
16901690
goto error;
@@ -1701,9 +1701,9 @@ islice_new_impl(PyTypeObject *type, PyObject *iterable, PyObject *start,
17011701
goto error;
17021702
lz->it = it;
17031703
it = NULL;
1704-
lz->next = start_val;
1705-
lz->stop = stop_val;
1706-
lz->step = step_val;
1704+
lz->next = start;
1705+
lz->stop = stop;
1706+
lz->step = step;
17071707
lz->cnt = 0L;
17081708

17091709
Py_DECREF(iterable);

0 commit comments

Comments
 (0)