* Added a substantial number of edge case and argument tests for
the itertoolsmodule.
* Taught itertools.repeat(obj, n) to treat negative repeat counts as
zero. This behavior matches that for sequences and prevents
infinite loops.
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 @@
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;