[Python-checkins] r76648 - python/trunk/Python/bltinmodule.c
mark.dickinson
python-checkins at python.org
Thu Dec 3 13:08:56 CET 2009
Author: mark.dickinson
Date: Thu Dec 3 13:08:56 2009
New Revision: 76648
Log:
Issue #6985: number of range() items should be constrained to lie
in a Py_ssize_t, not an int.
Modified:
python/trunk/Python/bltinmodule.c
Modified: python/trunk/Python/bltinmodule.c
==============================================================================
--- python/trunk/Python/bltinmodule.c (original)
+++ python/trunk/Python/bltinmodule.c Thu Dec 3 13:08:56 2009
@@ -1754,7 +1754,7 @@
PyObject *curnum = NULL;
PyObject *v = NULL;
long bign;
- int i, n;
+ Py_ssize_t i, n;
int cmp_result;
PyObject *zero = PyLong_FromLong(0);
@@ -1834,7 +1834,7 @@
Py_DECREF(neg_istep);
}
- n = (int)bign;
+ n = (Py_ssize_t)bign;
if (bign < 0 || (long)n != bign) {
PyErr_SetString(PyExc_OverflowError,
"range() result has too many items");
@@ -1914,7 +1914,7 @@
{
long ilow = 0, ihigh = 0, istep = 1;
long bign;
- int i, n;
+ Py_ssize_t i, n;
PyObject *v;
@@ -1943,7 +1943,7 @@
bign = get_len_of_range(ilow, ihigh, istep);
else
bign = get_len_of_range(ihigh, ilow, -istep);
- n = (int)bign;
+ n = (Py_ssize_t)bign;
if (bign < 0 || (long)n != bign) {
PyErr_SetString(PyExc_OverflowError,
"range() result has too many items");
More information about the Python-checkins
mailing list