Skip to content

Commit cb3866f

Browse files
fix: avoid overflow
1 parent 9f1b3a6 commit cb3866f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/itertoolsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ islice_length_hint(PyObject *op, PyObject *Py_UNUSED(dummy))
16851685
return PyLong_FromSsize_t(0);
16861686
}
16871687

1688-
Py_ssize_t steps = (remaining + lz->step - 1) / lz->step;
1688+
Py_ssize_t steps = 1 + (remaining - 1) / lz->step;
16891689
return PyLong_FromSsize_t(steps);
16901690
}
16911691

0 commit comments

Comments
 (0)