Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line

  Silence Coverity false alerts with CIDs #172, #183, #184
........
  r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines

  Fix an edge case whereby the __del__() method of a classic class could
  create a new weakref to the object.
........
  r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line

  Better variable name in an example.
........
  r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines

  This got fixed for classic classes in r60057,
  and backported to 2.5.2 in 60056.
........
  r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines

  Several tweaks: add construction from strings and .from_decimal(), change
  __init__ to __new__ to enforce immutability, and remove "rational." from repr
  and the parens from str.
........
  r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines

  Fix markup.
........
  r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines

  Amend curses docs by info how to write non-ascii characters.
  Thanks to Jeroen Ruigrok van der Werven.
........
  r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines

  Indentation normalization.
........
  r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines


  Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
  just-created (and empty) instance.  Added tests for this. Thanks
  Jonathan Share.
........
  r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line

  Polish sentence
........
  r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line

  Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
  r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line

  Update for threading.local test.
........
  r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line

  Polish sentence
........
  r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines

  Fix typos.
........
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index cbc9c6b..d138d23 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -579,8 +579,8 @@
 customize a prototype instance::
 
     >>> Account = namedtuple('Account', 'owner balance transaction_count')
-    >>> model_account = Account('<owner name>', 0.0, 0)
-    >>> johns_account = model_account._replace(owner='John')
+    >>> default_account = Account('<owner name>', 0.0, 0)
+    >>> johns_account = default_account._replace(owner='John')
 
 .. rubric:: Footnotes
 
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
index 07ccc55..7f82bca 100644
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -16,6 +16,19 @@
 designed to match the API of ncurses, an open-source curses library hosted on
 Linux and the BSD variants of Unix.
 
+.. note::
+
+   Since version 5.4, the ncurses library decides how to interpret non-ASCII data
+   using the ``nl_langinfo`` function.  That means that you have to call
+   :func:`locale.setlocale` in the application and encode Unicode strings
+   using one of the system's available encodings.  This example uses the
+   system's default encoding::
+
+      import locale
+      locale.setlocale(locale.LC_ALL, '')
+      code = locale.getpreferredencoding()
+
+   Then use *code* as the encoding for :meth:`str.encode` calls.
 
 .. seealso::
 
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 258bb0a..923d9f2 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1179,65 +1179,65 @@
 also illustrates what dict-like behaviour is needed from an arbitrary
 "dict-like" object for use in the constructor::
 
-import logging
-
-class ConnInfo:
-    """
-    An example class which shows how an arbitrary class can be used as
-    the 'extra' context information repository passed to a LoggerAdapter.
-    """
-
-    def __getitem__(self, name):
-        """
-        To allow this instance to look like a dict.
-        """
-        from random import choice
-        if name == "ip":
-            result = choice(["127.0.0.1", "192.168.0.1"])
-        elif name == "user":
-            result = choice(["jim", "fred", "sheila"])
-        else:
-            result = self.__dict__.get(name, "?")
-        return result
-
-    def __iter__(self):
-        """
-        To allow iteration over keys, which will be merged into
-        the LogRecord dict before formatting and output.
-        """
-        keys = ["ip", "user"]
-        keys.extend(self.__dict__.keys())
-        return keys.__iter__()
-
-if __name__ == "__main__":
-    from random import choice
-    levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
-    a1 = logging.LoggerAdapter(logging.getLogger("a.b.c"),
-                               { "ip" : "123.231.231.123", "user" : "sheila" })
-    logging.basicConfig(level=logging.DEBUG,
-                        format="%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s")
-    a1.debug("A debug message")
-    a1.info("An info message with %s", "some parameters")
-    a2 = logging.LoggerAdapter(logging.getLogger("d.e.f"), ConnInfo())
-    for x in range(10):
-        lvl = choice(levels)
-        lvlname = logging.getLevelName(lvl)
-        a2.log(lvl, "A message at %s level with %d %s", lvlname, 2, "parameters")
+   import logging
+   
+   class ConnInfo:
+       """
+       An example class which shows how an arbitrary class can be used as
+       the 'extra' context information repository passed to a LoggerAdapter.
+       """
+   
+       def __getitem__(self, name):
+           """
+           To allow this instance to look like a dict.
+           """
+           from random import choice
+           if name == "ip":
+               result = choice(["127.0.0.1", "192.168.0.1"])
+           elif name == "user":
+               result = choice(["jim", "fred", "sheila"])
+           else:
+               result = self.__dict__.get(name, "?")
+           return result
+   
+       def __iter__(self):
+           """
+           To allow iteration over keys, which will be merged into
+           the LogRecord dict before formatting and output.
+           """
+           keys = ["ip", "user"]
+           keys.extend(self.__dict__.keys())
+           return keys.__iter__()
+   
+   if __name__ == "__main__":
+       from random import choice
+       levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
+       a1 = logging.LoggerAdapter(logging.getLogger("a.b.c"),
+                                  { "ip" : "123.231.231.123", "user" : "sheila" })
+       logging.basicConfig(level=logging.DEBUG,
+                           format="%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s")
+       a1.debug("A debug message")
+       a1.info("An info message with %s", "some parameters")
+       a2 = logging.LoggerAdapter(logging.getLogger("d.e.f"), ConnInfo())
+       for x in range(10):
+           lvl = choice(levels)
+           lvlname = logging.getLevelName(lvl)
+           a2.log(lvl, "A message at %s level with %d %s", lvlname, 2, "parameters")
 
 When this script is run, the output should look something like this::
 
