[Python-3000] MemoryError oddities

Nick Coghlan ncoghlan at gmail.com
Thu Jul 31 16:32:32 CEST 2008


Antoine Pitrou wrote:
> Perhaps a bit less legitimate but still :)
> 
>>>> r = range(n)
>>>> len(r)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> OverflowError: Python int too large to convert to C ssize_t
> 
> Speaking of which, http://bugs.python.org/issue2690 (« Precompute range length
> », which has the - positive, IMHO - side effect that range objects of length
> greater than sys.maxsize cannot be created at all) is still awaiting a
> resolution.

I think what your patch does is the correct fix for the current 3.0 
behaviour - it would probably be a good thing to get in before beta 3.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list