[Python-checkins] r79904 - in python/branches/py3k-cdecimal: Doc/faq/extending.rst Doc/howto/functional.rst Doc/howto/webservers.rst Doc/library/decimal.rst Doc/library/functions.rst Doc/library/functools.rst Doc/library/math.rst Doc/library/multiprocessing.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/reference/datamodel.rst Doc/reference/expressions.rst Doc/using/cmdline.rst Doc/using/mac.rst Doc/whatsnew/2.1.rst Doc/whatsnew/2.6.rst Doc/whatsnew/2.7.rst Lib/dis.py Lib/functools.py Lib/pstats.py Lib/ssl.py Lib/test/test_codecs.py Lib/test/test_float.py Lib/test/test_functools.py Lib/test/test_select.py Lib/test/test_ssl.py Lib/test/test_structmembers.py Lib/test/test_warnings.py Lib/test/test_zlib.py Lib/threading.py Lib/unittest/loader.py Lib/unittest/util.py Makefile.pre.in Misc/NEWS Misc/python-config.in Misc/python.man Modules/_codecsmodule.c Modules/_ssl.c Modules/_struct.c Modules/main.c Modules/selectmodule.c Objects/longobject.c Objects/object.c Python/getargs.c Python/structmember.c

stefan.krah python-checkins at python.org
Thu Apr 8 13:38:02 CEST 2010


Author: stefan.krah
Date: Thu Apr  8 13:38:01 2010
New Revision: 79904

Log:
Merged revisions 79752,79757,79764-79765,79770-79771,79773,79780,79783,79790,79799,79805,79810,79813-79814,79819,79823,79829,79831,79835,79839,79841,79845,79849,79853,79857,79860,79864,79868,79873,79881-79882,79884,79886,79901 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79752 | mark.dickinson | 2010-04-04 23:23:57 +0200 (Sun, 04 Apr 2010) | 9 lines
  
  Merged revisions 79751 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79751 | mark.dickinson | 2010-04-04 22:19:35 +0100 (Sun, 04 Apr 2010) | 1 line
    
    A handful of whitespace fixes in Modules/_struct.c.
  ........
................
  r79757 | mark.dickinson | 2010-04-05 00:13:14 +0200 (Mon, 05 Apr 2010) | 13 lines
  
  Merged revisions 79756 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79756 | mark.dickinson | 2010-04-04 23:09:21 +0100 (Sun, 04 Apr 2010) | 6 lines
    
    Add versionchanged entry for Decimal(float) construction.
    
    Also add an example of constructing a Decimal directly from a float,
    update the quickstart tutorial, and tweak another couple of
    sentences.
  ........
................
  r79764 | benjamin.peterson | 2010-04-05 01:03:35 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79762 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79762 | benjamin.peterson | 2010-04-04 18:01:03 -0500 (Sun, 04 Apr 2010) | 1 line
    
    tabify
  ........
................
  r79765 | benjamin.peterson | 2010-04-05 01:09:06 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79763 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79763 | benjamin.peterson | 2010-04-04 18:03:22 -0500 (Sun, 04 Apr 2010) | 1 line
    
    fix tabs
  ........
................
  r79770 | benjamin.peterson | 2010-04-05 01:25:45 +0200 (Mon, 05 Apr 2010) | 8 lines
  
  Blocked revisions 79769 via svnmerge
  
  ........
    r79769 | benjamin.peterson | 2010-04-04 18:23:22 -0500 (Sun, 04 Apr 2010) | 1 line
    
    fix dis on new style classes #8310
  ........
................
  r79771 | benjamin.peterson | 2010-04-05 01:26:50 +0200 (Mon, 05 Apr 2010) | 1 line
  
  factor out constant
................
  r79773 | ezio.melotti | 2010-04-05 01:27:45 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79768 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79768 | ezio.melotti | 2010-04-05 02:21:53 +0300 (Mon, 05 Apr 2010) | 1 line
    
    Fix markup in decimal.rst.
  ........
................
  r79780 | philip.jenvey | 2010-04-05 05:05:24 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79779 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79779 | philip.jenvey | 2010-04-04 19:51:51 -0700 (Sun, 04 Apr 2010) | 2 lines
    
    fix escape_encode to return the correct consumed size
  ........
................
  r79783 | ezio.melotti | 2010-04-05 06:04:35 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79781 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79781 | ezio.melotti | 2010-04-05 06:51:38 +0300 (Mon, 05 Apr 2010) | 1 line
    
    #8212: rephrase the webservers howto and fix some mistakes.
  ........
................
  r79790 | ezio.melotti | 2010-04-05 10:21:29 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79788 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79788 | ezio.melotti | 2010-04-05 11:16:41 +0300 (Mon, 05 Apr 2010) | 1 line
    
    Fix markup errors.
  ........
................
  r79799 | ezio.melotti | 2010-04-05 15:25:51 +0200 (Mon, 05 Apr 2010) | 9 lines
  
  Merged revisions 79797 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79797 | ezio.melotti | 2010-04-05 15:51:45 +0300 (Mon, 05 Apr 2010) | 1 line
    
    Fix some broken URLs.
  ........
