summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-12-03 12:08:56 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-12-03 12:08:56 (GMT)
commit3dc254181abe0297b917eefb591af92a4a90598e (patch)
treeca85e759a8f49f47fd79b58b4cd1c76a22fe324b /Python/bltinmodule.c
parent91c12ebc3dc6472ea486ab5e4aa38139283d48ad (diff)
downloadcpython-3dc254181abe0297b917eefb591af92a4a90598e.zip
cpython-3dc254181abe0297b917eefb591af92a4a90598e.tar.gz
cpython-3dc254181abe0297b917eefb591af92a4a90598e.tar.bz2
Issue #6985: number of range() items should be constrained to lie
in a Py_ssize_t, not an int.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 80fc9b4..b201aaf 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1754,7 +1754,7 @@ handle_range_longs(PyObject *self, PyObject *args)
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 @@ handle_range_longs(PyObject *self, PyObject *args)
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 @@ builtin_range(PyObject *self, PyObject *args)
{
long ilow = 0, ihigh = 0, istep = 1;
long bign;
- int i, n;
+ Py_ssize_t i, n;
PyObject *v;
@@ -1943,7 +1943,7 @@ builtin_range(PyObject *self, PyObject *args)
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");