summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 2d496b5..b52f349 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1691,6 +1691,9 @@ repeat_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args, "O|l:repeat", &element, &cnt))
return NULL;
+ if (PyTuple_Size(args) == 2 && cnt < 0)
+ cnt = 0;
+
ro = (repeatobject *)type->tp_alloc(type, 0);
if (ro == NULL)
return NULL;