................
  r79805 | mark.dickinson | 2010-04-05 20:09:39 +0200 (Mon, 05 Apr 2010) | 12 lines
  
  Merged revisions 79804 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79804 | mark.dickinson | 2010-04-05 19:07:51 +0100 (Mon, 05 Apr 2010) | 5 lines
    
    Use a more robust infinity check in _Py_HashDouble.
    
    This fixes a test_decimal failure on FreeBSD 8.0.  (modf apparently
    doesn't follow C99 Annex F on FreeBSD.)
  ........
................
  r79810 | raymond.hettinger | 2010-04-05 20:56:31 +0200 (Mon, 05 Apr 2010) | 1 line
  
  Forward port total_ordering() and cmp_to_key().
................
  r79813 | antoine.pitrou | 2010-04-05 23:40:07 +0200 (Mon, 05 Apr 2010) | 11 lines
  
  Merged revisions 79812 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79812 | antoine.pitrou | 2010-04-05 23:35:07 +0200 (lun., 05 avril 2010) | 5 lines
    
    Issue #8321: Give access to OpenSSL version numbers from the `ssl` module,
    using the new attributes `ssl.OPENSSL_VERSION`, `ssl.OPENSSL_VERSION_INFO`
    and `ssl.OPENSSL_VERSION_NUMBER`.
  ........
................
  r79814 | antoine.pitrou | 2010-04-05 23:44:48 +0200 (Mon, 05 Apr 2010) | 3 lines
  
  Fix docs for r79813.
................
  r79819 | senthil.kumaran | 2010-04-06 05:30:18 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79817 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79817 | senthil.kumaran | 2010-04-06 08:53:33 +0530 (Tue, 06 Apr 2010) | 2 lines
    
    Fix Issue8262 - changing RuntimeError wording to "Threads can only be started once"
  ........
................
  r79823 | mark.dickinson | 2010-04-06 12:29:17 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79809 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79809 | mark.dickinson | 2010-04-05 19:54:51 +0100 (Mon, 05 Apr 2010) | 1 line
    
    Use a better NaN test in _Py_HashDouble as well.
  ........
................
  r79829 | mark.dickinson | 2010-04-06 16:36:52 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Recorded merge of revisions 79609 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79609 | raymond.hettinger | 2010-04-02 19:39:24 +0100 (Fri, 02 Apr 2010) | 1 line
    
    Issue 8257: Decimal constructor to accept float.
  ........
................
  r79831 | eric.smith | 2010-04-06 16:57:57 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79826 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79826 | eric.smith | 2010-04-06 10:30:15 -0400 (Tue, 06 Apr 2010) | 1 line
    
    Fixed PEP 378 example.
  ........
................
  r79835 | eric.smith | 2010-04-06 17:21:59 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79833 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79833 | eric.smith | 2010-04-06 11:17:33 -0400 (Tue, 06 Apr 2010) | 1 line
    
    Note that PEP 378 also applies to int.
  ........
................
  r79839 | mark.dickinson | 2010-04-06 17:47:14 +0200 (Tue, 06 Apr 2010) | 1 line
  
  Remove out-of-date comment.
................
  r79841 | antoine.pitrou | 2010-04-06 18:01:57 +0200 (Tue, 06 Apr 2010) | 23 lines
  
  Merged revisions 79837 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79837 | antoine.pitrou | 2010-04-06 17:38:25 +0200 (mar., 06 avril 2010) | 19 lines
    
    14 years later, we still don't know what it's for.
    Spotted by the PyPy developers.
    
    Original commit is:
    
    branch:      trunk
    user:        guido
    date:        Mon Aug 19 21:32:04 1996 +0200
    files:       Python/getargs.c
    description:
    [svn r6499] Support for keyword arguments (PyArg_ParseTupleAndKeywords) donated by
    Geoff Philbrick <philbric at delphi.hks.com> (slightly changed by me).
    
    Also a little change to make the file acceptable to K&R C compilers
    (HPUX, SunOS 4.x).
  ........
................
  r79845 | mark.dickinson | 2010-04-06 18:53:17 +0200 (Tue, 06 Apr 2010) | 15 lines
  
  Merged revisions 79843-79844 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79843 | mark.dickinson | 2010-04-06 17:46:09 +0100 (Tue, 06 Apr 2010) | 4 lines
    
    Issue #8259: Get rid of 'outrageous left shift count' error when
    left-shifting an integer by more than 2**31 on a 64-bit machine.  Also
    convert shift counts to a Py_ssize_t instead of a C long.
  ........
    r79844 | mark.dickinson | 2010-04-06 17:47:55 +0100 (Tue, 06 Apr 2010) | 1 line
    
    Misc/NEWS entry for r79843.
  ........
................
  r79849 | antoine.pitrou | 2010-04-06 19:23:13 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79848 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79848 | antoine.pitrou | 2010-04-06 19:21:09 +0200 (mar., 06 avril 2010) | 3 lines
    
    Issue #8193: Fix test_zlib failure with zlib 1.2.4.
  ........
................
  r79853 | mark.dickinson | 2010-04-06 20:22:06 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79852 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79852 | mark.dickinson | 2010-04-06 19:20:11 +0100 (Tue, 06 Apr 2010) | 1 line
    
    Issue #8259: Clarify that there's an upper bound on the right-hand operand of a shift operator.
  ........
................
  r79857 | mark.dickinson | 2010-04-06 21:02:54 +0200 (Tue, 06 Apr 2010) | 9 lines
  
  Merged revisions 79856 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79856 | mark.dickinson | 2010-04-06 19:58:54 +0100 (Tue, 06 Apr 2010) | 1 line
    
    Silence a 'comparison between signed and unsigned integer expressions' gcc warning.
  ........
................
  r79860 | mark.dickinson | 2010-04-06 21:55:03 +0200 (Tue, 06 Apr 2010) | 10 lines
  
  Merged revisions 79858 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79858 | mark.dickinson | 2010-04-06 20:50:03 +0100 (Tue, 06 Apr 2010) | 3 lines
    
    Issue #7947:  Clarify math module behaviour for IEEE 754 special cases, along
    with a number of additional minor edits and typo corrections.
  ........
................
  r79864 | collin.winter | 2010-04-06 23:30:42 +0200 (Tue, 06 Apr 2010) | 1 line
  
  Fix python-config to use the new sysconfig module; silences deprecation warnings.
................
  r79868 | benjamin.peterson | 2010-04-06 23:55:16 +0200 (Tue, 06 Apr 2010) | 13 lines
  
  Merged revisions 79866-79867 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79866 | benjamin.peterson | 2010-04-06 16:37:06 -0500 (Tue, 06 Apr 2010) | 1 line
    
    use skip decorator
  ........
    r79867 | benjamin.peterson | 2010-04-06 16:50:00 -0500 (Tue, 06 Apr 2010) | 1 line
    
    remove a optimization that resulted in unexpected behavior #8929
  ........
................
  r79873 | mark.dickinson | 2010-04-07 00:13:37 +0200 (Wed, 07 Apr 2010) | 9 lines
  
  Merged revisions 79871 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79871 | mark.dickinson | 2010-04-06 23:10:55 +0100 (Tue, 06 Apr 2010) | 2 lines
    
    Use consistent spelling for nans (thanks Georg for noticing).
  ........
................
  r79881 | philip.jenvey | 2010-04-07 06:04:10 +0200 (Wed, 07 Apr 2010) | 19 lines
  
  Merged revisions 79878-79880 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79878 | philip.jenvey | 2010-04-06 16:24:45 -0700 (Tue, 06 Apr 2010) | 4 lines
    
    #7301: add the environment variable $PYTHONWARNINGS to supplement the -W
    command line option
    patch from Brian Curtin
  ........
    r79879 | benjamin.peterson | 2010-04-06 16:32:27 -0700 (Tue, 06 Apr 2010) | 1 line
    
    tell people to update python.man, too
  ........
    r79880 | philip.jenvey | 2010-04-06 16:38:57 -0700 (Tue, 06 Apr 2010) | 1 line
    
    document new PYTHONWARNINGS env var
  ........
................
  r79882 | ezio.melotti | 2010-04-07 06:27:14 +0200 (Wed, 07 Apr 2010) | 25 lines
  
  Merged revisions 79349,79381,79412,79801,79818 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79349 | andrew.kuchling | 2010-03-23 20:39:24 +0200 (Tue, 23 Mar 2010) | 1 line
    
    add some unittest items
  ........
    r79381 | andrew.kuchling | 2010-03-24 20:07:43 +0200 (Wed, 24 Mar 2010) | 1 line
    
    Various edits
  ........
    r79412 | andrew.kuchling | 2010-03-25 03:35:51 +0200 (Thu, 25 Mar 2010) | 1 line
    
    Add various items
  ........
    r79801 | tarek.ziade | 2010-04-05 17:58:14 +0300 (Mon, 05 Apr 2010) | 1 line
    
    added a note for Andrew, about distutils2
  ........
    r79818 | ezio.melotti | 2010-04-06 06:26:49 +0300 (Tue, 06 Apr 2010) | 1 line
    
    Fix several links and other mistakes.
  ........
................
  r79884 | philip.jenvey | 2010-04-07 07:19:21 +0200 (Wed, 07 Apr 2010) | 2 lines
  
  woops these strings aren't kept around, free them
................
  r79886 | stefan.krah | 2010-04-07 10:49:55 +0200 (Wed, 07 Apr 2010) | 9 lines
  
  Merged revisions 79885 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79885 | stefan.krah | 2010-04-07 10:24:44 +0200 (Wed, 07 Apr 2010) | 1 line
    
    Issue #8328: Silence Visual Studio warnings.
  ........
................
  r79901 | georg.brandl | 2010-04-08 08:33:16 +0200 (Thu, 08 Apr 2010) | 1 line
  
  Fix indentation.
................


Modified:
   python/branches/py3k-cdecimal/   (props changed)
   python/branches/py3k-cdecimal/Doc/faq/extending.rst
   python/branches/py3k-cdecimal/Doc/howto/functional.rst
   python/branches/py3k-cdecimal/Doc/howto/webservers.rst
   python/branches/py3k-cdecimal/Doc/library/decimal.rst
   python/branches/py3k-cdecimal/Doc/library/functions.rst
   python/branches/py3k-cdecimal/Doc/library/functools.rst
   python/branches/py3k-cdecimal/Doc/library/math.rst
   python/branches/py3k-cdecimal/Doc/library/multiprocessing.rst
   python/branches/py3k-cdecimal/Doc/library/ssl.rst
   python/branches/py3k-cdecimal/Doc/library/stdtypes.rst
   python/branches/py3k-cdecimal/Doc/reference/datamodel.rst
   python/branches/py3k-cdecimal/Doc/reference/expressions.rst
   python/branches/py3k-cdecimal/Doc/using/cmdline.rst
   python/branches/py3k-cdecimal/Doc/using/mac.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.1.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst
   python/branches/py3k-cdecimal/Lib/dis.py
   python/branches/py3k-cdecimal/Lib/functools.py
   python/branches/py3k-cdecimal/Lib/pstats.py
   python/branches/py3k-cdecimal/Lib/ssl.py
   python/branches/py3k-cdecimal/Lib/test/test_codecs.py
   python/branches/py3k-cdecimal/Lib/test/test_float.py
   python/branches/py3k-cdecimal/Lib/test/test_functools.py
   python/branches/py3k-cdecimal/Lib/test/test_select.py
   python/branches/py3k-cdecimal/Lib/test/test_ssl.py
   python/branches/py3k-cdecimal/Lib/test/test_structmembers.py
   python/branches/py3k-cdecimal/Lib/test/test_warnings.py
   python/branches/py3k-cdecimal/Lib/test/test_zlib.py
   python/branches/py3k-cdecimal/Lib/threading.py
   python/branches/py3k-cdecimal/Lib/unittest/loader.py
   python/branches/py3k-cdecimal/Lib/unittest/util.py
   python/branches/py3k-cdecimal/Makefile.pre.in
   python/branches/py3k-cdecimal/Misc/NEWS
   python/branches/py3k-cdecimal/Misc/python-config.in
   python/branches/py3k-cdecimal/Misc/python.man
   python/branches/py3k-cdecimal/Modules/_codecsmodule.c
   python/branches/py3k-cdecimal/Modules/_ssl.c
   python/branches/py3k-cdecimal/Modules/_struct.c
   python/branches/py3k-cdecimal/Modules/main.c
   python/branches/py3k-cdecimal/Modules/selectmodule.c
   python/branches/py3k-cdecimal/Objects/longobject.c
   python/branches/py3k-cdecimal/Objects/object.c
   python/branches/py3k-cdecimal/Python/getargs.c
   python/branches/py3k-cdecimal/Python/structmember.c

Modified: python/branches/py3k-cdecimal/Doc/faq/extending.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/faq/extending.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/faq/extending.rst	Thu Apr  8 13:38:01 2010
@@ -54,7 +54,8 @@
 <http://www.riverbankcomputing.co.uk/software/sip/>`__, `CXX
 <http://cxx.sourceforge.net/>`_ `Boost
 <http://www.boost.org/libs/python/doc/index.html>`_, or `Weave
-<http://www.scipy.org/Weave>`_ are also alternatives for wrapping C++ libraries.
+<http://www.scipy.org/Weave>`_ are also alternatives for wrapping
+C++ libraries.
 
 
 How can I execute arbitrary Python statements from C?
@@ -200,7 +201,7 @@
 Python type around a C structure (pointer) type will also work for C++ objects.
 
 For C++ libraries, you can look at `SIP
-<http://www.riverbankcomputing.co.uk/sip/>`_, `CXX
+<http://www.riverbankcomputing.co.uk/software/sip/>`_, `CXX
 <http://cxx.sourceforge.net/>`_, `Boost
 <http://www.boost.org/libs/python/doc/index.html>`_, `Weave
 <http://www.scipy.org/Weave>`_ or `SWIG <http://www.swig.org>`_

Modified: python/branches/py3k-cdecimal/Doc/howto/functional.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/howto/functional.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/howto/functional.rst	Thu Apr  8 13:38:01 2010
@@ -336,7 +336,7 @@
 
 List comprehensions and generator expressions (short form: "listcomps" and
 "genexps") are a concise notation for such operations, borrowed from the
-functional programming language Haskell (http://www.haskell.org).  You can strip
+functional programming language Haskell (http://www.haskell.org/).  You can strip
 all the whitespace from a stream of strings with the following code::
 
     line_list = ['  line 1\n', 'line 2  \n', ...]

Modified: python/branches/py3k-cdecimal/Doc/howto/webservers.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/howto/webservers.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/howto/webservers.rst	Thu Apr  8 13:38:01 2010
@@ -6,74 +6,75 @@
 
 .. topic:: Abstract
 
-   This document shows how Python fits into the web.  It presents some ways on
-   how to integrate Python with the web server and general practices useful for
+   This document shows how Python fits into the web.  It presents some ways
+   to integrate Python with a web server, and general practices useful for
    developing web sites.
 
 
-Programming for the Web has become a hot topic since the raise of the "Web 2.0",
+Programming for the Web has become a hot topic since the rise of "Web 2.0",
 which focuses on user-generated content on web sites.  It has always been
 possible to use Python for creating web sites, but it was a rather tedious task.
-Therefore, many so-called "frameworks" and helper tools were created to help
-developers creating sites faster and these sites being more robust.  This HOWTO
-describes some of the methods used to combine Python with a web server to create
-dynamic content.  It is not meant as a general introduction as this topic is far
-too broad to be covered in one single document.  However, a short overview of
-the most popular libraries is provided.
+Therefore, many frameworks and helper tools have been created to assist
+developers in creating faster and more robust sites.  This HOWTO describes
+some of the methods used to combine Python with a web server to create
+dynamic content.  It is not meant as a complete introduction, as this topic is
+far too broad to be covered in one single document.  However, a short overview
+of the most popular libraries is provided.
 
 .. seealso::
 
-   While this HOWTO tries to give an overview over Python in the Web, it cannot
-   always be as up to date as desired.  Web development in Python is moving
-   forward rapidly, so the wiki page on `Web Programming
-   <http://wiki.python.org/moin/WebProgramming>`_ might be more in sync with
+   While this HOWTO tries to give an overview of Python in the web, it cannot
+   always be as up to date as desired.  Web development in Python is rapidly
+   moving forward, so the wiki page on `Web Programming
+   <http://wiki.python.org/moin/WebProgramming>`_ may be more in sync with
    recent development.
 
 
-The low-level view
+The Low-Level View
 ==================
 
-.. .. image:: http.png
-
-When a user enters a web site, his browser makes a connection to the site's
-webserver (this is called the *request*).  The server looks up the file in the
+When a user enters a web site, their browser makes a connection to the site's
+web server (this is called the *request*).  The server looks up the file in the
 file system and sends it back to the user's browser, which displays it (this is
 the *response*).  This is roughly how the underlying protocol, HTTP, works.
 
-Now, dynamic web sites are not files in the file system, but rather programs
-which are run by the web server when a request comes in.  They can do all sorts
-of useful things, like display the postings of a bulletin board, show your
-mails, configurate software or just display the current time.  These programs
-can be written in about any programming language the server supports, so it is
-easy to use Python for creating dynamic web sites.
-
-As most of HTTP servers are written in C or C++, they cannot execute Python code
-in a simple way -- a bridge is needed between the server and the program.  These
-bridges or rather interfaces define how programs interact with the server.  In
-the past there have been numerous attempts to create the best possible
-interface, but there are only a few worth mentioning.
-
-Not every web server supports every interface.  Many web servers do support only
-old, now-obsolete interfaces.  But they can often be extended using some
-third-party modules to support new interfaces.
+Dynamic web sites are not based on files in the file system, but rather on
+programs which are run by the web server when a request comes in, and which
+*generate* the content that is returned to the user.  They can do all sorts of
+useful things, like display the postings of a bulletin board, show your email,
+configure software, or just display the current time.  These programs can be
+written in any programming language the server supports.  Since most servers
+support Python, it is easy to use Python to create dynamic web sites.
+
+Most HTTP servers are written in C or C++, so they cannot execute Python code
+directly -- a bridge is needed between the server and the program.  These
+bridges, or rather interfaces, define how programs interact with the server.
+There have been numerous attempts to create the best possible interface, but
+there are only a few worth mentioning.
+
+Not every web server supports every interface.  Many web servers only support
+old, now-obsolete interfaces; however, they can often be extended using
+third-party modules to support newer ones.
 
 
 Common Gateway Interface
 ------------------------
 
-This interface is the oldest one, supported by nearly every web server out of
-the box.  Programs using CGI to communicate with their web server need to be
-started by the server for every request.  So, every request starts a new Python
-interpreter -- which takes some time to start up -- thus making the whole
-interface only usable for low load situations.
-
-The upside of CGI is that it is simple -- writing a program which uses CGI is a
-matter of about three lines of code.  But this simplicity comes at a price: it
-does very few things to help the developer.
-
-Writing CGI programs, while still possible, is not recommended anymore.  With
-WSGI (more on that later) it is possible to write programs that emulate CGI, so
-they can be run as CGI if no better option is available.
+This interface, most commonly referred to as "CGI", is the oldest, and is
+supported by nearly every web server out of the box.  Programs using CGI to
+communicate with their web server need to be started by the server for every
+request.  So, every request starts a new Python interpreter -- which takes some
+time to start up -- thus making the whole interface only usable for low load
+situations.
+
+The upside of CGI is that it is simple -- writing a Python program which uses
+CGI is a matter of about three lines of code.  This simplicity comes at a
+price: it does very few things to help the developer.
+
+Writing CGI programs, while still possible, is no longer recommended.  With
+:ref:`WSGI <WSGI>`, a topic covered later in this document, it is possible to write
+programs that emulate CGI, so they can be run as CGI if no better option is
+available.
 
 .. seealso::
 
@@ -81,7 +82,7 @@
    creating plain CGI programs:
 
    * :mod:`cgi` -- Handling of user input in CGI scripts
-   * :mod:`cgitb` -- Displays nice tracebacks when errors happen in of CGI
+   * :mod:`cgitb` -- Displays nice tracebacks when errors happen in CGI
      applications, instead of presenting a "500 Internal Server Error" message
 
    The Python wiki features a page on `CGI scripts
@@ -107,16 +108,15 @@
 
     print("Hello World!")
 
-You need to write this code into a file with a ``.py`` or ``.cgi`` extension,
-this depends on your web server configuration.  Depending on your web server
-configuration, this file may also need to be in a ``cgi-bin`` folder, for
-security reasons.
+Depending on your web server configuration, you may need to save this code with
+a ``.py`` or ``.cgi`` extension.  Additionally, this file may also need to be
+in a ``cgi-bin`` folder, for security reasons.
 
 You might wonder what the ``cgitb`` line is about.  This line makes it possible
 to display a nice traceback instead of just crashing and displaying an "Internal
 Server Error" in the user's browser.  This is useful for debugging, but it might
-risk exposing some confident data to the user.  Don't use it when the script is
-ready for production use.  Still, you should *always* catch exceptions, and
+risk exposing some confidential data to the user.  You should not use ``cgitb``
+in production code for this reason.  You should *always* catch exceptions, and
 display proper error pages -- end-users don't like to see nondescript "Internal
 Server Errors" in their browsers.
 
@@ -125,73 +125,83 @@
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 If you don't have your own web server, this does not apply to you.  You can
-check whether if works as-is and if not you need to talk to the administrator of
-your web server anyway. If it is a big hoster, you can try filing a ticket
-asking for Python support.
-
-If you're your own administrator or want to install it for testing purposes on
-your own computers, you have to configure it by yourself.  There is no one and
-single way on how to configure CGI, as there are many web servers with different
-configuration options.  The currently most widely used free web server is
-`Apache HTTPd <http://httpd.apache.org/>`_, Apache for short -- this is the one
-that most people use, it can be easily installed on nearly every system using
-the systems' package management.  But `lighttpd <http://www.lighttpd.net>`_ has
-been gaining attention since some time and is said to have a better performance.
-On many systems this server can also be installed using the package management,
-so manually compiling the web server is never needed.
+check whether it works as-is, and if not you will need to talk to the
+administrator of your web server. If it is a big host, you can try filing a
+ticket asking for Python support.
+
+If you are your own administrator or want to set up CGI for testing purposes on
+your own computers, you have to configure it by yourself.  There is no single
+way to configure CGI, as there are many web servers with different
+configuration options.  Currently the most widely used free web server is
+`Apache HTTPd <http://httpd.apache.org/>`_, or Apache for short. Apache can be
+easily installed on nearly every system using the system's package management
+tool.  `lighttpd <http://www.lighttpd.net>`_ is another alternative and is
+said to have better performance.  On many systems this server can also be
+installed using the package management tool, so manually compiling the web
+server may not be needed.
 
-* On Apache you can take a look into the `Dynamic Content with CGI
+* On Apache you can take a look at the `Dynamic Content with CGI
   <http://httpd.apache.org/docs/2.2/howto/cgi.html>`_ tutorial, where everything
   is described.  Most of the time it is enough just to set ``+ExecCGI``.  The
   tutorial also describes the most common gotchas that might arise.
+
 * On lighttpd you need to use the `CGI module
-  <http://trac.lighttpd.net/trac/wiki/Docs%3AModCGI>`_ which can be configured
+  <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModCGI>`_\ , which can be configured
   in a straightforward way.  It boils down to setting ``cgi.assign`` properly.
 
 
 Common problems with CGI scripts
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Trying to use CGI sometimes leads to small annoyances that one might experience
-while trying to get these scripts to run.  Sometimes it happens that a seemingly
-correct script does not work as expected, which is caused by some small hidden
-reason that's difficult to spot.
+Using CGI sometimes leads to small annoyances while trying to get these
+scripts to run.  Sometimes a seemingly correct script does not work as
+expected, the cause being some small hidden problem that's difficult to spot.
 
-Some of these reasons are:
+Some of these potential problems are:
 
-* The Python script is not marked executable.  When CGI scripts are not
-  executable most of the web servers will let the user download it, instead of
+* The Python script is not marked as executable.  When CGI scripts are not
+  executable most web servers will let the user download it, instead of
   running it and sending the output to the user.  For CGI scripts to run
-  properly the ``+x`` bit needs to be set.  Using ``chmod a+x your_script.py``
-  might already solve the problem.
-* The line endings must be of Unix-type.  This is important because the web
-  server checks the first line of the script (called shebang) and tries to run
-  the program specified there.  It gets easily confused by Windows line endings
-  (Carriage Return & Line Feed, also called CRLF), so you have to convert the
-  file to Unix line endings (only Line Feed, LF).  This can be done
-  automatically by uploading the file via FTP in text mode instead of binary
-  mode, but the preferred way is just telling your editor to save the files with
-  Unix line endings.  Most proper editors support this.
-* Your web server must be able to read the file, you need to make sure the
-  permissions are fine.  Often the server runs as user and group ``www-data``,
-  so it might be worth a try to change the file ownership or making the file
-  world readable by using ``chmod a+r your_script.py``.
-* The webserver must be able to know that the file you're trying to access is a
-  CGI script.  Check the configuration of your web server, maybe there is some
-  mistake.
-* The path to the interpreter in the shebang (``#!/usr/bin/env python``) must be
-  currect.  This line calls ``/usr/bin/env`` to find Python, but it'll fail if
-  there is no ``/usr/bin/env``.  If you know where your Python is installed, you
-  can also use that path.  The commands ``whereis python`` and ``type -p
-  python`` might also help to find where it is installed.  Once this is known,
-  the shebang line can be changed accordingly: ``#!/usr/bin/python``.
+  properly on Unix-like operating systems, the ``+x`` bit needs to be set.
+  Using ``chmod a+x your_script.py`` may solve this problem.
+
+* On a Unix-like system, The line endings in the program file must be Unix
+  style line endings.  This is important because the web server checks the
+  first line of the script (called shebang) and tries to run the program
+  specified there.  It gets easily confused by Windows line endings (Carriage
+  Return & Line Feed, also called CRLF), so you have to convert the file to
+  Unix line endings (only Line Feed, LF).  This can be done automatically by
+  uploading the file via FTP in text mode instead of binary mode, but the
+  preferred way is just telling your editor to save the files with Unix line
+  endings.  Most editors support this.
+
+* Your web server must be able to read the file, and you need to make sure the
+  permissions are correct.  On unix-like systems, the server often runs as user
+  and group ``www-data``, so it might be worth a try to change the file
+  ownership, or making the file world readable by using ``chmod a+r
+  your_script.py``.
+
+* The web server must know that the file you're trying to access is a CGI script.
+  Check the configuration of your web server, as it may be configured
+  to expect a specific file extension for CGI scripts.
+
+* On Unix-like systems, the path to the interpreter in the shebang
+  (``#!/usr/bin/env python``) must be correct.  This line calls
+  ``/usr/bin/env`` to find Python, but it will fail if there is no
+  ``/usr/bin/env``, or if Python is not in the web server's path.  If you know
+  where your Python is installed, you can also use that full path.  The
+  commands ``whereis python`` and ``type -p python`` could help you find
+  where it is installed.  Once you know the path, you can change the shebang
+  accordingly: ``#!/usr/bin/python``.
+
 * The file must not contain a BOM (Byte Order Mark). The BOM is meant for
-  determining the byte order of UTF-16 encodings, but some editors write this
-  also into UTF-8 files.  The BOM interferes with the shebang line, so be sure
-  to tell your editor not to write the BOM.
-* :ref:`mod-python` might be making problems.  mod_python is able to handle CGI
-  scripts by itself, but it can also be a source for problems.  Be sure you
-  disable it.
+  determining the byte order of UTF-16 and UTF-32 encodings, but some editors
+  write this also into UTF-8 files.  The BOM interferes with the shebang line,
+  so be sure to tell your editor not to write the BOM.
+
+* If the web server is using :ref:`mod-python`, ``mod_python`` may be having
+  problems.  ``mod_python`` is able to handle CGI scripts by itself, but it can
+  also be a source of issues.
 
 
 .. _mod-python:
@@ -200,33 +210,34 @@
 ----------
 
 People coming from PHP often find it hard to grasp how to use Python in the web.
-Their first thought is mostly `mod_python <http://www.modpython.org/>`_ because
-they think that this is the equivalent to ``mod_php``.  Actually it is not
-really.  It does embed the interpreter into the Apache process, thus speeding up
-requests by not having to start a Python interpreter every request.  On the
-other hand, it is by far not "Python intermixed with HTML" as PHP often does.
-The Python equivalent of that is a template engine.  mod_python itself is much
-more powerful and gives more access to Apache internals.  It can emulate CGI, it
-can work an a "Python Server Pages" mode similar to JSP which is "HTML
-intermangled with Python" and it has a "Publisher" which destignates one file to
-accept all requests and decide on what to do then.
-
-But mod_python has some problems.  Unlike the PHP interpreter the Python
-interpreter uses caching when executing files, so when changing a file the whole
-web server needs to be re-started to update.  Another problem ist the basic
-concept -- Apache starts some child processes to handle the requests and
-unfortunately every child process needs to load the whole Python interpreter
-even if it does not use it.  This makes the whole web server slower.  Another
-problem is that as mod_python is linked against a specific version of
-``libpython``, it is not possible to switch from an older version to a newer
-(e.g. 2.4 to 2.5) without recompiling mod_python.  mod_python is also bound to
-the Apache web server, so programs written for mod_python cannot easily run on
-other web servers.
-
-These are the reasons why mod_python should be avoided when writing new
-programs.  In some circumstances it might be still a good idea to use mod_python
-for deployment, but WSGI makes it possible to run WSGI programs under mod_python
-as well.
+Their first thought is mostly `mod_python <http://www.modpython.org/>`_\ ,
+because they think that this is the equivalent to ``mod_php``.  Actually, there
+are many differences.  What ``mod_python`` does is embed the interpreter into
+the Apache process, thus speeding up requests by not having to start a Python
+interpreter for each request.  On the other hand, it is not "Python intermixed
+with HTML" in the way that PHP is often intermixed with HTML. The Python
+equivalent of that is a template engine.  ``mod_python`` itself is much more
+powerful and provides more access to Apache internals.  It can emulate CGI,
+work in a "Python Server Pages" mode (similar to JSP) which is "HTML
+intermingled with Python", and it has a "Publisher" which designates one file
+to accept all requests and decide what to do with them.
+
+``mod_python`` does have some problems.  Unlike the PHP interpreter, the Python
+interpreter uses caching when executing files, so changes to a file will
+require the web server to be restarted.  Another problem is the basic concept
+-- Apache starts child processes to handle the requests, and unfortunately
+every child process needs to load the whole Python interpreter even if it does
+not use it.  This makes the whole web server slower.  Another problem is that,
+because ``mod_python`` is linked against a specific version of ``libpython``,
+it is not possible to switch from an older version to a newer (e.g. 2.4 to 2.5)
+without recompiling ``mod_python``.  ``mod_python`` is also bound to the Apache
+web server, so programs written for ``mod_python`` cannot easily run on other
+web servers.
+
+These are the reasons why ``mod_python`` should be avoided when writing new
+programs.  In some circumstances it still might be a good idea to use
+``mod_python`` for deployment, but WSGI makes it possible to run WSGI programs
+under ``mod_python`` as well.
 
 
 FastCGI and SCGI
@@ -234,19 +245,19 @@
 
 FastCGI and SCGI try to solve the performance problem of CGI in another way.
 Instead of embedding the interpreter into the web server, they create
-long-running processes which run in the background. There still is some module
-in the web server which makes it possible for the web server to "speak" with the
-background process.  As the background process is independent from the server,
-it can be written in any language of course also in Python.  The language just
-needs to have a library which handles the communication with the web server.
+long-running background processes. There is still a module in the web server
+which makes it possible for the web server to "speak" with the background
+process.  As the background process is independent of the server, it can be
+written in any language, including Python.  The language just needs to have a
+library which handles the communication with the webserver.
 
 The difference between FastCGI and SCGI is very small, as SCGI is essentially
-just a "simpler FastCGI".  But as the web server support for SCGI is limited
+just a "simpler FastCGI".  As the web server support for SCGI is limited,
 most people use FastCGI instead, which works the same way.  Almost everything
-that applies to SCGI also applies to FastCGI as well, so we'll only write about
+that applies to SCGI also applies to FastCGI as well, so we'll only cover
 the latter.
 
-These days, FastCGI is never used directly.  Just like ``mod_python`` it is only
+These days, FastCGI is never used directly.  Just like ``mod_python``, it is only
 used for the deployment of WSGI applications.
 
 .. seealso::
@@ -260,17 +271,20 @@
 Setting up FastCGI
 ^^^^^^^^^^^^^^^^^^
 
-Depending on the web server you need to have a special module.
+Each web server requires a specific module.
 
-* Apache has both `mod_fastcgi <http://www.fastcgi.com/>`_ and `mod_fcgid
+* Apache has both `mod_fastcgi <http://www.fastcgi.com/drupal/>`_ and `mod_fcgid
   <http://fastcgi.coremail.cn/>`_.  ``mod_fastcgi`` is the original one, but it
-  has some licensing issues that's why it is sometimes considered non-free.
-  ``mod_fcgid`` is a smaller, compatible alternative. One of these modules needs
+  has some licensing issues, which is why it is sometimes considered non-free.
+  ``mod_fcgid`` is a smaller, compatible alternative.  One of these modules needs
   to be loaded by Apache.
+
 * lighttpd ships its own `FastCGI module
-  <http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI>`_ as well as an `SCGI
-  module <http://trac.lighttpd.net/trac/wiki/Docs%3AModSCGI>`_.
-* nginx also supports `FastCGI <http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
+  <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ as well as an
+  `SCGI module <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModSCGI>`_.
+
+* `nginx <http://nginx.org/>`_ also supports `FastCGI
+  <http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
 
 Once you have installed and configured the module, you can test it with the
 following WSGI-application::
@@ -301,28 +315,27 @@
 .. seealso::
 
    There is some documentation on `setting up Django with FastCGI
-   <http://www.djangoproject.com/documentation/fastcgi/>`_, most of which can be
-   reused for other WSGI-compliant frameworks and libraries.  Only the
-   ``manage.py`` part has to be changed, the example used here can be used
-   instead. Django does more or less the exact same thing.
+   <http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/>`_, most of
+   which can be reused for other WSGI-compliant frameworks and libraries.
+   Only the ``manage.py`` part has to be changed, the example used here can be
+   used instead.  Django does more or less the exact same thing.
 
 
 mod_wsgi
 --------
 
-`mod_wsgi <http://www.modwsgi.org/>`_ is an attempt to get rid of the low level
-gateways.  As FastCGI, SCGI, mod_python are mostly used to deploy WSGI
-applications anyway, mod_wsgi was started to directly embed WSGI aplications
-into the Apache web server.  The benefit from this approach is that WSGI
-applications can be deployed much easier as is is specially designed to host
-WSGI applications -- unlike the other low level methods which have glue code to
-host WSGI applications (like flup which was mentioned before).  The downside is
-that mod_wsgi is limited to the Apache web server, other servers would need
+`mod_wsgi <http://code.google.com/p/modwsgi/>`_ is an attempt to get rid of the
+low level gateways.  Given that FastCGI, SCGI, and mod_python are mostly used to
+deploy WSGI applications, mod_wsgi was started to directly embed WSGI applications
+into the Apache web server. mod_wsgi is specifically designed to host WSGI
+applications.  It makes the deployment of WSGI applications much easier than
+deployment using other low level methods, which need glue code.  The downside
+is that mod_wsgi is limited to the Apache web server; other servers would need
 their own implementations of mod_wsgi.
 
-It supports two modes: the embedded mode in which it integrates with the Apache
-process and the daemon mode which is more FastCGI-like.  Contrary to FastCGI,
-mod_wsgi handles the worker-processes by itself which makes administration
+mod_wsgi supports two modes: embedded mode, in which it integrates with the
+Apache process, and daemon mode, which is more FastCGI-like.  Unlike FastCGI,
+mod_wsgi handles the worker-processes by itself, which makes administration
 easier.
 
 
@@ -331,58 +344,61 @@
 Step back: WSGI
 ===============
 
-WSGI was already mentioned several times so it has to be something important.
-In fact it really is, so now it's time to explain.
+WSGI has already been mentioned several times, so it has to be something
+important.  In fact it really is, and now it is time to explain it.
 
-The *Web Server Gateway Interface*, :pep:`333` or WSGI for short is currently
-the best possible way to Python web programming.  While it is great for
-programmers writing frameworks, the normal person does not need to get in direct
-contact with it.  But when choosing a framework for web development it is a good
-idea to take one which supports WSGI.
-
-The big profit from WSGI is the unification.  When your program is compatible
-with WSGI -- that means that your framework has support for WSGI, your program
-can be deployed on every web server interface for which there are WSGI wrappers.
-So you do not need to care about whether the user uses mod_python or FastCGI --
-with WSGI it just works on any gateway interface.  The Python standard library
-contains its own WSGI server :mod:`wsgiref`, which is a small web server that
-can be used for testing.
-
-A really great WSGI feature are the middlewares.  Middlewares are layers around
-your program which can add various functionality to it.  There is a `number of
-middlewares <http://wsgi.org/wsgi/Middleware_and_Utilities>`_ already available.
-For example, instead of writing your own session management (to identify a user
-in subsequent requests, as HTTP does not maintain state, so it does now know
-that the requests belong to the same user) you can just take one middleware,
-plug it in and you can rely an already existing functionality.  The same thing
-is compression -- say you want to compress your HTML using gzip, to save your
-server's bandwidth.  So you only need to plug-in a middleware and you're done.
-Authentication is also a problem easily solved using a middleware.
-
-So, generally -- although WSGI may seem complex, the initial phase of learning
-can be very rewarding as WSGI does already have solutions to many problems that
-might arise while writing web sites.
+The *Web Server Gateway Interface*,  or WSGI for short, is defined in
+:pep:`333` and is currently the best way to do Python web programming.  While
+it is great for programmers writing frameworks, a normal web developer does not
+need to get in direct contact with it.  When choosing a framework for web
+development it is a good idea to choose one which supports WSGI.
+
+The big benefit of WSGI is the unification of the application programming
+interface.  When your program is compatible with WSGI -- which at the outer
+level means that the framework you are using has support for WSGI -- your
+program can be deployed via any web server interface for which there are WSGI
+wrappers.  You do not need to care about whether the application user uses
+mod_python or FastCGI or mod_wsgi -- with WSGI your application will work on
+any gateway interface.  The Python standard library contains its own WSGI
+server, :mod:`wsgiref`, which is a small web server that can be used for
+testing.
+
+A really great WSGI feature is middleware.  Middleware is a layer around your
+program which can add various functionality to it.  There is quite a bit of
+`middleware <http://wsgi.org/wsgi/Middleware_and_Utilities>`_ already
+available.  For example, instead of writing your own session management (HTTP
+is a stateless protocol, so to associate multiple HTTP requests with a single
+user your application must create and manage such state via a session), you can
+just download middleware which does that, plug it in, and get on with coding
+the unique parts of your application.  The same thing with compression -- there
+is existing middleware which handles compressing your HTML using gzip to save
+on your server's bandwidth.  Authentication is another a problem easily solved
+using existing middleware.
+
+Although WSGI may seem complex, the initial phase of learning can be very
+rewarding because WSGI and the associated middleware already have solutions to
+many problems that might arise while developing web sites.
 
 
 WSGI Servers
 ------------
 
 The code that is used to connect to various low level gateways like CGI or
-mod_python is called *WSGI server*.  One of these servers is ``flup`` which was
-already mentioned and supports FastCGI, SCGI as well as `AJP
+mod_python is called a *WSGI server*.  One of these servers is ``flup``, which
+supports FastCGI and SCGI, as well as `AJP
 <http://en.wikipedia.org/wiki/Apache_JServ_Protocol>`_.  Some of these servers
-are written in Python as ``flup`` is, but there also exist others which are
+are written in Python, as ``flup`` is, but there also exist others which are
 written in C and can be used as drop-in replacements.
 
-There are quite a lot of servers already available, so a Python web application
-can be deployed nearly everywhere.  This is one big advantage that Python has
-compared with other web techniques.
+There are many servers already available, so a Python web application
+can be deployed nearly anywhere.  This is one big advantage that Python has
+compared with other web technologies.
 
 .. seealso::
 
-   A good overview of all WSGI-related code can be found in the `WSGI wiki
+   A good overview of WSGI-related code can be found in the `WSGI wiki
    <http://wsgi.org/wsgi>`_, which contains an extensive list of `WSGI servers
-   <http://wsgi.org/wsgi/Servers>`_, which can be used by *every* application
+   <http://wsgi.org/wsgi/Servers>`_ which can be used by *any* application
    supporting WSGI.
 
    You might be interested in some WSGI-supporting modules already contained in
@@ -394,39 +410,46 @@
 Case study: MoinMoin
 --------------------
 
-What does WSGI give the web application developer?  Let's take a look on one
-long existing web application written in Python without using WSGI.
-
-One of the most widely used wiki software is `MoinMoin <http://moinmo.in/>`_.
-It was created in 2000, so it predates WSGI by about three years.  While it now
-includes support for WSGI, older versions needed separate code to run on CGI,
-mod_python, FastCGI and standalone.  Now, this all is possible by using WSGI and
-the already-written gateways.  For running with on FastCGI ``flup`` can be used,
-for running a standalone server :mod:`wsgiref` is the way to go.
+What does WSGI give the web application developer?  Let's take a look at
+an application that's been around for a while, which was written in
+Python without using WSGI.
+
+One of the most widely used wiki software packages is `MoinMoin
+<http://moinmo.in/>`_.  It was created in 2000, so it predates WSGI by about
+three years.  Older versions needed separate code to run on CGI, mod_python,
+FastCGI and standalone.
+
+It now includes support for WSGI.  Using WSGI, it is possible to deploy
+MoinMoin on any WSGI compliant server, with no additional glue code.
+Unlike the pre-WSGI versions, this could include WSGI servers that the
+authors of MoinMoin know nothing about.
 
 
-Model-view-controller
+Model-View-Controller
 =====================
 
-The term *MVC* is often heard in statements like "framework *foo* supports MVC".
-While MVC is not really something technical but rather organisational, many web
-frameworks use this model to help the developer to bring structure into his
-program.  Bigger web applications can have lots of code so it is a good idea to
-have structure in the program right from the beginnings.  That way, even users
-of other frameworks (or even languages, as MVC is nothing Python-specific) can
-understand the existing code easier, as they are already familiar with the
-structure.
+The term *MVC* is often encountered in statements such as "framework *foo*
+supports MVC".  MVC is more about the overall organization of code, rather than
+any particular API.  Many web frameworks use this model to help the developer
+bring structure to their program.  Bigger web applications can have lots of
+code, so it is a good idea to have an effective structure right from the beginning.
+That way, even users of other frameworks (or even other languages, since MVC is
+not Python-specific) can easily understand the code, given that they are
+already familiar with the MVC structure.
 
 MVC stands for three components:
 
-* The *model*.  This is the data that is meant to modify.  In Python frameworks
-  this component is often represented by the classes used by the
-  object-relational mapper.  So, all declarations go here.
+* The *model*.  This is the data that will be displayed and modified.  In
+  Python frameworks, this component is often represented by the classes used by
+  an object-relational mapper.
+
 * The *view*.  This component's job is to display the data of the model to the
-  user.  Typically this component is represented by the templates.
+  user.  Typically this component is implemented via templates.
+
 * The *controller*.  This is the layer between the user and the model.  The
-  controller reacts on user actions (like opening some specific URL) and tells
-  the model to modify the data if necessary.
+  controller reacts to user actions (like opening some specific URL), tells
+  the model to modify the data if necessary, and tells the view code what to
+  display,
 
 While one might think that MVC is a complex design pattern, in fact it is not.
 It is used in Python because it has turned out to be useful for creating clean,
@@ -438,132 +461,136 @@
    to create a web site which uses the MVC pattern by separating the data logic
    (the model) from the user interaction logic (the controller) and the
    templates (the view).  That's why it is important not to write unnecessary
-   Python code in the templates -- it is against MVC and creates more chaos.
+   Python code in the templates -- it works against the MVC model and creates
+   chaos in the code base, making it harder to understand and modify.
 
 .. seealso::
 
-   The english Wikipedia has an article about the `Model-View-Controller pattern
-   <http://en.wikipedia.org/wiki/Model-view-controller>`_, which includes a long
-   list of web frameworks for different programming languages.
+   The English Wikipedia has an article about the `Model-View-Controller pattern
+   <http://en.wikipedia.org/wiki/Model-view-controller>`_.  It includes a long
+   list of web frameworks for various programming languages.
 
 
-Ingredients for web sites
-=========================
-
-Web sites are complex constructs, so tools were created to help the web site
-developer to make his work maintainable.  None of these tools are in any way
-Python specific, they also exist for other programming languages as well.  Of
-course, developers are not forced to use these tools and often there is no
-"best" tool, but it is worth informing yourself before choosing something
-because of the big number of helpers that the developer can use.
+Ingredients for Websites
+========================
+
+Websites are complex constructs, so tools have been created to help web
+developers make their code easier to write and more maintainable.  Tools like
+these exist for all web frameworks in all languages.  Developers are not forced
+to use these tools, and often there is no "best" tool.  It is worth learning
+about the available tools because they can greatly simplify the process of
+developing a web site.
 
 
 .. seealso::
 
-   People have written far more components that can be combined than these
-   presented here.  The Python wiki has a page about these components, called
+   There are far more components than can be presented here.  The Python wiki
+   has a page about these components, called
    `Web Components <http://wiki.python.org/moin/WebComponents>`_.
 
 
 Templates
 ---------
 
-Mixing of HTML and Python code is possible with some libraries.  While
+Mixing of HTML and Python code is made possible by a few libraries.  While
 convenient at first, it leads to horribly unmaintainable code.  That's why
 templates exist.  Templates are, in the simplest case, just HTML files with
-placeholders.  The HTML is sent to the user's browser after filling out the
+placeholders.  The HTML is sent to the user's browser after filling in the
 placeholders.
 
-Python already includes such simple templates::
+Python already includes a way to build simple templates::
 
     # a simple template
     template = "<html><body><h1>Hello {who}!</h1></body></html>"
     print(template.format(who="Reader"))
 
-The Python standard library also includes some more advanced templates usable
-through :class:`string.Template`, but in HTML templates it is needed to use
-conditional and looping contructs like Python's *for* and *if*.  So, some
-*template engine* is needed.
-
-Now, Python has a lot of template engines which can be used with or without a
-`framework`_.  Some of these are using a plain-text programming language which
-is very easy to learn as it is quite limited while others use XML so the
-template output is always guaranteed to be valid XML.  Some `frameworks`_ ship
-their own template engine or recommend one particular.  If one is not yet sure,
-using these is a good idea.
-
-.. note::
-
-   While Python has quite a lot of different template engines it usually does
-   not make sense to use a homebrewed template system.  The time needed to
-   evaluate all templating systems is not really worth it, better invest the
-   time in looking through the most popular ones.  Some frameworks have their
-   own template engine or have a recommentation for one.  It's wise to use
-   these.
-
-   Popular template engines include:
-
-   * Mako
-   * Genshi
-   * Jinja
+To generate complex HTML based on non-trivial model data, conditional
+and looping constructs like Python's *for* and *if* are generally needed.
+*Template engines* support templates of this complexity.
+
+There are a lot of template engines available for Python which can be used with
+or without a `framework`_.  Some of these define a plain-text programming
+language which is easy to learn, partly because it is limited in scope.
+Others use XML, and the template output is guaranteed to be always be valid
+XML.  There are many other variations.
+
+Some `frameworks`_ ship their own template engine or recommend one in
+particular.  In the absence of a reason to use a different template engine,
+using the one provided by or recommended by the framework is a good idea.
+
+Popular template engines include:
+
+   * `Mako <http://www.makotemplates.org/>`_
+   * `Genshi <http://genshi.edgewall.org/>`_
+   * `Jinja <http://jinja.pocoo.org/2/>`_
 
 .. seealso::
 
-   Lots of different template engines divide the attention between themselves
-   because it's easy to create them in Python.  The page `Templating
+   There are many template engines competing for attention, becuase it is
+   pretty easy to create them in Python.  The page `Templating
    <http://wiki.python.org/moin/Templating>`_ in the wiki lists a big,
-   ever-growing number of these.
+   ever-growing number of these.  The three listed above are considered "second
+   generation" template engines and are a good place to start.
 
 
 Data persistence
 ----------------
 
-*Data persistence*, while sounding very complicated is just about storing data.
-This data might be the text of blog entries, the postings of a bulletin board or
-the text of a wiki page.  As always, there are different ways to store
-informations on a web server.
-
-Often relational database engines like `MySQL <http://www.mysql.com/>`_ or
-`PostgreSQL <http://www.postgresql.org/>`_ are used due to their good
-performance handling very large databases consisting of up to millions of
-entries.  These are *queried* using a language called `SQL
-<http://en.wikipedia.org/wiki/SQL>`_.  Python programmers in general do not like
-SQL too much, they prefer to work with objects.  It is possible to save Python
-objects into a database using a technology called `ORM
-<http://en.wikipedia.org/wiki/Object-relational_mapping>`_.  ORM translates all
-object-oriented access into SQL code under the hood, the user does not need to
-think about it.  Most `frameworks`_ use ORMs and it works quite well.
-
-A second possibility is using files that are saved on the hard disk (sometimes
-called flatfiles).  This is very easy, but is not too fast.  There is even a
-small database engine called `SQLite <http://www.sqlite.org/>`_ which is bundled
-with Python in the :mod:`sqlite` module and uses only one file.  This database
-can be used to store objects via an ORM and has no other dependencies.  For
-smaller sites SQLite is just enough.  But it is not the only way in which data
-can be saved into the file systems.  Sometimes normal, plain text files are
-enough.
-
-The third and least used possibility are so-called object oriented databases.
-These databases store the *actual objects* instead of the relations that
-OR-mapping creates between rows in a database.  This has the advantage that
-nearly all objects can be saven in a straightforward way, unlike in relational
-databases where some objects are very hard to represent with ORMs.
-
-`Frameworks`_ often give the users hints on which method to choose, it is
-usually a good idea to stick to these unless there are some special requirements
-which require to use the one method and not the other.
+*Data persistence*, while sounding very complicated, is just about storing data.
+This data might be the text of blog entries, the postings on a bulletin board or
+the text of a wiki page.  There are, of course, a number of different ways to store
+information on a web server.
+
+Often, relational database engines like `MySQL <http://www.mysql.com/>`_ or
+`PostgreSQL <http://www.postgresql.org/>`_ are used because of their good
+performance when handling very large databases consisting of millions of
+entries.  There is also a small database engine called `SQLite
+<http://www.sqlite.org/>`_, which is bundled with Python in the :mod:`sqlite3`
+module, and which uses only one file.  It has no other dependencies.  For
+smaller sites SQLite is just enough.
+
+Relational databases are *queried* using a language called `SQL
+<http://en.wikipedia.org/wiki/SQL>`_.  Python programmers in general do not
+like SQL too much, as they prefer to work with objects.  It is possible to save
+Python objects into a database using a technology called `ORM
+<http://en.wikipedia.org/wiki/Object-relational_mapping>`_ (Object Relational
+Mapping).  ORM translates all object-oriented access into SQL code under the
+hood, so the developer does not need to think about it.  Most `frameworks`_ use
+ORMs, and it works quite well.
+
+A second possibility is storing data in normal, plain text files (some
+times called "flat files").  This is very easy for simple sites,
+but can be difficult to get right if the web site is performing many
+updates to the stored data.
+
+A third possibility are object oriented databases (also called "object
+databases").  These databases store the object data in a form that closely
+parallels the way the objects are structured in memory during program
+execution.  (By contrast, ORMs store the object data as rows of data in tables
+and relations between those rows.)  Storing the objects directly has the
+advantage that nearly all objects can be saved in a straightforward way, unlike
+in relational databases where some objects are very hard to represent.
+
+`Frameworks`_ often give hints on which data storage method to choose.  It is
+usually a good idea to stick to the data store recommended by the framework
+unless the application has special requirements better satisfied by an
+alternate storage mechanism.
 
 .. seealso::
 
    * `Persistence Tools <http://wiki.python.org/moin/PersistenceTools>`_ lists
-     possibilities on how to save data in the file system, some of these modules
-     are part of the standard library
+     possibilities on how to save data in the file system.  Some of these
+     modules are part of the standard library
+
    * `Database Programming <http://wiki.python.org/moin/DatabaseProgramming>`_
-     helps on choosing a method on how to save the data
-   * `SQLAlchemy <http://www.sqlalchemy.org/>`_, the most powerful OR-Mapper for
-     Python and `Elixir <http://elixir.ematia.de/>`_ which makes it easier to
-     use
+     helps with choosing a method for saving data
+
+   * `SQLAlchemy <http://www.sqlalchemy.org/>`_, the most powerful OR-Mapper
+     for Python, and `Elixir <http://elixir.ematia.de/>`_, which makes
+     SQLAlchemy easier to use
+
    * `SQLObject <http://www.sqlobject.org/>`_, another popular OR-Mapper
+
    * `ZODB <https://launchpad.net/zodb>`_ and `Durus
      <http://www.mems-exchange.org/software/durus/>`_, two object oriented
      databases
@@ -574,42 +601,44 @@
 Frameworks
 ==========
 
-As web sites can easily become quite large, there are so-called frameworks which
-were created to help the developer with making these sites.  Although the most
-well-known framework is Ruby on Rails, Python does also have its own frameworks
-which are partly inspired by Rails or which were existing a long time before
-Rails.
-
-Two possible approaches to web frameworks exist: the minimalistic approach and
-the all-inclusive approach (somtimes called *full-stack*). Frameworks which are
-all-inclusive give you everything you need to start working, like a template
-engine, some way to save and access data in databases and many features more.
-Most users are best off using these as they are widely used by lots of other
-users and well documented in form of books and tutorials.  Other web frameworks
-go the minimalistic approach trying to be as flexible as possible leaving the
-user the freedom to choose what's best for him.
-
-The majority of users is best off with all-inclusive framewors.  They bring
-everything along so a user can just jump in and start to code.  While they do
-have some limitations they can fullfill 80% of what one will ever want to
-perfectly.  They consist of various components which are designed to work
-together as good as possible.
-
-The multitude of web frameworks written in Python demonstrates that it is really
-easy to write one.  One of the most well-known web applications written in
-Python is `Zope <http://www.zope.org/>`_ which can be regarded as some kind of
-big framework.  But Zope was not the only framework, there were some others
-which are by now nearly forgotten.  These do not need to be mentioned anymore,
-because most people that used them moved on to newer ones.
+The process of creating code to run web sites involves writing code to provide
+various services.  The code to provide a particular service often works the
+same way regardless of the complexity or purpose of the web site in question.
+Abstracting these common solutions into reusable code produces what are called
+"frameworks" for web development.  Perhaps the most well-known framework for
+web development is Ruby on Rails, but Python has its own frameworks.  Some of
+these were partly inspired by Rails, or borrowed ideas from Rails, but many
+existed a long time before Rails.
+
+Originally Python web frameworks tended to incorporate all of the services
+needed to develop web sites as a giant, integrated set of tools.  No two web
+frameworks were interoperable:  a program developed for one could not be
+deployed on a different one without considerable re-engineering work.  This led
+to the development of "minimalist" web frameworks that provided just the tools
+to communicate between the Python code and the http protocol, with all other
+services to be added on top via separate components.  Some ad hoc standards
+were developed that allowed for limited interoperability between frameworks,
+such as a standard that allowed different template engines to be used
+interchangeably.
+
+Since the advent of WSGI, the Python web framework world has been evolving
+toward interoperability based on the WSGI standard.  Now many web frameworks,
+whether "full stack" (providing all the tools one needs to deploy the most
+complex web sites) or minimalist, or anything in between, are built from
+collections of reusable components that can be used with more than one
+framework.
+
+The majority of users will probably want to select a "full stack" framework
+that has an active community.  These frameworks tend to be well documented,
+and provide the easiest path to producing a fully functional web site in
+minimal time.
 
 
 Some notable frameworks
 -----------------------
 
-There is an incredible number of frameworks, so there is no way to describe them
-all.  It is not even necessary, as most of these frameworks are nothing special
-and everything that can be done with these can also be done with one of the
-popular ones.
+There are an incredible number of frameworks, so they cannot all be covered
+here.  Instead we will briefly touch on some of the most popular.
 
 
 Django
@@ -617,16 +646,16 @@
 
 `Django <http://www.djangoproject.com/>`_ is a framework consisting of several
 tightly coupled elements which were written from scratch and work together very
-well.  It includes an ORM which is quite powerful while being simple to use and
-has a great online administration interface which makes it possible to edit the
-data in the database with a browser.  The template engine is text-based and is
-designed to be usable for page designers who cannot write Python.  It supports
-so-called template inheritance and filters (which work like Unix pipes).  Django
-has many handy features bundled, like creation of RSS feeds or generic views
-which make it possible to write web sites nearly without any Python code.
+well.  It includes an ORM which is quite powerful while being simple to use,
+and has a great online administration interface which makes it possible to edit
+the data in the database with a browser.  The template engine is text-based and
+is designed to be usable for page designers who cannot write Python.  It
+supports template inheritance and filters (which work like Unix pipes).  Django
+has many handy features bundled, such as creation of RSS feeds or generic views,
+which make it possible to create web sites almost without writing any Python code.
 
-It has a big, international community which has created many sites using Django.
-There are also quite a lot of add-on projects which extend Django's normal
+It has a big, international community, the members of which have created many
+web sites.  There are also a lot of add-on projects which extend Django's normal
 functionality.  This is partly due to Django's well written `online
 documentation <http://docs.djangoproject.com/>`_ and the `Django book
 <http://www.djangobook.com/>`_.
@@ -634,22 +663,20 @@
 
 .. note::
 
-   Although Django is an MVC-style framework, it calls the components
+   Although Django is an MVC-style framework, it names the elements
    differently, which is described in the `Django FAQ
-   <http://www.djangoproject.com/documentation/faq/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names>`_.
+   <http://docs.djangoproject.com/en/dev/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names>`_.
 
 
 TurboGears
 ^^^^^^^^^^
 
-The other popular web framework in Python is `TurboGears
-<http://www.turbogears.org/>`_.  It takes the approach of using already existing
-components and combining them with glue code to create a seamless experience.
-TurboGears gives the user more flexibility on which components to choose, the
-ORM can be switched between some easy to use but limited and complex but very
-powerful.  Same goes for the template engine.  One strong point about TurboGears
-is that the components that it consists of can be used easily in other projects
-without depending on TurboGears, for example the underlying web server CherryPy.
+Another popular web framework for Python is `TurboGears
+<http://www.turbogears.org/>`_.  TurboGears takes the approach of using already
+existing components and combining them with glue code to create a seamless
+experience.  TurboGears gives the user flexibility in choosing components. For
+example the ORM and template engine can be changed to use packages different
+from those used by default.
 
 The documentation can be found in the `TurboGears wiki
 <http://docs.turbogears.org/>`_, where links to screencasts can be found.
@@ -657,31 +684,46 @@
 questions.  There is also a `TurboGears book <http://turbogearsbook.com/>`_
 published, which is a good starting point.
 
-The plan for the next major version of TurboGears, version 2.0 is to switch to a
-more flexible base provided by another very flexible web framework called
-`Pylons <http://pylonshq.com/>`_.
+The newest version of TurboGears, version 2.0, moves even further in direction
+of WSGI support and a component-based architecture.  TurboGears 2 is based on
+the WSGI stack of another popular component-based web framework, `Pylons
+<http://pylonshq.com/>`_.
+
+
+Zope
+^^^^
+
+The Zope framework is one of the "old original" frameworks.  Its current
+incarnation in Zope2 is a tightly integrated full-stack framework.  One of its
+most interesting feature is its tight integration with a powerful object
+database called the `ZODB <https://launchpad.net/zodb>`_ (Zope Object Database).
+Because of its highly integrated nature, Zope wound up in a somewhat isolated
+ecosystem:  code written for Zope wasn't very usable outside of Zope, and
+vice-versa.  To solve this problem the Zope 3 effort was started.  Zope 3
+re-engineers Zope as a set of more cleanly isolated components.  This effort
+was started before the advent of the WSGI standard, but there is WSGI support
+for Zope 3 from the `Repoze <http://repoze.org/>`_ project.  Zope components
+have many years of production use behind them, and the Zope 3 project gives
+access to these components to the wider Python community.  There is even a
+separate framework based on the Zope components: `Grok
+<http://grok.zope.org/>`_.
+
+Zope is also the infrastructure used by the `Plone <http://plone.org/>`_ content
+management system, one of the most powerful and popular content management
+systems available.
 
 
 Other notable frameworks
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
-These two are of course not the only frameworks that are available, there are
-also some less-popular frameworks worth mentioning.
-
-One of these is the already mentioned Zope, which has been around for quite a
-long time.  With Zope 2.x having been known as rather un-pythonic, the newer
-Zope 3.x tries to change that and therefore gets more acceptance from Python
-programmers.  These efforts already showed results, there is a project which
-connects Zope with WSGI called `Repoze <http://repoze.org/>`_ and another
-project called `Grok <http://grok.zope.org/>`_ which makes it possible for
-"normal" Python programmers use the very mature Zope components.
+Of course these are not the only frameworks that are available.  There are
+many other frameworks worth mentioning.
 
 Another framework that's already been mentioned is `Pylons`_.  Pylons is much
-like TurboGears with an even stronger emphasis on flexibility, which is bought
+like TurboGears, but with an even stronger emphasis on flexibility, which comes
 at the cost of being more difficult to use.  Nearly every component can be
 exchanged, which makes it necessary to use the documentation of every single
-component, because there are so many Pylons combinations possible that can
-satisfy every requirement.  Pylons builds upon `Paste
+component, of which there are many.  Pylons builds upon `Paste
 <http://pythonpaste.org/>`_, an extensive set of tools which are handy for WSGI.
 
 And that's still not everything.  The most up-to-date information can always be
@@ -693,6 +735,6 @@
    <http://wiki.python.org/moin/WebFrameworks>`_.
 
    Most frameworks also have their own mailing lists and IRC channels, look out
-   for these on the projects' websites.  There is also a general "Python in the
+   for these on the projects' web sites.  There is also a general "Python in the
    Web" IRC channel on freenode called `#python.web
    <http://wiki.python.org/moin/PoundPythonWeb>`_.

Modified: python/branches/py3k-cdecimal/Doc/library/decimal.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/decimal.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/decimal.rst	Thu Apr  8 13:38:01 2010
@@ -127,10 +127,9 @@
 
    >>> getcontext().prec = 7       # Set a new precision
 
-Decimal instances can be constructed from integers, strings, or tuples.  To
-create a Decimal from a :class:`float`, first convert it to a string.  This
-serves as an explicit reminder of the details of the conversion (including
-representation error).  Decimal numbers include special values such as
+Decimal instances can be constructed from integers, strings, floats, or tuples.
+Construction from an integer or a float performs an exact conversion of the
+value of that integer or float.  Decimal numbers include special values such as
 :const:`NaN` which stands for "Not a number", positive and negative
 :const:`Infinity`, and :const:`-0`.
 
@@ -139,6 +138,8 @@
    Decimal('10')
    >>> Decimal('3.14')
    Decimal('3.14')
+   >>> Decimal(3.14)
+   Decimal('3.140000000000000124344978758017532527446746826171875')
    >>> Decimal((0, (3, 1, 4), -2))
    Decimal('3.14')
    >>> Decimal(str(2.0 ** 0.5))
@@ -336,8 +337,9 @@
 
    If *value* is a :class:`float`, the binary floating point value is losslessly
    converted to its exact decimal equivalent.  This conversion can often require
-   upto 53 digits of precision.  For example, ``Decimal(float('1.1'))`` converts
-   to ``Decimal('1.100000000000000088817841970012523233890533447265625')``.
+   53 or more digits of precision.  For example, ``Decimal(float('1.1'))``
+   converts to
+   ``Decimal('1.100000000000000088817841970012523233890533447265625')``.
 
    The *context* precision does not affect how many digits are stored. That is
    determined exclusively by the number of digits in *value*. For example,
@@ -351,6 +353,9 @@
 
    Once constructed, :class:`Decimal` objects are immutable.
 
+   .. versionchanged:: 3.2
+      The argument to the constructor is now permitted to be a :class:`float` instance.
+
    Decimal floating point objects share many properties with the other built-in
    numeric types such as :class:`float` and :class:`int`.  All of the usual math
    operations and special methods apply.  Likewise, decimal objects can be
@@ -490,6 +495,9 @@
       `0x1.999999999999ap-4`.  That equivalent value in decimal is
       `0.1000000000000000055511151231257827021181583404541015625`.
 
+      .. note:: From Python 3.2 onwards, a :class:`Decimal` instance
+         can also be constructed directly from a :class:`float`.
+
       .. doctest::
 
           >>> Decimal.from_float(0.1)
@@ -1846,7 +1854,7 @@
 
 Q. Is there a way to convert a regular float to a :class:`Decimal`?
 
-A. Yes, all binary floating point numbers can be exactly expressed as a
+A. Yes, any binary floating point number can be exactly expressed as a
 Decimal though an exact conversion may take more precision than intuition would
 suggest:
 

Modified: python/branches/py3k-cdecimal/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/functions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/functions.rst	Thu Apr  8 13:38:01 2010
@@ -1014,9 +1014,8 @@
    *reverse* is a boolean value.  If set to ``True``, then the list elements are
    sorted as if each comparison were reversed.
 
-   To convert an old-style *cmp* function to a *key* function, see the
-   `CmpToKey recipe in the ASPN cookbook
-   <http://code.activestate.com/recipes/576653/>`_\.
+   Use :func:`functools.cmp_to_key` to convert an
+   old-style *cmp* function to a *key* function.
 
    For sorting examples and a brief sorting tutorial, see `Sorting HowTo
    <http://wiki.python.org/moin/HowTo/Sorting/>`_\.

Modified: python/branches/py3k-cdecimal/Doc/library/functools.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/functools.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/functools.rst	Thu Apr  8 13:38:01 2010
@@ -15,6 +15,51 @@
 
 The :mod:`functools` module defines the following functions:
 
+..  function:: cmp_to_key(func)
+
+    Transform an old-style comparison function to a key-function.  Used with
+    tools that accept key functions (such as :func:`sorted`, :func:`min`,
+    :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`,
+    :func:`itertools.groupby`).
+    This function is primarily used as a transition tool for programs
+    being converted from Py2.x which supported the use of comparison
+    functions.
+
+    A compare function is any callable that accept two arguments, compares
+    them, and returns a negative number for less-than, zero for equality,
+    or a positive number for greater-than.  A key function is a callable
+    that accepts one argument and returns another value that indicates
+    the position in the desired collation sequence.
+
+    Example::
+
+        sorted(iterable, key=cmp_to_key(locale.strcoll))  # locale-aware sort order
+
+   .. versionadded:: 3.2
+
+.. function:: total_ordering(cls)
+
+   Given a class defining one or more rich comparison ordering methods, this
+   class decorator supplies the rest.  This simplies the effort involved
+   in specifying all of the possible rich comparison operations:
+
+   The class must define one of :meth:`__lt__`, :meth:`__le__`,
+   :meth:`__gt__`, or :meth:`__ge__`.
+   In addition, the class should supply an :meth:`__eq__` method.
+
+   For example::
+
+       @total_ordering
+       class Student:
+           def __eq__(self, other):
+               return ((self.lastname.lower(), self.firstname.lower()) ==
+                       (other.lastname.lower(), other.firstname.lower()))
+           def __lt__(self, other):
+               return ((self.lastname.lower(), self.firstname.lower()) <
+                       (other.lastname.lower(), other.firstname.lower()))
+
+   .. versionadded:: 3.2
+
 .. function:: partial(func, *args, **keywords)
 
    Return a new :class:`partial` object which when called will behave like *func*

Modified: python/branches/py3k-cdecimal/Doc/library/math.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/math.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/math.rst	Thu Apr  8 13:38:01 2010
@@ -33,8 +33,8 @@
 
 .. function:: copysign(x, y)
 
-   Return *x* with the sign of *y*. ``copysign`` copies the sign bit of an IEEE
-   754 float, ``copysign(1, -0.0)`` returns *-1.0*.
+   Return *x* with the sign of *y*.  On a platform that supports
+   signed zeros, ``copysign(1.0, -0.0)`` returns *-1.0*.
 
 
 .. function:: fabs(x)
@@ -99,15 +99,13 @@
 
 .. function:: isinf(x)
 
-   Checks if the float *x* is positive or negative infinite.
+   Check if the float *x* is positive or negative infinity.
 
 
 .. function:: isnan(x)
 
-   Checks if the float *x* is a NaN (not a number). NaNs are part of the
-   IEEE 754 standards. Operation like but not limited to ``inf * 0``,
-   ``inf / inf`` or any operation involving a NaN, e.g. ``nan * 1``, return
-   a NaN.
+   Check if the float *x* is a NaN (not a number).  For more information
+   on NaNs, see the IEEE 754 standards.
 
 
 .. function:: ldexp(x, i)
@@ -223,7 +221,7 @@
    The vector in the plane from the origin to point ``(x, y)`` makes this angle
    with the positive X axis. The point of :func:`atan2` is that the signs of both
    inputs are known to it, so it can compute the correct quadrant for the angle.
-   For example, ``atan(1``) and ``atan2(1, 1)`` are both ``pi/4``, but ``atan2(-1,
+   For example, ``atan(1)`` and ``atan2(1, 1)`` are both ``pi/4``, but ``atan2(-1,
    -1)`` is ``-3*pi/4``.
 
 
@@ -331,28 +329,31 @@
 
 .. data:: pi
 
-   The mathematical constant *pi*.
+   The mathematical constant π = 3.141592..., to available precision.
 
 
 .. data:: e
 
-   The mathematical constant *e*.
+   The mathematical constant e = 2.718281..., to available precision.
 
 
 .. impl-detail::
 
    The :mod:`math` module consists mostly of thin wrappers around the platform C
-   math library functions.  Behavior in exceptional cases is loosely specified
-   by the C standards, and Python inherits much of its math-function
-   error-reporting behavior from the platform C implementation.  As a result,
-   the specific exceptions raised in error cases (and even whether some
-   arguments are considered to be exceptional at all) are not defined in any
-   useful cross-platform or cross-release way.
-
-   All functions return a quiet *NaN* if at least one of the args is *NaN*.
-   Signaling *NaN*\s raise an exception. The exception type still depends on the
-   platform and libm implementation. It's usually :exc:`ValueError` for *EDOM*
-   and :exc:`OverflowError` for errno *ERANGE*.
+   math library functions.  Behavior in exceptional cases follows Annex F of
+   the C99 standard where appropriate.  The current implementation will raise
+   :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)``
+   (where C99 Annex F recommends signaling invalid operation or divide-by-zero),
+   and :exc:`OverflowError` for results that overflow (for example,
+   ``exp(1000.0)``).  A *NaN* will not be returned from any of the functions
+   above unless one or more of the input arguments was a *NaN*; in that case,
+   most functions will return a *NaN*, but (again following C99 Annex F) there
+   are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or
+   ``hypot(float('nan'), float('inf'))``.
+
+   Note that Python makes no effort to distinguish signaling NaNs from
+   quiet NaNs, and behavior for signaling NaNs remains unspecified.
+   Typical behavior is to treat all NaNs as though they were quiet.
 
 
 .. seealso::

Modified: python/branches/py3k-cdecimal/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/multiprocessing.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/multiprocessing.rst	Thu Apr  8 13:38:01 2010
@@ -61,15 +61,15 @@
 follows the API of :class:`threading.Thread`.  A trivial example of a
 multiprocess program is ::
 
-    from multiprocessing import Process
+   from multiprocessing import Process
 
    def f(name):
        print('hello', name)
 
-    if __name__ == '__main__':
-        p = Process(target=f, args=('bob',))
-        p.start()
-        p.join()
+   if __name__ == '__main__':
+       p = Process(target=f, args=('bob',))
+       p.start()
+       p.join()
 
 To show the individual process IDs involved, here is an expanded example::
 

Modified: python/branches/py3k-cdecimal/Doc/library/ssl.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/ssl.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/ssl.rst	Thu Apr  8 13:38:01 2010
@@ -237,6 +237,36 @@
    modern version, and probably the best choice for maximum protection, if both
    sides can speak it.
 
+.. data:: OPENSSL_VERSION
+
+   The version string of the OpenSSL library loaded by the interpreter::
+
+    >>> ssl.OPENSSL_VERSION
+    'OpenSSL 0.9.8k 25 Mar 2009'
+
+   .. versionadded:: 3.2
+
+.. data:: OPENSSL_VERSION_INFO
+
+   A tuple of five integers representing version information about the
+   OpenSSL library::
+
+    >>> ssl.OPENSSL_VERSION_INFO
+    (0, 9, 8, 11, 15)
+
+   .. versionadded:: 3.2
+
+.. data:: OPENSSL_VERSION_NUMBER
+
+   The raw version number of the OpenSSL library, as a single integer::
+
+    >>> ssl.OPENSSL_VERSION_NUMBER
+    9470143
+    >>> hex(ssl.OPENSSL_VERSION_NUMBER)
+    '0x9080bf'
+
+   .. versionadded:: 3.2
+
 
 SSLSocket Objects
 -----------------

Modified: python/branches/py3k-cdecimal/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/stdtypes.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/stdtypes.rst	Thu Apr  8 13:38:01 2010
@@ -1567,6 +1567,9 @@
 
    *key* specifies a function of one argument that is used to extract a comparison
    key from each list element: ``key=str.lower``.  The default value is ``None``.
+   Use :func:`functools.cmp_to_key` to convert an
+   old-style *cmp* function to a *key* function.
+
 
    *reverse* is a boolean value.  If set to ``True``, then the list elements are
    sorted as if each comparison were reversed.

Modified: python/branches/py3k-cdecimal/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/reference/datamodel.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/reference/datamodel.rst	Thu Apr  8 13:38:01 2010
@@ -1209,8 +1209,7 @@
    Arguments to rich comparison methods are never coerced.
 
    To automatically generate ordering operations from a single root operation,
-   see the `Total Ordering recipe in the ASPN cookbook
-   <http://code.activestate.com/recipes/576529/>`_\.
+   see :func:`functools.total_ordering`.
 
 .. method:: object.__hash__(self)
 

Modified: python/branches/py3k-cdecimal/Doc/reference/expressions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/reference/expressions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/reference/expressions.rst	Thu Apr  8 13:38:01 2010
@@ -914,6 +914,9 @@
 A right shift by *n* bits is defined as division by ``pow(2,n)``.  A left shift
 by *n* bits is defined as multiplication with ``pow(2,n)``.
 
+.. note:: In the current implementation, the right-hand operand is required
+   to be at most :attr:`sys.maxsize`.  If the right-hand operand is larger than
+   :attr:`sys.maxsize` an :exc:`OverflowError` exception is raised.
 
 .. _bitwise:
 

Modified: python/branches/py3k-cdecimal/Doc/using/cmdline.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/using/cmdline.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/using/cmdline.rst	Thu Apr  8 13:38:01 2010
@@ -1,5 +1,8 @@
 .. highlightlang:: none
 
+.. ATTENTION: You probably should update Misc/python.man, too, if you modify
+.. this file.
+
 .. _using-on-general:
 
 Command line and environment
@@ -306,6 +309,8 @@
 
       :pep:`230` -- Warning framework
 
+      :envvar:`PYTHONWARNINGS`
+
 
 .. cmdoption:: -x
 
@@ -469,6 +474,12 @@
    value instead of the value got through the C runtime.  Only works on
    Mac OS X.
 
+.. envvar:: PYTHONWARNINGS
+
+   This is the equivalent to the :option:`-W` option. If set to a comma
+   separated string, it is equivalent to specifying :option:`-W` multiple
+   times.
+
 
 Debug-mode variables
 ~~~~~~~~~~~~~~~~~~~~

Modified: python/branches/py3k-cdecimal/Doc/using/mac.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/using/mac.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/using/mac.rst	Thu Apr  8 13:38:01 2010
@@ -66,7 +66,7 @@
 http://www.barebones.com/products/bbedit/index.shtml) are good choices, as is
 :program:`TextMate` (see http://macromates.com/). Other editors include
 :program:`Gvim` (http://macvim.org) and :program:`Aquamacs`
-(http://aquamacs.org).
+(http://aquamacs.org/).
 
 To run your script from the Terminal window you must make sure that
 :file:`/usr/local/bin` is in your shell search path.

Modified: python/branches/py3k-cdecimal/Doc/whatsnew/2.1.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/2.1.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/2.1.rst	Thu Apr  8 13:38:01 2010
@@ -731,7 +731,7 @@
          ...
 
   For a fuller discussion of the line I/O changes, see the python-dev summary for
-  January 1-15, 2001 at http://www.python.org/dev/summary/2001-01-1.html.
+  January 1-15, 2001 at http://www.python.org/dev/summary/2001-01-1/.
 
 * A new method, :meth:`popitem`, was added to dictionaries to enable
   destructively iterating through the contents of a dictionary; this can be faster

Modified: python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst	Thu Apr  8 13:38:01 2010
@@ -2195,7 +2195,7 @@
   This produces better results when operating on Unix's dot-files.
   For example, ``os.path.splitext('.ipython')``
   now returns ``('.ipython', '')`` instead of ``('', '.ipython')``.
-  (:issue:`115886`)
+  (:issue:`1115886`)
 
   A new function, ``os.path.relpath(path, start='.')``, returns a relative path
   from the ``start`` path, if it's supplied, or from the current

Modified: python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst	Thu Apr  8 13:38:01 2010
@@ -8,6 +8,9 @@
 
 .. Fix accents on Kristjan Valur Jonsson, Fuerstenau
 
+.. Big jobs: argparse, ElementTree 1.3, pep 391, 3106, sysconfig
+..  unittest test discovery
+
 .. $Id$
    Rules for maintenance:
 
@@ -37,7 +40,7 @@
    * You can comment out your additions if you like, but it's not
    necessary (especially when a final release is some months away).
 
-   * Credit the author of a patch or bugfix.   Just the name is
+   * Credit the author of a patch or bugfix.  Just the name is
    sufficient; the e-mail address isn't necessary.
 
    * It's helpful to add the bug/patch number in a parenthetical comment.
@@ -106,11 +109,12 @@
 Over the years, a number of authors have written alternative implementations
 that remember the order that the keys were originally inserted.  Based on
 the experiences from those implementations, a new
-:class:`collections.OrderedDict` class has been introduced.
+:class:`~collections.OrderedDict` class has been introduced in the
+:mod:`collections` module.
 
-The :class:`OrderedDict` API is substantially the same as regular dictionaries
-but will iterate over keys and values in a guaranteed order depending on
-when a key was first inserted::
+The :class:`~collections.OrderedDict` API is substantially the same as regular
+dictionaries but will iterate over keys and values in a guaranteed order
+depending on when a key was first inserted::
 
     >>> from collections import OrderedDict
     >>> d = OrderedDict([('first', 1), ('second', 2),
@@ -132,8 +136,8 @@
     >>> d.items()
     [('first', 1), ('third', 3), ('second', 5)]
 
-The :meth:`popitem` method has an optional *last* argument
-that defaults to True.  If *last* is True, the most recently
+The :meth:`~collections.OrderedDict.popitem` method has an optional *last*
+argument that defaults to True.  If *last* is True, the most recently
 added key is returned and removed; if it's False, the
 oldest key is selected::
 
@@ -142,9 +146,9 @@
     (19, 0)
     >>> od.popitem()
     (18, 0)
-    >>> od.popitem(False)
+    >>> od.popitem(last=False)
     (0, 0)
-    >>> od.popitem(False)
+    >>> od.popitem(last=False)
     (1, 0)
 
 Comparing two ordered dictionaries checks both the keys and values,
@@ -154,31 +158,35 @@
     ...                    ('third', 3)])
     >>> od2 = OrderedDict([('third', 3), ('first', 1),
     ...                    ('second', 2)])
-    >>> od1==od2
+    >>> od1 == od2
     False
     >>> # Move 'third' key to the end
-    >>> del od2['third'] ; od2['third'] = 3
-    >>> od1==od2
+    >>> del od2['third']; od2['third'] = 3
+    >>> od1 == od2
     True
 
-Comparing an :class:`OrderedDict` with a regular dictionary
+Comparing an :class:`~collections.OrderedDict` with a regular dictionary
 ignores the insertion order and just compares the keys and values.
 
-How does the :class:`OrderedDict` work?  It maintains a doubly-linked
-list of keys, appending new keys to the list as they're inserted.  A
-secondary dictionary maps keys to their corresponding list node, so
+How does the :class:`~collections.OrderedDict` work?  It maintains a
+doubly-linked list of keys, appending new keys to the list as they're inserted.
+A secondary dictionary maps keys to their corresponding list node, so
 deletion doesn't have to traverse the entire linked list and therefore
 remains O(1).
 
 .. XXX check O(1)-ness with Raymond
+..     Also check if the 'somenamedtuple' in the collection module should
+..     be replaced/removed in order to use
+..     :meth:`~collections.namedtuple._asdict()` (see below)
 
 The standard library now supports use of ordered dictionaries in several
 modules.  The :mod:`configparser` module uses them by default.  This lets
 configuration files be read, modified, and then written back in their original
-order.  The *_asdict()* method for :func:`collections.namedtuple` now
-returns an ordered dictionary with the values appearing in the same order as
-the underlying tuple indicies.  The :mod:`json` module is being built-out with
-an *object_pairs_hook* to allow OrderedDicts to be built by the decoder.
+order.  The :meth:`~collections.somenamedtuple._asdict()` method for
+:func:`collections.namedtuple` now returns an ordered dictionary with the
+values appearing in the same order as the underlying tuple indices.
+The :mod:`json` module is being built-out with an *object_pairs_hook* to allow
+OrderedDicts to be built by the decoder.
 Support was also added for third-party tools like `PyYAML <http://pyyaml.org/>`_.
 
 .. seealso::
@@ -190,7 +198,7 @@
 .. _pep-0378:
 
 PEP 378: Format Specifier for Thousands Separator
-====================================================
+=================================================
 
 To make program output more readable, it can be useful to add
 separators to large numbers and render them as
@@ -203,13 +211,18 @@
 threads are producing output for different locales.
 
 Therefore, a simple comma-grouping mechanism has been added to the
-mini-language used by the string :meth:`format` method.  When
+mini-language used by the :meth:`str.format` method.  When
 formatting a floating-point number, simply include a comma between the
 width and the precision::
 
-   >>> '{:20,.2}'.format(f)
+   >>> '{:20,.2f}'.format(18446744073709551616.0)
    '18,446,744,073,709,551,616.00'
 
+When formatting an integer, include the comma after the width:
+
+   >>> '{:20,d}'.format(18446744073709551616)
+   '18,446,744,073,709,551,616'
+
 This mechanism is not adaptable at all; commas are always used as the
 separator and the grouping is always into three-digit groups.  The
 comma-formatting mechanism isn't as general as the :mod:`locale`
@@ -237,6 +250,20 @@
 
 XXX write this section.
 
+Two smaller enhancements to the logging module are:
+
+.. rev79293
+
+* :class:`Logger` instances gained a :meth:`getChild` that retrieves a
+  descendant logger using a relative path.  For example,
+  once you retrieve a logger by doing ``log = getLogger('app')``,
+  calling ``log.getChild('network.listen')`` is equivalent to
+  ``getLogger('app.network.listen')``.
+
+* The :class:`LoggerAdapter` class gained a :meth:`isEnabledFor` method
+  that takes a *level* and returns whether the underlying logger would
+  process a message of that level of importance.
+
 .. seealso::
 
    :pep:`391` - Dictionary-Based Configuration For Logging
@@ -268,9 +295,9 @@
 
     >>> {1,2,3,4,5}
     set([1, 2, 3, 4, 5])
-    >>> set()
+    >>> set() # empty set
     set([])
-    >>> {}
+    >>> {}    # empty dict
     {}
 
   Backported by Alexandre Vassalotti; :issue:`2335`.
@@ -316,7 +343,7 @@
   :mod:`marshal`, :mod:`pickle`
   and :mod:`json` modules;
   parsing of float and imaginary literals in Python code;
-  and :class:`Decimal`-to-float conversion.
+  and :class:`~decimal.Decimal`-to-float conversion.
 
   Related to this, the :func:`repr` of a floating-point number *x*
   now returns a result based on the shortest decimal string that's
@@ -324,6 +351,8 @@
   round-half-to-even rounding mode).  Previously it gave a string
   based on rounding x to 17 decimal digits.
 
+  .. maybe add an example?
+
   The rounding library responsible for this improvement works on
   Windows, and on Unix platforms using the gcc, icc, or suncc
   compilers.  There may be a small number of platforms where correct
@@ -351,11 +380,12 @@
   of them -- but you can mix auto-numbering and named fields, as in the second
   example above.  (Contributed by Eric Smith; :issue:`5237`.)
 
-  Complex numbers now correctly support usage with :func:`format`.
+  Complex numbers now correctly support usage with :func:`format`,
+  and default to being right-aligned.
   Specifying a precision or comma-separation applies to both the real
   and imaginary parts of the number, but a specified field width and
   alignment is applied to the whole of the resulting ``1.5+3j``
-  output.  (Contributed by Eric Smith; :issue:`1588`.)
+  output.  (Contributed by Eric Smith; :issue:`1588` and :issue:`7988`.)
 
   The 'F' format code now always formats its output using uppercase characters,
   so it will now produce 'INF' and 'NAN'.
@@ -366,7 +396,7 @@
   its argument in binary::
 
       >>> n = 37
-      >>> bin(37)
+      >>> bin(n)
       '0b100101'
       >>> n.bit_length()
       6
@@ -397,8 +427,7 @@
     >>> n = 295147905179352891391
     >>> float(n)
     2.9514790517935289e+20
-    >>> n-long(float(n)
-    ... )
+    >>> n - long(float(n))
     -1L
 
   (Implemented by Mark Dickinson; :issue:`3166`.)
@@ -406,10 +435,16 @@
   Integer division is also more accurate in its rounding behaviours.  (Also
   implemented by Mark Dickinson; :issue:`1811`.)
 
-* The :class:`bytearray` type's :meth:`translate` method now accepts
+* It's now possible for a subclass of the built-in :class:`unicode` type
+  to override the :meth:`__unicode__` method.  (Implemented by
+  Victor Stinner; :issue:`1583863`.)
+
+* The :class:`bytearray` type's :meth:`~bytearray.translate` method now accepts
   ``None`` as its first argument.  (Fixed by Georg Brandl;
   :issue:`4759`.)
 
+  .. bytearray doesn't seem to be documented
+
 * When using ``@classmethod`` and ``@staticmethod`` to wrap
   methods as class or static methods, the wrapper object now
   exposes the wrapped function as their :attr:`__func__` attribute.
@@ -468,7 +503,7 @@
   the middle generation has been collected 10 times and when the
   number of survivor objects from the middle generation exceeds 10% of
   the number of objects in the oldest generation.  (Suggested by Martin
-  von Loewis and implemented by Antoine Pitrou; :issue:`4074`.)
+  von Löwis and implemented by Antoine Pitrou; :issue:`4074`.)
 
 * The garbage collector tries to avoid tracking simple containers
   which can't be part of a cycle. In Python 2.7, this is now true for
@@ -490,7 +525,7 @@
 
   Apart from the performance improvements this change should be
   invisible to end users, with one exception: for testing and
-  debugging purposes there's a new structseq ``sys.long_info`` that
+  debugging purposes there's a new structseq :data:`sys.long_info` that
   provides information about the internal format, giving the number of
   bits per digit and the size in bytes of the C type used to store
   each digit::
@@ -556,7 +591,7 @@
 :file:`Misc/NEWS` file in the source tree for a more complete list of
 changes, or look through the Subversion logs for all the details.
 
-* The :mod:`bdb` module's base debugging class :class:`Bdb`
+* The :mod:`bdb` module's base debugging class :class:`~bdb.Bdb`
   gained a feature for skipping modules.  The constructor
   now takes an iterable containing glob-style patterns such as
   ``django.*``; the debugger will not step into stack frames
@@ -568,13 +603,21 @@
   used with :class:`memoryview` instances and other similar buffer objects.
   (Backported from 3.x by Florent Xicluna; :issue:`7703`.)
 
-* The :mod:`bz2` module's :class:`BZ2File` now supports the context
+* Updated module: the :mod:`bsddb` module has been updated from 4.7.2devel9
+  to version 4.8.4 of
+  `the pybsddb package <http://www.jcea.es/programacion/pybsddb.htm>`__.
+  The new version features better Python 3.x compatibility, various bug fixes,
+  and adds several new BerkeleyDB flags and methods.
+  (Updated by Jesús Cea Avión; :issue:`8156`.  The pybsddb
+  changelog can be browsed at http://hg.jcea.es/pybsddb/file/tip/ChangeLog.)
+
+* The :mod:`bz2` module's :class:`~bz2.BZ2File` now supports the context
   management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``.
   (Contributed by Hagen Fuerstenau; :issue:`3860`.)
 
-* New class: the :class:`Counter` class in the :mod:`collections` module is
-  useful for tallying data.  :class:`Counter` instances behave mostly
-  like dictionaries but return zero for missing keys instead of
+* New class: the :class:`~collections.Counter` class in the :mod:`collections`
+  module is useful for tallying data.  :class:`~collections.Counter` instances
+  behave mostly like dictionaries but return zero for missing keys instead of
   raising a :exc:`KeyError`:
 
   .. doctest::
@@ -594,8 +637,9 @@
      >>> c['z']
      0
 
-  There are two additional :class:`Counter` methods: :meth:`most_common`
-  returns the N most common elements and their counts, and :meth:`elements`
+  There are two additional :class:`~collections.Counter` methods:
+  :meth:`~collections.Counter.most_common` returns the N most common elements
+  and their counts, and :meth:`~collections.Counter.elements`
   returns an iterator over the contained element, repeating each element
   as many times as its count::
 
@@ -607,12 +651,14 @@
        'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
        's', 's', 'r', 't', 't', 'x'
 
+  .. maybe it's better to use list(c.elements()) here
+
   Contributed by Raymond Hettinger; :issue:`1696199`.
 
-  The new `~collections.OrderedDict` class is described in the earlier section
-  :ref:`pep-0372`.
+  The new :class:`~collections.OrderedDict` class is described in the earlier
+  section :ref:`pep-0372`.
 
-  The :class:`namedtuple` class now has an optional *rename* parameter.
+  The :class:`~collections.namedtuple` class now has an optional *rename* parameter.
   If *rename* is true, field names that are invalid because they've
   been repeated or that aren't legal Python identifiers will be
   renamed to legal names that are derived from the field's
@@ -625,12 +671,12 @@
 
   (Added by Raymond Hettinger; :issue:`1818`.)
 
-  The :class:`deque` data type now exposes its maximum length as the
-  read-only :attr:`maxlen` attribute, and has a
-  :meth:`reverse` method that reverses the elements of the deque in-place.
+  The :class:`~collections.deque` data type now exposes its maximum length as the
+  read-only :attr:`~collections.deque.maxlen` attribute, and has a
+  :meth:`~collections.deque.reverse` method that reverses the elements of the deque in-place.
   (Added by Raymond Hettinger.)
 
-* The :mod:`copy` module's :func:`deepcopy` function will now
+* The :mod:`copy` module's :func:`~copy.deepcopy` function will now
   correctly copy bound instance methods.  (Implemented by
   Robert Collins; :issue:`1515`.)
 
@@ -641,13 +687,13 @@
   3.0.9, containing various fixes for different platforms.  (Updated
   by Matthias Klose; :issue:`8142`.)
 
-* New method: the :mod:`datetime` module's :class:`timedelta` class
-  gained a :meth:`total_seconds` method that returns the number of seconds
-  in the duration.  (Contributed by Brian Quinlan; :issue:`5788`.)
-
-* New method: the :class:`Decimal` class gained a
-  :meth:`from_float` class method that performs an exact conversion
-  of a floating-point number to a :class:`Decimal`.
+* New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class
+  gained a :meth:`~datetime.timedelta.total_seconds` method that returns the
+  number of seconds in the duration.  (Contributed by Brian Quinlan; :issue:`5788`.)
+
+* New method: the :class:`~decimal.Decimal` class gained a
+  :meth:`~decimal.Decimal.from_float` class method that performs an exact
+  conversion of a floating-point number to a :class:`~decimal.Decimal`.
   Note that this is an **exact** conversion that strives for the
   closest decimal approximation to the floating-point representation's value;
   the resulting decimal value will therefore still include the inaccuracy,
@@ -656,32 +702,39 @@
   ``Decimal('0.1000000000000000055511151231257827021181583404541015625')``.
   (Implemented by Raymond Hettinger; :issue:`4796`.)
 
-  The constructor for :class:`Decimal` now accepts non-European
+  Most of the methods of the :class:`~decimal.Context` class now accept integers
+  as well as :class:`~decimal.Decimal` instances; the only exceptions are the
+  :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context.is_canonical`
+  methods.  (Patch by Juan José Conti; :issue:`7633`.)
+
+  The constructor for :class:`~decimal.Decimal` now accepts non-European
   Unicode characters, such as Arabic-Indic digits.  (Contributed by
   Mark Dickinson; :issue:`6595`.)
 
-  When using :class:`Decimal` instances with a string's
-  :meth:`format` method, the default alignment was previously
+  When using :class:`~decimal.Decimal` instances with a string's
+  :meth:`~str.format` method, the default alignment was previously
   left-alignment.  This has been changed to right-alignment, which seems
   more sensible for numeric types.  (Changed by Mark Dickinson; :issue:`6857`.)
 
-* The :class:`Fraction` class now accepts two rational numbers
+* The :class:`~fractions.Fraction` class now accepts two rational numbers
   as arguments to its constructor.
   (Implemented by Mark Dickinson; :issue:`5812`.)
 
-* The :mod:`ftplib` module gained the ability to establish secure FTP
+* New class: a new :class:`~ftplib.FTP_TLS` class in
+  the :mod:`ftplib` module provides secure FTP
   connections using TLS encapsulation of authentication as well as
-  subsequent control and data transfers.  This is provided by the new
-  :class:`ftplib.FTP_TLS` class.
-  (Contributed by Giampaolo Rodola', :issue:`2054`.)  The :meth:`storbinary`
-  method for binary uploads can now restart uploads thanks to an added
-  *rest* parameter (patch by Pablo Mouzo; :issue:`6845`.)
+  subsequent control and data transfers.
+  (Contributed by Giampaolo Rodola', :issue:`2054`.)
 
-* New function: the :mod:`gc` module's :func:`is_tracked` returns
+  The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart
+  uploads thanks to an added *rest* parameter (patch by Pablo Mouzo;
+  :issue:`6845`.)
+
+* New function: the :mod:`gc` module's :func:`~gc.is_tracked` returns
   true if a given instance is tracked by the garbage collector, false
   otherwise. (Contributed by Antoine Pitrou; :issue:`4688`.)
 
-* The :mod:`gzip` module's :class:`GzipFile` now supports the context
+* The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context
   management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``
   (contributed by Hagen Fuerstenau; :issue:`3860`), and it now implements
   the :class:`io.BufferedIOBase` ABC, so you can wrap it with
@@ -695,11 +748,17 @@
   :mod:`gzip` module will now consume these trailing bytes.  (Fixed by
   Tadek Pietraszek and Brian Curtin; :issue:`2846`.)
 
-* The default :class:`HTTPResponse` class used by the :mod:`httplib` module now
+* New attribute: the :mod:`hashlib` module now has an :attr:`~hashlib.hashlib.algorithms`
+  attribute containing a tuple naming the supported algorithms.
+  In Python 2.7, ``hashlib.algorithms`` contains
+  ``('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')``
+  (Contributed by Carl Chenet; :issue:`7418`.)
+
+* The default :class:`~httplib.HTTPResponse` class used by the :mod:`httplib` module now
   supports buffering, resulting in much faster reading of HTTP responses.
   (Contributed by Kristjan Valur Jonsson; :issue:`4879`.)
 
-  The :class:`HTTPConnection` and :class:`HTTPSConnection` classes
+  The :class:`~httplib.HTTPConnection` and :class:`~httplib.HTTPSConnection` classes
   now support a *source_address* parameter, a ``(host, port)`` 2-tuple
   giving the source address that will be used for the connection.
   (Contributed by Eldon Ziegler; :issue:`3972`.)
@@ -707,9 +766,9 @@
 * The :mod:`imaplib` module now supports IPv6 addresses.
   (Contributed by Derek Morr; :issue:`1655`.)
 
-* The :mod:`io` library has been upgraded to the version shipped with
+* Updated module: The :mod:`io` library has been upgraded to the version shipped with
   Python 3.1.  For 3.1, the I/O library was entirely rewritten in C
-  and is 2 to 20 times faster depending on the task at hand.  The
+  and is 2 to 20 times faster depending on the task being performed.  The
   original Python version was renamed to the :mod:`_pyio` module.
 
   One minor resulting change: the :class:`io.TextIOBase` class now
@@ -719,7 +778,7 @@
 
   The :class:`io.FileIO` class now raises an :exc:`OSError` when passed
   an invalid file descriptor.  (Implemented by Benjamin Peterson;
-  :issue:`4991`.)  The :meth:`truncate` method now preserves the
+  :issue:`4991`.)  The :meth:`~io.IOBase.truncate` method now preserves the
   file position; previously it would change the file position to the
   end of the new file.  (Fixed by Pascal Chambon; :issue:`6939`.)
 
@@ -730,9 +789,11 @@
     itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>
       A, C, E, F
 
+  .. maybe here is better to use >>> list(itertools.compress(...)) instead
+
   New function: ``itertools.combinations_with_replacement(iter, r)``
   returns all the possible *r*-length combinations of elements from the
-  iterable *iter*.  Unlike :func:`combinations`, individual elements
+  iterable *iter*.  Unlike :func:`~itertools.combinations`, individual elements
   can be repeated in the generated combinations::
 
     itertools.combinations_with_replacement('abc', 2) =>
@@ -742,10 +803,10 @@
   Note that elements are treated as unique depending on their position
   in the input, not their actual values.
 
-  The :class:`itertools.count` function now has a *step* argument that
-  allows incrementing by values other than 1.  :func:`count` also
+  The :func:`itertools.count` function now has a *step* argument that
+  allows incrementing by values other than 1.  :func:`~itertools.count` also
   now allows keyword arguments, and using non-integer values such as
-  floats or :class:`Decimal` instances.  (Implemented by Raymond
+  floats or :class:`~decimal.Decimal` instances.  (Implemented by Raymond
   Hettinger; :issue:`5032`.)
 
   :func:`itertools.combinations` and :func:`itertools.product` were
@@ -753,22 +814,22 @@
   the input iterable.  This was deemed a specification error, so they
   now return an empty iterator.  (Fixed by Raymond Hettinger; :issue:`4816`.)
 
-* The :mod:`json` module was upgraded to version 2.0.9 of the
+* Updated module: The :mod:`json` module was upgraded to version 2.0.9 of the
   simplejson package, which includes a C extension that makes
   encoding and decoding faster.
   (Contributed by Bob Ippolito; :issue:`4136`.)
 
-  To support the new :class:`OrderedDict` type, :func:`json.load`
+  To support the new :class:`collections.OrderedDict` type, :func:`json.load`
   now has an optional *object_pairs_hook* parameter that will be called
   with any object literal that decodes to a list of pairs.
   (Contributed by Raymond Hettinger; :issue:`5381`.)
 
 * New functions: the :mod:`math` module gained
-  :func:`erf` and :func:`erfc` for the error function and the complementary error function,
-  :func:`expm1` which computes ``e**x - 1`` with more precision than
-  using :func:`exp` and subtracting 1,
-  :func:`gamma` for the Gamma function, and
-  :func:`lgamma` for the natural log of the Gamma function.
+  :func:`~math.erf` and :func:`~math.erfc` for the error function and the complementary error function,
+  :func:`~math.expm1` which computes ``e**x - 1`` with more precision than
+  using :func:`~math.exp` and subtracting 1,
+  :func:`~math.gamma` for the Gamma function, and
+  :func:`~math.lgamma` for the natural log of the Gamma function.
   (Contributed by Mark Dickinson and nirinA raseliarison; :issue:`3366`.)
 
 * The :mod:`multiprocessing` module's :class:`Manager*` classes
@@ -777,10 +838,10 @@
   passed to the callable.
   (Contributed by lekma; :issue:`5585`.)
 
-  The :class:`Pool` class, which controls a pool of worker processes,
+  The :class:`~multiprocessing.Pool` class, which controls a pool of worker processes,
   now has an optional *maxtasksperchild* parameter.  Worker processes
   will perform the specified number of tasks and then exit, causing the
-  :class:`Pool` to start a new worker.  This is useful if tasks may leak
+  :class:`~multiprocessing.Pool` to start a new worker.  This is useful if tasks may leak
   memory or other resources, or if some tasks will cause the worker to
   become very large.
   (Contributed by Charles Cazabon; :issue:`6963`.)
@@ -789,47 +850,50 @@
   (Contributed by Derek Morr; :issue:`1664`.)
 
 * New functions: the :mod:`os` module wraps the following POSIX system
-  calls: :func:`getresgid` and :func:`getresuid`, which return the
+  calls: :func:`~os.getresgid` and :func:`~os.getresuid`, which return the
   real, effective, and saved GIDs and UIDs;
-  :func:`setresgid` and :func:`setresuid`, which set
+  :func:`~os.setresgid` and :func:`~os.setresuid`, which set
   real, effective, and saved GIDs and UIDs to new values;
-  :func:`initgroups`.  (GID/UID functions
+  :func:`~os.initgroups`.  (GID/UID functions
   contributed by Travis H.; :issue:`6508`.  Support for initgroups added
   by Jean-Paul Calderone; :issue:`7333`.)
 
   The :func:`os.fork` function now re-initializes the import lock in
-  the child process; this fixes problems on Solaris when :func:`fork`
+  the child process; this fixes problems on Solaris when :func:`~os.fork`
   is called from a thread.  (Fixed by Zsolt Cserna; :issue:`7242`.)
 
-  The :func:`normpath` function now preserves Unicode; if its input path
+* In the :mod:`os.path` module, the :func:`~os.path.normpath` and
+  :func:`~os.path.abspath` functions now preserve Unicode; if their input path
   is a Unicode string, the return value is also a Unicode string.
-  (Fixed by Matt Giuca; :issue:`5827`.)
+  (:meth:`~os.path.normpath` fixed by Matt Giuca in :issue:`5827`;
+  :meth:`~os.path.abspath` fixed by Ezio Melotti in :issue:`3426`.)
 
 * The :mod:`pydoc` module now has help for the various symbols that Python
   uses.  You can now do ``help('<<')`` or ``help('@')``, for example.
   (Contributed by David Laban; :issue:`4739`.)
 
-* The :mod:`re` module's :func:`split`, :func:`sub`, and :func:`subn`
+* The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re.subn`
   now accept an optional *flags* argument, for consistency with the
   other functions in the module.  (Added by Gregory P. Smith.)
 
-* The :mod:`shutil` module's :func:`copyfile` and :func:`copytree`
-  functions now raises a :exc:`SpecialFileError` exception when
+* New function: in the :mod:`shutil` module, :func:`~shutil.make_archive`
+  takes a filename, archive type (zip or tar-format), and a directory
+  path, and creates an archive containing the directory's contents.
+  (Added by Tarek Ziadé.)
+
+  :mod:`shutil`'s :func:`~shutil.copyfile` and :func:`~shutil.copytree`
+  functions now raise a :exc:`~shutil.SpecialFileError` exception when
   asked to copy a named pipe.  Previously the code would treat
   named pipes like a regular file by opening them for reading, and
   this would block indefinitely.  (Fixed by Antoine Pitrou; :issue:`3002`.)
 
-  New function: :func:`make_archive` takes a filename, archive type
-  (zip or tar-format), and a directory path, and creates an archive
-  containing the directory's contents.  (Added by Tarek Ziadé.)
-
 * New functions: in the :mod:`site` module, three new functions
   return various site- and user-specific paths.
-  :func:`getsitepackages` returns a list containing all
+  :func:`~site.getsitepackages` returns a list containing all
   global site-packages directories, and
-  :func:`getusersitepackages` returns the path of the user's
+  :func:`~site.getusersitepackages` returns the path of the user's
   site-packages directory.
-  :func:`getuserbase` returns the value of the :envvar:`USER_BASE`
+  :func:`~site.getuserbase` returns the value of the :envvar:`USER_BASE`
   environment variable, giving the path to a directory that can be used
   to store data.
   (Contributed by Tarek Ziadé; :issue:`6693`.)
@@ -839,32 +903,32 @@
   catch and swallow the :exc:`KeyboardInterrupt` exception.  (Fixed by
   Victor Stinner; :issue:`3137`.)
 
-* The :mod:`socket` module's :class:`SSL` objects now support the
+* The :mod:`socket` module's :class:`~ssl.SSL` objects now support the
   buffer API, which fixed a test suite failure.  (Fixed by Antoine
   Pitrou; :issue:`7133`.)
 
-  The :func:`create_connection` function
+  The :func:`~socket.create_connection` function
   gained a *source_address* parameter, a ``(host, port)`` 2-tuple
   giving the source address that will be used for the connection.
   (Contributed by Eldon Ziegler; :issue:`3972`.)
 
-  The :meth:`recv_into` and `recvfrom_into` methods will now write
-  into objects that support the buffer API, most usefully
+  The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket.recvfrom_into`
+  methods will now write into objects that support the buffer API, most usefully
   the :class:`bytearray` and :class:`memoryview` objects.  (Implemented by
   Antoine Pitrou; :issue:`8104`.)
 
-* The :mod:`SocketServer` module's :class:`TCPServer` class now
-  has a :attr:`disable_nagle_algorithm` class attribute.
+* The :mod:`SocketServer` module's :class:`~SocketServer.TCPServer` class now
+  has a :attr:`~SocketServer.TCPServer.disable_nagle_algorithm` class attribute.
   The default value is False; if overridden to be True,
   new request connections will have the TCP_NODELAY option set to
   prevent buffering many small sends into a single TCP packet.
   (Contributed by Kristjan Valur Jonsson; :issue:`6192`.)
 
-* Updated module: the :mod:`sqlite` module has been updated to
+* Updated module: the :mod:`sqlite3` module has been updated to
   version 2.6.0 of the `pysqlite package <http://code.google.com/p/pysqlite/>`__. Version 2.6.0 includes a number of bugfixes, and adds
   the ability to load SQLite extensions from shared libraries.
   Call the ``enable_load_extension(True)`` method to enable extensions,
-  and then call :meth:`load_extension` to load a particular shared library.
+  and then call :meth:`~sqlite3.Connection.load_extension` to load a particular shared library.
   (Updated by Gerhard Häring.)
 
 * The :mod:`struct` module will no longer silently ignore overflow
@@ -874,9 +938,9 @@
   :issue:`1523`.)
 
 * New function: the :mod:`subprocess` module's
-  :func:`check_output` runs a command with a specified set of arguments
+  :func:`~subprocess.check_output` runs a command with a specified set of arguments
   and returns the command's output as a string when the command runs without
-  error, or raises a :exc:`CalledProcessError` exception otherwise.
+  error, or raises a :exc:`~subprocess.CalledProcessError` exception otherwise.
 
   ::
 
@@ -890,7 +954,11 @@
 
   (Contributed by Gregory P. Smith.)
 
-* New function: :func:`is_declared_global` in the :mod:`symtable` module
+  The :mod:`subprocess` module will now retry its internal system calls
+  on receiving an :const:`EINTR` signal.  (Reported by several people; final
+  patch by Gregory P. Smith in :issue:`1068268`.)
+
+* New function: :func:`~symtable.is_declared_global` in the :mod:`symtable` module
   returns true for variables that are explicitly declared to be global,
   false for ones that are implicitly global.
   (Contributed by Jeremy Hylton.)
@@ -914,65 +982,61 @@
   which raises an exception if there's an error.
   (Changed by Lars Gustäbel; :issue:`7357`.)
 
-  :mod:`tarfile` now supports filtering the :class:`TarInfo`
-  objects being added to a tar file.  When you call :meth:`TarFile.add`,
+  :mod:`tarfile` now supports filtering the :class:`~tarfile.TarInfo`
+  objects being added to a tar file.  When you call :meth:`~tarfile.TarFile.add`,
   instance, you may supply an optional *filter* argument
   that's a callable.  The *filter* callable will be passed the
-  :class:`TarInfo` for every file being added, and can modify and return it.
+  :class:`~tarfile.TarInfo` for every file being added, and can modify and return it.
   If the callable returns ``None``, the file will be excluded from the
   resulting archive.  This is more powerful than the existing
   *exclude* argument, which has therefore been deprecated.
   (Added by Lars Gustäbel; :issue:`6856`.)
-  The :class:`TarFile` class also now supports the context manager protocol.
+  The :class:`~tarfile.TarFile` class also now supports the context manager protocol.
   (Added by Lars Gustäbel; :issue:`7232`.)
 
-* The :mod:`threading` module's :meth:`Event.wait` method now returns
-  the internal flag on exit.  This means the method will usually
-  return true because :meth:`wait` is supposed to block until the
+* The :meth:`~threading.Event.wait` method of the :class:`threading.Event` class
+  now returns the internal flag on exit.  This means the method will usually
+  return true because :meth:`~threading.Event.wait` is supposed to block until the
   internal flag becomes true.  The return value will only be false if
   a timeout was provided and the operation timed out.
   (Contributed by Tim Lesher; :issue:`1674032`.)
 
-* The Unicode database has been updated to the version 5.2.0.
-  (Updated by Florent Xicluna; :issue:`8024`.)
-
-* The Unicode database provided by the :mod:`unicodedata` is used
-  internally to determine which characters are numeric, whitespace,
-  or represent line breaks.  The database also now includes information
-  from the :file:`Unihan.txt` data file.  (Patch by Anders Chrigström
-  and Amaury Forgeot d'Arc; :issue:`1571184`.)
+* The Unicode database provided by the :mod:`unicodedata` module is
+  now used internally to determine which characters are numeric,
+  whitespace, or represent line breaks.  The database also
+  includes information from the :file:`Unihan.txt` data file (patch
+  by Anders Chrigström and Amaury Forgeot d'Arc; :issue:`1571184`)
+  and has been updated to version 5.2.0 (updated by
+  Florent Xicluna; :issue:`8024`).
 
-* The :class:`UserDict` class is now a new-style class.  (Changed by
+* The :class:`~UserDict.UserDict` class is now a new-style class.  (Changed by
   Benjamin Peterson.)
 
 * The ElementTree library, :mod:`xml.etree`, no longer escapes
   ampersands and angle brackets when outputting an XML processing
-  instruction (which looks like `<?xml-stylesheet href="#style1"?>`)
-  or comment (which looks like `<!-- comment -->`).
+  instruction (which looks like ``<?xml-stylesheet href="#style1"?>``)
+  or comment (which looks like ``<!-- comment -->``).
   (Patch by Neil Muller; :issue:`2746`.)
 
-* The :mod:`zipfile` module's :class:`ZipFile` now supports the context
+* The :mod:`zipfile` module's :class:`~zipfile.ZipFile` now supports the context
   management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``.
   (Contributed by Brian Curtin; :issue:`5511`.)
 
   :mod:`zipfile` now supports archiving empty directories and
   extracts them correctly.  (Fixed by Kuba Wieczorek; :issue:`4710`.)
   Reading files out of an archive is now faster, and interleaving
-  :meth:`read` and :meth:`readline` now works correctly.
+  :meth:`~zipfile.ZipFile.read` and :meth:`~zipfile.ZipFile.readline` now works correctly.
   (Contributed by Nir Aides; :issue:`7610`.)
 
-  The :func:`is_zipfile` function in the module now
+  The :func:`~zipfile.is_zipfile` function now
   accepts a file object, in addition to the path names accepted in earlier
   versions.  (Contributed by Gabriel Genellina; :issue:`4756`.)
 
-  The :meth:`writestr` method now has an optional *compress_type* parameter
+  The :meth:`~zipfile.ZipFile.writestr` method now has an optional *compress_type* parameter
   that lets you override the default compression method specified in the
-  :class:`ZipFile` constructor.  (Contributed by Ronald Oussoren;
+  :class:`~zipfile.ZipFile` constructor.  (Contributed by Ronald Oussoren;
   :issue:`6003`.)
 
-* XXX the :mod:`shutil` module has now a :func:`make_archive` function
-  (see the module doc, contributed by Tarek)
-
 
 New module: sysconfig
 ---------------------------------
@@ -996,6 +1060,9 @@
 Distutils Enhancements
 ---------------------------------
 
+XXX all of this work has been moved to Distutils2
+XXX Not sure what we should say here
+
 Distutils is being more actively developed, thanks to Tarek Ziadé
 who has taken over maintenance of the package, so there are a number
 of fixes and improvements.
@@ -1049,111 +1116,135 @@
 The progress messages now shows 'x' for expected failures
 and 'u' for unexpected successes when run in verbose mode.
 (Contributed by Benjamin Peterson.)
-Test cases can raise the :exc:`SkipTest` exception to skip a test.
+Test cases can raise the :exc:`~unittest.SkipTest` exception to skip a test.
 (:issue:`1034053`.)
 
 .. XXX describe test discovery (Contributed by Michael Foord; :issue:`6001`.)
 
-The error messages for :meth:`assertEqual`,
-:meth:`assertTrue`, and :meth:`assertFalse`
+The error messages for :meth:`~unittest.TestCase.assertEqual`,
+:meth:`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse`
 failures now provide more information.  If you set the
-:attr:`longMessage` attribute of your :class:`TestCase` classes to
-true, both the standard error message and any additional message you
+:attr:`~unittest.TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes to
+True, both the standard error message and any additional message you
 provide will be printed for failures.  (Added by Michael Foord; :issue:`5663`.)
 
-The :meth:`assertRaises` and :meth:`failUnlessRaises` methods now
+The :meth:`~unittest.TestCase.assertRaises` method now
 return a context handler when called without providing a callable
 object to run.  For example, you can write this::
 
   with self.assertRaises(KeyError):
-      raise ValueError
+      {}['foo']
 
 (Implemented by Antoine Pitrou; :issue:`4444`.)
 
-The methods :meth:`addCleanup` and :meth:`doCleanups` were added.
-:meth:`addCleanup` allows you to add cleanup functions that
-will be called unconditionally (after :meth:`setUp` if
-:meth:`setUp` fails, otherwise after :meth:`tearDown`). This allows
-for much simpler resource allocation and deallocation during tests.
-:issue:`5679`
+.. rev 78774
+
+Module- and class-level setup and teardown fixtures are now supported.
+Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest.tearDownModule`
+functions.  Classes can have :meth:`~unittest.TestCase.setUpClass` and
+:meth:`~unittest.TestCase.tearDownClass` methods that must be defined as class methods
+(using ``@classmethod`` or equivalent).  These functions and
+methods are invoked when the test runner switches to a test case in a
+different module or class.
+
+The methods :meth:`~unittest.TestCase.addCleanup` and
+:meth:`~unittest.TestCase.doCleanups` were added.
+:meth:`~unittest.TestCase.addCleanup` allows you to add cleanup functions that
+will be called unconditionally (after :meth:`~unittest.TestCase.setUp` if
+:meth:`~unittest.TestCase.setUp` fails, otherwise after :meth:`~unittest.TestCase.tearDown`). This allows
+for much simpler resource allocation and deallocation during tests
+(:issue:`5679`).
 
 A number of new methods were added that provide more specialized
 tests.  Many of these methods were written by Google engineers
 for use in their test suites; Gregory P. Smith, Michael Foord, and
 GvR worked on merging them into Python's version of :mod:`unittest`.
 
-* :meth:`assertIsNone` and :meth:`assertIsNotNone` take one
+* :meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase.assertIsNotNone` take one
   expression and verify that the result is or is not ``None``.
 
-* :meth:`assertIs` and :meth:`assertIsNot` take two values and check
-  whether the two values evaluate to the same object or not.
+* :meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase.assertIsNot`
+  take two values and check whether the two values evaluate to the same object or not.
   (Added by Michael Foord; :issue:`2578`.)
 
-* :meth:`assertIsInstance` and :meth:`assertNotIsInstance` check whether
+* :meth:`~unittest.TestCase.assertIsInstance` and
+  :meth:`~unittest.TestCase.assertNotIsInstance` check whether
   the resulting object is an instance of a particular class, or of
   one of a tuple of classes.  (Added by Georg Brandl; :issue:`7031`.)
 
-* :meth:`assertGreater`, :meth:`assertGreaterEqual`,
-  :meth:`assertLess`, and :meth:`assertLessEqual` compare
+* :meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`,
+  :meth:`~unittest.TestCase.assertLess`, and :meth:`~unittest.TestCase.assertLessEqual` compare
   two quantities.
 
-* :meth:`assertMultiLineEqual` compares two strings, and if they're
+* :meth:`~unittest.TestCase.assertMultiLineEqual` compares two strings, and if they're
   not equal, displays a helpful comparison that highlights the
   differences in the two strings.  This comparison is now used by
-  default when Unicode strings are compared with :meth:`assertEqual`.)
+  default when Unicode strings are compared with :meth:`~unittest.TestCase.assertEqual`.
 
-* :meth:`assertRegexpMatches` checks whether its first argument is a
+* :meth:`~unittest.TestCase.assertRegexpMatches` checks whether its first argument is a
   string matching a regular expression provided as its second argument.
 
-* :meth:`assertRaisesRegexp` checks whether a particular exception
+  .. XXX add assertNotRegexpMatches see issue 8038
+
+* :meth:`~unittest.TestCase.assertRaisesRegexp` checks whether a particular exception
   is raised, and then also checks that the string representation of
   the exception matches the provided regular expression.
 
-* :meth:`assertIn` and :meth:`assertNotIn` tests whether
-  *first* is or is not in  *second*.
+* :meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase.assertNotIn`
+  tests whether *first* is or is not in  *second*.
 
-* :meth:`assertItemsEqual` tests whether two provided sequences
+* :meth:`~unittest.TestCase.assertItemsEqual` tests whether two provided sequences
   contain the same elements.
 
-* :meth:`assertSetEqual` compares whether two sets are equal, and
+* :meth:`~unittest.TestCase.assertSetEqual` compares whether two sets are equal, and
   only reports the differences between the sets in case of error.
 
-* Similarly, :meth:`assertListEqual` and :meth:`assertTupleEqual`
+* Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest.TestCase.assertTupleEqual`
   compare the specified types and explain any differences without necessarily
   printing their full values; these methods are now used by default
-  when comparing lists and tuples using :meth:`assertEqual`.
-  More generally, :meth:`assertSequenceEqual` compares two sequences
+  when comparing lists and tuples using :meth:`~unittest.TestCase.assertEqual`.
+  More generally, :meth:`~unittest.TestCase.assertSequenceEqual` compares two sequences
   and can optionally check whether both sequences are of a
   particular type.
 
-* :meth:`assertDictEqual` compares two dictionaries and reports the
+* :meth:`~unittest.TestCase.assertDictEqual` compares two dictionaries and reports the
   differences; it's now used by default when you compare two dictionaries
-  using :meth:`assertEqual`.  :meth:`assertDictContainsSubset` checks whether
+  using :meth:`~unittest.TestCase.assertEqual`.  :meth:`~unittest.TestCase.assertDictContainsSubset` checks whether
   all of the key/value pairs in *first* are found in *second*.
 
-* :meth:`assertAlmostEqual` and :meth:`assertNotAlmostEqual` test
+* :meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase.assertNotAlmostEqual` test
   whether *first* and *second* are approximately equal by computing
   their difference, rounding the result to an optionally-specified number
   of *places* (the default is 7), and comparing to zero.
 
-* :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of
-  the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)
-
-* A new hook, :meth:`addTypeEqualityFunc` takes a type object and a
-  function.  The :meth:`assertEqual` method will use the function
-  when both of the objects being compared are of the specified type.
-  This function should compare the two objects and raise an
-  exception if they don't match; it's a good idea for the function
-  to provide additional information about why the two objects are
-  matching, much as the new sequence comparison methods do.
-
-:func:`unittest.main` now takes an optional ``exit`` argument.
-If False ``main`` doesn't call :func:`sys.exit` allowing it to
-be used from the interactive interpreter. :issue:`3379`.
-
-:class:`TestResult` has new :meth:`startTestRun` and
-:meth:`stopTestRun` methods; called immediately before
-and after a test run. :issue:`5728` by Robert Collins.
+* :meth:`~unittest.TestLoader.loadTestsFromName` properly honors the
+  :attr:`~unittest.TestLoader.suiteClass` attribute of
+  the :class:`~unittest.TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)
+
+* A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method to handle
+  new data types.  The :meth:`~unittest.TestCase.addTypeEqualityFunc` method takes a type
+  object and a function. The function will be used when both of the
+  objects being compared are of the specified type.  This function
+  should compare the two objects and raise an exception if they don't
+  match; it's a good idea for the function to provide additional
+  information about why the two objects are matching, much as the new
+  sequence comparison methods do.
+
+:func:`unittest.main` now takes an optional ``exit`` argument.  If
+False, :func:`~unittest.main` doesn't call :func:`sys.exit`, allowing it to be
+used from the interactive interpreter. (Contributed by J. Pablo
+Fernández; :issue:`3379`.)
+
+A new command-line switch, :option:`-f` or :option:`--failfast`, makes
+test execution stop immediately when a test fails instead of
+continuing to execute further tests.  (Suggested by Cliff Dyer and
+implemented by Michael Foord; :issue:`8074`.)
+
+.. XXX document the other new switches
+
+:class:`~unittest.TestResult` has new :meth:`~unittest.TestResult.startTestRun` and
+:meth:`~unittest.TestResult.stopTestRun` methods that are called immediately before
+and after a test run.  (Contributed by Robert Collins; :issue:`5728`.)
 
 With all these changes, the :file:`unittest.py` was becoming awkwardly
 large, so the module was turned into a package and the code split into
@@ -1172,7 +1263,7 @@
 to users who wish to write new importers that can participate in the
 import process.  Python 2.7 doesn't contain the complete
 :mod:`importlib` package, but instead has a tiny subset that contains
-a single function, :func:`import_module`.
+a single function, :func:`~importlib.import_module`.
 
 ``import_module(name, package=None)`` imports a module.  *name* is
 a string containing the module or package's name.  It's possible to do
@@ -1180,7 +1271,7 @@
 character, such as ``..utils.errors``.  For relative imports, the
 *package* argument must be provided and is the name of the package that
 will be used as the anchor for
-the relative import.  :func:`import_module` both inserts the imported
+the relative import.  :func:`~importlib.import_module` both inserts the imported
 module into ``sys.modules`` and returns the module object.
 
 Here are some examples::

Modified: python/branches/py3k-cdecimal/Lib/dis.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/dis.py	(original)
+++ python/branches/py3k-cdecimal/Lib/dis.py	Thu Apr  8 13:38:01 2010
@@ -10,6 +10,8 @@
            "findlinestarts", "findlabels"] + _opcodes_all
 del _opcodes_all
 
+_have_code = (types.MethodType, types.FunctionType, types.CodeType, type)
+
 def dis(x=None):
     """Disassemble classes, methods, functions, or code.
 
@@ -26,8 +28,7 @@
     if hasattr(x, '__dict__'):
         items = sorted(x.__dict__.items())
         for name, x1 in items:
-            if isinstance(x1, (types.MethodType, types.FunctionType,
-                               types.CodeType, type)):
+            if isinstance(x1, _have_code):
                 print("Disassembly of %s:" % name)
                 try:
                     dis(x1)

Modified: python/branches/py3k-cdecimal/Lib/functools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/functools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/functools.py	Thu Apr  8 13:38:01 2010
@@ -49,3 +49,50 @@
     """
     return partial(update_wrapper, wrapped=wrapped,
                    assigned=assigned, updated=updated)
+
+def total_ordering(cls):
+    'Class decorator that fills-in missing ordering methods'
+    convert = {
+        '__lt__': [('__gt__', lambda self, other: other < self),
+                   ('__le__', lambda self, other: not other < self),
+                   ('__ge__', lambda self, other: not self < other)],
+        '__le__': [('__ge__', lambda self, other: other <= self),
+                   ('__lt__', lambda self, other: not other <= self),
+                   ('__gt__', lambda self, other: not self <= other)],
+        '__gt__': [('__lt__', lambda self, other: other > self),
+                   ('__ge__', lambda self, other: not other > self),
+                   ('__le__', lambda self, other: not self > other)],
+        '__ge__': [('__le__', lambda self, other: other >= self),
+                   ('__gt__', lambda self, other: not other >= self),
+                   ('__lt__', lambda self, other: not self >= other)]
+    }
+    roots = set(dir(cls)) & set(convert)
+    assert roots, 'must define at least one ordering operation: < > <= >='
+    root = max(roots)       # prefer __lt __ to __le__ to __gt__ to __ge__
+    for opname, opfunc in convert[root]:
+        if opname not in roots:
+            opfunc.__name__ = opname
+            opfunc.__doc__ = getattr(int, opname).__doc__
+            setattr(cls, opname, opfunc)
+    return cls
+
+def cmp_to_key(mycmp):
+    'Convert a cmp= function into a key= function'
+    class K(object):
+        def __init__(self, obj, *args):
+            self.obj = obj
+        def __lt__(self, other):
+            return mycmp(self.obj, other.obj) < 0
+        def __gt__(self, other):
+            return mycmp(self.obj, other.obj) > 0
+        def __eq__(self, other):
+            return mycmp(self.obj, other.obj) == 0
+        def __le__(self, other):
+            return mycmp(self.obj, other.obj) <= 0
+        def __ge__(self, other):
+            return mycmp(self.obj, other.obj) >= 0
+        def __ne__(self, other):
+            return mycmp(self.obj, other.obj) != 0
+        def __hash__(self):
+            raise TypeError('hash not implemented')
+    return K

Modified: python/branches/py3k-cdecimal/Lib/pstats.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pstats.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pstats.py	Thu Apr  8 13:38:01 2010
@@ -37,6 +37,7 @@
 import time
 import marshal
 import re
+from functools import cmp_to_key
 
 __all__ = ["Stats"]
 
@@ -226,7 +227,7 @@
             stats_list.append((cc, nc, tt, ct) + func +
                               (func_std_string(func), func))
 
-        stats_list.sort(key=CmpToKey(TupleComp(sort_tuple).compare))
+        stats_list.sort(key=cmp_to_key(TupleComp(sort_tuple).compare))
 
         self.fcn_list = fcn_list = []
         for tuple in stats_list:
@@ -458,15 +459,6 @@
                 return direction
         return 0
 
-def CmpToKey(mycmp):
-    'Convert a cmp= function into a key= function'
-    class K(object):
-        def __init__(self, obj):
-            self.obj = obj
-        def __lt__(self, other):
-            return mycmp(self.obj, other.obj) == -1
-    return K
-
 
 #**************************************************************************
 # func_name is a triple (file:string, line:int, name:string)

Modified: python/branches/py3k-cdecimal/Lib/ssl.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/ssl.py	(original)
+++ python/branches/py3k-cdecimal/Lib/ssl.py	Thu Apr  8 13:38:01 2010
@@ -58,6 +58,7 @@
 
 import _ssl             # if we can't import it, let the error propagate
 
+from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
 from _ssl import SSLError
 from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
 from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23,

Modified: python/branches/py3k-cdecimal/Lib/test/test_codecs.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_codecs.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_codecs.py	Thu Apr  8 13:38:01 2010
@@ -905,6 +905,8 @@
         self.assertEquals(encoder("a")[1], 1)
         self.assertEquals(encoder("\xe9\u0142")[1], 2)
 
+        self.assertEquals(codecs.escape_encode(br'\x00')[1], 4)
+
 # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
 nameprep_tests = [
     # 3.1 Map to nothing.

Modified: python/branches/py3k-cdecimal/Lib/test/test_float.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_float.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_float.py	Thu Apr  8 13:38:01 2010
@@ -914,6 +914,15 @@
         self.assertFalse(NAN.is_inf())
         self.assertFalse((0.).is_inf())
 
+    def test_hash_inf(self):
+        # the actual values here should be regarded as an
+        # implementation detail, but they need to be
+        # identical to those used in the Decimal module.
+        self.assertEqual(hash(float('inf')), 314159)
+        self.assertEqual(hash(float('-inf')), -271828)
+        self.assertEqual(hash(float('nan')), 0)
+
+
 fromHex = float.fromhex
 toHex = float.hex
 class HexFloatTestCase(unittest.TestCase):

Modified: python/branches/py3k-cdecimal/Lib/test/test_functools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_functools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_functools.py	Thu Apr  8 13:38:01 2010
@@ -364,7 +364,89 @@
         d = {"one": 1, "two": 2, "three": 3}
         self.assertEqual(self.func(add, d), "".join(d.keys()))
 
-
+class TestCmpToKey(unittest.TestCase):
+    def test_cmp_to_key(self):
+        def mycmp(x, y):
+            return y - x
+        self.assertEqual(sorted(range(5), key=functools.cmp_to_key(mycmp)),
+                         [4, 3, 2, 1, 0])
+
+    def test_hash(self):
+        def mycmp(x, y):
+            return y - x
+        key = functools.cmp_to_key(mycmp)
+        k = key(10)
+        self.assertRaises(TypeError, hash(k))
+
+class TestTotalOrdering(unittest.TestCase):
+
+    def test_total_ordering_lt(self):
+        @functools.total_ordering
+        class A:
+            def __init__(self, value):
+                self.value = value
+            def __lt__(self, other):
+                return self.value < other.value
+        self.assert_(A(1) < A(2))
+        self.assert_(A(2) > A(1))
+        self.assert_(A(1) <= A(2))
+        self.assert_(A(2) >= A(1))
+        self.assert_(A(2) <= A(2))
+        self.assert_(A(2) >= A(2))
+
+    def test_total_ordering_le(self):
+        @functools.total_ordering
+        class A:
+            def __init__(self, value):
+                self.value = value
+            def __le__(self, other):
+                return self.value <= other.value
+        self.assert_(A(1) < A(2))
+        self.assert_(A(2) > A(1))
+        self.assert_(A(1) <= A(2))
+        self.assert_(A(2) >= A(1))
+        self.assert_(A(2) <= A(2))
+        self.assert_(A(2) >= A(2))
+
+    def test_total_ordering_gt(self):
+        @functools.total_ordering
+        class A:
+            def __init__(self, value):
+                self.value = value
+            def __gt__(self, other):
+                return self.value > other.value
+        self.assert_(A(1) < A(2))
+        self.assert_(A(2) > A(1))
+        self.assert_(A(1) <= A(2))
+        self.assert_(A(2) >= A(1))
+        self.assert_(A(2) <= A(2))
+        self.assert_(A(2) >= A(2))
+
+    def test_total_ordering_ge(self):
+        @functools.total_ordering
+        class A:
+            def __init__(self, value):
+                self.value = value
+            def __ge__(self, other):
+                return self.value >= other.value
+        self.assert_(A(1) < A(2))
+        self.assert_(A(2) > A(1))
+        self.assert_(A(1) <= A(2))
+        self.assert_(A(2) >= A(1))
+        self.assert_(A(2) <= A(2))
+        self.assert_(A(2) >= A(2))
+
+    def test_total_ordering_no_overwrite(self):
+        # new methods should not overwrite existing
+        @functools.total_ordering
+        class A(int):
+            raise Exception()
+        self.assert_(A(1) < A(2))
+        self.assert_(A(2) > A(1))
+        self.assert_(A(1) <= A(2))
+        self.assert_(A(2) >= A(1))
+        self.assert_(A(2) <= A(2))
+        self.assert_(A(2) >= A(2))
 
 
 def test_main(verbose=None):

Modified: python/branches/py3k-cdecimal/Lib/test/test_select.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_select.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_select.py	Thu Apr  8 13:38:01 2010
@@ -4,6 +4,8 @@
 import os
 import sys
 
+ at unittest.skipIf(sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'),
+                 "can't easily test on this system")
 class SelectTestCase(unittest.TestCase):
 
     class Nope:
@@ -19,11 +21,14 @@
         self.assertRaises(TypeError, select.select, [self.Almost()], [], [])
         self.assertRaises(TypeError, select.select, [], [], [], "not a number")
 
+    def test_returned_list_identity(self):
+        # See issue #8329
+        r, w, x = select.select([], [], [], 1)
+        self.assertIsNot(r, w)
+        self.assertIsNot(r, x)
+        self.assertIsNot(w, x)
+
     def test_select(self):
-        if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'):
-            if support.verbose:
-                print("Can't test select easily on", sys.platform)
-            return
         cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
         p = os.popen(cmd, 'r')
         for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:

Modified: python/branches/py3k-cdecimal/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_ssl.py	Thu Apr  8 13:38:01 2010
@@ -94,6 +94,34 @@
         if (d1 != d2):
             raise support.TestFailed("PEM-to-DER or DER-to-PEM translation failed")
 
+    def test_openssl_version(self):
+        n = ssl.OPENSSL_VERSION_NUMBER
+        t = ssl.OPENSSL_VERSION_INFO
+        s = ssl.OPENSSL_VERSION
+        self.assertIsInstance(n, int)
+        self.assertIsInstance(t, tuple)
+        self.assertIsInstance(s, str)
+        # Some sanity checks follow
+        # >= 0.9
+        self.assertGreaterEqual(n, 0x900000)
+        # < 2.0
+        self.assertLess(n, 0x20000000)
+        major, minor, fix, patch, status = t
+        self.assertGreaterEqual(major, 0)
+        self.assertLess(major, 2)
+        self.assertGreaterEqual(minor, 0)
+        self.assertLess(minor, 256)
+        self.assertGreaterEqual(fix, 0)
+        self.assertLess(fix, 256)
+        self.assertGreaterEqual(patch, 0)
+        self.assertLessEqual(patch, 26)
+        self.assertGreaterEqual(status, 0)
+        self.assertLessEqual(status, 15)
+        # Version string as returned by OpenSSL, the format might change
+        self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
+                        (s, t))
+
+
 class NetworkedTests(unittest.TestCase):
 
     def testConnect(self):

Modified: python/branches/py3k-cdecimal/Lib/test/test_structmembers.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_structmembers.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_structmembers.py	Thu Apr  8 13:38:01 2010
@@ -88,8 +88,6 @@
         self.assertEquals(ts.T_ULONGLONG, 4)
 
     def test_bad_assignments(self):
-        # XXX testing of T_UINT and T_ULONG temporarily disabled;
-        # see issue 8014.
         integer_attributes = [
             'T_BOOL',
             'T_BYTE', 'T_UBYTE',

Modified: python/branches/py3k-cdecimal/Lib/test/test_warnings.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_warnings.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_warnings.py	Thu Apr  8 13:38:01 2010
@@ -4,6 +4,7 @@
 from io import StringIO
 import sys
 import unittest
+import subprocess
 from test import support
 
 from test import warning_tests
@@ -685,6 +686,42 @@
     module = py_warnings
 
 
+class EnvironmentVariableTests(BaseTest):
+
+    def test_single_warning(self):
+        newenv = os.environ.copy()
+        newenv["PYTHONWARNINGS"] = "ignore::DeprecationWarning"
+        p = subprocess.Popen([sys.executable,
+                "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
+                stdout=subprocess.PIPE, env=newenv)
+        self.assertEqual(p.stdout.read(), b"['ignore::DeprecationWarning']")
+
+    def test_comma_separated_warnings(self):
+        newenv = os.environ.copy()
+        newenv["PYTHONWARNINGS"] = ("ignore::DeprecationWarning,"
+                                    "ignore::UnicodeWarning")
+        p = subprocess.Popen([sys.executable,
+                "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
+                stdout=subprocess.PIPE, env=newenv)
+        self.assertEqual(p.stdout.read(),
+                b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
+
+    def test_envvar_and_command_line(self):
+        newenv = os.environ.copy()
+        newenv["PYTHONWARNINGS"] = "ignore::DeprecationWarning"
+        p = subprocess.Popen([sys.executable, "-W" "ignore::UnicodeWarning",
+                "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
+                stdout=subprocess.PIPE, env=newenv)
+        self.assertEqual(p.stdout.read(),
+                b"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']")
+
+class CEnvironmentVariableTests(EnvironmentVariableTests):
+    module = c_warnings
+
+class PyEnvironmentVariableTests(EnvironmentVariableTests):
+    module = py_warnings
+
+
 def test_main():
     py_warnings.onceregistry.clear()
     c_warnings.onceregistry.clear()
@@ -696,6 +733,8 @@
                                 _WarningsTests,
                                 CWarningsDisplayTests, PyWarningsDisplayTests,
                                 CCatchWarningTests, PyCatchWarningTests,
+                                CEnvironmentVariableTests,
+                                PyEnvironmentVariableTests
                              )
 
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_zlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_zlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_zlib.py	Thu Apr  8 13:38:01 2010
@@ -85,7 +85,7 @@
 
     def test_baddecompressobj(self):
         # verify failure on building decompress object with bad params
-        self.assertRaises(ValueError, zlib.decompressobj, 0)
+        self.assertRaises(ValueError, zlib.decompressobj, -1)
 
     def test_decompressobj_badflush(self):
         # verify failure on calling decompressobj.flush with bad params

Modified: python/branches/py3k-cdecimal/Lib/threading.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/threading.py	(original)
+++ python/branches/py3k-cdecimal/Lib/threading.py	Thu Apr  8 13:38:01 2010
@@ -460,7 +460,7 @@
             raise RuntimeError("thread.__init__() not called")
 
         if self._started.is_set():
-            raise RuntimeError("thread already started")
+            raise RuntimeError("threads can only be started once")
         if __debug__:
             self._note("%s.start(): starting thread", self)
         with _active_limbo_lock:

Modified: python/branches/py3k-cdecimal/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/loader.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/loader.py	Thu Apr  8 13:38:01 2010
@@ -5,6 +5,7 @@
 import sys
 import traceback
 import types
+import functools
 
 from fnmatch import fnmatch
 
@@ -141,7 +142,7 @@
         testFnNames = testFnNames = list(filter(isTestMethod,
                                                 dir(testCaseClass)))
         if self.sortTestMethodsUsing:
-            testFnNames.sort(key=util.CmpToKey(self.sortTestMethodsUsing))
+            testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing))
         return testFnNames
 
     def discover(self, start_dir, pattern='test*.py', top_level_dir=None):

Modified: python/branches/py3k-cdecimal/Lib/unittest/util.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/util.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/util.py	Thu Apr  8 13:38:01 2010
@@ -70,15 +70,6 @@
     # anything left in actual is unexpected
     return missing, actual
 
-def CmpToKey(mycmp):
-    'Convert a cmp= function into a key= function'
-    class K(object):
-        def __init__(self, obj, *args):
-            self.obj = obj
-        def __lt__(self, other):
-            return mycmp(self.obj, other.obj) == -1
-    return K
-
 def three_way_cmp(x, y):
     """Return -1 if x < y, 0 if x == y and 1 if x > y"""
     return (x > y) - (x < y)

Modified: python/branches/py3k-cdecimal/Makefile.pre.in
==============================================================================
--- python/branches/py3k-cdecimal/Makefile.pre.in	(original)
+++ python/branches/py3k-cdecimal/Makefile.pre.in	Thu Apr  8 13:38:01 2010
@@ -239,7 +239,7 @@
 PGOBJS=		\
 		Objects/obmalloc.o \
 		Python/mysnprintf.o \
-                Python/pyctype.o \
+		Python/pyctype.o \
 		Parser/tokenizer_pgen.o \
 		Parser/printgrammar.o \
 		Parser/pgenmain.o

Modified: python/branches/py3k-cdecimal/Misc/NEWS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/NEWS	(original)
+++ python/branches/py3k-cdecimal/Misc/NEWS	Thu Apr  8 13:38:01 2010
@@ -12,6 +12,15 @@
 Core and Builtins
 -----------------
 
+- Issue #7301: Add environment variable $PYTHONWARNINGS.
+
+- Issue #8329: Don't return the same lists from select.select when no fds are
+  changed.
+
+- Issue #8259: 1L << (2**31) no longer produces an 'outrageous shift error'
+  on 64-bit machines.  The shift count for either left or right shift is
+  permitted to be up to sys.maxsize.
+
 - Ensure that tokenization of identifiers is not affected by locale.
 
 - Issue #1222585: Added LDCXXSHARED for C++ support. Patch by Arfrever.
@@ -303,6 +312,12 @@
 Library
 -------
 
+- Issue #8321: Give access to OpenSSL version numbers from the `ssl` module,
+  using the new attributes `ssl.OPENSSL_VERSION`, `ssl.OPENSSL_VERSION_INFO`
+  and `ssl.OPENSSL_VERSION_NUMBER`.
+
+- Add functools.total_ordering() and functools.cmp_to_key().
+
 - Issue #8257: The Decimal construct now accepts a float instance
   directly, converting that float to a Decimal of equal value:
 
@@ -1005,6 +1020,8 @@
 Tests
 -----
 
+- Issue #8193: Fix test_zlib failure with zlib 1.2.4.
+
 - Issue #8248: Add some tests for the bool type.  Patch by Gregory Nofi.
 
 - Issue #8263: Now regrtest.py will report a failure if it receives a

Modified: python/branches/py3k-cdecimal/Misc/python-config.in
==============================================================================
--- python/branches/py3k-cdecimal/Misc/python-config.in	(original)
+++ python/branches/py3k-cdecimal/Misc/python-config.in	Thu Apr  8 13:38:01 2010
@@ -1,9 +1,9 @@
 #!@EXENAME@
 
-import sys
-import os
 import getopt
-from distutils import sysconfig
+import os
+import sys
+import sysconfig
 
 valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
               'ldflags', 'help']
@@ -31,14 +31,14 @@
 
 for opt in opt_flags:
     if opt == '--prefix':
-        print(sysconfig.PREFIX)
+        print(sysconfig.get_config_var('prefix'))
 
     elif opt == '--exec-prefix':
-        print(sysconfig.EXEC_PREFIX)
+        print(sysconfig.get_config_var('exec_prefix'))
 
     elif opt in ('--includes', '--cflags'):
-        flags = ['-I' + sysconfig.get_python_inc(),
-                 '-I' + sysconfig.get_python_inc(plat_specific=True)]
+        flags = ['-I' + sysconfig.get_path('include'),
+                 '-I' + sysconfig.get_path('platinclude')]
         if opt == '--cflags':
             flags.extend(getvar('CFLAGS').split())
         print(' '.join(flags))

Modified: python/branches/py3k-cdecimal/Misc/python.man
==============================================================================
--- python/branches/py3k-cdecimal/Misc/python.man	(original)
+++ python/branches/py3k-cdecimal/Misc/python.man	Thu Apr  8 13:38:01 2010
@@ -394,6 +394,9 @@
 If this is set to a non-empty string it is equivalent to specifying
 the \fB\-v\fP option. If set to an integer, it is equivalent to
 specifying \fB\-v\fP multiple times. 
+.IP PYTHONWARNINGS
+If this is set to a comma-separated string it is equivalent to
+specifying the \fB\-W\fP option for each separate value.
 .SH AUTHOR
 The Python Software Foundation: http://www.python.org/psf
 .SH INTERNET RESOURCES

Modified: python/branches/py3k-cdecimal/Modules/_codecsmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_codecsmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_codecsmodule.c	Thu Apr  8 13:38:01 2010
@@ -217,7 +217,7 @@
 		}
 	}
 	
-	return codec_tuple(v, PyBytes_Size(v));
+	return codec_tuple(v, size);
 }
 
 /* --- Decoder ------------------------------------------------------------ */

Modified: python/branches/py3k-cdecimal/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_ssl.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_ssl.c	Thu Apr  8 13:38:01 2010
@@ -1636,7 +1636,9 @@
 PyMODINIT_FUNC
 PyInit__ssl(void)
 {
-	PyObject *m, *d;
+	PyObject *m, *d, *r;
+	unsigned long libver;
+	unsigned int major, minor, fix, patch, status;
         PySocketModule_APIObject *socket_api;
 
 	if (PyType_Ready(&PySSL_Type) < 0)
@@ -1710,5 +1712,32 @@
 				PY_SSL_VERSION_SSL23);
 	PyModule_AddIntConstant(m, "PROTOCOL_TLSv1",
 				PY_SSL_VERSION_TLS1);
+
+	/* OpenSSL version */
+	/* SSLeay() gives us the version of the library linked against,
+	   which could be different from the headers version.
+	*/
+	libver = SSLeay();
+	r = PyLong_FromUnsignedLong(libver);
+	if (r == NULL)
+		return NULL;
+	if (PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r))
+		return NULL;
+	status = libver & 0xF;
+	libver >>= 4;
+	patch = libver & 0xFF;
+	libver >>= 8;
+	fix = libver & 0xFF;
+	libver >>= 8;
+	minor = libver & 0xFF;
+	libver >>= 8;
+	major = libver & 0xFF;
+	r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
+	if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r))
+		return NULL;
+	r = PyUnicode_FromString(SSLeay_version(SSLEAY_VERSION));
+	if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r))
+		return NULL;
+
 	return m;
 }

Modified: python/branches/py3k-cdecimal/Modules/_struct.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_struct.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_struct.c	Thu Apr  8 13:38:01 2010
@@ -153,7 +153,7 @@
 		return -1;
 	assert(PyLong_Check(v));
 	x = PyLong_AsUnsignedLong(v);
-        Py_DECREF(v);
+	Py_DECREF(v);
 	if (x == (unsigned long)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
@@ -178,7 +178,7 @@
 		return -1;
 	assert(PyLong_Check(v));
 	x = PyLong_AsLongLong(v);
-        Py_DECREF(v);
+	Py_DECREF(v);
 	if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
@@ -201,7 +201,7 @@
 		return -1;
 	assert(PyLong_Check(v));
 	x = PyLong_AsUnsignedLongLong(v);
-        Py_DECREF(v);
+	Py_DECREF(v);
 	if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
@@ -222,7 +222,7 @@
 
 static PyObject *
 unpack_float(const char *p,  /* start of 4-byte string */
-             int le)	     /* true for little-endian, false for big-endian */
+	     int le)	     /* true for little-endian, false for big-endian */
 {
 	double x;
 
@@ -234,7 +234,7 @@
 
 static PyObject *
 unpack_double(const char *p,  /* start of 8-byte string */
-              int le)         /* true for little-endian, false for big-endian */
+	      int le)         /* true for little-endian, false for big-endian */
 {
 	double x;
 
@@ -591,7 +591,7 @@
 static int
 np_bool(char *p, PyObject *v, const formatdef *f)
 {
-	BOOL_TYPE y; 
+	BOOL_TYPE y;
 	y = PyObject_IsTrue(v);
 	memcpy(p, (char *)&y, sizeof y);
 	return 0;
@@ -812,7 +812,7 @@
 	if (v == NULL)
 		return -1;
 	res = _PyLong_AsByteArray((PyLongObject *)v,
-			   	  (unsigned char *)p,
+				  (unsigned char *)p,
 				  8,
 				  0, /* little_endian */
 				  1  /* signed */);
@@ -828,7 +828,7 @@
 	if (v == NULL)
 		return -1;
 	res = _PyLong_AsByteArray((PyLongObject *)v,
-			   	  (unsigned char *)p,
+				  (unsigned char *)p,
 				  8,
 				  0, /* little_endian */
 				  0  /* signed */);
@@ -863,7 +863,7 @@
 static int
 bp_bool(char *p, PyObject *v, const formatdef *f)
 {
-	char y; 
+	char y;
 	y = PyObject_IsTrue(v);
 	memcpy(p, (char *)&y, sizeof y);
 	return 0;
@@ -1030,7 +1030,7 @@
 	if (v == NULL)
 		return -1;
 	res = _PyLong_AsByteArray((PyLongObject*)v,
-			   	  (unsigned char *)p,
+				  (unsigned char *)p,
 				  8,
 				  1, /* little_endian */
 				  1  /* signed */);
@@ -1046,7 +1046,7 @@
 	if (v == NULL)
 		return -1;
 	res = _PyLong_AsByteArray((PyLongObject*)v,
-			   	  (unsigned char *)p,
+				  (unsigned char *)p,
 				  8,
 				  1, /* little_endian */
 				  0  /* signed */);
@@ -1407,7 +1407,7 @@
 		PyErr_Format(StructError,
 			     "unpack requires a bytes argument of length %zd",
 			     soself->s_size);
-                PyBuffer_Release(&vbuf);
+		PyBuffer_Release(&vbuf);
 		return NULL;
 	}
 	result = s_unpack_internal(soself, vbuf.buf);
@@ -1449,7 +1449,7 @@
 		PyErr_Format(StructError,
 			"unpack_from requires a buffer of at least %zd bytes",
 			soself->s_size);
-                PyBuffer_Release(&vbuf);
+		PyBuffer_Release(&vbuf);
 		return NULL;
 	}
 	result = s_unpack_internal(soself, (char*)vbuf.buf + offset);
@@ -1782,7 +1782,7 @@
 		return NULL;
 	n = ((PyStructObject *)s_object)->s_size;
 	Py_DECREF(s_object);
-    	return PyLong_FromSsize_t(n);
+	return PyLong_FromSsize_t(n);
 }
 
 PyDoc_STRVAR(pack_doc,
@@ -1808,7 +1808,7 @@
 		Py_DECREF(newargs);
 		return NULL;
 	}
-    	result = s_pack(s_object, newargs);
+	result = s_pack(s_object, newargs);
 	Py_DECREF(newargs);
 	Py_DECREF(s_object);
 	return result;
@@ -1838,7 +1838,7 @@
 		Py_DECREF(newargs);
 		return NULL;
 	}
-    	result = s_pack_into(s_object, newargs);
+	result = s_pack_into(s_object, newargs);
 	Py_DECREF(newargs);
 	Py_DECREF(s_object);
 	return result;
@@ -1859,7 +1859,7 @@
 	s_object = cache_struct(fmt);
 	if (s_object == NULL)
 		return NULL;
-    	result = s_unpack(s_object, inputstr);
+	result = s_unpack(s_object, inputstr);
 	Py_DECREF(s_object);
 	return result;
 }
@@ -1888,20 +1888,20 @@
 		Py_DECREF(newargs);
 		return NULL;
 	}
-    	result = s_unpack_from(s_object, newargs, kwds);
+	result = s_unpack_from(s_object, newargs, kwds);
 	Py_DECREF(newargs);
 	Py_DECREF(s_object);
 	return result;
 }
 
 static struct PyMethodDef module_functions[] = {
-	{"_clearcache",	(PyCFunction)clearcache,	METH_NOARGS, 	clearcache_doc},
-	{"calcsize",	calcsize,	METH_O, 	calcsize_doc},
-	{"pack",	pack,		METH_VARARGS, 	pack_doc},
-	{"pack_into",	pack_into,	METH_VARARGS, 	pack_into_doc},
-	{"unpack",	unpack,       	METH_VARARGS, 	unpack_doc},
-	{"unpack_from",	(PyCFunction)unpack_from, 	
-			METH_VARARGS|METH_KEYWORDS, 	unpack_from_doc},
+	{"_clearcache",	(PyCFunction)clearcache,	METH_NOARGS,	clearcache_doc},
+	{"calcsize",	calcsize,	METH_O,	calcsize_doc},
+	{"pack",	pack,		METH_VARARGS,	pack_doc},
+	{"pack_into",	pack_into,	METH_VARARGS,	pack_into_doc},
+	{"unpack",	unpack,	METH_VARARGS,	unpack_doc},
+	{"unpack_from",	(PyCFunction)unpack_from,
+			METH_VARARGS|METH_KEYWORDS,	unpack_from_doc},
 	{NULL,	 NULL}		/* sentinel */
 };
 

Modified: python/branches/py3k-cdecimal/Modules/main.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/main.c	(original)
+++ python/branches/py3k-cdecimal/Modules/main.c	Thu Apr  8 13:38:01 2010
@@ -82,6 +82,7 @@
          can be supplied multiple times to increase verbosity\n\
 -V     : print the Python version number and exit (also --version)\n\
 -W arg : warning control; arg is action:message:category:module:lineno\n\
+         also PYTHONWARNINGS=arg\n\
 -x     : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
 ";
 static char *usage_4 = "\
@@ -401,6 +402,25 @@
 	    (p = Py_GETENV("PYTHONNOUSERSITE")) && *p != '\0')
 		Py_NoUserSiteDirectory = 1;
 
+	if ((p = Py_GETENV("PYTHONWARNINGS")) && *p != '\0') {
+		char *buf;
+		wchar_t *warning;
+		size_t len;
+
+		for (buf = strtok(p, ",");
+		     buf != NULL;
+		     buf = strtok(NULL, ",")) {
+			len = strlen(buf);
+			warning = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
+			if (warning == NULL)
+				Py_FatalError(
+				   "not enough memory to copy PYTHONWARNINGS");
+			mbstowcs(warning, buf, len);
+			PySys_AddWarnOption(warning);
+			free(warning);
+		}
+	}
+
 	if (command == NULL && module == NULL && _PyOS_optind < argc &&
 	    wcscmp(argv[_PyOS_optind], L"-") != 0)
 	{

Modified: python/branches/py3k-cdecimal/Modules/selectmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/selectmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/selectmodule.c	Thu Apr  8 13:38:01 2010
@@ -284,14 +284,6 @@
 		PyErr_SetFromErrno(SelectError);
 	}
 #endif
-	else if (n == 0) {
-                /* optimization */
-		ifdlist = PyList_New(0);
-		if (ifdlist) {
-			ret = PyTuple_Pack(3, ifdlist, ifdlist, ifdlist);
-			Py_DECREF(ifdlist);
-		}
-	}
 	else {
 		/* any of these three calls can raise an exception.  it's more
 		   convenient to test for this after all three calls... but

Modified: python/branches/py3k-cdecimal/Objects/longobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/longobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/longobject.c	Thu Apr  8 13:38:01 2010
@@ -1111,7 +1111,7 @@
 	int ndigits = 0;
 
 	if (ival < PyLong_BASE)
-		return PyLong_FromLong(ival);
+		return PyLong_FromLong((long)ival);
 	/* Count the number of Python digits. */
 	t = ival;
 	while (t) {
@@ -2405,7 +2405,7 @@
 		while (x_size < shift_digits)
 			x_digits[x_size++] = 0;
 		rem = v_lshift(x_digits + x_size, a->ob_digit, a_size,
-			       shift_bits);
+			       (int)shift_bits);
 		x_size += a_size;
 		x_digits[x_size++] = rem;
 	}
@@ -2413,7 +2413,7 @@
 		shift_digits = (a_bits - DBL_MANT_DIG - 2) / PyLong_SHIFT;
 		shift_bits = (a_bits - DBL_MANT_DIG - 2) % PyLong_SHIFT;
 		rem = v_rshift(x_digits, a->ob_digit + shift_digits,
-			       a_size - shift_digits, shift_bits);
+			       a_size - shift_digits, (int)shift_bits);
 		x_size = a_size - shift_digits;
 		/* For correct rounding below, we need the least significant
 		   bit of x to be 'sticky' for this shift: if any of the bits
@@ -2428,7 +2428,7 @@
 					break;
 				}
 	}
-	assert(1 <= x_size && x_size <= sizeof(x_digits)/sizeof(digit));
+	assert(1 <= x_size && x_size <= (Py_ssize_t)(sizeof(x_digits)/sizeof(digit)));
 
 	/* Round, and convert to double. */
 	x_digits[0] += half_even_correction[x_digits[0] & 7];
@@ -2475,7 +2475,7 @@
 				"long int too large to convert to float");
 		return -1.0;
 	}
-	return ldexp(x, exponent);
+	return ldexp(x, (int)exponent);
 }
 
 /* Methods */
@@ -3492,9 +3492,9 @@
 
 	/* Check whether ldexp result will overflow a double. */
 	if (shift + x_bits >= DBL_MAX_EXP &&
-	    (shift + x_bits > DBL_MAX_EXP || dx == ldexp(1.0, x_bits)))
+	    (shift + x_bits > DBL_MAX_EXP || dx == ldexp(1.0, (int)x_bits)))
 		goto overflow;
-	result = ldexp(dx, shift);
+	result = ldexp(dx, (int)shift);
 
   success:
 	return PyFloat_FromDouble(negate ? -result : result);
@@ -3779,8 +3779,7 @@
 long_rshift(PyLongObject *a, PyLongObject *b)
 {
 	PyLongObject *z = NULL;
-	long shiftby;
-	Py_ssize_t newsize, wordshift, loshift, hishift, i, j;
+	Py_ssize_t shiftby, newsize, wordshift, loshift, hishift, i, j;
 	digit lomask, himask;
 
 	CHECK_BINOP(a, b);
@@ -3799,8 +3798,7 @@
 		Py_DECREF(a2);
 	}
 	else {
-
-		shiftby = PyLong_AsLong((PyObject *)b);
+		shiftby = PyLong_AsSsize_t((PyObject *)b);
 		if (shiftby == -1L && PyErr_Occurred())
 			goto rshift_error;
 		if (shiftby < 0) {
@@ -3841,27 +3839,21 @@
 	PyLongObject *a = (PyLongObject*)v;
 	PyLongObject *b = (PyLongObject*)w;
 	PyLongObject *z = NULL;
-	long shiftby;
-	Py_ssize_t oldsize, newsize, wordshift, remshift, i, j;
+	Py_ssize_t shiftby, oldsize, newsize, wordshift, remshift, i, j;
 	twodigits accum;
 
 	CHECK_BINOP(a, b);
 
-	shiftby = PyLong_AsLong((PyObject *)b);
+	shiftby = PyLong_AsSsize_t((PyObject *)b);
 	if (shiftby == -1L && PyErr_Occurred())
 		goto lshift_error;
 	if (shiftby < 0) {
 		PyErr_SetString(PyExc_ValueError, "negative shift count");
 		goto lshift_error;
 	}
-	if ((long)(int)shiftby != shiftby) {
-		PyErr_SetString(PyExc_ValueError,
-				"outrageous left shift count");
-		goto lshift_error;
-	}
 	/* wordshift, remshift = divmod(shiftby, PyLong_SHIFT) */
-	wordshift = (int)shiftby / PyLong_SHIFT;
-	remshift  = (int)shiftby - wordshift * PyLong_SHIFT;
+	wordshift = shiftby / PyLong_SHIFT;
+	remshift  = shiftby - wordshift * PyLong_SHIFT;
 
 	oldsize = ABS(Py_SIZE(a));
 	newsize = oldsize + wordshift;
@@ -4370,7 +4362,7 @@
 	Py_DECREF(result);
 	result = y;
 
-	x = (PyLongObject *)PyLong_FromLong(msd_bits);
+	x = (PyLongObject *)PyLong_FromLong((long)msd_bits);
 	if (x == NULL)
 		goto error;
 	y = (PyLongObject *)long_add(result, x);

Modified: python/branches/py3k-cdecimal/Objects/object.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/object.c	(original)
+++ python/branches/py3k-cdecimal/Objects/object.c	Thu Apr  8 13:38:01 2010
@@ -656,15 +656,18 @@
 	 * of mapping keys will turn out weird.
 	 */
 
+	if (!Py_IS_FINITE(v)) {
+		if (Py_IS_INFINITY(v))
+			return v < 0 ? -271828 : 314159;
+		else
+			return 0;
+	}
 	fractpart = modf(v, &intpart);
 	if (fractpart == 0.0) {
 		/* This must return the same hash as an equal int or long. */
 		if (intpart > LONG_MAX/2 || -intpart > LONG_MAX/2) {
 			/* Convert to long and use its hash. */
 			PyObject *plong;	/* converted to Python long */
-			if (Py_IS_INFINITY(intpart))
-				/* can't convert to long int -- arbitrary */
-				v = v < 0 ? -271828.0 : 314159.0;
 			plong = PyLong_FromDouble(v);
 			if (plong == NULL)
 				return -1;

Modified: python/branches/py3k-cdecimal/Python/getargs.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/getargs.c	(original)
+++ python/branches/py3k-cdecimal/Python/getargs.c	Thu Apr  8 13:38:01 2010
@@ -1849,16 +1849,6 @@
 				(void) va_arg(*p_va, PyTypeObject*);
 				(void) va_arg(*p_va, PyObject **);
 			}
-#if 0
-/* I don't know what this is for */
-			else if (*format == '?') {
-				inquiry pred = va_arg(*p_va, inquiry);
-				format++;
-				if ((*pred)(arg)) {
-					(void) va_arg(*p_va, PyObject **);
-				}
-			}
-#endif
 			else if (*format == '&') {
 				typedef int (*converter)(PyObject *, void *);
 				(void) va_arg(*p_va, converter);

Modified: python/branches/py3k-cdecimal/Python/structmember.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/structmember.c	(original)
+++ python/branches/py3k-cdecimal/Python/structmember.c	Thu Apr  8 13:38:01 2010
@@ -267,7 +267,7 @@
 		break;
 		}
 	case T_STRING:
-        case T_STRING_INPLACE:
+	case T_STRING_INPLACE:
 		PyErr_SetString(PyExc_TypeError, "readonly attribute");
 		return -1;
 #ifdef HAVE_LONG_LONG


More information about the Python-checkins mailing list