[Python-bugs-list] [ python-Bugs-422088 ] [OSF1 alpha] string.replace()

noreply@sourceforge.net noreply@sourceforge.net
Wed, 09 May 2001 16:01:51 -0700


Bugs item #422088, was updated on 2001-05-07 11:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=422088&group_id=5470

Category: Python Interpreter Core
Group: Platform-specific
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Martin Casado (martin_casado)
>Assigned to: Tim Peters (tim_one)
Summary: [OSF1 alpha] string.replace()

Initial Comment:
>>> import sys
>>> sys.version
'2.0c1 (#7, Jan 24 2001, 15:36:12) [C]'
>>> s = "123"
>>> s.replace("123","")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError
>>> os.uname()
('OSF1', 'xxx', 'V4.0', '1229', 'alpha')
>>> 


I haven't tried it with anything newer, perhaps this
bug
has already been posted and/or fixed, though I couldn't
find it in the buglist

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-05-09 16:01

Message:
Logged In: YES 
user_id=31435

Good eye, Michael!  I've checked in what I hope will be a 
fix:

Lib/test/string_tests.py new revision: 1.8
Modules/stropmodule.c new revision: 2.77

Please give that a try and let me know whether it fixes the 
problem on this box.


----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2001-05-08 07:51

Message:
Logged In: YES 
user_id=6656

FWIW, I can (a) reproduce this on alpha/OSF1 (recompiling
stringobject.c without optimizations makes no odds,
recompiling all of Python takes too long on this particular
alpha) (b) make it go away by replacing the call to
PyMem_MALLOC in mymemreplace with one to PyMem_Malloc.

The difference is that PyMem_Malloc(0) can't be NULL;
PyMem_MALLOC can.

So either do this, or check if new_len is zero and return
PyString_FromString("") or something (in mymemreplace).

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2001-05-08 00:34

Message:
Logged In: YES 
user_id=6656

FWIW, I can (a) reproduce this on alpha/OSF1 (recompiling
stringobject.c without optimizations makes no odds,
recompiling all of Python takes too long on this particular
alpha) (b) make it go away by replacing the call to
PyMem_MALLOC in mymemreplace with one to PyMem_Malloc.

The difference is that PyMem_Malloc(0) can't be NULL;
PyMem_MALLOC can.

So either do this, or check if new_len is zero and return
PyString_FromString("") or something (in mymemreplace).

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-05-07 19:58

Message:
Logged In: YES 
user_id=31435

Works for me.  Please try recompiling with optimization 
turned off.  If that makes the problem go away (seems 
likely to me), it's a platform compiler bug.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=422088&group_id=5470