Code by Inyeol Lee, submitted to SF bug 595350, to implement
the string/unicode method .replace() with a zero-lengt first argument.
Inyeol contributed tests for this too.
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index a071f20..f2d6853 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -202,6 +202,10 @@
     test('replace', 'one!two!three!', 'one@two@three@', '!', '@')
     test('replace', 'one!two!three!', 'one!two!three!', 'x', '@')
     test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2)
+    test('replace', 'abc', '-a-b-c-', '', '-')
+    test('replace', 'abc', '-a-b-c', '', '-', 3)
+    test('replace', 'abc', 'abc', '', '-', 0)
+    test('replace', '', '', '', '')
     # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with
     # MemoryError due to empty result (platform malloc issue when requesting
     # 0 bytes).
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index bedb9d2..0c7def1 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -2996,10 +2996,6 @@
     except ValueError: pass
     else: raise TestFailed, "''.rindex('5') doesn't raise ValueError"
 
-    try: ''.replace('', '')
-    except ValueError: pass
-    else: raise TestFailed, "''.replace('', '') doesn't raise ValueError"
-
     try: '%(n)s' % None
     except TypeError: pass
     else: raise TestFailed, "'%(n)s' % None doesn't raise TypeError"
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 4efa39c..90147eb 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -210,12 +210,10 @@
 test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@')
 test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@')
 test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2)
-try:
-    u"abc".replace(u"", u"x")
-except ValueError:
-    pass
-else:
-    raise TestFailed, "u.replace('', ...) should raise ValueError"
+test('replace', u'abc', u'-a-b-c-', u'', u'-')
+test('replace', u'abc', u'-a-b-c', u'', u'-', 3)
+test('replace', u'abc', u'abc', u'', u'-', 0)
+test('replace', u'', u'', u'', u'')
 
 test('startswith', u'hello', True, u'he')
 test('startswith', u'hello', True, u'hello')