Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 1729999..a071f20 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -314,3 +314,9 @@
test('__contains__', 'asdf', True, 'asdf') # vereq('asdf' in 'asdf', True)
test('__contains__', 'asd', False, 'asdf') # vereq('asdf' in 'asd', False)
test('__contains__', '', False, 'asdf') # vereq('asdf' in '', False)
+
+def run_inplace_tests(constructor):
+ # Verify clearing of SF bug #592573
+ s = t = constructor('abc')
+ s += constructor('def')
+ verify(s != t, 'in-place concatenate should create a new object')
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py
index c92f5f7..a30cdbd 100644
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -52,6 +52,7 @@
string_tests.run_module_tests(test)
string_tests.run_method_tests(test)
string_tests.run_contains_tests(test)
+string_tests.run_inplace_tests(str)
string.whitespace
string.lowercase
diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py
index 5492f2e..67fbb5c 100755
--- a/Lib/test/test_userstring.py
+++ b/Lib/test/test_userstring.py
@@ -42,3 +42,4 @@
string_tests.run_method_tests(test)
string_tests.run_contains_tests(test)
+string_tests.run_inplace_tests(UserString)