Skip to content

Commit 8174b4b

Browse files
committed
use allow_negative for Py_ssize_t in AC
1 parent eb2926d commit 8174b4b

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎Modules/clinic/itertoolsmodule.c.h‎

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

‎Modules/itertoolsmodule.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,26 +2094,20 @@ struct productobject {
20942094
@classmethod
20952095
itertools.product.__new__ as product_new
20962096
*iterables: array
2097-
repeat: Py_ssize_t = 1
2097+
repeat: Py_ssize_t(allow_negative=False) = 1
20982098
[clinic start generated code]*/
20992099

21002100
static PyObject *
21012101
product_new_impl(PyTypeObject *type, PyObject * const *iterables,
21022102
Py_ssize_t iterables_length, Py_ssize_t repeat)
2103-
/*[clinic end generated code: output=b0881d40e6be4c00 input=2d0325c612c678a1]*/
2103+
/*[clinic end generated code: output=b0881d40e6be4c00 input=189ab566d53a8ea9]*/
21042104
{
21052105
productobject *lz;
21062106
Py_ssize_t nargs, npools;
21072107
PyObject *pools = NULL;
21082108
Py_ssize_t *indices = NULL;
21092109
Py_ssize_t i;
21102110

2111-
if (repeat < 0) {
2112-
PyErr_SetString(PyExc_ValueError,
2113-
"repeat argument cannot be negative");
2114-
return NULL;
2115-
}
2116-
21172111
if (repeat == 0) {
21182112
nargs = 0;
21192113
} else {

0 commit comments

Comments
 (0)