-2008-01-18 14:49:54,023 a.b.c DEBUG    IP: 123.231.231.123 User: sheila   A debug message
-2008-01-18 14:49:54,023 a.b.c INFO     IP: 123.231.231.123 User: sheila   An info message with some parameters
-2008-01-18 14:49:54,023 d.e.f CRITICAL IP: 192.168.0.1     User: jim      A message at CRITICAL level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f INFO     IP: 192.168.0.1     User: jim      A message at INFO level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f ERROR    IP: 127.0.0.1       User: fred     A message at ERROR level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f ERROR    IP: 127.0.0.1       User: sheila   A message at ERROR level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: jim      A message at WARNING level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f INFO     IP: 192.168.0.1     User: fred     A message at INFO level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
-2008-01-18 14:49:54,033 d.e.f WARNING  IP: 127.0.0.1       User: jim      A message at WARNING level with 2 parameters
+   2008-01-18 14:49:54,023 a.b.c DEBUG    IP: 123.231.231.123 User: sheila   A debug message
+   2008-01-18 14:49:54,023 a.b.c INFO     IP: 123.231.231.123 User: sheila   An info message with some parameters
+   2008-01-18 14:49:54,023 d.e.f CRITICAL IP: 192.168.0.1     User: jim      A message at CRITICAL level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f INFO     IP: 192.168.0.1     User: jim      A message at INFO level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f ERROR    IP: 127.0.0.1       User: fred     A message at ERROR level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f ERROR    IP: 127.0.0.1       User: sheila   A message at ERROR level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: jim      A message at WARNING level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f INFO     IP: 192.168.0.1     User: fred     A message at INFO level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f WARNING  IP: 192.168.0.1     User: sheila   A message at WARNING level with 2 parameters
+   2008-01-18 14:49:54,033 d.e.f WARNING  IP: 127.0.0.1       User: jim      A message at WARNING level with 2 parameters
 
 .. versionadded:: 2.6
 
diff --git a/Doc/library/rational.rst b/Doc/library/rational.rst
index dd18305..8ed702f 100644
--- a/Doc/library/rational.rst
+++ b/Doc/library/rational.rst
@@ -15,6 +15,7 @@
 
 .. class:: Rational(numerator=0, denominator=1)
            Rational(other_rational)
+           Rational(string)
 
    The first version requires that *numerator* and *denominator* are
    instances of :class:`numbers.Integral` and returns a new
@@ -22,10 +23,12 @@
    *denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The
    second version requires that *other_rational* is an instance of
    :class:`numbers.Rational` and returns an instance of
-   :class:`Rational` with the same value.
+   :class:`Rational` with the same value. The third version expects a
+   string of the form ``[-+]?[0-9]+(/[0-9]+)?``, optionally surrounded
+   by spaces.
 
    Implements all of the methods and operations from
-   :class:`numbers.Rational` and is hashable.
+   :class:`numbers.Rational` and is immutable and hashable.
 
 
 .. method:: Rational.from_float(flt)
@@ -36,6 +39,13 @@
    10)``
 
 
+.. method:: Rational.from_decimal(dec)
+
+   This classmethod constructs a :class:`Rational` representing the
+   exact value of *dec*, which must be a
+   :class:`decimal.Decimal`.
+
+
 .. method:: Rational.__floor__()
 
    Returns the greatest :class:`int` ``<= self``. Will be accessible