[issue6985] range() fails with long integers

2009-12-03 Thread Mark Dickinson

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 memory, range(2**31) should now 
work.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-12-03 Thread Mark Dickinson

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
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Krzysztof Szawala

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 obtained from OptParse command-line option as a valid 
ingeter.

Applies to both Windows and Linux (32 and 64-bit).

--
components: Interpreter Core
messages: 93063
nosy: kszawala
severity: normal
status: open
title: range() fails with long integers
type: crash
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Eric Smith

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 fix
status: open - closed
type: crash - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Mark Dickinson

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 bytes per entry:  24 bytes for each integer
and 8 bytes for the list pointer.)

--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Mark Dickinson

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
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Mark Dickinson

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 sense to me.  I
suspect it's historical, and may have to do both with the xrange
int-long switch and the int - Py_ssize_t switch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6985] range() fails with long integers

2009-09-24 Thread Brett Cannon

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 tracker rep...@bugs.python.org
http://bugs.python.org/issue6985
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com