summaryrefslogtreecommitdiff
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-12-03 21:52:21 +0200
committerGitHub <noreply@github.com>2022-12-03 11:52:21 -0800
commita87c46eab3c306b1c5b8a072b7b30ac2c50651c0 (patch)
tree92c0ebdb6abd303ea967c0bd999d839a98f84494 /Modules/itertoolsmodule.c
parentc68573b339320409b038501fdd7d4f8a56766275 (diff)
downloadcpython-git-a87c46eab3c306b1c5b8a072b7b30ac2c50651c0.tar.gz
bpo-15999: Accept arbitrary values for boolean parameters. (#15609)
builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index e8b9bc76ee..7869d92bf3 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1368,12 +1368,12 @@ cycle_setstate(cycleobject *lz, PyObject *state)
PyErr_SetString(PyExc_TypeError, "state is not a tuple");
return NULL;
}
- if (!PyArg_ParseTuple(state, "O!i", &PyList_Type, &saved, &firstpass)) {
+ if (!PyArg_ParseTuple(state, "O!p", &PyList_Type, &saved, &firstpass)) {
return NULL;
}
Py_INCREF(saved);
Py_XSETREF(lz->saved, saved);
- lz->firstpass = firstpass != 0;
+ lz->firstpass = firstpass;
lz->index = 0;
Py_RETURN_NONE;
}