[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.76,2.77

Fredrik Lundh fredrik@effbot.org
Thu, 10 May 2001 01:19:40 +0200


tim wrote:

> Modified Files:
> stropmodule.c 
> Log Message:
> SF bug #422088: [OSF1 alpha] string.replace().
> Platform blew up on "123".replace("123", "").  Michael Hudson pinned the
> blame on platform malloc(0) returning NULL.

any reason why the

#ifdef MALLOC_ZERO_RETURNS_NULL

macro (in pyport.h) isn't set / doesn't take care of this?

(and is it just me, or does the strop.replace function allocate
a buffer, copy the result to that buffer, only to copy it into a
string and throw the buffer away?  no wonder u"".replace() is
30% faster than "".replace() ;-)

Cheers /F