[Python-bugs-list] [ python-Bugs-422088 ] [OSF1 alpha] string.replace()
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 10 May 2001 03:45:03 -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: Closed
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: Michael Hudson (mwh)
Date: 2001-05-10 03:45
Message:
Logged In: YES
user_id=6656
I meant:
Python 2.2a0 (#3, May 10 2001, 07:57:08) [C] on osf1V4
Type "copyright", "credits" or "license" for more information.
>>> import strop
>>> strop.replace("123","123","")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
MemoryError
as I said, I thought this was expected, but thought I'd check (I
did put a comment in yesterday that explained what I meant more
thouroughly, but sf ate it).
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-05-10 02:02
Message:
Logged In: YES
user_id=31435
Sorry, don't know what "doesn't fix strop" means. What's
broken in strop? The test case didn't use strop (although
I mentioned stropmodule.c in a comment). Closing the bug
assuming this is some misunderstanding that's not worth the
time to straighten out <0.7 wink>; please re-open if you
think it is.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2001-05-10 00:11
Message:
Logged In: YES
user_id=6656
yep, fixes it. doesn't fix strop, but I think that's
deliberate?
----------------------------------------------------------------------
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