Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Antoine Pitrou
Amaury Forgeot d'Arc gmail.com> writes: > > I corrected this with r65341. > But this prebuilt MemoryError has another nasty consequence: > when PyErr_NoMemory is raised, the traceback is attached to the > prebuilt object, > and all local variables of the failing procedure are still referenced > a

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Amaury Forgeot d'Arc
2008/7/21 Georg Brandl <[EMAIL PROTECTED]>: b"a"*sys.maxsize > Traceback (most recent call last): > File "", line 1, in > MemoryError > [41297 refs] b"a"*sys.maxsize > Traceback (most recent call last): > File "", line 1, in > File "", line 1, in > MemoryError > [41317 refs] b"

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Guido van Rossum
On Thu, Jul 31, 2008 at 10:32 AM, Neal Norwitz <[EMAIL PROTECTED]> wrote: > On Wed, Jul 30, 2008 at 9:36 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> On Tue, Jul 29, 2008 at 10:07 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> >> wrote: +1 OverflowErrors should probably by reserved for numer

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Neal Norwitz
On Wed, Jul 30, 2008 at 9:36 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Tue, Jul 29, 2008 at 10:07 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >>> +1 OverflowErrors should probably by reserved for numeric overflows. >> >> In a sense, passing sys.maxsize as a string size *is* a numeri

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Nick Coghlan
Antoine Pitrou wrote: Perhaps a bit less legitimate but still :) r = range(n) len(r) Traceback (most recent call last): File "", line 1, in OverflowError: Python int too large to convert to C ssize_t Speaking of which, http://bugs.python.org/issue2690 (« Precompute range length », which ha

Re: [Python-3000] MemoryError oddities

2008-07-31 Thread Antoine Pitrou
Guido van Rossum 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 "", line 1, in OverflowError: Python int too large to convert

Re: [Python-3000] MemoryError oddities

2008-07-30 Thread Benjamin Peterson
On Wed, Jul 30, 2008 at 11:36 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > FWIW, are there any legitimate occurrences of OverflowError in Py3k > now that ints have unlimited range? I believe not being able to convert an int to Py_ssize_t with PyNumber_AsSsize_t is a valid use. > > -- > --Gu

Re: [Python-3000] MemoryError oddities

2008-07-30 Thread Guido van Rossum
On Tue, Jul 29, 2008 at 10:07 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> +1 OverflowErrors should probably by reserved for numeric overflows. > > In a sense, passing sys.maxsize as a string size *is* a numeric > overflow - the size can't be represented in the available variable. I'm sure

Re: [Python-3000] MemoryError oddities

2008-07-29 Thread Martin v. Löwis
> +1 OverflowErrors should probably by reserved for numeric overflows. In a sense, passing sys.maxsize as a string size *is* a numeric overflow - the size can't be represented in the available variable. Regards, Martin ___ Python-3000 mailing list Pytho

Re: [Python-3000] MemoryError oddities

2008-07-29 Thread Benjamin Peterson
On Tue, Jul 29, 2008 at 7:05 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Did anyone come up with a fix for these? > > It's true that OverflowError and MemoryError are returned pretty > randomly when we detect that an allocation is not going to fit. I > think MemoryError is better though, so p

Re: [Python-3000] MemoryError oddities

2008-07-29 Thread Guido van Rossum
Did anyone come up with a fix for these? It's true that OverflowError and MemoryError are returned pretty randomly when we detect that an allocation is not going to fit. I think MemoryError is better though, so perhaps those uses of OverflowError should be fixed. I doubt that there are any apps (e

[Python-3000] MemoryError oddities

2008-07-21 Thread Georg Brandl
In a debug-build 3k, do this (32-bit machine): Python 3.0b2+ (py3k:65171M, Jul 21 2008, 20:08:20) [GCC 4.2.4 (Gentoo 4.2.4 p1.0)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> "a"*10 instinstTraceback (most recent call last): File "", line 1, in M