[Python-bugs-list] [ python-Bugs-469681 ] Replace a whole string with empty string

noreply@sourceforge.net noreply@sourceforge.net
Tue, 09 Oct 2001 17:16:02 -0700


Bugs item #469681, was opened at 2001-10-09 14:36
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469681&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Tim Peters (tim_one)
Summary: Replace a whole string with empty string

Initial Comment:
Replaceing a whole string with an empty string is behaving differently in Unix and windows 
environment.  It raises a memory error in Unix as shown below:

UNIX RUN:
Python 2.1 (#18, May 24 2001, 14:56:32) [C] on osf1V4
Type "copyright", "credits" or "license" for more information.
>>> x = 'test'
>>> x.replace('test','')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError

The same test has passed in Windows environment:

PythonWin 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH@ActiveState.com) - see 'Help/About 
PythonWin' for further copyright information.
>>> x = 'test'
>>> x.replace('test','')
''
>>> x
'test'
>>> 


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

>Comment By: Tim Peters (tim_one)
Date: 2001-10-09 17:16

Message:
Logged In: YES 
user_id=31435

Closed as Duplicate:  this was the subject of bug 422088, 
and was indeed fixed in 2.1.1.  It varied across platforms 
because it depended on what the platform malloc returned 
when passed 0.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-09 16:20

Message:
Logged In: YES 
user_id=6380

I can't reproduce this either with Python 2.1.1.  I believe
it's been fixed there; can you try?

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

Comment By: M.-A. Lemburg (lemburg)
Date: 2001-10-09 15:08

Message:
Logged In: YES 
user_id=38388

I tried to reproduce this on Linux but did not succeed. Could this be a compiler optimization problem on the OSF 
system ? Does the same problem occur if you compile Python without optimization ?

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

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