Mark Dickinson dicki...@gmail.com added the comment:
I suspect the ints in builtin_range should have been changed to Py_ssize_t
when PEP 353 was implemented. I've fixed them in trunk in r76625; it
doesn't seem worth changing this in the 2.6 branch.
So on an LP64 machine with sufficient
Mark Dickinson dicki...@gmail.com added the comment:
Whoops. That revision number should have been r76648.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
New submission from Krzysztof Szawala kszaw...@slb.com:
range() method fails with the following error message:
Traceback (most recent call last):
File stdin, line 1, in module
OverflowError: range() result has too many items
when passing a valid integer value of 99.
This value is
Eric Smith e...@trueblade.com added the comment:
This doesn't crash the interpreter, so I'm changing it to behavior.
The number of items in a range() must fit into a native int.
What are you doing with the range? Could you use xrange instead?
--
nosy: +eric.smith
resolution: - wont
Mark Dickinson dicki...@gmail.com added the comment:
I *think* range uses long internally, so 99 should be okay on an
LP64 machine. Except that of course the range() result must also fit in
memory: on a 64-bit machine range(99) would need more than 300
Gb of memory. (That's 32
Mark Dickinson dicki...@gmail.com added the comment:
Might it make more sense for this range call to return a MemoryError
rather than an OverflowError, on 64-bit machines?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
Mark Dickinson dicki...@gmail.com added the comment:
Mark]
I *think* range uses long internally
Aargh! Sorry, Eric. I take it back. *xrange* uses longs internally
(and used to use ints once upon a time, IIRC), but there's a weird mix
of int and long in builtin_range that doesn't make any
Brett Cannon br...@python.org added the comment:
Both range and xrange were mucked with so much just before and during py3k
development that I am sure odd inconsistencies of what they use internally
are oversights.
--
nosy: +brett.cannon
___
Python