[Python-checkins] r79816 - in python/branches/py3k-jit: Doc/faq/extending.rst Doc/howto/functional.rst Doc/howto/webservers.rst Doc/library/collections.rst Doc/library/decimal.rst Doc/library/fractions.rst Doc/library/functions.rst Doc/library/functools.rst Doc/library/itertools.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/library/struct.rst Doc/library/zipfile.rst Doc/reference/datamodel.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/collections.py Lib/decimal.py Lib/dis.py Lib/distutils/tests/test_build_ext.py Lib/fractions.py Lib/functools.py Lib/platform.py Lib/pstats.py Lib/ssl.py Lib/test/test___all__.py Lib/test/test_argparse.py Lib/test/test_codecs.py Lib/test/test_collections.py Lib/test/test_complex.py Lib/test/test_contextlib.py Lib/test/test_decimal.py Lib/test/test_deque.py Lib/test/test_descr.py Lib/test/test_doctest.py Lib/test/test_float.py Lib/test/test_fractions.py Lib/test/test_functools.py Lib/test/test_global.py Lib/test/test_hmac.py Lib/test/test_io.py Lib/test/test_robotparser.py Lib/test/test_ssl.py Lib/test/test_struct.py Lib/test/test_structmembers.py Lib/test/test_sundry.py Lib/test/test_xml_etree.py Lib/unittest/loader.py Lib/unittest/util.py Makefile.pre.in Misc/NEWS Misc/python.man Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/socketmodule.c Objects/object.c PCbuild/rt.bat Parser/tokenizer.c Python/structmember.c configure.in

collin.winter python-checkins at python.org
Tue Apr 6 03:07:35 CEST 2010


Author: collin.winter
Date: Tue Apr  6 03:07:34 2010
New Revision: 79816

Log:
Merged revisions 79565,79571,79573,79581,79591,79593-79594,79600,79602,79604-79605,79610-79611,79613,79615,79621,79628,79631,79641,79645,79656-79657,79662,79665,79668,79670,79676,79681,79683,79688-79689,79694,79696,79701,79703,79705,79708,79715,79720-79721,79724,79726,79728-79729,79731,79737,79739,79742,79746,79752,79757,79764-79765,79770-79771,79773,79780,79783,79790,79799,79805,79810,79813-79814 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79565 | raymond.hettinger | 2010-04-01 17:25:45 -0700 (Thu, 01 Apr 2010) | 1 line
  
  Document sorting HowTo
................
  r79571 | raymond.hettinger | 2010-04-01 21:18:18 -0700 (Thu, 01 Apr 2010) | 1 line
  
  Add and update itertools recipes.
................
  r79573 | raymond.hettinger | 2010-04-01 21:50:35 -0700 (Thu, 01 Apr 2010) | 1 line
  
  Fix nits in itertools recipes.
................
  r79581 | georg.brandl | 2010-04-02 01:47:07 -0700 (Fri, 02 Apr 2010) | 1 line
  
  #8213: document behavior of -u on py3k better.
................
  r79591 | larry.hastings | 2010-04-02 04:03:37 -0700 (Fri, 02 Apr 2010) | 16 lines
  
  Blocked revisions 79590 via svnmerge
  
  ........
    r79590 | larry.hastings | 2010-04-02 04:01:35 -0700 (Fri, 02 Apr 2010) | 10 lines
    
    Capsule-related changes:
    * PyCObject_AsVoidPtr() can now open capsules.  This addresses
      most of the remaining backwards-compatibility concerns about
      the conversion of Python 2.7 from CObjects to capsules.
    * CObjects were marked Pending Deprecation.
    * Documentation about this pending deprecation was added to
      cobject.h.
    * The capsule source files were added to the legacy PC build
      processes.
  ........
................
  r79593 | larry.hastings | 2010-04-02 04:20:07 -0700 (Fri, 02 Apr 2010) | 9 lines
  
  Blocked revisions 79592 via svnmerge
  
  ........
    r79592 | larry.hastings | 2010-04-02 04:18:17 -0700 (Fri, 02 Apr 2010) | 3 lines
    
    Issue #8235: _socket: Add the constant ``SO_SETFIB``.  SO_SETFIB is
    a socket option available on FreeBSD 7.1 and newer.
  ........
................
  r79594 | larry.hastings | 2010-04-02 04:47:10 -0700 (Fri, 02 Apr 2010) | 4 lines
  
  - Issue #8235: _socket: Add the constant ``SO_SETFIB``.  SO_SETFIB is
    a socket option available on FreeBSD 7.1 and newer.
................
  r79600 | ezio.melotti | 2010-04-02 06:56:40 -0700 (Fri, 02 Apr 2010) | 15 lines
  
  Merged revisions 79540-79541 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  Add -Wd to the flags used to run the tests (-3 is not necessary here).
  
  ........
    r79540 | ezio.melotti | 2010-04-01 01:18:09 +0300 (Thu, 01 Apr 2010) | 1 line
    
    Add -Wd and -3 to the flags used to run the tests.
  ........
    r79541 | ezio.melotti | 2010-04-01 01:43:31 +0300 (Thu, 01 Apr 2010) | 1 line
    
    Add -Wd and -3 to the flags used to run the tests on Windows.
  ........
................
  r79602 | raymond.hettinger | 2010-04-02 09:58:27 -0700 (Fri, 02 Apr 2010) | 1 line
  
  Issue 8257: Decimal constructor to accept float argument.
................
  r79604 | andrew.kuchling | 2010-04-02 10:02:57 -0700 (Fri, 02 Apr 2010) | 9 lines
  
  Merged revisions 79603 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79603 | andrew.kuchling | 2010-04-02 12:59:16 -0400 (Fri, 02 Apr 2010) | 1 line
    
    #4440: modernize a use of filter(), making it compatible with 3.x
  ........
................
  r79605 | antoine.pitrou | 2010-04-02 10:12:12 -0700 (Fri, 02 Apr 2010) | 3 lines
  
  Furniture is not very reliable these days (buildbot failures).
................
  r79610 | florent.xicluna | 2010-04-02 11:52:12 -0700 (Fri, 02 Apr 2010) | 27 lines
  
  (partially)
  
  Merged revisions 79534,79537,79539,79558,79606 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79534 | florent.xicluna | 2010-03-31 23:21:54 +0200 (mer, 31 mar 2010) | 2 lines
    
    Fix test for xml.etree when using a non-ascii path.  And use check_warnings instead of catch_warnings.
  ........
    r79537 | florent.xicluna | 2010-03-31 23:40:32 +0200 (mer, 31 mar 2010) | 2 lines
    
    Fix typo
  ........
    r79539 | florent.xicluna | 2010-04-01 00:01:03 +0200 (jeu, 01 avr 2010) | 2 lines
    
    Replace catch_warnings with check_warnings when it makes sense.  Use assertRaises context manager to simplify some tests.
  ........
    r79558 | florent.xicluna | 2010-04-01 20:17:09 +0200 (jeu, 01 avr 2010) | 2 lines
    
    #7092: Fix some -3 warnings, and fix Lib/platform.py when the path contains a double-quote.
  ........
    r79606 | florent.xicluna | 2010-04-02 19:26:42 +0200 (ven, 02 avr 2010) | 2 lines
    
    Backport some robotparser test and skip the test if the external resource is not available.
  ........
................
  r79611 | raymond.hettinger | 2010-04-02 11:54:02 -0700 (Fri, 02 Apr 2010) | 1 line
  
  Add nice docstrings to namedtuples.
................
  r79613 | florent.xicluna | 2010-04-02 12:25:32 -0700 (Fri, 02 Apr 2010) | 2 lines
  
  An oversight in previous merge, r79610: test_doctest is sensible to the line numbering.
................
  r79615 | georg.brandl | 2010-04-02 13:12:42 -0700 (Fri, 02 Apr 2010) | 1 line
  
  #8288: fix next -> __next__.
................
  r79621 | tarek.ziade | 2010-04-02 14:24:55 -0700 (Fri, 02 Apr 2010) | 9 lines
  
  Merged revisions 79618 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79618 | tarek.ziade | 2010-04-02 23:14:04 +0200 (Fri, 02 Apr 2010) | 1 line
    
    removed the local copy of xxmodule, and skip only test_build_ext when xxmodule is not found, not the whole unittest
  ........
................
  r79628 | ezio.melotti | 2010-04-02 15:15:23 -0700 (Fri, 02 Apr 2010) | 8 lines
  
  Blocked revisions 79582 via svnmerge
  
  ........
    r79582 | georg.brandl | 2010-04-02 11:51:31 +0300 (Fri, 02 Apr 2010) | 1 line
    
    Fix typo in unicode character name.
  ........
................
  r79631 | brian.curtin | 2010-04-02 15:38:52 -0700 (Fri, 02 Apr 2010) | 2 lines
  
  Change test_support to support. Fixes a failing test on Windows.
................
  r79641 | benjamin.peterson | 2010-04-02 18:02:00 -0700 (Fri, 02 Apr 2010) | 14 lines
  
  Blocked revisions 79636,79639 via svnmerge
  
  ........
    r79636 | benjamin.peterson | 2010-04-02 18:59:41 -0500 (Fri, 02 Apr 2010) | 4 lines
    
    always check _PyString_Resize for error
    
    also normalize how this error is checked
  ........
    r79639 | benjamin.peterson | 2010-04-02 19:57:33 -0500 (Fri, 02 Apr 2010) | 1 line
    
    more _PyString_Resize error checking
  ........
................
  r79645 | benjamin.peterson | 2010-04-02 18:40:24 -0700 (Fri, 02 Apr 2010) | 13 lines
  
  Merged revisions 79642,79644 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79642 | benjamin.peterson | 2010-04-02 20:08:34 -0500 (Fri, 02 Apr 2010) | 1 line
    
    split out large test function
  ........
    r79644 | benjamin.peterson | 2010-04-02 20:28:57 -0500 (Fri, 02 Apr 2010) | 1 line
    
    give TypeError when trying to set T_STRING_INPLACE
  ........
................
  r79656 | victor.stinner | 2010-04-03 01:43:28 -0700 (Sat, 03 Apr 2010) | 11 lines
  
  Blocked revisions 79654 via svnmerge
  
  ........
    r79654 | victor.stinner | 2010-04-03 10:40:16 +0200 (sam., 03 avril 2010) | 5 lines
    
    Issue #8227: Fix C API documentation, argument parsing
    
     * 'z', 'z#', 'z*' does also accept Unicode
     * unify types name: replace "string or Unicode objet" by "string or Unicode"
  ........
................
  r79657 | tarek.ziade | 2010-04-03 01:46:49 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Merged revisions 79652 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79652 | tarek.ziade | 2010-04-03 10:37:59 +0200 (Sat, 03 Apr 2010) | 1 line
    
    Issue #1222585: Added LDCXXSHARED for C++ support
  ........
................
  r79662 | raymond.hettinger | 2010-04-03 03:32:58 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Add a subtract() method to collections.Counter()
................
  r79665 | mark.dickinson | 2010-04-03 03:49:56 -0700 (Sat, 03 Apr 2010) | 20 lines
  
  Merged revisions 79661 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79661 | mark.dickinson | 2010-04-03 11:27:05 +0100 (Sat, 03 Apr 2010) | 14 lines
    
    Fix a couple of issues with the test_structmembersType class in _testcapimodule
    
     - rename to _test_structmembersType to avoid the class being automatically
       called by test_capi
    
     - allow space for trailing NUL in inplace_member field of all_structmembers
    
     - use T_STRING_INPLACE instead of T_INPLACE_STRING as keyword argument
       to _test_structmembersType initializer
    
     - don't attempt to initialize inplace_member field if T_STRING_INPLACE
       argument wasn't supplied.
  ........
................
  r79668 | mark.dickinson | 2010-04-03 04:08:14 -0700 (Sat, 03 Apr 2010) | 26 lines
  
  Merged revisions 79583,79588-79589 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79583 | mark.dickinson | 2010-04-02 09:53:22 +0100 (Fri, 02 Apr 2010) | 7 lines
    
    Issue #2531: Make float-to-decimal comparisons return correct results.
    
    Float to decimal comparison operations now return a result based on
    the numeric values of the operands.  Decimal.__hash__ has also been
    fixed so that Decimal and float values that compare equal have equal
    hash value.
  ........
    r79588 | mark.dickinson | 2010-04-02 11:17:07 +0100 (Fri, 02 Apr 2010) | 2 lines
    
    Issue #7279:  Make comparisons involving a Decimal sNaN signal InvalidOperation.
  ........
    r79589 | mark.dickinson | 2010-04-02 11:35:12 +0100 (Fri, 02 Apr 2010) | 6 lines
    
    Issue #7279:  Make Decimal('nan') hashable.  Decimal('snan') remains unhashable.
    
    Also rewrite the Decimal __hash__ method so that it doesn't rely on
    float('inf') being valid: float('inf') could raise an exception on
    platforms not using IEEE 754 arithmetic.
  ........
................
  r79670 | mark.dickinson | 2010-04-03 04:18:52 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Merged revisions 79629 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79629 | mark.dickinson | 2010-04-02 23:27:36 +0100 (Fri, 02 Apr 2010) | 2 lines
    
    Issue #8294:  Allow float and Decimal arguments in Fraction constructor.
  ........
................
  r79676 | mark.dickinson | 2010-04-03 07:24:58 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Remove unused define.
................
  r79681 | ezio.melotti | 2010-04-03 07:59:49 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Merged revisions 79678 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79678 | ezio.melotti | 2010-04-03 17:51:00 +0300 (Sat, 03 Apr 2010) | 1 line
    
    Use more specific assert* methods in test_decimal.
  ........
................
  r79683 | mark.dickinson | 2010-04-03 08:07:40 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Clean up integer tests in test_struct, and bring them more in line with the trunk tests.
................
  r79688 | mark.dickinson | 2010-04-03 08:26:31 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Internal refactoring in struct.pack:  make all integer conversions go through get_pylong.
................
  r79689 | ezio.melotti | 2010-04-03 08:27:05 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Add -bb to rt.bat to do some extra checks during the tests (it is already used by the non-Windows buildbots).
................
  r79694 | ezio.melotti | 2010-04-03 08:39:17 -0700 (Sat, 03 Apr 2010) | 8 lines
  
  Blocked revisions 79624 via svnmerge
  
  ........
    r79624 | ezio.melotti | 2010-04-03 00:43:10 +0300 (Sat, 03 Apr 2010) | 1 line
    
    Fix test_compiler.py that was using unittest.__file__ to find Lib/ (unittest is now a package).
  ........
................
  r79696 | benjamin.peterson | 2010-04-03 08:42:04 -0700 (Sat, 03 Apr 2010) | 12 lines
  
  Blocked revisions 79693,79695 via svnmerge
  
  ........
    r79693 | benjamin.peterson | 2010-04-03 10:38:38 -0500 (Sat, 03 Apr 2010) | 1 line
    
    wrap
  ........
    r79695 | benjamin.peterson | 2010-04-03 10:40:29 -0500 (Sat, 03 Apr 2010) | 1 line
    
    remove unneeded argument
  ........
................
  r79701 | mark.dickinson | 2010-04-03 08:51:03 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Merged revisions 79699 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79699 | mark.dickinson | 2010-04-03 16:47:46 +0100 (Sat, 03 Apr 2010) | 1 line
    
    Add Misc/NEWS entry for r79609.
  ........
................
  r79703 | mark.dickinson | 2010-04-03 08:54:36 -0700 (Sat, 03 Apr 2010) | 10 lines
  
  Merged revisions 79674 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79674 | mark.dickinson | 2010-04-03 15:05:10 +0100 (Sat, 03 Apr 2010) | 3 lines
    
    Issue #8300:  Let struct.pack use __index__ to convert and pack non-integers.
    Based on a patch by Meador Inge.
  ........
................
  r79705 | benjamin.peterson | 2010-04-03 09:01:50 -0700 (Sat, 03 Apr 2010) | 16 lines
  
  Blocked revisions 79697-79698,79704 via svnmerge
  
  ........
    r79697 | benjamin.peterson | 2010-04-03 10:44:56 -0500 (Sat, 03 Apr 2010) | 1 line
    
    silence PyCObject warnings in bsddb
  ........
    r79698 | benjamin.peterson | 2010-04-03 10:45:59 -0500 (Sat, 03 Apr 2010) | 1 line
    
    spelling
  ........
    r79704 | benjamin.peterson | 2010-04-03 10:58:15 -0500 (Sat, 03 Apr 2010) | 1 line
    
    remove deprecation warnings silence attempting
  ........
