Index: Misc/NEWS =================================================================== --- Misc/NEWS (revision 63753) +++ Misc/NEWS (working copy) @@ -63,6 +63,9 @@ Library ------- +- The UserString.MutableString class has been deprecated for removal + in Python 3.0. + - Do not close external file objects passed to tarfile.open(mode='w:bz2') when the TarFile is closed. Index: Doc/library/userdict.rst =================================================================== --- Doc/library/userdict.rst (revision 63753) +++ Doc/library/userdict.rst (working copy) @@ -154,6 +154,11 @@ string or Unicode objects; this is especially the case for :class:`MutableString`. +.. warning:: + + In 3.0, :class:`MutableString` has been removed. Also, :class:`UserString` + has been moved to the :mod:`collections` module. + The :mod:`UserString` module defines the following classes: @@ -178,6 +183,9 @@ mutable object as dictionary key, which would be otherwise very error prone and hard to track down. + .. deprecated:: 2.6 + The :class:`MutableString` class has been removed in Python 3.0. + In addition to supporting the methods and operations of string and Unicode objects (see section :ref:`string-methods`), :class:`UserString` instances provide the following attribute: Index: Lib/UserString.py =================================================================== --- Lib/UserString.py (revision 63753) +++ Lib/UserString.py (working copy) @@ -7,6 +7,7 @@ """ import sys import collections +from warnings import warnpy3k __all__ = ["UserString","MutableString"] @@ -146,6 +147,8 @@ A faster and better solution is to rewrite your program using lists.""" def __init__(self, string=""): + warnpy3k("the MutableString class has been removed in Python 3.0", + stacklevel=2) self.data = string def __hash__(self): raise TypeError, "unhashable type (it is mutable)" Index: Lib/test/test_py3kwarn.py =================================================================== --- Lib/test/test_py3kwarn.py (revision 63753) +++ Lib/test/test_py3kwarn.py (working copy) @@ -219,6 +219,12 @@ func = getattr(commands, name) self.assertRaises(DeprecationWarning, func, *([None]*arg_count)) + def test_userstring_mutablestring(self): + import UserString + with catch_warning(record=False): + warnings.filterwarnings("error") + self.assertRaises(DeprecationWarning, UserString.MutableString) + def test_main(): with catch_warning(record=True): Index: Lib/test/test_userstring.py =================================================================== --- Lib/test/test_userstring.py (revision 63753) +++ Lib/test/test_userstring.py (working copy) @@ -7,6 +7,9 @@ from UserString import UserString, MutableString +from warnings import filterwarnings +filterwarnings("ignore", "the MutableString class", DeprecationWarning) + class UserStringTest( string_tests.CommonTest, string_tests.MixinStrUnicodeUserStringTest,