Python and Industry, IBM I'm afraid

Fredrik Lundh fredrik at effbot.org
Thu Jan 18 17:07:59 EST 2001


Donn Cave wrote:
> But AIX's malloc is somewhat notorious for the converse:  request
> 0 bytes and get a null pointer.  I guess the rationale for this is
> something like "ask a silly question, get a silly answer", and it
> still does that to this day.

from SUSv2:

    "If the size of the space requested is 0, the
    behaviour is implementation-dependent; the
    value returned will be either a null pointer or
    a unique pointer."

(you can successfully store zero bytes at that location,
so what are you complaining about ;-)

and AIX isn't exactly alone here; thanks to a bug in PIL, I've
stumbled upon this on several platforms, including tru64.

    try:
        im = Image.new("L", (0, 0))
    except MemoryError:
        print "please upgrade to PIL 1.0 or later"

Cheers /F





More information about the Python-list mailing list