................
  r79708 | mark.dickinson | 2010-04-03 09:42:09 -0700 (Sat, 03 Apr 2010) | 11 lines
  
  Blocked revisions 79707 via svnmerge
  
  ........
    r79707 | mark.dickinson | 2010-04-03 17:41:20 +0100 (Sat, 03 Apr 2010) | 5 lines
    
    Ensure 'module removed' warning messages contain the word 'module' or 'package'.
    
    This should fix the test_py3kwarn failure on OS X.  test_support.import_module
    also requires this.
  ........
................
  r79715 | mark.dickinson | 2010-04-03 11:18:44 -0700 (Sat, 03 Apr 2010) | 8 lines
  
  Blocked revisions 79714 via svnmerge
  
  ........
    r79714 | mark.dickinson | 2010-04-03 19:17:54 +0100 (Sat, 03 Apr 2010) | 1 line
    
    Silence DeprecationWarnings from uses of has_key and <> in plat-mac.
  ........
................
  r79720 | benjamin.peterson | 2010-04-03 14:57:26 -0700 (Sat, 03 Apr 2010) | 8 lines
  
  Blocked revisions 79712 via svnmerge
  
  ........
    r79712 | raymond.hettinger | 2010-04-03 12:10:05 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Silence a compiler warning.
  ........
................
  r79721 | benjamin.peterson | 2010-04-03 15:11:20 -0700 (Sat, 03 Apr 2010) | 12 lines
  
  Blocked revisions 79718-79719 via svnmerge
  
  ........
    r79718 | antoine.pitrou | 2010-04-03 16:42:18 -0500 (Sat, 03 Apr 2010) | 3 lines
    
    Remove useless (?) import from r79706
  ........
    r79719 | benjamin.peterson | 2010-04-03 16:50:40 -0500 (Sat, 03 Apr 2010) | 1 line
    
    import bsddb more robustly
  ........
................
  r79724 | benjamin.peterson | 2010-04-03 15:55:48 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Merged revisions 79723 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79723 | benjamin.peterson | 2010-04-03 17:48:51 -0500 (Sat, 03 Apr 2010) | 1 line
    
    ensure that the locale does not affect the tokenization of identifiers
  ........
................
  r79726 | benjamin.peterson | 2010-04-03 16:10:01 -0700 (Sat, 03 Apr 2010) | 11 lines
  
  Merged revisions 79725 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79725 | benjamin.peterson | 2010-04-03 18:03:35 -0500 (Sat, 03 Apr 2010) | 4 lines
    
    use our own locale independent ctype macros
    
    requires building pyctype.o into pgen
  ........
................
  r79728 | raymond.hettinger | 2010-04-03 16:20:46 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Add count() method to collections.deque().
................
  r79729 | benjamin.peterson | 2010-04-03 16:56:48 -0700 (Sat, 03 Apr 2010) | 1 line
  
  add missing decrefs
................
  r79731 | ezio.melotti | 2010-04-03 23:30:08 -0700 (Sat, 03 Apr 2010) | 1 line
  
  Fix versionchanged from 2.7 to 3.2 in decimal.rst.
................
  r79737 | ezio.melotti | 2010-04-03 23:53:44 -0700 (Sat, 03 Apr 2010) | 13 lines
  
  Merged revisions 79733,79735 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79733 | ezio.melotti | 2010-04-04 09:41:27 +0300 (Sun, 04 Apr 2010) | 1 line
    
    Add a versionadded to Counter.subtract() doc.
  ........
    r79735 | ezio.melotti | 2010-04-04 09:50:58 +0300 (Sun, 04 Apr 2010) | 1 line
    
    Revert 79733 - Counter is new in 2.7, the versionadded is not necessary - and fix a typo.
  ........
................
  r79739 | ezio.melotti | 2010-04-03 23:57:44 -0700 (Sat, 03 Apr 2010) | 9 lines
  
  Recorded merge of revisions 79660 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79660 | raymond.hettinger | 2010-04-03 13:22:00 +0300 (Sat, 03 Apr 2010) | 1 line
    
    Add subtract() method to collections.Counter() objects.
  ........
................
  r79742 | ezio.melotti | 2010-04-04 00:21:15 -0700 (Sun, 04 Apr 2010) | 9 lines
  
  Merged revisions 79740 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79740 | ezio.melotti | 2010-04-04 10:00:02 +0300 (Sun, 04 Apr 2010) | 1 line
    
    Use more specific assert* methods in test_struct.
  ........
................
  r79746 | mark.dickinson | 2010-04-04 01:52:51 -0700 (Sun, 04 Apr 2010) | 10 lines
  
  Merged revisions 79745 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79745 | mark.dickinson | 2010-04-04 09:43:04 +0100 (Sun, 04 Apr 2010) | 3 lines
    
    Issue #8300 (__index__ handling in struct.pack): Remove redundant check
    and improve test coverage.  Thanks Meador Inge for the patch.
  ........
