[Python-3000] MemoryError oddities
Antoine Pitrou
solipsis at pitrou.net
Thu Jul 31 10:26:27 CEST 2008
Guido van Rossum <guido <at> python.org> writes:
>
> FWIW, are there any legitimate occurrences of OverflowError in Py3k
> now that ints have unlimited range?
Legitimate:
>>> n = 2 ** 16384
>>> float(n)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C double
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.
Regards
Antoine.
More information about the Python-3000
mailing list