Fix two problems that emerged when the testsuite was run with an x64 build: PyLong_FromSSize_t incorrectly assumed an unsigned object, and itertools.count() had the wrong upper limit for the iterator.
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 70f787f..31f20c7 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -2073,9 +2073,9 @@
static PyObject *
count_next(countobject *lz)
{
- if (lz->cnt == LONG_MAX) {
+ if (lz->cnt == PY_SSIZE_T_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "cannot count beyond LONG_MAX");
+ "cannot count beyond PY_SSIZE_T_MAX");
return NULL;
}
return PyInt_FromSsize_t(lz->cnt++);