................
  r79752 | mark.dickinson | 2010-04-04 14:23:57 -0700 (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-04 15:13:14 -0700 (Sun, 04 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-04 16:03:35 -0700 (Sun, 04 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-04 16:09:06 -0700 (Sun, 04 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-04 16:25:45 -0700 (Sun, 04 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-04 16:26:50 -0700 (Sun, 04 Apr 2010) | 1 line
  
  factor out constant
................
  r79773 | ezio.melotti | 2010-04-04 16:27:45 -0700 (Sun, 04 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-04 20:05:24 -0700 (Sun, 04 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-04 21:04:35 -0700 (Sun, 04 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 01:21:29 -0700 (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 06:25:51 -0700 (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 11:09:39 -0700 (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 11:56:31 -0700 (Mon, 05 Apr 2010) | 1 line
  
  Forward port total_ordering() and cmp_to_key().
................
  r79813 | antoine.pitrou | 2010-04-05 14:40:07 -0700 (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 14:44:48 -0700 (Mon, 05 Apr 2010) | 3 lines
  
  Fix docs for r79813.
................


Modified:
   python/branches/py3k-jit/   (props changed)
   python/branches/py3k-jit/Doc/faq/extending.rst
   python/branches/py3k-jit/Doc/howto/functional.rst
   python/branches/py3k-jit/Doc/howto/webservers.rst
   python/branches/py3k-jit/Doc/library/collections.rst
   python/branches/py3k-jit/Doc/library/decimal.rst
   python/branches/py3k-jit/Doc/library/fractions.rst
   python/branches/py3k-jit/Doc/library/functions.rst
   python/branches/py3k-jit/Doc/library/functools.rst
   python/branches/py3k-jit/Doc/library/itertools.rst
   python/branches/py3k-jit/Doc/library/ssl.rst
   python/branches/py3k-jit/Doc/library/stdtypes.rst
   python/branches/py3k-jit/Doc/library/struct.rst
   python/branches/py3k-jit/Doc/library/zipfile.rst
   python/branches/py3k-jit/Doc/reference/datamodel.rst
   python/branches/py3k-jit/Doc/using/cmdline.rst
   python/branches/py3k-jit/Doc/using/mac.rst
   python/branches/py3k-jit/Doc/whatsnew/2.1.rst
   python/branches/py3k-jit/Doc/whatsnew/2.6.rst
   python/branches/py3k-jit/Doc/whatsnew/2.7.rst
   python/branches/py3k-jit/Lib/collections.py
   python/branches/py3k-jit/Lib/decimal.py
   python/branches/py3k-jit/Lib/dis.py
   python/branches/py3k-jit/Lib/distutils/tests/test_build_ext.py
   python/branches/py3k-jit/Lib/fractions.py
   python/branches/py3k-jit/Lib/functools.py
   python/branches/py3k-jit/Lib/platform.py
   python/branches/py3k-jit/Lib/pstats.py
   python/branches/py3k-jit/Lib/ssl.py
   python/branches/py3k-jit/Lib/test/test___all__.py
   python/branches/py3k-jit/Lib/test/test_argparse.py
   python/branches/py3k-jit/Lib/test/test_codecs.py
   python/branches/py3k-jit/Lib/test/test_collections.py
   python/branches/py3k-jit/Lib/test/test_complex.py
   python/branches/py3k-jit/Lib/test/test_contextlib.py
   python/branches/py3k-jit/Lib/test/test_decimal.py
   python/branches/py3k-jit/Lib/test/test_deque.py
   python/branches/py3k-jit/Lib/test/test_descr.py
   python/branches/py3k-jit/Lib/test/test_doctest.py
   python/branches/py3k-jit/Lib/test/test_float.py
   python/branches/py3k-jit/Lib/test/test_fractions.py
   python/branches/py3k-jit/Lib/test/test_functools.py
   python/branches/py3k-jit/Lib/test/test_global.py
   python/branches/py3k-jit/Lib/test/test_hmac.py
   python/branches/py3k-jit/Lib/test/test_io.py
   python/branches/py3k-jit/Lib/test/test_robotparser.py
   python/branches/py3k-jit/Lib/test/test_ssl.py
   python/branches/py3k-jit/Lib/test/test_struct.py
   python/branches/py3k-jit/Lib/test/test_structmembers.py
   python/branches/py3k-jit/Lib/test/test_sundry.py
   python/branches/py3k-jit/Lib/test/test_xml_etree.py
   python/branches/py3k-jit/Lib/unittest/loader.py
   python/branches/py3k-jit/Lib/unittest/util.py
   python/branches/py3k-jit/Makefile.pre.in
   python/branches/py3k-jit/Misc/NEWS
   python/branches/py3k-jit/Misc/python.man
   python/branches/py3k-jit/Modules/_codecsmodule.c
   python/branches/py3k-jit/Modules/_collectionsmodule.c
   python/branches/py3k-jit/Modules/_ssl.c
   python/branches/py3k-jit/Modules/_struct.c
   python/branches/py3k-jit/Modules/_testcapimodule.c
   python/branches/py3k-jit/Modules/socketmodule.c
   python/branches/py3k-jit/Objects/object.c
   python/branches/py3k-jit/PCbuild/rt.bat
   python/branches/py3k-jit/Parser/tokenizer.c
   python/branches/py3k-jit/Python/structmember.c
   python/branches/py3k-jit/configure.in

Modified: python/branches/py3k-jit/Doc/faq/extending.rst
==============================================================================
--- python/branches/py3k-jit/Doc/faq/extending.rst	(original)
+++ python/branches/py3k-jit/Doc/faq/extending.rst	Tue Apr  6 03:07:34 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-jit/Doc/howto/functional.rst
==============================================================================
--- python/branches/py3k-jit/Doc/howto/functional.rst	(original)
+++ python/branches/py3k-jit/Doc/howto/functional.rst	Tue Apr  6 03:07:34 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-jit/Doc/howto/webservers.rst
==============================================================================
--- python/branches/py3k-jit/Doc/howto/webservers.rst	(original)
+++ python/branches/py3k-jit/Doc/howto/webservers.rst	Tue Apr  6 03:07:34 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-jit/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/collections.rst	(original)
+++ python/branches/py3k-jit/Doc/library/collections.rst	Tue Apr  6 03:07:34 2010
@@ -191,7 +191,7 @@
    .. versionadded:: 3.1
 
 
-   Counter objects support two methods beyond those available for all
+   Counter objects support three methods beyond those available for all
    dictionaries:
 
    .. method:: elements()
@@ -214,6 +214,19 @@
             >>> Counter('abracadabra').most_common(3)
             [('a', 5), ('r', 2), ('b', 2)]
 
+   .. method:: subtract([iterable-or-mapping])
+
+      Elements are subtracted from an *iterable* or from another *mapping*
+      (or counter).  Like :meth:`dict.update` but subtracts counts instead
+      of replacing them.  Both inputs and outputs may be zero or negative.
+
+            >>> c = Counter(a=4, b=2, c=0, d=-2)
+            >>> d = Counter(a=1, b=2, c=3, d=4)
+            >>> c.subtract(d)
+            Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})
+
+      .. versionadded:: 3.2
+
    The usual dictionary methods are available for :class:`Counter` objects
    except for two which work differently for counters.
 
@@ -327,6 +340,12 @@
       Remove all elements from the deque leaving it with length 0.
 
 
+   .. method:: count(x)
+
+      Count the number of deque elements equal to *x*.
+
+      .. versionadded:: 3.2
+
    .. method:: extend(iterable)
 
       Extend the right side of the deque by appending elements from the iterable
@@ -653,6 +672,7 @@
            _fields = ('x', 'y')
    <BLANKLINE>
            def __new__(_cls, x, y):
+               'Create a new instance of Point(x, y)'
                return _tuple.__new__(_cls, (x, y))
    <BLANKLINE>
            @classmethod
@@ -664,6 +684,7 @@
                return result
    <BLANKLINE>
            def __repr__(self):
+               'Return a nicely formatted representation string'
                return 'Point(x=%r, y=%r)' % self
    <BLANKLINE>
            def _asdict(self):
@@ -678,10 +699,11 @@
                return result
    <BLANKLINE>
            def __getnewargs__(self):
+               'Return self as a plain tuple.   Used by copy and pickle.'
                return tuple(self)
    <BLANKLINE>
-           x = _property(_itemgetter(0))
-           y = _property(_itemgetter(1))
+           x = _property(_itemgetter(0), doc='Alias for field number 0')
+           y = _property(_itemgetter(1), doc='Alias for field number 1')
 
    >>> p = Point(11, y=22)     # instantiate with positional or keyword arguments
    >>> p[0] + p[1]             # indexable like the plain tuple (11, 22)

Modified: python/branches/py3k-jit/Doc/library/decimal.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/decimal.rst	(original)
+++ python/branches/py3k-jit/Doc/library/decimal.rst	Tue Apr  6 03:07:34 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))
@@ -308,7 +309,7 @@
 
    Construct a new :class:`Decimal` object based from *value*.
 
-   *value* can be an integer, string, tuple, or another :class:`Decimal`
+   *value* can be an integer, string, tuple, :class:`float`, or another :class:`Decimal`
    object. If no *value* is given, returns ``Decimal('0')``.  If *value* is a
    string, it should conform to the decimal numeric string syntax after leading
    and trailing whitespace characters are removed::
@@ -334,6 +335,12 @@
    digits, and an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), -3))``
    returns ``Decimal('1.414')``.
 
+   If *value* is a :class:`float`, the binary floating point value is losslessly
+   converted to its exact decimal equivalent.  This conversion can often require
+   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,
    ``Decimal('3.00000')`` records all five zeros even if the context precision is
@@ -346,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
@@ -353,6 +363,24 @@
    compared, sorted, and coerced to another type (such as :class:`float` or
    :class:`int`).
 
+   Decimal objects cannot generally be combined with floats in
+   arithmetic operations: an attempt to add a :class:`Decimal` to a
+   :class:`float`, for example, will raise a :exc:`TypeError`.
+   There's one exception to this rule: it's possible to use Python's
+   comparison operators to compare a :class:`float` instance ``x``
+   with a :class:`Decimal` instance ``y``.  Without this exception,
+   comparisons between :class:`Decimal` and :class:`float` instances
+   would follow the general rules for comparing objects of different
+   types described in the :ref:`expressions` section of the reference
+   manual, leading to confusing results.
+
+   .. versionchanged:: 3.2
+      A comparison between a :class:`float` instance ``x`` and a
+      :class:`Decimal` instance ``y`` now returns a result based on
+      the values of ``x`` and ``y``.  In earlier versions ``x < y``
+      returned the same (arbitrary) result for any :class:`Decimal`
+      instance ``x`` and any :class:`float` instance ``y``.
+
    In addition to the standard numeric properties, decimal floating point
    objects also have a number of specialized methods:
 
@@ -467,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)
@@ -1823,37 +1854,15 @@
 
 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
-Decimal.  An exact conversion may take more precision than intuition would
-suggest, so we trap :const:`Inexact` to signal a need for more precision:
-
-.. testcode::
-
-    def float_to_decimal(f):
-        "Convert a floating point number to a Decimal with no loss of information"
-        n, d = f.as_integer_ratio()
-        with localcontext() as ctx:
-            ctx.traps[Inexact] = True
-            while True:
-                try:
-                   return Decimal(n) / Decimal(d)
-                except Inexact:
-                    ctx.prec += 1
+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:
 
 .. doctest::
 
-    >>> float_to_decimal(math.pi)
+    >>> Decimal(math.pi)
     Decimal('3.141592653589793115997963468544185161590576171875')
 
-Q. Why isn't the :func:`float_to_decimal` routine included in the module?
-
-A. There is some question about whether it is advisable to mix binary and
-decimal floating point.  Also, its use requires some care to avoid the
-representation issues associated with binary floating point:
-
-   >>> float_to_decimal(1.1)
-   Decimal('1.100000000000000088817841970012523233890533447265625')
-
 Q. Within a complex calculation, how can I make sure that I haven't gotten a
 spurious result because of insufficient precision or rounding anomalies.
 

Modified: python/branches/py3k-jit/Doc/library/fractions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/fractions.rst	(original)
+++ python/branches/py3k-jit/Doc/library/fractions.rst	Tue Apr  6 03:07:34 2010
@@ -15,17 +15,24 @@
 
 .. class:: Fraction(numerator=0, denominator=1)
            Fraction(other_fraction)
+           Fraction(float)
+           Fraction(decimal)
            Fraction(string)
 
-   The first version requires that *numerator* and *denominator* are
-   instances of :class:`numbers.Rational` and returns a new
-   :class:`Fraction` instance with value ``numerator/denominator``. If
-   *denominator* is :const:`0`, it raises a
-   :exc:`ZeroDivisionError`. The second version requires that
-   *other_fraction* is an instance of :class:`numbers.Rational` and
-   returns an :class:`Fraction` instance with the same value.  The
-   last version of the constructor expects a string instance.  The
-   usual form for this string is::
+   The first version requires that *numerator* and *denominator* are instances
+   of :class:`numbers.Rational` and returns a new :class:`Fraction` instance
+   with value ``numerator/denominator``. If *denominator* is :const:`0`, it
+   raises a :exc:`ZeroDivisionError`. The second version requires that
+   *other_fraction* is an instance of :class:`numbers.Rational` and returns a
+   :class:`Fraction` instance with the same value.  The next two versions accept
+   either a :class:`float` or a :class:`decimal.Decimal` instance, and return a
+   :class:`Fraction` instance with exactly the same value.  Note that due to the
+   usual issues with binary floating-point (see :ref:`tut-fp-issues`), the
+   argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so
+   ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might expect.
+   (But see the documentation for the :meth:`limit_denominator` method below.)
+   The last version of the constructor expects a string or unicode instance.
+   The usual form for this instance is::
 
       [sign] numerator ['/' denominator]
 
@@ -55,6 +62,13 @@
       Fraction(-1, 8)
       >>> Fraction('7e-6')
       Fraction(7, 1000000)
+      >>> Fraction(2.25)
+      Fraction(9, 4)
+      >>> Fraction(1.1)
+      Fraction(2476979795053773, 2251799813685248)
+      >>> from decimal import Decimal
+      >>> Fraction(Decimal('1.1'))
+      Fraction(11, 10)
 
 
    The :class:`Fraction` class inherits from the abstract base class
@@ -63,6 +77,10 @@
    and should be treated as immutable.  In addition,
    :class:`Fraction` has the following methods:
 
+   .. versionchanged:: 3.2
+      The :class:`Fraction` constructor now accepts :class:`float` and
+      :class:`decimal.Decimal` instances.
+
 
    .. method:: from_float(flt)
 
@@ -70,12 +88,19 @@
       value of *flt*, which must be a :class:`float`. Beware that
       ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)``
 
+      .. note:: From Python 3.2 onwards, you can also construct a
+         :class:`Fraction` instance directly from a :class:`float`.
+
 
    .. method:: from_decimal(dec)
 
       This class method constructs a :class:`Fraction` representing the exact
       value of *dec*, which must be a :class:`decimal.Decimal` instance.
 
+      .. note:: From Python 3.2 onwards, you can also construct a
+         :class:`Fraction` instance directly from a :class:`decimal.Decimal`
+         instance.
+
 
    .. method:: limit_denominator(max_denominator=1000000)
 
@@ -90,10 +115,12 @@
       or for recovering a rational number that's represented as a float:
 
          >>> from math import pi, cos
-         >>> Fraction.from_float(cos(pi/3))
+         >>> Fraction(cos(pi/3))
          Fraction(4503599627370497, 9007199254740992)
-         >>> Fraction.from_float(cos(pi/3)).limit_denominator()
+         >>> Fraction(cos(pi/3)).limit_denominator()
          Fraction(1, 2)
+         >>> Fraction(1.1).limit_denominator()
+         Fraction(11, 10)
 
 
    .. method:: __floor__()

Modified: python/branches/py3k-jit/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/functions.rst	(original)
+++ python/branches/py3k-jit/Doc/library/functions.rst	Tue Apr  6 03:07:34 2010
@@ -1014,9 +1014,11 @@
    *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/>`_\.
 
 .. function:: staticmethod(function)
 

Modified: python/branches/py3k-jit/Doc/library/functools.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/functools.rst	(original)
+++ python/branches/py3k-jit/Doc/library/functools.rst	Tue Apr  6 03:07:34 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-jit/Doc/library/itertools.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/itertools.rst	(original)
+++ python/branches/py3k-jit/Doc/library/itertools.rst	Tue Apr  6 03:07:34 2010
@@ -455,7 +455,7 @@
        def product(*args, repeat=1):
            # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
            # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
-           pools = map(tuple, args) * repeat
+           pools = [tuple(pool) for pool in args] * repeat
            result = [[]]
            for pool in pools:
                result = [x+[y] for x in result for y in pool]
@@ -611,13 +611,14 @@
 
    def ncycles(iterable, n):
        "Returns the sequence elements n times"
-       return chain.from_iterable(repeat(iterable, n))
+       return chain.from_iterable(repeat(tuple(iterable), n))
 
    def dotproduct(vec1, vec2):
        return sum(map(operator.mul, vec1, vec2))
 
    def flatten(listOfLists):
-       return list(chain.from_iterable(listOfLists))
+       "Flatten one level of nesting"
+       return chain.from_iterable(listOfLists)
 
    def repeatfunc(func, times=None, *args):
        """Repeat calls to func with specified arguments.
@@ -703,6 +704,27 @@
        except exception:
            pass
 
+   def random_product(*args, repeat=1):
+       "Random selection from itertools.product(*args, **kwds)"
+       pools = [tuple(pool) for pool in args] * repeat
+       return tuple(random.choice(pool) for pool in pools)
+
+   def random_permuation(iterable, r=None):
+       "Random selection from itertools.permutations(iterable, r)"
+       pool = tuple(iterable)
+       r = len(pool) if r is None else r
+       return tuple(random.sample(pool, r))
+
+   def random_combination(iterable, r):
+       "Random selection from itertools.combinations(iterable, r)"
+       pool = tuple(iterable)
+       return tuple(sorted(random.sample(pool, r), key=pool.index))
+
+   def random_combination_with_replacement(iterable, r):
+       "Random selection from itertools.combinations_with_replacement(iterable, r)"
+       pool = tuple(iterable)
+       return tuple(sorted(map(random.choice, repeat(pool, r)), key=pool.index))
+
 Note, many of the above recipes can be optimized by replacing global lookups
 with local variables defined as default values.  For example, the
 *dotproduct* recipe can be written as::

Modified: python/branches/py3k-jit/Doc/library/ssl.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/ssl.rst	(original)
+++ python/branches/py3k-jit/Doc/library/ssl.rst	Tue Apr  6 03:07:34 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-jit/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/stdtypes.rst	(original)
+++ python/branches/py3k-jit/Doc/library/stdtypes.rst	Tue Apr  6 03:07:34 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-jit/Doc/library/struct.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/struct.rst	(original)
+++ python/branches/py3k-jit/Doc/library/struct.rst	Tue Apr  6 03:07:34 2010
@@ -119,6 +119,15 @@
    the platform C compiler supports C :ctype:`long long`, or, on Windows,
    :ctype:`__int64`.  They are always available in standard modes.
 
+(4)
+   When attempting to pack a non-integer using any of the integer conversion
+   codes, if the non-integer has a :meth:`__index__` method then that method is
+   called to convert the argument to an integer before packing.
+
+   .. versionchanged:: 3.2
+      Use of the :meth:`__index__` method for non-integers is new in 3.2.
+
+
 A format character may be preceded by an integral repeat count.  For example,
 the format string ``'4h'`` means exactly the same as ``'hhhh'``.
 

Modified: python/branches/py3k-jit/Doc/library/zipfile.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/zipfile.rst	(original)
+++ python/branches/py3k-jit/Doc/library/zipfile.rst	Tue Apr  6 03:07:34 2010
@@ -168,7 +168,7 @@
 
       The file-like object is read-only and provides the following methods:
       :meth:`read`, :meth:`readline`, :meth:`readlines`, :meth:`__iter__`,
-      :meth:`next`.
+      :meth:`__next__`.
 
    .. note::
 

Modified: python/branches/py3k-jit/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/py3k-jit/Doc/reference/datamodel.rst	(original)
+++ python/branches/py3k-jit/Doc/reference/datamodel.rst	Tue Apr  6 03:07:34 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-jit/Doc/using/cmdline.rst
==============================================================================
--- python/branches/py3k-jit/Doc/using/cmdline.rst	(original)
+++ python/branches/py3k-jit/Doc/using/cmdline.rst	Tue Apr  6 03:07:34 2010
@@ -232,8 +232,9 @@
 
 .. cmdoption:: -u
 
-   Force stdin, stdout and stderr to be totally unbuffered.  On systems where it
-   matters, also put stdin, stdout and stderr in binary mode.
+   Force the binary layer of the stdin, stdout and stderr streams (which is
+   available as their ``buffer`` attribute) to be unbuffered.  The text I/O
+   layer will still be line-buffered.
 
    See also :envvar:`PYTHONUNBUFFERED`.
 

Modified: python/branches/py3k-jit/Doc/using/mac.rst
==============================================================================
--- python/branches/py3k-jit/Doc/using/mac.rst	(original)
+++ python/branches/py3k-jit/Doc/using/mac.rst	Tue Apr  6 03:07:34 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-jit/Doc/whatsnew/2.1.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.1.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.1.rst	Tue Apr  6 03:07:34 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-jit/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.6.rst	Tue Apr  6 03:07:34 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-jit/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.7.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.7.rst	Tue Apr  6 03:07:34 2010
@@ -836,7 +836,7 @@
 
   The :mod:`site` module now reports exceptions occurring
   when the :mod:`sitecustomize` module is imported, and will no longer
-  catch and swallow the :exc:`KeyboardError` exception.  (Fixed by
+  catch and swallow the :exc:`KeyboardInterrupt` exception.  (Fixed by
   Victor Stinner; :issue:`3137`.)
 
 * The :mod:`socket` module's :class:`SSL` objects now support the
@@ -848,7 +848,7 @@
   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
+  The :meth:`recv_into` and :meth:`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`.)

Modified: python/branches/py3k-jit/Lib/collections.py
==============================================================================
--- python/branches/py3k-jit/Lib/collections.py	(original)
+++ python/branches/py3k-jit/Lib/collections.py	Tue Apr  6 03:07:34 2010
@@ -233,6 +233,7 @@
         __slots__ = () \n
         _fields = %(field_names)r \n
         def __new__(_cls, %(argtxt)s):
+            'Create new instance of %(typename)s(%(argtxt)s)'
             return _tuple.__new__(_cls, (%(argtxt)s)) \n
         @classmethod
         def _make(cls, iterable, new=tuple.__new__, len=len):
@@ -242,6 +243,7 @@
                 raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))
             return result \n
         def __repr__(self):
+            'Return a nicely formatted representation string'
             return '%(typename)s(%(reprtxt)s)' %% self \n
         def _asdict(self):
             'Return a new OrderedDict which maps field names to their values'
@@ -253,9 +255,10 @@
                 raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
             return result \n
         def __getnewargs__(self):
+            'Return self as a plain tuple.  Used by copy and pickle.'
             return tuple(self) \n\n''' % locals()
     for i, name in enumerate(field_names):
-        template += '        %s = _property(_itemgetter(%d))\n' % (name, i)
+        template += "        %s = _property(_itemgetter(%d), doc='Alias for field number %d')\n" % (name, i, i)
     if verbose:
         print(template)
 
@@ -433,6 +436,34 @@
         if kwds:
             self.update(kwds)
 
+    def subtract(self, iterable=None, **kwds):
+        '''Like dict.update() but subtracts counts instead of replacing them.
+        Counts can be reduced below zero.  Both the inputs and outputs are
+        allowed to contain zero and negative counts.
+
+        Source can be an iterable, a dictionary, or another Counter instance.
+
+        >>> c = Counter('which')
+        >>> c.subtract('witch')             # subtract elements from another iterable
+        >>> c.subtract(Counter('watch'))    # subtract elements from another counter
+        >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch
+        0
+        >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch
+        -1
+
+        '''
+        if iterable is not None:
+            if isinstance(iterable, Mapping):
+                self_get = self.get
+                for elem, count in iterable.items():
+                    self[elem] = self_get(elem, 0) - count
+            else:
+                self_get = self.get
+                for elem in iterable:
+                    self[elem] = self_get(elem, 0) - 1
+        if kwds:
+            self.subtract(kwds)
+
     def copy(self):
         'Like dict.copy() but returns a Counter instance instead of a dict.'
         return Counter(self)

Modified: python/branches/py3k-jit/Lib/decimal.py
==============================================================================
--- python/branches/py3k-jit/Lib/decimal.py	(original)
+++ python/branches/py3k-jit/Lib/decimal.py	Tue Apr  6 03:07:34 2010
@@ -648,8 +648,12 @@
             return self
 
         if isinstance(value, float):
-            raise TypeError("Cannot convert float in Decimal constructor. "
-                            "Use from_float class method.")
+            value = Decimal.from_float(value)
+            self._exp  = value._exp
+            self._sign = value._sign
+            self._int  = value._int
+            self._is_special  = value._is_special
+            return self
 
         raise TypeError("Cannot convert %r to Decimal" % value)
 
@@ -845,8 +849,11 @@
     # subject of what should happen for a comparison involving a NaN.
     # We take the following approach:
     #
-    #   == comparisons involving a NaN always return False
-    #   != comparisons involving a NaN always return True
+    #   == comparisons involving a quiet NaN always return False
+    #   != comparisons involving a quiet NaN always return True
+    #   == or != comparisons involving a signaling NaN signal
+    #      InvalidOperation, and return False or True as above if the
+    #      InvalidOperation is not trapped.
     #   <, >, <= and >= comparisons involving a (quiet or signaling)
     #      NaN signal InvalidOperation, and return False if the
     #      InvalidOperation is not trapped.
@@ -854,25 +861,25 @@
     # This behavior is designed to conform as closely as possible to
     # that specified by IEEE 754.
 
-    def __eq__(self, other):
-        other = _convert_other(other)
+    def __eq__(self, other, context=None):
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
-        if self.is_nan() or other.is_nan():
+        if self._check_nans(other, context):
             return False
         return self._cmp(other) == 0
 
-    def __ne__(self, other):
-        other = _convert_other(other)
+    def __ne__(self, other, context=None):
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
-        if self.is_nan() or other.is_nan():
+        if self._check_nans(other, context):
             return True
         return self._cmp(other) != 0
 
 
     def __lt__(self, other, context=None):
-        other = _convert_other(other)
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -881,7 +888,7 @@
         return self._cmp(other) < 0
 
     def __le__(self, other, context=None):
-        other = _convert_other(other)
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -890,7 +897,7 @@
         return self._cmp(other) <= 0
 
     def __gt__(self, other, context=None):
-        other = _convert_other(other)
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -899,7 +906,7 @@
         return self._cmp(other) > 0
 
     def __ge__(self, other, context=None):
-        other = _convert_other(other)
+        other = _convert_other(other, allow_float=True)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -933,12 +940,34 @@
         # The hash of a nonspecial noninteger Decimal must depend only
         # on the value of that Decimal, and not on its representation.
         # For example: hash(Decimal('100E-1')) == hash(Decimal('10')).
+
+        # Equality comparisons involving signaling nans can raise an
+        # exception; since equality checks are implicitly and
+        # unpredictably used when checking set and dict membership, we
+        # prevent signaling nans from being used as set elements or
+        # dict keys by making __hash__ raise an exception.
         if self._is_special:
-            if self._isnan():
-                raise TypeError('Cannot hash a NaN value.')
-            return hash(str(self))
-        if not self:
-            return 0
+            if self.is_snan():
+                raise TypeError('Cannot hash a signaling NaN value.')
+            elif self.is_nan():
+                # 0 to match hash(float('nan'))
+                return 0
+            else:
+                # values chosen to match hash(float('inf')) and
+                # hash(float('-inf')).
+                if self._sign:
+                    return -271828
+                else:
+                    return 314159
+
+        # In Python 2.7, we're allowing comparisons (but not
+        # arithmetic operations) between floats and Decimals;  so if
+        # a Decimal instance is exactly representable as a float then
+        # its hash should match that of the float.
+        self_as_float = float(self)
+        if Decimal.from_float(self_as_float) == self:
+            return hash(self_as_float)
+
         if self._isinteger():
             op = _WorkRep(self.to_integral_value())
             # to make computation feasible for Decimals with large
@@ -5776,15 +5805,21 @@
 
 ##### Helper Functions ####################################################
 
-def _convert_other(other, raiseit=False):
+def _convert_other(other, raiseit=False, allow_float=False):
     """Convert other to Decimal.
 
     Verifies that it's ok to use in an implicit construction.
+    If allow_float is true, allow conversion from float;  this
+    is used in the comparison methods (__eq__ and friends).
+
     """
     if isinstance(other, Decimal):
         return other
     if isinstance(other, int):
         return Decimal(other)
+    if allow_float and isinstance(other, float):
+        return Decimal.from_float(other)
+
     if raiseit:
         raise TypeError("Unable to convert %s to Decimal" % other)
     return NotImplemented

Modified: python/branches/py3k-jit/Lib/dis.py
==============================================================================
--- python/branches/py3k-jit/Lib/dis.py	(original)
+++ python/branches/py3k-jit/Lib/dis.py	Tue Apr  6 03:07:34 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-jit/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/branches/py3k-jit/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/branches/py3k-jit/Lib/distutils/tests/test_build_ext.py	Tue Apr  6 03:07:34 2010
@@ -25,19 +25,23 @@
 
 def _get_source_filename():
     srcdir = sysconfig.get_config_var('srcdir')
+    if srcdir is None:
+        return os.path.join(sysconfig.project_base, 'Modules', 'xxmodule.c')
     return os.path.join(srcdir, 'Modules', 'xxmodule.c')
 
-class BuildExtTestCase(TempdirManager,
-                       LoggingSilencer,
-                       unittest.TestCase):
+_XX_MODULE_PATH = _get_source_filename()
+
+class BuildExtTestCase(TempdirManager, LoggingSilencer, unittest.TestCase):
+
     def setUp(self):
         # Create a simple test environment
         # Note that we're making changes to sys.path
         super(BuildExtTestCase, self).setUp()
         self.tmp_dir = self.mkdtemp()
-        self.sys_path = sys.path, sys.path[:]
-        sys.path.append(self.tmp_dir)
-        shutil.copy(_get_source_filename(), self.tmp_dir)
+        if os.path.exists(_XX_MODULE_PATH):
+            self.sys_path = sys.path[:]
+            sys.path.append(self.tmp_dir)
+            shutil.copy(_XX_MODULE_PATH, self.tmp_dir)
         if sys.version > "2.6":
             import site
             self.old_user_base = site.USER_BASE
@@ -45,6 +49,19 @@
             from distutils.command import build_ext
             build_ext.USER_BASE = site.USER_BASE
 
+    def tearDown(self):
+        # Get everything back to normal
+        if os.path.exists(_XX_MODULE_PATH):
+            support.unload('xx')
+            sys.path[:] = self.sys_path
+            # XXX on Windows the test leaves a directory
+            # with xx module in TEMP
+        shutil.rmtree(self.tmp_dir, os.name == 'nt' or
+                                    sys.platform == 'cygwin')
+        super(BuildExtTestCase, self).tearDown()
+
+    @unittest.skipIf(not os.path.exists(_XX_MODULE_PATH),
+                     'xxmodule.c not found')
     def test_build_ext(self):
         global ALREADY_TESTED
         xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
@@ -87,18 +104,6 @@
         self.assertTrue(isinstance(xx.Null(), xx.Null))
         self.assertTrue(isinstance(xx.Str(), xx.Str))
 
-    def tearDown(self):
-        # Get everything back to normal
-        support.unload('xx')
-        sys.path = self.sys_path[0]
-        sys.path[:] = self.sys_path[1]
-        if sys.version > "2.6":
-            import site
-            site.USER_BASE = self.old_user_base
-            from distutils.command import build_ext
-            build_ext.USER_BASE = self.old_user_base
-        super(BuildExtTestCase, self).tearDown()
-
     def test_solaris_enable_shared(self):
         dist = Distribution({'name': 'xx'})
         cmd = build_ext(dist)

Modified: python/branches/py3k-jit/Lib/fractions.py
==============================================================================
--- python/branches/py3k-jit/Lib/fractions.py	(original)
+++ python/branches/py3k-jit/Lib/fractions.py	Tue Apr  6 03:07:34 2010
@@ -3,6 +3,7 @@
 
 """Fraction, infinite-precision, real numbers."""
 
+from decimal import Decimal
 import math
 import numbers
 import operator
@@ -41,13 +42,21 @@
 class Fraction(numbers.Rational):
     """This class implements rational numbers.
 
-    Fraction(8, 6) will produce a rational number equivalent to
-    4/3. Both arguments must be Integral. The numerator defaults to 0
-    and the denominator defaults to 1 so that Fraction(3) == 3 and
-    Fraction() == 0.
+    In the two-argument form of the constructor, Fraction(8, 6) will
+    produce a rational number equivalent to 4/3. Both arguments must
+    be Rational. The numerator defaults to 0 and the denominator
+    defaults to 1 so that Fraction(3) == 3 and Fraction() == 0.
 
-    Fraction can also be constructed from strings of the form
-    '[-+]?[0-9]+((/|.)[0-9]+)?', optionally surrounded by spaces.
+    Fractions can also be constructed from:
+
+      - numeric strings similar to those accepted by the
+        float constructor (for example, '-2.3' or '1e10')
+
+      - strings of the form '123/456'
+
+      - float and Decimal instances
+
+      - other Rational instances (including integers)
 
     """
 
@@ -57,8 +66,32 @@
     def __new__(cls, numerator=0, denominator=None):
         """Constructs a Rational.
 
-        Takes a string like '3/2' or '1.5', another Rational, or a
-        numerator/denominator pair.
+        Takes a string like '3/2' or '1.5', another Rational instance, a
+        numerator/denominator pair, or a float.
+
+        Examples
+        --------
+
+        >>> Fraction(10, -8)
+        Fraction(-5, 4)
+        >>> Fraction(Fraction(1, 7), 5)
+        Fraction(1, 35)
+        >>> Fraction(Fraction(1, 7), Fraction(2, 3))
+        Fraction(3, 14)
+        >>> Fraction('314')
+        Fraction(314, 1)
+        >>> Fraction('-35/4')
+        Fraction(-35, 4)
+        >>> Fraction('3.1415') # conversion from numeric string
+        Fraction(6283, 2000)
+        >>> Fraction('-47e-2') # string may include a decimal exponent
+        Fraction(-47, 100)
+        >>> Fraction(1.47)  # direct construction from float (exact conversion)
+        Fraction(6620291452234629, 4503599627370496)
+        >>> Fraction(2.25)
+        Fraction(9, 4)
+        >>> Fraction(Decimal('1.47'))
+        Fraction(147, 100)
 
         """
         self = super(Fraction, cls).__new__(cls)
@@ -69,6 +102,19 @@
                 self._denominator = numerator.denominator
                 return self
 
+            elif isinstance(numerator, float):
+                # Exact conversion from float
+                value = Fraction.from_float(numerator)
+                self._numerator = value._numerator
+                self._denominator = value._denominator
+                return self
+
+            elif isinstance(numerator, Decimal):
+                value = Fraction.from_decimal(numerator)
+                self._numerator = value._numerator
+                self._denominator = value._denominator
+                return self
+
             elif isinstance(numerator, str):
                 # Handle construction from strings.
                 m = _RATIONAL_FORMAT.match(numerator)

Modified: python/branches/py3k-jit/Lib/functools.py
==============================================================================
--- python/branches/py3k-jit/Lib/functools.py	(original)
+++ python/branches/py3k-jit/Lib/functools.py	Tue Apr  6 03:07:34 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-jit/Lib/platform.py
==============================================================================
--- python/branches/py3k-jit/Lib/platform.py	(original)
+++ python/branches/py3k-jit/Lib/platform.py	Tue Apr  6 03:07:34 2010
@@ -942,7 +942,7 @@
     if sys.platform in ('dos','win32','win16','os2'):
         # XXX Others too ?
         return default
-    target = _follow_symlinks(target)
+    target = _follow_symlinks(target).replace('"', '\\"')
     try:
         f = os.popen('file "%s" 2> %s' % (target, DEV_NULL))
     except (AttributeError,os.error):

Modified: python/branches/py3k-jit/Lib/pstats.py
==============================================================================
--- python/branches/py3k-jit/Lib/pstats.py	(original)
+++ python/branches/py3k-jit/Lib/pstats.py	Tue Apr  6 03:07:34 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)
@@ -636,7 +628,7 @@
 
         def do_sort(self, line):
             abbrevs = self.stats.get_sort_arg_defs()
-            if line and not filter(lambda x,a=abbrevs: x not in a,line.split()):
+            if line and all((x in abbrevs) for x in line.split()):
                 self.stats.sort_stats(*line.split())
             else:
                 print("Valid sort keys (unique prefixes are accepted):", file=self.stream)

Modified: python/branches/py3k-jit/Lib/ssl.py
==============================================================================
--- python/branches/py3k-jit/Lib/ssl.py	(original)
+++ python/branches/py3k-jit/Lib/ssl.py	Tue Apr  6 03:07:34 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-jit/Lib/test/test___all__.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test___all__.py	(original)
+++ python/branches/py3k-jit/Lib/test/test___all__.py	Tue Apr  6 03:07:34 2010
@@ -2,7 +2,6 @@
 from test import support
 import os
 import sys
-import warnings
 
 
 class NoAll(RuntimeError):
@@ -16,9 +15,8 @@
 
     def check_all(self, modname):
         names = {}
-        with warnings.catch_warnings():
-            warnings.filterwarnings("ignore", ".* (module|package)",
-                                    DeprecationWarning)
+        with support.check_warnings((".* (module|package)",
+                                     DeprecationWarning), quiet=True):
             try:
                 exec("import %s" % modname, names)
             except:

Modified: python/branches/py3k-jit/Lib/test/test_argparse.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_argparse.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_argparse.py	Tue Apr  6 03:07:34 2010
@@ -7,7 +7,6 @@
 import textwrap
 import tempfile
 import unittest
-import warnings
 import argparse
 
 from io import StringIO
@@ -4150,21 +4149,12 @@
             self.assertTrue(hasattr(argparse, name))
 
 def test_main():
-    with warnings.catch_warnings():
-        # silence warnings about version argument - these are expected
-        warnings.filterwarnings(
-            action='ignore',
-            message='The "version" argument to ArgumentParser is deprecated.',
-            category=DeprecationWarning)
-        warnings.filterwarnings(
-            action='ignore',
-            message='The format_version method is deprecated',
-            category=DeprecationWarning)
-        warnings.filterwarnings(
-            action='ignore',
-            message='The print_version method is deprecated',
-            category=DeprecationWarning)
-
+    # silence warnings about version argument - these are expected
+    with support.check_warnings(
+            ('The "version" argument to ArgumentParser is deprecated.',
+             DeprecationWarning),
+            ('The (format|print)_version method is deprecated',
+             DeprecationWarning)):
         support.run_unittest(__name__)
     # Remove global references to avoid looking like we have refleaks.
     RFile.seen = {}

Modified: python/branches/py3k-jit/Lib/test/test_codecs.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_codecs.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_codecs.py	Tue Apr  6 03:07:34 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-jit/Lib/test/test_collections.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_collections.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_collections.py	Tue Apr  6 03:07:34 2010
@@ -661,6 +661,16 @@
                 set_result = setop(set(p.elements()), set(q.elements()))
                 self.assertEqual(counter_result, dict.fromkeys(set_result, 1))
 
+    def test_subtract(self):
+        c = Counter(a=-5, b=0, c=5, d=10, e=15,g=40)
+        c.subtract(a=1, b=2, c=-3, d=10, e=20, f=30, h=-50)
+        self.assertEqual(c, Counter(a=-6, b=-2, c=8, d=0, e=-5, f=-30, g=40, h=50))
+        c = Counter(a=-5, b=0, c=5, d=10, e=15,g=40)
+        c.subtract(Counter(a=1, b=2, c=-3, d=10, e=20, f=30, h=-50))
+        self.assertEqual(c, Counter(a=-6, b=-2, c=8, d=0, e=-5, f=-30, g=40, h=50))
+        c = Counter('aaabbcd')
+        c.subtract('aaaabbcce')
+        self.assertEqual(c, Counter(a=-1, b=0, c=-1, d=1, e=-1))
 
 class TestOrderedDict(unittest.TestCase):
 

Modified: python/branches/py3k-jit/Lib/test/test_complex.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_complex.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_complex.py	Tue Apr  6 03:07:34 2010
@@ -1,4 +1,4 @@
-import unittest, os
+import unittest
 from test import support
 
 from random import random
@@ -395,10 +395,7 @@
         finally:
             if (fo is not None) and (not fo.closed):
                 fo.close()
-            try:
-                os.remove(support.TESTFN)
-            except (OSError, IOError):
-                pass
+            support.unlink(support.TESTFN)
 
     def test_getnewargs(self):
         self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0))

Modified: python/branches/py3k-jit/Lib/test/test_contextlib.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_contextlib.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_contextlib.py	Tue Apr  6 03:07:34 2010
@@ -1,7 +1,5 @@
 """Unit tests for contextlib.py, and other context managers."""
 
-
-import os
 import sys
 import tempfile
 import unittest
@@ -9,6 +7,7 @@
 from contextlib import *  # Tests __all__
 from test import support
 
+
 class ContextManagerTestCase(unittest.TestCase):
 
     def test_contextmanager_plain(self):
@@ -33,16 +32,12 @@
                 yield 42
             finally:
                 state.append(999)
-        try:
+        with self.assertRaises(ZeroDivisionError):
             with woohoo() as x:
                 self.assertEqual(state, [1])
                 self.assertEqual(x, 42)
                 state.append(x)
                 raise ZeroDivisionError()
-        except ZeroDivisionError:
-            pass
-        else:
-            self.fail("Expected ZeroDivisionError")
         self.assertEqual(state, [1, 42, 999])
 
     def test_contextmanager_no_reraise(self):
@@ -130,14 +125,11 @@
                 state.append(1)
         x = C()
         self.assertEqual(state, [])
-        try:
+        with self.assertRaises(ZeroDivisionError):
             with closing(x) as y:
                 self.assertEqual(x, y)
-                1/0
-        except ZeroDivisionError:
-            self.assertEqual(state, [1])
-        else:
-            self.fail("Didn't raise ZeroDivisionError")
+                1 / 0
+        self.assertEqual(state, [1])
 
 class FileContextTestCase(unittest.TestCase):
 
@@ -150,20 +142,14 @@
                 f.write("Booh\n")
             self.assertTrue(f.closed)
             f = None
-            try:
+            with self.assertRaises(ZeroDivisionError):
                 with open(tfn, "r") as f:
                     self.assertFalse(f.closed)
                     self.assertEqual(f.read(), "Booh\n")
-                    1/0
-            except ZeroDivisionError:
-                self.assertTrue(f.closed)
-            else:
-                self.fail("Didn't raise ZeroDivisionError")
+                    1 / 0
+            self.assertTrue(f.closed)
         finally:
-            try:
-                os.remove(tfn)
-            except os.error:
-                pass
+            support.unlink(tfn)
 
 class LockContextTestCase(unittest.TestCase):
 
@@ -172,14 +158,11 @@
         with lock:
             self.assertTrue(locked())
         self.assertFalse(locked())
-        try:
+        with self.assertRaises(ZeroDivisionError):
             with lock:
                 self.assertTrue(locked())
-                1/0
-        except ZeroDivisionError:
-            self.assertFalse(locked())
-        else:
-            self.fail("Didn't raise ZeroDivisionError")
+                1 / 0
+        self.assertFalse(locked())
 
     def testWithLock(self):
         lock = threading.Lock()

Modified: python/branches/py3k-jit/Lib/test/test_decimal.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_decimal.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_decimal.py	Tue Apr  6 03:07:34 2010
@@ -26,6 +26,7 @@
 
 import math
 import os, sys
+import operator
 import pickle, copy
 import unittest
 from decimal import *
@@ -52,6 +53,11 @@
         )
     setcontext(DefaultTestContext)
 
+# decorator for skipping tests on non-IEEE 754 platforms
+requires_IEEE_754 = unittest.skipUnless(
+    float.__getformat__("double").startswith("IEEE"),
+    "test requires IEEE 754 doubles")
+
 TESTDATADIR = 'decimaltestdata'
 if __name__ == '__main__':
     file = sys.argv[0]
@@ -504,6 +510,27 @@
         self.assertEqual(str(e), '0')
         self.assertNotEqual(id(d), id(e))
 
+    @requires_IEEE_754
+    def test_explicit_from_float(self):
+        r = Decimal(0.1)
+        self.assertEqual(type(r), Decimal)
+        self.assertEqual(str(r),
+                '0.1000000000000000055511151231257827021181583404541015625')
+        self.assertTrue(Decimal(float('nan')).is_qnan())
+        self.assertTrue(Decimal(float('inf')).is_infinite())
+        self.assertTrue(Decimal(float('-inf')).is_infinite())
+        self.assertEqual(str(Decimal(float('nan'))),
+                         str(Decimal('NaN')))
+        self.assertEqual(str(Decimal(float('inf'))),
+                         str(Decimal('Infinity')))
+        self.assertEqual(str(Decimal(float('-inf'))),
+                         str(Decimal('-Infinity')))
+        self.assertEqual(str(Decimal(float('-0.0'))),
+                         str(Decimal('-0')))
+        for i in range(200):
+            x = random.expovariate(0.01) * (random.random() * 2.0 - 1.0)
+            self.assertEqual(x, float(Decimal(x))) # roundtrip
+
     def test_explicit_context_create_decimal(self):
 
         nc = copy.copy(getcontext())
@@ -1070,18 +1097,56 @@
         self.assertEqual(abs(Decimal(45)), abs(Decimal(-45)))  # abs
 
     def test_nan_comparisons(self):
+        # comparisons involving signaling nans signal InvalidOperation
+
+        # order comparisons (<, <=, >, >=) involving only quiet nans
+        # also signal InvalidOperation
+
+        # equality comparisons (==, !=) involving only quiet nans
+        # don't signal, but return False or True respectively.
+
         n = Decimal('NaN')
         s = Decimal('sNaN')
         i = Decimal('Inf')
         f = Decimal('2')
-        for x, y in [(n, n), (n, i), (i, n), (n, f), (f, n),
-                     (s, n), (n, s), (s, i), (i, s), (s, f), (f, s), (s, s)]:
-            self.assertTrue(x != y)
-            self.assertTrue(not (x == y))
-            self.assertTrue(not (x < y))
-            self.assertTrue(not (x <= y))
-            self.assertTrue(not (x > y))
-            self.assertTrue(not (x >= y))
+
+        qnan_pairs = (n, n), (n, i), (i, n), (n, f), (f, n)
+        snan_pairs = (s, n), (n, s), (s, i), (i, s), (s, f), (f, s), (s, s)
+        order_ops = operator.lt, operator.le, operator.gt, operator.ge
+        equality_ops = operator.eq, operator.ne
+
+        # results when InvalidOperation is not trapped
+        for x, y in qnan_pairs + snan_pairs:
+            for op in order_ops + equality_ops:
+                got = op(x, y)
+                expected = True if op is operator.ne else False
+                self.assertIs(expected, got,
+                              "expected {0!r} for operator.{1}({2!r}, {3!r}); "
+                              "got {4!r}".format(
+                        expected, op.__name__, x, y, got))
+
+        # repeat the above, but this time trap the InvalidOperation
+        with localcontext() as ctx:
+            ctx.traps[InvalidOperation] = 1
+
+            for x, y in qnan_pairs:
+                for op in equality_ops:
+                    got = op(x, y)
+                    expected = True if op is operator.ne else False
+                    self.assertIs(expected, got,
+                                  "expected {0!r} for "
+                                  "operator.{1}({2!r}, {3!r}); "
+                                  "got {4!r}".format(
+                            expected, op.__name__, x, y, got))
+
+            for x, y in snan_pairs:
+                for op in equality_ops:
+                    self.assertRaises(InvalidOperation, operator.eq, x, y)
+                    self.assertRaises(InvalidOperation, operator.ne, x, y)
+
+            for x, y in qnan_pairs + snan_pairs:
+                for op in order_ops:
+                    self.assertRaises(InvalidOperation, op, x, y)
 
     def test_copy_sign(self):
         d = Decimal(1).copy_sign(Decimal(-2))
@@ -1160,18 +1225,18 @@
         dc = Decimal('45')
 
         #two Decimals
-        self.assertTrue(dc > da)
-        self.assertTrue(dc >= da)
-        self.assertTrue(da < dc)
-        self.assertTrue(da <= dc)
+        self.assertGreater(dc, da)
+        self.assertGreaterEqual(dc, da)
+        self.assertLess(da, dc)
+        self.assertLessEqual(da, dc)
         self.assertEqual(da, db)
-        self.assertTrue(da != dc)
-        self.assertTrue(da <= db)
-        self.assertTrue(da >= db)
+        self.assertNotEqual(da, dc)
+        self.assertLessEqual(da, db)
+        self.assertGreaterEqual(da, db)
 
         #a Decimal and an int
-        self.assertTrue(dc > 23)
-        self.assertTrue(23 < dc)
+        self.assertGreater(dc, 23)
+        self.assertLess(23, dc)
         self.assertEqual(dc, 45)
 
         #a Decimal and uncomparable
@@ -1187,6 +1252,23 @@
         a.sort()
         self.assertEqual(a, b)
 
+    def test_decimal_float_comparison(self):
+        da = Decimal('0.25')
+        db = Decimal('3.0')
+        self.assertLess(da, 3.0)
+        self.assertLessEqual(da, 3.0)
+        self.assertGreater(db, 0.25)
+        self.assertGreaterEqual(db, 0.25)
+        self.assertNotEqual(da, 1.5)
+        self.assertEqual(da, 0.25)
+        self.assertGreater(3.0, da)
+        self.assertGreaterEqual(3.0, da)
+        self.assertLess(0.25, db)
+        self.assertLessEqual(0.25, db)
+        self.assertNotEqual(0.25, db)
+        self.assertEqual(3.0, db)
+        self.assertNotEqual(0.1, Decimal('0.1'))
+
     def test_copy_and_deepcopy_methods(self):
         d = Decimal('43.24')
         c = copy.copy(d)
@@ -1197,6 +1279,10 @@
     def test_hash_method(self):
         #just that it's hashable
         hash(Decimal(23))
+        hash(Decimal('Infinity'))
+        hash(Decimal('-Infinity'))
+        hash(Decimal('nan123'))
+        hash(Decimal('-NaN'))
 
         test_values = [Decimal(sign*(2**m + n))
                        for m in [0, 14, 15, 16, 17, 30, 31,
@@ -1231,10 +1317,19 @@
 
         #the same hash that to an int
         self.assertEqual(hash(Decimal(23)), hash(23))
-        self.assertRaises(TypeError, hash, Decimal('NaN'))
+        self.assertRaises(TypeError, hash, Decimal('sNaN'))
         self.assertTrue(hash(Decimal('Inf')))
         self.assertTrue(hash(Decimal('-Inf')))
 
+        # check that the hashes of a Decimal float match when they
+        # represent exactly the same values
+        test_strings = ['inf', '-Inf', '0.0', '-.0e1',
+                        '34.0', '2.5', '112390.625', '-0.515625']
+        for s in test_strings:
+            f = float(s)
+            d = Decimal(s)
+            self.assertEqual(hash(f), hash(d))
+
         # check that the value of the hash doesn't depend on the
         # current context (issue #1757)
         c = getcontext()
@@ -1260,16 +1355,16 @@
         l2 = 28
 
         #between Decimals
-        self.assertTrue(min(d1,d2) is d1)
-        self.assertTrue(min(d2,d1) is d1)
-        self.assertTrue(max(d1,d2) is d2)
-        self.assertTrue(max(d2,d1) is d2)
+        self.assertIs(min(d1,d2), d1)
+        self.assertIs(min(d2,d1), d1)
+        self.assertIs(max(d1,d2), d2)
+        self.assertIs(max(d2,d1), d2)
 
         #between Decimal and long
-        self.assertTrue(min(d1,l2) is d1)
-        self.assertTrue(min(l2,d1) is d1)
-        self.assertTrue(max(l1,d2) is d2)
-        self.assertTrue(max(d2,l1) is d2)
+        self.assertIs(min(d1,l2), d1)
+        self.assertIs(min(l2,d1), d1)
+        self.assertIs(max(l1,d2), d2)
+        self.assertIs(max(d2,l1), d2)
 
     def test_as_nonzero(self):
         #as false
@@ -1526,10 +1621,10 @@
         d1 = MyDecimal(1)
         d2 = MyDecimal(2)
         d = d1 + d2
-        self.assertTrue(type(d) is Decimal)
+        self.assertIs(type(d), Decimal)
 
         d = d1.max(d2)
-        self.assertTrue(type(d) is Decimal)
+        self.assertIs(type(d), Decimal)
 
     def test_implicit_context(self):
         # Check results when context given implicitly.  (Issue 2478)
@@ -1589,7 +1684,7 @@
 
     def test_abc(self):
         self.assertTrue(issubclass(Decimal, numbers.Number))
-        self.assertTrue(not issubclass(Decimal, numbers.Real))
+        self.assertFalse(issubclass(Decimal, numbers.Real))
         self.assertIsInstance(Decimal(0), numbers.Number)
         self.assertNotIsInstance(Decimal(0), numbers.Real)
 
@@ -2137,9 +2232,9 @@
         with localcontext() as enter_ctx:
             set_ctx = getcontext()
         final_ctx = getcontext()
-        self.assertTrue(orig_ctx is final_ctx, 'did not restore context correctly')
-        self.assertTrue(orig_ctx is not set_ctx, 'did not copy the context')
-        self.assertTrue(set_ctx is enter_ctx, '__enter__ returned wrong context')
+        self.assertIs(orig_ctx, final_ctx, 'did not restore context correctly')
+        self.assertIsNot(orig_ctx, set_ctx, 'did not copy the context')
+        self.assertIs(set_ctx, enter_ctx, '__enter__ returned wrong context')
 
     def test_localcontextarg(self):
         # Use a copy of the supplied context in the block
@@ -2148,10 +2243,10 @@
         with localcontext(new_ctx) as enter_ctx:
             set_ctx = getcontext()
         final_ctx = getcontext()
-        self.assertTrue(orig_ctx is final_ctx, 'did not restore context correctly')
-        self.assertTrue(set_ctx.prec == new_ctx.prec, 'did not set correct context')
-        self.assertTrue(new_ctx is not set_ctx, 'did not copy the context')
-        self.assertTrue(set_ctx is enter_ctx, '__enter__ returned wrong context')
+        self.assertIs(orig_ctx, final_ctx, 'did not restore context correctly')
+        self.assertEqual(set_ctx.prec, new_ctx.prec, 'did not set correct context')
+        self.assertIsNot(new_ctx, set_ctx, 'did not copy the context')
+        self.assertIs(set_ctx, enter_ctx, '__enter__ returned wrong context')
 
 class ContextFlags(unittest.TestCase):
     def test_flags_irrelevant(self):

Modified: python/branches/py3k-jit/Lib/test/test_deque.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_deque.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_deque.py	Tue Apr  6 03:07:34 2010
@@ -114,6 +114,30 @@
             d = deque('abc')
             d.maxlen = 10
 
+    def test_count(self):
+        for s in ('', 'abracadabra', 'simsalabim'*500+'abc'):
+            s = list(s)
+            d = deque(s)
+            for letter in 'abcdefghijklmnopqrstuvwxyz':
+                self.assertEqual(s.count(letter), d.count(letter), (s, d, letter))
+        self.assertRaises(TypeError, d.count)       # too few args
+        self.assertRaises(TypeError, d.count, 1, 2) # too many args
+        class BadCompare:
+            def __eq__(self, other):
+                raise ArithmeticError
+        d = deque([1, 2, BadCompare(), 3])
+        self.assertRaises(ArithmeticError, d.count, 2)
+        d = deque([1, 2, 3])
+        self.assertRaises(ArithmeticError, d.count, BadCompare())
+        class MutatingCompare:
+            def __eq__(self, other):
+                self.d.pop()
+                return True
+        m = MutatingCompare()
+        d = deque([1, 2, 3, m, 4, 5])
+        m.d = d
+        self.assertRaises(RuntimeError, d.count, 3)
+
     def test_comparisons(self):
         d = deque('xabc'); d.popleft()
         for e in [d, deque('abc'), deque('ab'), deque(), list(d)]:

Modified: python/branches/py3k-jit/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_descr.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_descr.py	Tue Apr  6 03:07:34 2010
@@ -2,7 +2,6 @@
 import sys
 import types
 import unittest
-import warnings
 
 from copy import deepcopy
 from test import support

Modified: python/branches/py3k-jit/Lib/test/test_doctest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_doctest.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_doctest.py	Tue Apr  6 03:07:34 2010
@@ -4,7 +4,7 @@
 
 from test import support
 import doctest
-import warnings
+
 
 # NOTE: There are some additional tests relating to interaction with
 #       zipimport in the test_zipimport_support test module.

Modified: python/branches/py3k-jit/Lib/test/test_float.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_float.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_float.py	Tue Apr  6 03:07:34 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-jit/Lib/test/test_fractions.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_fractions.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_fractions.py	Tue Apr  6 03:07:34 2010
@@ -12,6 +12,11 @@
 F = fractions.Fraction
 gcd = fractions.gcd
 
+# decorator for skipping tests on non-IEEE 754 platforms
+requires_IEEE_754 = unittest.skipUnless(
+    float.__getformat__("double").startswith("IEEE"),
+    "test requires IEEE 754 doubles")
+
 class DummyFloat(object):
     """Dummy float class for testing comparisons with Fractions"""
 
@@ -130,13 +135,33 @@
 
         self.assertRaisesMessage(ZeroDivisionError, "Fraction(12, 0)",
                                  F, 12, 0)
-        self.assertRaises(TypeError, F, 1.5)
         self.assertRaises(TypeError, F, 1.5 + 3j)
 
         self.assertRaises(TypeError, F, "3/2", 3)
         self.assertRaises(TypeError, F, 3, 0j)
         self.assertRaises(TypeError, F, 3, 1j)
 
+    @requires_IEEE_754
+    def testInitFromFloat(self):
+        self.assertEquals((5, 2), _components(F(2.5)))
+        self.assertEquals((0, 1), _components(F(-0.0)))
+        self.assertEquals((3602879701896397, 36028797018963968),
+                          _components(F(0.1)))
+        self.assertRaises(TypeError, F, float('nan'))
+        self.assertRaises(TypeError, F, float('inf'))
+        self.assertRaises(TypeError, F, float('-inf'))
+
+    def testInitFromDecimal(self):
+        self.assertEquals((11, 10),
+                          _components(F(Decimal('1.1'))))
+        self.assertEquals((7, 200),
+                          _components(F(Decimal('3.5e-2'))))
+        self.assertEquals((0, 1),
+                          _components(F(Decimal('.000e20'))))
+        self.assertRaises(TypeError, F, Decimal('nan'))
+        self.assertRaises(TypeError, F, Decimal('snan'))
+        self.assertRaises(TypeError, F, Decimal('inf'))
+        self.assertRaises(TypeError, F, Decimal('-inf'))
 
     def testFromString(self):
         self.assertEquals((5, 1), _components(F("5")))

Modified: python/branches/py3k-jit/Lib/test/test_functools.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_functools.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_functools.py	Tue Apr  6 03:07:34 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-jit/Lib/test/test_global.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_global.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_global.py	Tue Apr  6 03:07:34 2010
@@ -2,7 +2,6 @@
 
 from test.support import run_unittest, check_syntax_error, check_warnings
 import unittest
-
 import warnings
 
 
@@ -54,7 +53,9 @@
 
 
 def test_main():
-    run_unittest(GlobalTests)
+    with warnings.catch_warnings():
+        warnings.filterwarnings("error", module="<test string>")
+        run_unittest(GlobalTests)
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-jit/Lib/test/test_hmac.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_hmac.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_hmac.py	Tue Apr  6 03:07:34 2010
@@ -213,19 +213,13 @@
 
         with warnings.catch_warnings():
             warnings.simplefilter('error', RuntimeWarning)
-            try:
+            with self.assertRaises(RuntimeWarning):
                 hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash)
-            except RuntimeWarning:
-                pass
-            else:
                 self.fail('Expected warning about missing block_size')
 
             MockCrazyHash.block_size = 1
-            try:
+            with self.assertRaises(RuntimeWarning):
                 hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash)
-            except RuntimeWarning:
-                pass
-            else:
                 self.fail('Expected warning about small block_size')
 
 

Modified: python/branches/py3k-jit/Lib/test/test_io.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_io.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_io.py	Tue Apr  6 03:07:34 2010
@@ -26,7 +26,6 @@
 import threading
 import random
 import unittest
-import warnings
 import weakref
 import abc
 from itertools import cycle, count

Modified: python/branches/py3k-jit/Lib/test/test_robotparser.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_robotparser.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_robotparser.py	Tue Apr  6 03:07:34 2010
@@ -1,6 +1,7 @@
 import io
 import unittest
 import urllib.robotparser
+from urllib.error import URLError
 from test import support
 
 class RobotTestCase(unittest.TestCase):
@@ -208,18 +209,19 @@
 class NetworkTestCase(unittest.TestCase):
 
     def testPasswordProtectedSite(self):
-        if not support.is_resource_enabled('network'):
-            return
-        # whole site is password-protected.
+        support.requires('network')
+        # XXX it depends on an external resource which could be unavailable
         url = 'http://mueblesmoraleda.com'
         parser = urllib.robotparser.RobotFileParser()
         parser.set_url(url)
-        parser.read()
+        try:
+            parser.read()
+        except URLError:
+            self.skipTest('%s is unavailable' % url)
         self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False)
 
     def testPythonOrg(self):
-        if not support.is_resource_enabled('network'):
-            return
+        support.requires('network')
         parser = urllib.robotparser.RobotFileParser(
             "http://www.python.org/robots.txt")
         parser.read()

Modified: python/branches/py3k-jit/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_ssl.py	Tue Apr  6 03:07:34 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-jit/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_struct.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_struct.py	Tue Apr  6 03:07:34 2010
@@ -8,6 +8,18 @@
 ISBIGENDIAN = sys.byteorder == "big"
 IS32BIT = sys.maxsize == 0x7fffffff
 
+integer_codes = 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q'
+byteorders = '', '@', '=', '<', '>', '!'
+
+# Native 'q' packing isn't available on systems that don't have the C
+# long long type.
+try:
+    struct.pack('q', 5)
+except struct.error:
+    HAVE_LONG_LONG = False
+else:
+    HAVE_LONG_LONG = True
+
 def string_reverse(s):
     return s[::-1]
 
@@ -125,138 +137,89 @@
                 if rev != arg:
                     self.assertTrue(asy)
 
-    def test_native_qQ(self):
-        # can't pack -1 as unsigned regardless
-        self.assertRaises((struct.error, OverflowError), struct.pack, "Q", -1)
-        # can't pack string as 'q' regardless
-        self.assertRaises(struct.error, struct.pack, "q", "a")
-        # ditto, but 'Q'
-        self.assertRaises(struct.error, struct.pack, "Q", "a")
-
-        try:
-            struct.pack("q", 5)
-        except struct.error:
-            # does not have native q/Q
-            pass
-        else:
-            nbytes = struct.calcsize('q')
-            # The expected values here are in big-endian format, primarily
-            # because I'm on a little-endian machine and so this is the
-            # clearest way (for me) to force the code to get exercised.
-            for format, input, expected in (
-                    ('q', -1, '\xff' * nbytes),
-                    ('q', 0, '\x00' * nbytes),
-                    ('Q', 0, '\x00' * nbytes),
-                    ('q', 1, '\x00' * (nbytes-1) + '\x01'),
-                    ('Q', (1 << (8*nbytes))-1, '\xff' * nbytes),
-                    ('q', (1 << (8*nbytes-1))-1, '\x7f' + '\xff' * (nbytes - 1))):
-                expected = bytes(expected, "latin-1")
-                got = struct.pack(format, input)
-                native_expected = bigendian_to_native(expected)
-                self.assertEqual(got, native_expected)
-                retrieved = struct.unpack(format, got)[0]
-                self.assertEqual(retrieved, input)
+    def test_calcsize(self):
+        expected_size = {
+            'b': 1, 'B': 1,
+            'h': 2, 'H': 2,
+            'i': 4, 'I': 4,
+            'l': 4, 'L': 4,
+            'q': 8, 'Q': 8,
+            }
+
+        # standard integer sizes
+        for code in integer_codes:
+            for byteorder in '=', '<', '>', '!':
+                format = byteorder+code
+                size = struct.calcsize(format)
+                self.assertEqual(size, expected_size[code])
+
+        # native integer sizes
+        native_pairs = 'bB', 'hH', 'iI', 'lL'
+        if HAVE_LONG_LONG:
+            native_pairs += 'qQ',
+        for format_pair in native_pairs:
+            for byteorder in '', '@':
+                signed_size = struct.calcsize(byteorder + format_pair[0])
+                unsigned_size = struct.calcsize(byteorder + format_pair[1])
+                self.assertEqual(signed_size, unsigned_size)
+
+        # bounds for native integer sizes
+        self.assertEqual(struct.calcsize('b'), 1)
+        self.assertLessEqual(2, struct.calcsize('h'))
+        self.assertLessEqual(4, struct.calcsize('l'))
+        self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i'))
+        self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l'))
+        if HAVE_LONG_LONG:
+            self.assertLessEqual(8, struct.calcsize('q'))
+            self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q'))
 
-    def test_standard_integers(self):
-        # Standard integer tests (bBhHiIlLqQ).
+    def test_integers(self):
+        # Integer tests (bBhHiIlLqQ).
         import binascii
 
         class IntTester(unittest.TestCase):
-
-            def __init__(self, formatpair, bytesize):
+            def __init__(self, format):
                 super(IntTester, self).__init__(methodName='test_one')
-                self.assertEqual(len(formatpair), 2)
-                self.formatpair = formatpair
-                for direction in "<>!=":
-                    for code in formatpair:
-                        format = direction + code
-                        self.assertEqual(struct.calcsize(format), bytesize)
-                self.bytesize = bytesize
-                self.bitsize = bytesize * 8
-                self.signed_code, self.unsigned_code = formatpair
-                self.unsigned_min = 0
-                self.unsigned_max = 2**self.bitsize - 1
-                self.signed_min = -(2**(self.bitsize-1))
-                self.signed_max = 2**(self.bitsize-1) - 1
+                self.format = format
+                self.code = format[-1]
+                self.byteorder = format[:-1]
+                if not self.byteorder in byteorders:
+                    raise ValueError("unrecognized packing byteorder: %s" %
+                                     self.byteorder)
+                self.bytesize = struct.calcsize(format)
+                self.bitsize = self.bytesize * 8
+                if self.code in tuple('bhilq'):
+                    self.signed = True
+                    self.min_value = -(2**(self.bitsize-1))
+                    self.max_value = 2**(self.bitsize-1) - 1
+                elif self.code in tuple('BHILQ'):
+                    self.signed = False
+                    self.min_value = 0
+                    self.max_value = 2**self.bitsize - 1
+                else:
+                    raise ValueError("unrecognized format code: %s" %
+                                     self.code)
 
             def test_one(self, x, pack=struct.pack,
                                   unpack=struct.unpack,
                                   unhexlify=binascii.unhexlify):
-                # Try signed.
-                code = self.signed_code
-                if self.signed_min <= x <= self.signed_max:
-                    # Try big-endian.
-                    expected = x
-                    if x < 0:
-                        expected += 1 << self.bitsize
-                        self.assertTrue(expected > 0)
-                    expected = hex(expected)[2:] # chop "0x"
-                    if len(expected) & 1:
-                        expected = "0" + expected
-                    expected = unhexlify(expected)
-                    expected = b"\x00" * (self.bytesize - len(expected)) + expected
-
-                    # Pack work?
-                    format = ">" + code
-                    got = pack(format, x)
-                    self.assertEqual(got, expected)
 
-                    # Unpack work?
-                    retrieved = unpack(format, got)[0]
-                    self.assertEqual(x, retrieved)
-
-                    # Adding any byte should cause a "too big" error.
-                    self.assertRaises((struct.error, TypeError),
-                                      unpack, format, b'\x01' + got)
-
-                    # Try little-endian.
-                    format = "<" + code
-                    expected = string_reverse(expected)
-
-                    # Pack work?
-                    got = pack(format, x)
-                    self.assertEqual(got, expected)
-
-                    # Unpack work?
-                    retrieved = unpack(format, got)[0]
-                    self.assertEqual(x, retrieved)
-
-                    # Adding any byte should cause a "too big" error.
-                    self.assertRaises((struct.error, TypeError),
-                                      unpack, format, b'\x01' + got)
-
-                else:
-                    # x is out of range -- verify pack realizes that.
-                    self.assertRaises(struct.error, pack, ">" + code, x)
-                    self.assertRaises(struct.error, pack, "<" + code, x)
-
-                # Much the same for unsigned.
-                code = self.unsigned_code
-                if self.unsigned_min <= x <= self.unsigned_max:
-                    # Try big-endian.
-                    format = ">" + code
+                format = self.format
+                if self.min_value <= x <= self.max_value:
                     expected = x
-                    expected = hex(expected)[2:] # chop "0x"
+                    if self.signed and x < 0:
+                        expected += 1 << self.bitsize
+                    self.assertGreaterEqual(expected, 0)
+                    expected = '%x' % expected
                     if len(expected) & 1:
                         expected = "0" + expected
                     expected = unhexlify(expected)
-                    expected = b"\x00" * (self.bytesize - len(expected)) + expected
-
-                    # Pack work?
-                    got = pack(format, x)
-                    self.assertEqual(got, expected)
-
-                    # Unpack work?
-                    retrieved = unpack(format, got)[0]
-                    self.assertEqual(x, retrieved)
-
-                    # Adding any byte should cause a "too big" error.
-                    self.assertRaises((struct.error, TypeError),
-                                      unpack, format, b'\x01' + got)
-
-                    # Try little-endian.
-                    format = "<" + code
-                    expected = string_reverse(expected)
+                    expected = (b"\x00" * (self.bytesize - len(expected)) +
+                                expected)
+                    if (self.byteorder == '<' or
+                        self.byteorder in ('', '@', '=') and not ISBIGENDIAN):
+                        expected = string_reverse(expected)
+                    self.assertEqual(len(expected), self.bytesize)
 
                     # Pack work?
                     got = pack(format, x)
@@ -267,13 +230,11 @@
                     self.assertEqual(x, retrieved)
 
                     # Adding any byte should cause a "too big" error.
-                    self.assertRaises((struct.error, TypeError),
-                                      unpack, format, b'\x01' + got)
-
+                    self.assertRaises((struct.error, TypeError), unpack, format,
+                                                                 b'\x01' + got)
                 else:
                     # x is out of range -- verify pack realizes that.
-                    self.assertRaises(struct.error, pack, ">" + code, x)
-                    self.assertRaises(struct.error, pack, "<" + code, x)
+                    self.assertRaises(struct.error, pack, format, x)
 
             def run(self):
                 from random import randrange
@@ -290,34 +251,83 @@
                         val = (val << 8) | randrange(256)
                     values.append(val)
 
-                # Try all those, and their negations, and +-1 from them.  Note
-                # that this tests all power-of-2 boundaries in range, and a few out
-                # of range, plus +-(2**n +- 1).
+                # Values absorbed from other tests
+                values.extend([300, 700000, sys.maxsize*4])
+
+                # Try all those, and their negations, and +-1 from
+                # them.  Note that this tests all power-of-2
+                # boundaries in range, and a few out of range, plus
+                # +-(2**n +- 1).
                 for base in values:
                     for val in -base, base:
                         for incr in -1, 0, 1:
                             x = val + incr
-                            try:
-                                x = int(x)
-                            except OverflowError:
-                                pass
                             self.test_one(x)
 
                 # Some error cases.
-                for direction in "<>":
-                    for code in self.formatpair:
-                        for badobject in "a string", 3+42j, randrange, -1729.0:
-                            self.assertRaises(struct.error,
-                                              struct.pack, direction + code,
-                                              badobject)
-
-        for args in [("bB", 1),
-                     ("hH", 2),
-                     ("iI", 4),
-                     ("lL", 4),
-                     ("qQ", 8)]:
-            t = IntTester(*args)
-            t.run()
+                class NotAnInt:
+                    def __int__(self):
+                        return 42
+
+                # Objects with an '__index__' method should be allowed
+                # to pack as integers.  That is assuming the implemented
+                # '__index__' method returns and 'int' or 'long'.
+                class Indexable(object):
+                    def __init__(self, value):
+                        self._value = value
+
+                    def __index__(self):
+                        return self._value
+
+                # If the '__index__' method raises a type error, then
+                # '__int__' should be used with a deprecation warning.
+                class BadIndex(object):
+                    def __index__(self):
+                        raise TypeError
+
+                    def __int__(self):
+                        return 42
+
+                self.assertRaises((TypeError, struct.error),
+                                  struct.pack, self.format,
+                                  "a string")
+                self.assertRaises((TypeError, struct.error),
+                                  struct.pack, self.format,
+                                  randrange)
+                self.assertRaises((TypeError, struct.error),
+                                  struct.pack, self.format,
+                                  3+42j)
+                self.assertRaises((TypeError, struct.error),
+                                  struct.pack, self.format,
+                                  NotAnInt())
+                self.assertRaises((TypeError, struct.error),
+                                  struct.pack, self.format,
+                                  BadIndex())
+
+                # Check for legitimate values from '__index__'.
+                for obj in (Indexable(0), Indexable(10), Indexable(17),
+                            Indexable(42), Indexable(100), Indexable(127)):
+                    try:
+                        struct.pack(format, obj)
+                    except:
+                        self.fail("integer code pack failed on object "
+                                  "with '__index__' method")
+
+                # Check for bogus values from '__index__'.
+                for obj in (Indexable(b'a'), Indexable('b'), Indexable(None),
+                            Indexable({'a': 1}), Indexable([1, 2, 3])):
+                    self.assertRaises((TypeError, struct.error),
+                                      struct.pack, self.format,
+                                      obj)
+
+        for code in integer_codes:
+            for byteorder in byteorders:
+                if (byteorder in ('', '@') and code in ('q', 'Q') and
+                    not HAVE_LONG_LONG):
+                    continue
+                format = byteorder+code
+                t = IntTester(format)
+                t.run()
 
     def test_p_code(self):
         # Test p ("Pascal string") code.
@@ -371,33 +381,18 @@
         big = math.ldexp(big, 127 - 24)
         self.assertRaises(OverflowError, struct.pack, ">f", big)
 
-    def test_1229380(self):
-        # SF bug 1229380. No struct.pack exception for some out of
-        # range integers
-        for endian in ('', '>', '<'):
-            for fmt in ('B', 'H', 'I', 'L'):
-                self.assertRaises((struct.error, OverflowError), struct.pack,
-                                  endian + fmt, -1)
-
-            self.assertRaises((struct.error, OverflowError), struct.pack,
-                              endian + 'B', 300)
-            self.assertRaises((struct.error, OverflowError), struct.pack,
-                              endian + 'H', 70000)
-
-            self.assertRaises((struct.error, OverflowError), struct.pack,
-                              endian + 'I', sys.maxsize * 4)
-            self.assertRaises((struct.error, OverflowError), struct.pack,
-                              endian + 'L', sys.maxsize * 4)
-
     def test_1530559(self):
-        for endian in ('', '>', '<'):
-            for fmt in ('B', 'H', 'I', 'L', 'Q', 'b', 'h', 'i', 'l', 'q'):
-                self.assertRaises(struct.error, struct.pack, endian + fmt, 1.0)
-                self.assertRaises(struct.error, struct.pack, endian + fmt, 1.5)
+        for byteorder in '', '@', '=', '<', '>', '!':
+            for code in integer_codes:
+                if (byteorder in ('', '@') and code in ('q', 'Q') and
+                    not HAVE_LONG_LONG):
+                    continue
+                format = byteorder + code
+                self.assertRaises(struct.error, struct.pack, format, 1.0)
+                self.assertRaises(struct.error, struct.pack, format, 1.5)
         self.assertRaises(struct.error, struct.pack, 'P', 1.0)
         self.assertRaises(struct.error, struct.pack, 'P', 1.5)
 
-
     def test_unpack_from(self):
         test_string = b'abcd01234'
         fmt = '4s'

Modified: python/branches/py3k-jit/Lib/test/test_structmembers.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_structmembers.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_structmembers.py	Tue Apr  6 03:07:34 2010
@@ -1,4 +1,4 @@
-from _testcapi import test_structmembersType, \
+from _testcapi import _test_structmembersType, \
     CHAR_MAX, CHAR_MIN, UCHAR_MAX, \
     SHRT_MAX, SHRT_MIN, USHRT_MAX, \
     INT_MAX, INT_MIN, UINT_MAX, \
@@ -9,7 +9,7 @@
 import unittest
 from test import support
 
-ts=test_structmembersType(False,  # T_BOOL
+ts=_test_structmembersType(False,  # T_BOOL
                           1,      # T_BYTE
                           2,      # T_UBYTE
                           3,      # T_SHORT
@@ -20,17 +20,20 @@
                           8,      # T_ULONG
                           23,     # T_PYSSIZET
                           9.99999,# T_FLOAT
-                          10.1010101010 # T_DOUBLE
+                          10.1010101010, # T_DOUBLE
+                          "hi" # T_STRING_INPLACE
                           )
 
 class ReadWriteTests(unittest.TestCase):
-    def test_types(self):
+
+    def test_bool(self):
         ts.T_BOOL = True
         self.assertEquals(ts.T_BOOL, True)
         ts.T_BOOL = False
         self.assertEquals(ts.T_BOOL, False)
         self.assertRaises(TypeError, setattr, ts, 'T_BOOL', 1)
 
+    def test_byte(self):
         ts.T_BYTE = CHAR_MAX
         self.assertEquals(ts.T_BYTE, CHAR_MAX)
         ts.T_BYTE = CHAR_MIN
@@ -38,6 +41,7 @@
         ts.T_UBYTE = UCHAR_MAX
         self.assertEquals(ts.T_UBYTE, UCHAR_MAX)
 
+    def test_short(self):
         ts.T_SHORT = SHRT_MAX
         self.assertEquals(ts.T_SHORT, SHRT_MAX)
         ts.T_SHORT = SHRT_MIN
@@ -45,6 +49,7 @@
         ts.T_USHORT = USHRT_MAX
         self.assertEquals(ts.T_USHORT, USHRT_MAX)
 
+    def test_int(self):
         ts.T_INT = INT_MAX
         self.assertEquals(ts.T_INT, INT_MAX)
         ts.T_INT = INT_MIN
@@ -52,6 +57,7 @@
         ts.T_UINT = UINT_MAX
         self.assertEquals(ts.T_UINT, UINT_MAX)
 
+    def test_long(self):
         ts.T_LONG = LONG_MAX
         self.assertEquals(ts.T_LONG, LONG_MAX)
         ts.T_LONG = LONG_MIN
@@ -59,26 +65,27 @@
         ts.T_ULONG = ULONG_MAX
         self.assertEquals(ts.T_ULONG, ULONG_MAX)
 
+    def test_py_ssize_t(self):
         ts.T_PYSSIZET = PY_SSIZE_T_MAX
         self.assertEquals(ts.T_PYSSIZET, PY_SSIZE_T_MAX)
         ts.T_PYSSIZET = PY_SSIZE_T_MIN
         self.assertEquals(ts.T_PYSSIZET, PY_SSIZE_T_MIN)
 
-        ## T_LONGLONG and T_ULONGLONG may not be present on some platforms
-        if hasattr(ts, 'T_LONGLONG'):
-            ts.T_LONGLONG = LLONG_MAX
-            self.assertEquals(ts.T_LONGLONG, LLONG_MAX)
-            ts.T_LONGLONG = LLONG_MIN
-            self.assertEquals(ts.T_LONGLONG, LLONG_MIN)
-
-            ts.T_ULONGLONG = ULLONG_MAX
-            self.assertEquals(ts.T_ULONGLONG, ULLONG_MAX)
-
-            ## make sure these will accept a plain int as well as a long
-            ts.T_LONGLONG = 3
-            self.assertEquals(ts.T_LONGLONG, 3)
-            ts.T_ULONGLONG = 4
-            self.assertEquals(ts.T_ULONGLONG, 4)
+    @unittest.skipUnless(hasattr(ts, "T_LONGLONG"), "long long not present")
+    def test_longlong(self):
+        ts.T_LONGLONG = LLONG_MAX
+        self.assertEquals(ts.T_LONGLONG, LLONG_MAX)
+        ts.T_LONGLONG = LLONG_MIN
+        self.assertEquals(ts.T_LONGLONG, LLONG_MIN)
+
+        ts.T_ULONGLONG = ULLONG_MAX
+        self.assertEquals(ts.T_ULONGLONG, ULLONG_MAX)
+
+        ## make sure these will accept a plain int as well as a long
+        ts.T_LONGLONG = 3
+        self.assertEquals(ts.T_LONGLONG, 3)
+        ts.T_ULONGLONG = 4
+        self.assertEquals(ts.T_ULONGLONG, 4)
 
     def test_bad_assignments(self):
         # XXX testing of T_UINT and T_ULONG temporarily disabled;
@@ -91,7 +98,6 @@
             'T_LONG', 'T_ULONG',
             'T_PYSSIZET'
             ]
-
         if hasattr(ts, 'T_LONGLONG'):
             integer_attributes.extend(['T_LONGLONG', 'T_ULONGLONG'])
 
@@ -101,6 +107,11 @@
             for attr in integer_attributes:
                 self.assertRaises(TypeError, setattr, ts, attr, nonint)
 
+    def test_inplace_string(self):
+        self.assertEquals(ts.T_STRING_INPLACE, "hi")
+        self.assertRaises(TypeError, setattr, ts, "T_STRING_INPLACE", "s")
+        self.assertRaises(TypeError, delattr, ts, "T_STRING_INPLACE")
+
 
 class TestWarnings(unittest.TestCase):
 

Modified: python/branches/py3k-jit/Lib/test/test_sundry.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_sundry.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_sundry.py	Tue Apr  6 03:07:34 2010
@@ -3,12 +3,10 @@
 from test import support
 import sys
 import unittest
-import warnings
 
 class TestUntestedModules(unittest.TestCase):
     def test_at_least_import_untested_modules(self):
-        with warnings.catch_warnings():
-            warnings.simplefilter("ignore")
+        with support.check_warnings(quiet=True):
             import bdb
             import cgitb
             import code

Modified: python/branches/py3k-jit/Lib/test/test_xml_etree.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_xml_etree.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_xml_etree.py	Tue Apr  6 03:07:34 2010
@@ -12,6 +12,7 @@
 # except if the test is specific to the Python implementation.
 
 import sys
+import cgi
 
 from test import support
 from test.support import findfile
@@ -1305,7 +1306,7 @@
   <p>Example.</p>
   <xi:include href="{}"/>
 </document>
-""".format(SIMPLE_XMLFILE)
+""".format(cgi.escape(SIMPLE_XMLFILE, True))
 
 def xinclude_loader(href, parse="xml", encoding=None):
     try:
@@ -1808,6 +1809,23 @@
 
 class CleanContext(object):
     """Provide default namespace mapping and path cache."""
+    checkwarnings = None
+
+    def __init__(self, quiet=False):
+        deprecations = (
+            # Search behaviour is broken if search path starts with "/".
+            ("This search is broken in 1.3 and earlier, and will be fixed "
+             "in a future version.  If you rely on the current behaviour, "
+             "change it to '.+'", FutureWarning),
+            # Element.getchildren() and Element.getiterator() are deprecated.
+            ("This method will be removed in future versions.  "
+             "Use .+ instead.", DeprecationWarning),
+            ("This method will be removed in future versions.  "
+             "Use .+ instead.", PendingDeprecationWarning),
+            # XMLParser.doctype() is deprecated.
+            ("This method of XMLParser is deprecated.  Define doctype.. "
+             "method on the TreeBuilder target.", DeprecationWarning))
+        self.checkwarnings = support.check_warnings(*deprecations, quiet=quiet)
 
     def __enter__(self):
         from xml.etree import ElementTree
@@ -1817,35 +1835,26 @@
         ElementTree._namespace_map = self._nsmap.copy()
         # Copy the path cache (should be empty)
         ElementTree.ElementPath._cache = self._path_cache.copy()
+        self.checkwarnings.__enter__()
 
     def __exit__(self, *args):
         from xml.etree import ElementTree
         # Restore mapping and path cache
         ElementTree._namespace_map = self._nsmap
         ElementTree.ElementPath._cache = self._path_cache
+        self.checkwarnings.__exit__(*args)
 
 
 def test_main(module_name='xml.etree.ElementTree'):
-    import warnings
     from test import test_xml_etree
-    def ignore(message, category=DeprecationWarning):
-        warnings.filterwarnings("ignore", message, category)
+
+    use_py_module = (module_name == 'xml.etree.ElementTree')
 
     # The same doctests are used for both the Python and the C implementations
     assert test_xml_etree.ET.__name__ == module_name
 
-    with warnings.catch_warnings(), CleanContext():
-        # Search behaviour is broken if search path starts with "/".
-        ignore("This search is broken in 1.3 and earlier, and will be fixed "
-               "in a future version.  If you rely on the current behaviour, "
-               "change it to '.+'", FutureWarning)
-        # Element.getchildren() and Element.getiterator() are deprecated.
-        ignore("This method will be removed in future versions.  "
-               "Use .+ instead.")
-        # XMLParser.doctype() is deprecated.
-        ignore("This method of XMLParser is deprecated.  "
-               "Define doctype.. method on the TreeBuilder target.")
-
+    # XXX the C module should give the same warnings as the Python module
+    with CleanContext(quiet=not use_py_module):
         support.run_doctest(test_xml_etree, verbosity=True)
 
     # The module should not be changed by the tests

Modified: python/branches/py3k-jit/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/loader.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/loader.py	Tue Apr  6 03:07:34 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-jit/Lib/unittest/util.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/util.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/util.py	Tue Apr  6 03:07:34 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-jit/Makefile.pre.in
==============================================================================
--- python/branches/py3k-jit/Makefile.pre.in	(original)
+++ python/branches/py3k-jit/Makefile.pre.in	Tue Apr  6 03:07:34 2010
@@ -107,6 +107,7 @@
 SO=		@SO@
 LDSHARED=	@LDSHARED@
 BLDSHARED=	@BLDSHARED@
+LDCXXSHARED=	@LDCXXSHARED@
 DESTSHARED=	$(BINLIBDEST)/lib-dynload
 
 # Executable suffix (.exe on Windows and Mac OS X)
@@ -238,6 +239,7 @@
 PGOBJS=		\
 		Objects/obmalloc.o \
 		Python/mysnprintf.o \
+		Python/pyctype.o \
 		Parser/tokenizer_pgen.o \
 		Parser/printgrammar.o \
 		Parser/pgenmain.o
@@ -736,7 +738,7 @@
 
 TESTOPTS=	-l $(EXTRATESTOPTS)
 TESTPROG=	$(srcdir)/Lib/test/regrtest.py
-TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -E -bb
+TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -E -bb
 test:		all platform ctest
 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)

Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS	(original)
+++ python/branches/py3k-jit/Misc/NEWS	Tue Apr  6 03:07:34 2010
@@ -12,6 +12,12 @@
 Core and Builtins
 -----------------
 
+- Ensure that tokenization of identifiers is not affected by locale.
+
+- Issue #1222585: Added LDCXXSHARED for C++ support. Patch by Arfrever.
+
+- Raise a TypeError when trying to delete a T_STRING_INPLACE struct member.
+
 - Issue #8211: Save/restore CFLAGS around AC_PROG_CC in configure.in, compiler
   optimizations are disabled when --with-pydebug is used.
 
@@ -297,6 +303,33 @@
 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:
+
+     >>> Decimal(1.1)
+     Decimal('1.100000000000000088817841970012523233890533447265625')
+
+- Issue #8294: The Fraction constructor now accepts Decimal and float
+  instances directly.
+
+- Issue #7279: Comparisons involving a Decimal signaling NaN now
+  signal InvalidOperation instead of returning False.  (Comparisons
+  involving a quiet NaN are unchanged.)  Also, Decimal quiet NaNs
+  are now hashable;  Decimal signaling NaNs remain unhashable.
+
+- Issue #2531: Comparison operations between floats and Decimal
+  instances now return a result based on the numeric values of the
+  operands;  previously they returned an arbitrary result based on
+  the relative ordering of id(float) and id(Decimal).
+
+- Added a subtract() method to collections.Counter().
+
 - Issue #8233: When run as a script, py_compile.py optionally takes a single
   argument `-` which tells it to read files to compile from stdin.  Each line
   is read on demand and the named file is compiled immediately.  (Original
@@ -549,7 +582,7 @@
 - Issue #5949: added check for correct lineends in input from IMAP server
   in imaplib.
 
-- Add a reverse() method to collections.deque().
+- Add count() and reverse() methods to collections.deque().
 
 - Fix variations of extending deques:  d.extend(d)  d.extendleft(d)  d+=d
 
@@ -848,9 +881,17 @@
 
 - Issue #6247: The argparse module has been added to the standard library.
 
+- Issue #8235: _socket: Add the constant ``SO_SETFIB``.  SO_SETFIB is
+  a socket option available on FreeBSD 7.1 and newer.
+
 Extension Modules
 -----------------
 
+- Issue #8300: When passing a non-integer argument to struct.pack with any
+  integer format code, struct.pack first attempts to convert the non-integer
+  using its __index__ method.  If that method is non-existent or raises
+  TypeError it goes on to try the __int__ method, as described below.
+
 - Issue #8142: Update libffi to the 3.0.9 release.
 
 - Issue #6949: Allow the _dbm extension to be built with db 4.8.x.

Modified: python/branches/py3k-jit/Misc/python.man
==============================================================================
--- python/branches/py3k-jit/Misc/python.man	(original)
+++ python/branches/py3k-jit/Misc/python.man	Tue Apr  6 03:07:34 2010
@@ -165,12 +165,12 @@
 that it entails.
 .TP
 .B \-u
-Force stdin, stdout and stderr to be totally unbuffered.  On systems
-where it matters, also put stdin, stdout and stderr in binary mode.
-Note that there is internal buffering in readlines() and
-file-object iterators ("for line in sys.stdin") which is not
-influenced by this option.  To work around this, you will want to use
-"sys.stdin.readline()" inside a "while 1:" loop.
+Force the binary I/O layers of stdin, stdout and stderr to be unbuffered.
+The text I/O layer will still be line-buffered.
+.\" Note that there is internal buffering in readlines() and
+.\" file-object iterators ("for line in sys.stdin") which is not
+.\" influenced by this option.  To work around this, you will want to use
+.\" "sys.stdin.readline()" inside a "while 1:" loop.
 .TP
 .B \-v
 Print a message each time a module is initialized, showing the place

Modified: python/branches/py3k-jit/Modules/_codecsmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_codecsmodule.c	(original)
+++ python/branches/py3k-jit/Modules/_codecsmodule.c	Tue Apr  6 03:07:34 2010
@@ -217,7 +217,7 @@
 		}
 	}
 	
-	return codec_tuple(v, PyBytes_Size(v));
+	return codec_tuple(v, size);
 }
 
 /* --- Decoder ------------------------------------------------------------ */

Modified: python/branches/py3k-jit/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_collectionsmodule.c	(original)
+++ python/branches/py3k-jit/Modules/_collectionsmodule.c	Tue Apr  6 03:07:34 2010
@@ -504,6 +504,46 @@
 PyDoc_STRVAR(reverse_doc,
 "D.reverse() -- reverse *IN PLACE*");
 
+static PyObject *
+deque_count(dequeobject *deque, PyObject *v)
+{
+	block *leftblock = deque->leftblock;
+	Py_ssize_t leftindex = deque->leftindex;
+	Py_ssize_t n = (deque->len);
+	Py_ssize_t i;
+	Py_ssize_t count = 0;
+	PyObject *item;
+	long start_state = deque->state;
+	int cmp;
+
+	for (i=0 ; i<n ; i++) {
+		item = leftblock->data[leftindex];
+		cmp = PyObject_RichCompareBool(item, v, Py_EQ);
+		if (cmp > 0)
+			count++;
+		else if (cmp < 0)
+			return NULL;
+
+		if (start_state != deque->state) {
+			PyErr_SetString(PyExc_RuntimeError,
+					"deque mutated during iteration");
+			return NULL;
+		}
+
+		/* Advance left block/index pair */
+		leftindex++;
+		if (leftindex == BLOCKLEN) {
+			assert (leftblock->rightlink != NULL);
+			leftblock = leftblock->rightlink;
+			leftindex = 0;
+		}
+	}
+	return PyLong_FromSsize_t(count);
+}
+
+PyDoc_STRVAR(count_doc,
+"D.count(value) -> integer -- return number of occurrences of value");
+
 static Py_ssize_t
 deque_len(dequeobject *deque)
 {
@@ -933,6 +973,8 @@
 		METH_NOARGS,	 clear_doc},
 	{"__copy__",		(PyCFunction)deque_copy,
 		METH_NOARGS,	 copy_doc},
+	{"count",		(PyCFunction)deque_count,
+	    METH_O,			count_doc},
 	{"extend",		(PyCFunction)deque_extend,
 		METH_O,		 extend_doc},
 	{"extendleft",		(PyCFunction)deque_extendleft,

Modified: python/branches/py3k-jit/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-jit/Modules/_ssl.c	(original)
+++ python/branches/py3k-jit/Modules/_ssl.c	Tue Apr  6 03:07:34 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-jit/Modules/_struct.c
==============================================================================
--- python/branches/py3k-jit/Modules/_struct.c	(original)
+++ python/branches/py3k-jit/Modules/_struct.c	Tue Apr  6 03:07:34 2010
@@ -89,19 +89,30 @@
 #pragma options align=reset
 #endif
 
-/* Helper to get a PyLongObject.  Caller should decref. */
+/* Helper for integer format codes: converts an arbitrary Python object to a
+   PyLongObject if possible, otherwise fails.  Caller should decref. */
 
 static PyObject *
 get_pylong(PyObject *v)
 {
 	assert(v != NULL);
 	if (!PyLong_Check(v)) {
-		PyErr_SetString(StructError,
-				"required argument is not an integer");
-		return NULL;
+		/* Not an integer;  try to use __index__ to convert. */
+		if (PyIndex_Check(v)) {
+			v = PyNumber_Index(v);
+			if (v == NULL)
+				return NULL;
+		}
+		else {
+			PyErr_SetString(StructError,
+					"required argument is not an integer");
+			return NULL;
+		}
 	}
+	else
+		Py_INCREF(v);
 
-	Py_INCREF(v);
+	assert(PyLong_Check(v));
 	return v;
 }
 
@@ -113,13 +124,13 @@
 {
 	long x;
 
-	if (!PyLong_Check(v)) {
-		PyErr_SetString(StructError,
-				"required argument is not an integer");
+	v = get_pylong(v);
+	if (v == NULL)
 		return -1;
-	}
+	assert(PyLong_Check(v));
 	x = PyLong_AsLong(v);
-	if (x == -1 && PyErr_Occurred()) {
+	Py_DECREF(v);
+	if (x == (long)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
 					"argument out of range");
@@ -132,18 +143,17 @@
 
 /* Same, but handling unsigned long */
 
-#ifndef PY_STRUCT_OVERFLOW_MASKING
 static int
 get_ulong(PyObject *v, unsigned long *p)
 {
 	unsigned long x;
 
-	if (!PyLong_Check(v)) {
-		PyErr_SetString(StructError,
-				"required argument is not an integer");
+	v = get_pylong(v);
+	if (v == NULL)
 		return -1;
-	}
+	assert(PyLong_Check(v));
 	x = PyLong_AsUnsignedLong(v);
+	Py_DECREF(v);
 	if (x == (unsigned long)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
@@ -153,7 +163,6 @@
 	*p = x;
 	return 0;
 }
-#endif  /* PY_STRUCT_OVERFLOW_MASKING */
 
 #ifdef HAVE_LONG_LONG
 
@@ -163,13 +172,14 @@
 get_longlong(PyObject *v, PY_LONG_LONG *p)
 {
 	PY_LONG_LONG x;
-	if (!PyLong_Check(v)) {
-		PyErr_SetString(StructError,
-				"required argument is not an integer");
+
+	v = get_pylong(v);
+	if (v == NULL)
 		return -1;
-	}
+	assert(PyLong_Check(v));
 	x = PyLong_AsLongLong(v);
-	if (x == -1 && PyErr_Occurred()) {
+	Py_DECREF(v);
+	if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
 					"argument out of range");
@@ -185,13 +195,14 @@
 get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
 {
 	unsigned PY_LONG_LONG x;
-	if (!PyLong_Check(v)) {
-		PyErr_SetString(StructError,
-				"required argument is not an integer");
+
+	v = get_pylong(v);
+	if (v == NULL)
 		return -1;
-	}
+	assert(PyLong_Check(v));
 	x = PyLong_AsUnsignedLongLong(v);
-	if (x == -1 && PyErr_Occurred()) {
+	Py_DECREF(v);
+	if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) {
 		if (PyErr_ExceptionMatches(PyExc_OverflowError))
 			PyErr_SetString(StructError,
 					"argument out of range");
@@ -211,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;
 
@@ -223,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;
 
@@ -580,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;
@@ -801,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 */);
@@ -817,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 */);
@@ -852,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;
@@ -1019,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 */);
@@ -1035,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 */);
@@ -1396,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);
@@ -1438,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);
@@ -1771,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,
@@ -1797,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;
@@ -1827,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;
@@ -1848,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;
 }
@@ -1877,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-jit/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-jit/Modules/_testcapimodule.c	Tue Apr  6 03:07:34 2010
@@ -1668,6 +1668,7 @@
 	Py_ssize_t pyssizet_member;
 	float float_member;
 	double double_member;
+	char inplace_member[6];
 #ifdef HAVE_LONG_LONG
 	PY_LONG_LONG longlong_member;
 	unsigned PY_LONG_LONG ulonglong_member;
@@ -1692,6 +1693,7 @@
 	{"T_PYSSIZET", T_PYSSIZET, offsetof(test_structmembers, structmembers.pyssizet_member), 0, NULL},
 	{"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL},
 	{"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL},
+	{"T_STRING_INPLACE", T_STRING_INPLACE, offsetof(test_structmembers, structmembers.inplace_member), 0, NULL},
 #ifdef HAVE_LONG_LONG
 	{"T_LONGLONG", T_LONGLONG, offsetof(test_structmembers, structmembers.longlong_member), 0, NULL},
 	{"T_ULONGLONG", T_ULONGLONG, offsetof(test_structmembers, structmembers.ulonglong_member), 0, NULL},
@@ -1706,17 +1708,19 @@
 	static char *keywords[] = {
 		"T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT",
 		"T_INT", "T_UINT", "T_LONG", "T_ULONG", "T_PYSSIZET",
-		"T_FLOAT", "T_DOUBLE",
+		"T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE",
 #ifdef HAVE_LONG_LONG
 		"T_LONGLONG", "T_ULONGLONG",
 #endif
 		NULL};
-	static char *fmt = "|bbBhHiIlknfd"
+	static char *fmt = "|bbBhHiIlknfds#"
 #ifdef HAVE_LONG_LONG
 		"LK"
 #endif
 		;
 	test_structmembers *ob;
+	const char *s = NULL;
+	Py_ssize_t string_len = 0;
 	ob = PyObject_New(test_structmembers, type);
 	if (ob == NULL)
 		return NULL;
@@ -1733,7 +1737,8 @@
 					 &ob->structmembers.ulong_member,
 					 &ob->structmembers.pyssizet_member,
 					 &ob->structmembers.float_member,
-					 &ob->structmembers.double_member
+					 &ob->structmembers.double_member,
+					 &s, &string_len
 #ifdef HAVE_LONG_LONG
 					 , &ob->structmembers.longlong_member,
 					 &ob->structmembers.ulonglong_member
@@ -1742,6 +1747,17 @@
 		Py_DECREF(ob);
 		return NULL;
 	}
+	if (s != NULL) {
+		if (string_len > 5) {
+			Py_DECREF(ob);
+			PyErr_SetString(PyExc_ValueError, "string too long");
+			return NULL;
+		}
+		strcpy(ob->structmembers.inplace_member, s);
+	}
+	else {
+		strcpy(ob->structmembers.inplace_member, "");
+	}
 	return (PyObject *)ob;
 }
 
@@ -1820,7 +1836,9 @@
 
 	Py_TYPE(&test_structmembersType)=&PyType_Type;
 	Py_INCREF(&test_structmembersType);
-	PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
+	/* don't use a name starting with "test", since we don't want
+	   test_capi to automatically call this */
+	PyModule_AddObject(m, "_test_structmembersType", (PyObject *)&test_structmembersType);
 
 	PyModule_AddObject(m, "CHAR_MAX", PyLong_FromLong(CHAR_MAX));
 	PyModule_AddObject(m, "CHAR_MIN", PyLong_FromLong(CHAR_MIN));

Modified: python/branches/py3k-jit/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/socketmodule.c	(original)
+++ python/branches/py3k-jit/Modules/socketmodule.c	Tue Apr  6 03:07:34 2010
@@ -4551,6 +4551,9 @@
 #ifdef	SO_TYPE
 	PyModule_AddIntConstant(m, "SO_TYPE", SO_TYPE);
 #endif
+#ifdef	SO_SETFIB
+	PyModule_AddIntConstant(m, "SO_SETFIB", SO_SETFIB);
+#endif
 
 	/* Maximum number of connections for "listen" */
 #ifdef	SOMAXCONN

Modified: python/branches/py3k-jit/Objects/object.c
==============================================================================
--- python/branches/py3k-jit/Objects/object.c	(original)
+++ python/branches/py3k-jit/Objects/object.c	Tue Apr  6 03:07:34 2010
@@ -656,15 +656,15 @@
 	 * of mapping keys will turn out weird.
 	 */
 
+	if (Py_IS_INFINITY(v))
+		/* can't convert to long int -- arbitrary */
+		v = v < 0 ? -271828.0 : 314159.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-jit/PCbuild/rt.bat
==============================================================================
--- python/branches/py3k-jit/PCbuild/rt.bat	(original)
+++ python/branches/py3k-jit/PCbuild/rt.bat	Tue Apr  6 03:07:34 2010
@@ -40,7 +40,7 @@
 
 PATH %PATH%;..\..\%tcltk%\bin
 set exe=%prefix%\python%suffix%
-set cmd=%exe% %dashO% -E ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9
+set cmd=%exe% %dashO% -Wd -E -bb ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9
 if defined qmode goto Qmode
 
 echo Deleting .pyc/.pyo files ...

Modified: python/branches/py3k-jit/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k-jit/Parser/tokenizer.c	(original)
+++ python/branches/py3k-jit/Parser/tokenizer.c	Tue Apr  6 03:07:34 2010
@@ -245,7 +245,7 @@
 			} while (t[0] == '\x20' || t[0] == '\t');
 
 			begin = t;
-			while (isalnum(Py_CHARMASK(t[0])) ||
+			while (Py_ISALNUM(t[0]) ||
 			       t[0] == '-' || t[0] == '_' || t[0] == '.')
 				t++;
 

Modified: python/branches/py3k-jit/Python/structmember.c
==============================================================================
--- python/branches/py3k-jit/Python/structmember.c	(original)
+++ python/branches/py3k-jit/Python/structmember.c	Tue Apr  6 03:07:34 2010
@@ -106,7 +106,7 @@
 
 	addr += l->offset;
 
-	if ((l->flags & READONLY) || l->type == T_STRING)
+	if ((l->flags & READONLY))
 	{
 		PyErr_SetString(PyExc_AttributeError, "readonly attribute");
 		return -1;
@@ -266,6 +266,10 @@
 		*(char*)addr = string[0];
 		break;
 		}
+	case T_STRING:
+	case T_STRING_INPLACE:
+		PyErr_SetString(PyExc_TypeError, "readonly attribute");
+		return -1;
 #ifdef HAVE_LONG_LONG
 	case T_LONGLONG:{
 		PY_LONG_LONG value;

Modified: python/branches/py3k-jit/configure.in
==============================================================================
--- python/branches/py3k-jit/configure.in	(original)
+++ python/branches/py3k-jit/configure.in	Tue Apr  6 03:07:34 2010
@@ -1621,6 +1621,7 @@
 # Set info about shared libraries.
 AC_SUBST(SO)
 AC_SUBST(LDSHARED)
+AC_SUBST(LDCXXSHARED)
 AC_SUBST(BLDSHARED)
 AC_SUBST(CCSHARED)
 AC_SUBST(LINKFORSHARED)
@@ -1669,36 +1670,47 @@
 	IRIX/5*) LDSHARED="ld -shared";;
 	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
 	SunOS/5*) 
-		if test "$GCC" = "yes"
-		then LDSHARED='$(CC) -shared'
-		else LDSHARED='$(CC) -G';
+		if test "$GCC" = "yes" ; then
+			LDSHARED='$(CC) -shared'
+			LDCXXSHARED='$(CXX) -shared'
+		else
+			LDSHARED='$(CC) -G'
+			LDCXXSHARED='$(CXX) -G'
 		fi ;;
 	hp*|HP*)
-		if test "$GCC" = "yes"
-		then LDSHARED='$(CC) -shared'
-		else LDSHARED='ld -b';
+		if test "$GCC" = "yes" ; then
+			LDSHARED='$(CC) -shared'
+			LDCXXSHARED='$(CXX) -shared'
+		else
+			LDSHARED='ld -b'
 		fi ;;
 	OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
 	Darwin/1.3*)
 		LDSHARED='$(CC) $(LDFLAGS) -bundle'
+		LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
 		if test "$enable_framework" ; then
 			# Link against the framework. All externals should be defined.
 			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 		else
 			# No framework. Ignore undefined symbols, assuming they come from Python
 			LDSHARED="$LDSHARED -undefined suppress"
+			LDCXXSHARED="$LDCXXSHARED -undefined suppress"
 		fi ;;
 	Darwin/1.4*|Darwin/5.*|Darwin/6.*)
 		LDSHARED='$(CC) $(LDFLAGS) -bundle'
+		LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
 		if test "$enable_framework" ; then
 			# Link against the framework. All externals should be defined.
 			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 		else
 			# No framework, use the Python app as bundle-loader
 			BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
 			LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+			LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
 		fi ;;
 	Darwin/*)
 		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
@@ -1710,26 +1722,35 @@
 				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
 			fi
 			LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
+			LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle -undefined dynamic_lookup'
 			BLDSHARED="$LDSHARED"
 		else
 			LDSHARED='$(CC) $(LDFLAGS) -bundle'
+			LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
 			if test "$enable_framework" ; then
 				# Link against the framework. All externals should be defined.
 				BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 				LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+				LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
 			else
 				# No framework, use the Python app as bundle-loader
 				BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
 				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
 			fi
 		fi
 		;;
-	Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
-	BSD/OS*/4*) LDSHARED="gcc -shared";;
+	Linux*|GNU*|QNX*)
+		LDSHARED='$(CC) -shared'
+		LDCXXSHARED='$(CXX) -shared';;
+	BSD/OS*/4*)
+		LDSHARED="gcc -shared"
+		LDCXXSHARED="g++ -shared";;
 	FreeBSD*)
 		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
 		then
 			LDSHARED='$(CC) -shared ${LDFLAGS}'
+			LDCXXSHARED='$(CXX) -shared ${LDFLAGS}'
 		else
 			LDSHARED="ld -Bshareable ${LDFLAGS}"
 		fi;;
@@ -1737,6 +1758,7 @@
 		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
 		then
 				LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
+				LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
 		else
 				case `uname -r` in
 				[[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
@@ -1744,21 +1766,32 @@
 				   ;;
 				*)
 				   LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
+				   LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
 				   ;;
 				esac
 		fi;;
-	NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
+	NetBSD*|DragonFly*)
+		LDSHARED="cc -shared ${LDFLAGS}"
+		LDCXXSHARED="c++ -shared ${LDFLAGS}";;
 	OpenUNIX*|UnixWare*)
-		if test "$GCC" = "yes"
-		then LDSHARED='$(CC) -shared'
-		else LDSHARED='$(CC) -G'
+		if test "$GCC" = "yes" ; then
+			LDSHARED='$(CC) -shared'
+			LDCXXSHARED='$(CXX) -shared'
+		else
+			LDSHARED='$(CC) -G'
+			LDCXXSHARED='$(CXX) -G'
 		fi;;
-	SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
-	CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
+	SCO_SV*)
+		LDSHARED='$(CC) -Wl,-G,-Bexport'
+		LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
+	CYGWIN*)
+		LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
+		LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
 	*)	LDSHARED="ld";;
 	esac
 fi
 AC_MSG_RESULT($LDSHARED)
+LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
 BLDSHARED=${BLDSHARED-$LDSHARED}
 # CCSHARED are the C *flags* used to create objects to go into a shared
 # library (module) -- this is only needed for a few systems


More information about the Python-checkins mailing list