Kaydet (Commit) f4601d87 authored tarafından Kristján Valur Jónsson's avatar Kristján Valur Jónsson

Fix two problems that emerged when the testsuite was run with an x64 build: …

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.
üst b4c285a2
...@@ -2073,9 +2073,9 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds) ...@@ -2073,9 +2073,9 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject * static PyObject *
count_next(countobject *lz) count_next(countobject *lz)
{ {
if (lz->cnt == LONG_MAX) { if (lz->cnt == PY_SSIZE_T_MAX) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"cannot count beyond LONG_MAX"); "cannot count beyond PY_SSIZE_T_MAX");
return NULL; return NULL;
} }
return PyInt_FromSsize_t(lz->cnt++); return PyInt_FromSsize_t(lz->cnt++);
......
...@@ -893,7 +893,7 @@ _PyLong_FromSsize_t(Py_ssize_t ival) ...@@ -893,7 +893,7 @@ _PyLong_FromSsize_t(Py_ssize_t ival)
int one = 1; int one = 1;
return _PyLong_FromByteArray( return _PyLong_FromByteArray(
(unsigned char *)&bytes, (unsigned char *)&bytes,
SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0); SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1);
} }
/* Create a new long int object from a C size_t. */ /* Create a new long int object from a C size_t. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment