[Python-checkins] r79747 - in python/branches/py3k-cdecimal: Doc/library/collections.rst Doc/library/decimal.rst Doc/library/fractions.rst Doc/library/functions.rst Doc/library/itertools.rst Doc/library/struct.rst Doc/library/zipfile.rst Doc/reference/expressions.rst Doc/using/cmdline.rst Doc/whatsnew/2.7.rst Include/ceval.h Lib/collections.py Lib/decimal.py Lib/distutils/tests/test_build_ext.py Lib/fractions.py Lib/platform.py Lib/pstats.py Lib/test/test___all__.py Lib/test/test_argparse.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_fractions.py Lib/test/test_global.py Lib/test/test_hmac.py Lib/test/test_io.py Lib/test/test_robotparser.py Lib/test/test_struct.py Lib/test/test_structmembers.py Lib/test/test_sundry.py Lib/test/test_xml_etree.py Makefile.pre.in Misc/NEWS Misc/python.man Modules/_collectionsmodule.c Modules/_struct.c Modules/_testcapimodule.c Modules/socketmodule.c PCbuild/rt.bat Parser/tokenizer.c Python/ceval.c Python/structmember.c configure configure.in

stefan.krah python-checkins at python.org
Sun Apr 4 13:32:57 CEST 2010


Author: stefan.krah
Date: Sun Apr  4 13:32:56 2010
New Revision: 79747

Log:
Merged revisions 79553,79556,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 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79553 | stefan.krah | 2010-04-01 12:34:09 +0200 (Thu, 01 Apr 2010) | 1 line
  
  Fix typo in definition of 'in' keyword.
................
  r79556 | antoine.pitrou | 2010-04-01 18:53:15 +0200 (Thu, 01 Apr 2010) | 11 lines
  
  Merged revisions 79555 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79555 | antoine.pitrou | 2010-04-01 18:42:11 +0200 (jeu., 01 avril 2010) | 5 lines
    
    Issue #8276: PyEval_CallObject() is now only available in macro form.  The
    function declaration, which was kept for backwards compatibility reasons,
    is now removed (the macro was introduced in 1997!).
  ........
................
  r79565 | raymond.hettinger | 2010-04-02 02:25:45 +0200 (Fri, 02 Apr 2010) | 1 line
  
  Document sorting HowTo
................
  r79571 | raymond.hettinger | 2010-04-02 06:18:18 +0200 (Fri, 02 Apr 2010) | 1 line
  
  Add and update itertools recipes.
................
  r79573 | raymond.hettinger | 2010-04-02 06:50:35 +0200 (Fri, 02 Apr 2010) | 1 line
  
  Fix nits in itertools recipes.
................
  r79581 | georg.brandl | 2010-04-02 10:47:07 +0200 (Fri, 02 Apr 2010) | 1 line
  
  #8213: document behavior of -u on py3k better.
................
  r79591 | larry.hastings | 2010-04-02 13:03:37 +0200 (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 13:20:07 +0200 (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 13:47:10 +0200 (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 15:56:40 +0200 (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 18:58:27 +0200 (Fri, 02 Apr 2010) | 1 line
  
  Issue 8257: Decimal constructor to accept float argument.
................
  r79604 | andrew.kuchling | 2010-04-02 19:02:57 +0200 (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 19:12:12 +0200 (Fri, 02 Apr 2010) | 3 lines
  
  Furniture is not very reliable these days (buildbot failures).
................
  r79610 | florent.xicluna | 2010-04-02 20:52:12 +0200 (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 20:54:02 +0200 (Fri, 02 Apr 2010) | 1 line
  
  Add nice docstrings to namedtuples.
................
  r79613 | florent.xicluna | 2010-04-02 21:25:32 +0200 (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 22:12:42 +0200 (Fri, 02 Apr 2010) | 1 line
  
  #8288: fix next -> __next__.
................
  r79621 | tarek.ziade | 2010-04-02 23:24:55 +0200 (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-03 00:15:23 +0200 (Sat, 03 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-03 00:38:52 +0200 (Sat, 03 Apr 2010) | 2 lines
  
  Change test_support to support. Fixes a failing test on Windows.
................
  r79641 | benjamin.peterson | 2010-04-03 03:02:00 +0200 (Sat, 03 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-03 03:40:24 +0200 (Sat, 03 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 10:43:28 +0200 (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 10:46:49 +0200 (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 12:32:58 +0200 (Sat, 03 Apr 2010) | 1 line
  
  Add a subtract() method to collections.Counter()
................
  r79665 | mark.dickinson | 2010-04-03 12:49:56 +0200 (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 13:08:14 +0200 (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 13:18:52 +0200 (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 16:24:58 +0200 (Sat, 03 Apr 2010) | 1 line
  
  Remove unused define.
................
  r79681 | ezio.melotti | 2010-04-03 16:59:49 +0200 (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 17:07:40 +0200 (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 17:26:31 +0200 (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 17:27:05 +0200 (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 17:39:17 +0200 (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 17:42:04 +0200 (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 17:51:03 +0200 (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 17:54:36 +0200 (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 18:01:50 +0200 (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 18:42:09 +0200 (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 20:18:44 +0200 (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 23:57:26 +0200 (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-04 00:11:20 +0200 (Sun, 04 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-04 00:55:48 +0200 (Sun, 04 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-04 01:10:01 +0200 (Sun, 04 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-04 01:20:46 +0200 (Sun, 04 Apr 2010) | 1 line
  
  Add count() method to collections.deque().
................
  r79729 | benjamin.peterson | 2010-04-04 01:56:48 +0200 (Sun, 04 Apr 2010) | 1 line
  
  add missing decrefs
................
  r79731 | ezio.melotti | 2010-04-04 08:30:08 +0200 (Sun, 04 Apr 2010) | 1 line
  
  Fix versionchanged from 2.7 to 3.2 in decimal.rst.
................
  r79737 | ezio.melotti | 2010-04-04 08:53:44 +0200 (Sun, 04 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-04 08:57:44 +0200 (Sun, 04 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 09:21:15 +0200 (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 10:52:51 +0200 (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.
  ........
................


Modified:
   python/branches/py3k-cdecimal/   (props changed)
   python/branches/py3k-cdecimal/Doc/library/collections.rst
   python/branches/py3k-cdecimal/Doc/library/decimal.rst
   python/branches/py3k-cdecimal/Doc/library/fractions.rst
   python/branches/py3k-cdecimal/Doc/library/functions.rst
   python/branches/py3k-cdecimal/Doc/library/itertools.rst
   python/branches/py3k-cdecimal/Doc/library/struct.rst
   python/branches/py3k-cdecimal/Doc/library/zipfile.rst
   python/branches/py3k-cdecimal/Doc/reference/expressions.rst
   python/branches/py3k-cdecimal/Doc/using/cmdline.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst
   python/branches/py3k-cdecimal/Include/ceval.h
   python/branches/py3k-cdecimal/Lib/collections.py
   python/branches/py3k-cdecimal/Lib/decimal.py
   python/branches/py3k-cdecimal/Lib/distutils/tests/test_build_ext.py
   python/branches/py3k-cdecimal/Lib/fractions.py
   python/branches/py3k-cdecimal/Lib/platform.py
   python/branches/py3k-cdecimal/Lib/pstats.py
   python/branches/py3k-cdecimal/Lib/test/test___all__.py
   python/branches/py3k-cdecimal/Lib/test/test_argparse.py
   python/branches/py3k-cdecimal/Lib/test/test_collections.py
   python/branches/py3k-cdecimal/Lib/test/test_complex.py
   python/branches/py3k-cdecimal/Lib/test/test_contextlib.py
   python/branches/py3k-cdecimal/Lib/test/test_decimal.py
   python/branches/py3k-cdecimal/Lib/test/test_deque.py
   python/branches/py3k-cdecimal/Lib/test/test_descr.py
   python/branches/py3k-cdecimal/Lib/test/test_doctest.py
   python/branches/py3k-cdecimal/Lib/test/test_fractions.py
   python/branches/py3k-cdecimal/Lib/test/test_global.py
   python/branches/py3k-cdecimal/Lib/test/test_hmac.py
   python/branches/py3k-cdecimal/Lib/test/test_io.py
   python/branches/py3k-cdecimal/Lib/test/test_robotparser.py
   python/branches/py3k-cdecimal/Lib/test/test_struct.py
   python/branches/py3k-cdecimal/Lib/test/test_structmembers.py
   python/branches/py3k-cdecimal/Lib/test/test_sundry.py
   python/branches/py3k-cdecimal/Lib/test/test_xml_etree.py
   python/branches/py3k-cdecimal/Makefile.pre.in
   python/branches/py3k-cdecimal/Misc/NEWS
   python/branches/py3k-cdecimal/Misc/python.man
   python/branches/py3k-cdecimal/Modules/_collectionsmodule.c
   python/branches/py3k-cdecimal/Modules/_struct.c
   python/branches/py3k-cdecimal/Modules/_testcapimodule.c
   python/branches/py3k-cdecimal/Modules/socketmodule.c
   python/branches/py3k-cdecimal/PCbuild/rt.bat
   python/branches/py3k-cdecimal/Parser/tokenizer.c
   python/branches/py3k-cdecimal/Python/ceval.c
   python/branches/py3k-cdecimal/Python/structmember.c
   python/branches/py3k-cdecimal/configure
   python/branches/py3k-cdecimal/configure.in

Modified: python/branches/py3k-cdecimal/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/collections.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/collections.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/library/decimal.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/decimal.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/decimal.rst	Sun Apr  4 13:32:56 2010
@@ -308,7 +308,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 +334,11 @@
    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
+   upto 53 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
@@ -353,6 +358,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:
 
@@ -1824,36 +1847,14 @@
 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
+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-cdecimal/Doc/library/fractions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/fractions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/fractions.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/functions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/functions.rst	Sun Apr  4 13:32:56 2010
@@ -1018,6 +1018,9 @@
    `CmpToKey recipe in the ASPN cookbook
    <http://code.activestate.com/recipes/576653/>`_\.
 
+   For sorting examples and a brief sorting tutorial, see `Sorting HowTo
+   <http://wiki.python.org/moin/HowTo/Sorting/>`_\.
+
 .. function:: staticmethod(function)
 
    Return a static method for *function*.

Modified: python/branches/py3k-cdecimal/Doc/library/itertools.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/itertools.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/itertools.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/library/struct.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/struct.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/struct.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/library/zipfile.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/zipfile.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/zipfile.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/reference/expressions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/reference/expressions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/reference/expressions.rst	Sun Apr  4 13:32:56 2010
@@ -1061,7 +1061,7 @@
 support this as well as dictionary, for which :keyword:`in` tests whether a the
 dictionary has a given key. For container types such as list, tuple, set,
 frozenset, dict, or collections.deque, the expression ``x in y`` is equivalent
-to ``any(x is e or x == e for val e in y)``.
+to ``any(x is e or x == e for e in y)``.
 
 For the string and bytes types, ``x in y`` is true if and only if *x* is a
 substring of *y*.  An equivalent test is ``y.find(x) != -1``.  Empty strings are

Modified: python/branches/py3k-cdecimal/Doc/using/cmdline.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/using/cmdline.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/using/cmdline.rst	Sun Apr  4 13:32:56 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-cdecimal/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst	Sun Apr  4 13:32:56 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

Modified: python/branches/py3k-cdecimal/Include/ceval.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/ceval.h	(original)
+++ python/branches/py3k-cdecimal/Include/ceval.h	Sun Apr  4 13:32:56 2010
@@ -10,10 +10,6 @@
 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
 	PyObject *, PyObject *, PyObject *);
 
-/* DLL-level Backwards compatibility: */
-#undef PyEval_CallObject
-PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
-
 /* Inline this */
 #define PyEval_CallObject(func,arg) \
         PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)

Modified: python/branches/py3k-cdecimal/Lib/collections.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/collections.py	(original)
+++ python/branches/py3k-cdecimal/Lib/collections.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/decimal.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/decimal.py	(original)
+++ python/branches/py3k-cdecimal/Lib/decimal.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/branches/py3k-cdecimal/Lib/distutils/tests/test_build_ext.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/fractions.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/fractions.py	(original)
+++ python/branches/py3k-cdecimal/Lib/fractions.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/platform.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/platform.py	(original)
+++ python/branches/py3k-cdecimal/Lib/platform.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/pstats.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pstats.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pstats.py	Sun Apr  4 13:32:56 2010
@@ -636,7 +636,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-cdecimal/Lib/test/test___all__.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test___all__.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test___all__.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_argparse.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_argparse.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_argparse.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_collections.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_collections.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_collections.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_complex.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_complex.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_complex.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_contextlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_contextlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_contextlib.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_decimal.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_decimal.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_decimal.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_deque.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_deque.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_deque.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_descr.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_descr.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_doctest.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_doctest.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_doctest.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_fractions.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_fractions.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_fractions.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_global.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_global.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_global.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_hmac.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_hmac.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_hmac.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_io.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_io.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_io.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_robotparser.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_robotparser.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_robotparser.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_struct.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_struct.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_structmembers.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_structmembers.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_structmembers.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_sundry.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_sundry.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_sundry.py	Sun Apr  4 13:32:56 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-cdecimal/Lib/test/test_xml_etree.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_xml_etree.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_xml_etree.py	Sun Apr  4 13:32:56 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-cdecimal/Makefile.pre.in
==============================================================================
--- python/branches/py3k-cdecimal/Makefile.pre.in	(original)
+++ python/branches/py3k-cdecimal/Makefile.pre.in	Sun Apr  4 13:32:56 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
@@ -706,7 +708,7 @@
 
 TESTOPTS=	-l $(EXTRATESTOPTS)
 TESTPROG=	$(srcdir)/Lib/test/regrtest.py
-TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -E -bb
+TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -E -bb
 test:		all platform
 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)

Modified: python/branches/py3k-cdecimal/Misc/NEWS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/NEWS	(original)
+++ python/branches/py3k-cdecimal/Misc/NEWS	Sun Apr  4 13:32:56 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.
 
@@ -246,6 +252,10 @@
 C-API
 -----
 
+- Issue #8276: PyEval_CallObject() is now only available in macro form.  The
+  function declaration, which was kept for backwards compatibility reasons,
+  is now removed (the macro was introduced in 1997!).
+
 - Issue #7767: New function PyLong_AsLongLongAndOverflow added,
   analogous to PyLong_AsLongAndOverflow.
 
@@ -293,6 +303,27 @@
 Library
 -------
 
+- 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
@@ -545,7 +576,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
 
@@ -844,9 +875,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-cdecimal/Misc/python.man
==============================================================================
--- python/branches/py3k-cdecimal/Misc/python.man	(original)
+++ python/branches/py3k-cdecimal/Misc/python.man	Sun Apr  4 13:32:56 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-cdecimal/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_collectionsmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_collectionsmodule.c	Sun Apr  4 13:32:56 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-cdecimal/Modules/_struct.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_struct.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_struct.c	Sun Apr  4 13:32:56 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");

Modified: python/branches/py3k-cdecimal/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_testcapimodule.c	Sun Apr  4 13:32:56 2010
@@ -2087,6 +2087,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;
@@ -2111,6 +2112,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},
@@ -2125,17 +2127,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;
@@ -2152,7 +2156,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
@@ -2161,6 +2166,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;
 }
 
@@ -2239,7 +2255,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-cdecimal/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/socketmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/socketmodule.c	Sun Apr  4 13:32:56 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-cdecimal/PCbuild/rt.bat
==============================================================================
--- python/branches/py3k-cdecimal/PCbuild/rt.bat	(original)
+++ python/branches/py3k-cdecimal/PCbuild/rt.bat	Sun Apr  4 13:32:56 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-cdecimal/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k-cdecimal/Parser/tokenizer.c	(original)
+++ python/branches/py3k-cdecimal/Parser/tokenizer.c	Sun Apr  4 13:32:56 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-cdecimal/Python/ceval.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/ceval.c	(original)
+++ python/branches/py3k-cdecimal/Python/ceval.c	Sun Apr  4 13:32:56 2010
@@ -3695,18 +3695,7 @@
 
 
 /* External interface to call any callable object.
-   The arg must be a tuple or NULL. */
-
-#undef PyEval_CallObject
-/* for backward compatibility: export this interface */
-
-PyObject *
-PyEval_CallObject(PyObject *func, PyObject *arg)
-{
-	return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL);
-}
-#define PyEval_CallObject(func,arg) \
-        PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
+   The arg must be a tuple or NULL.  The kw must be a dict or NULL. */
 
 PyObject *
 PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)

Modified: python/branches/py3k-cdecimal/Python/structmember.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/structmember.c	(original)
+++ python/branches/py3k-cdecimal/Python/structmember.c	Sun Apr  4 13:32:56 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-cdecimal/configure
==============================================================================
--- python/branches/py3k-cdecimal/configure	(original)
+++ python/branches/py3k-cdecimal/configure	Sun Apr  4 13:32:56 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 79401 .
+# From configure.in Revision: 79550 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.2.
 #
@@ -710,6 +710,7 @@
 LIBTOOL_CRUFT
 SO
 LDSHARED
+LDCXXSHARED
 BLDSHARED
 CCSHARED
 LINKFORSHARED
@@ -14663,6 +14664,7 @@
 
 
 
+
 # SO is the extension of shared libraries `(including the dot!)
 # -- usually .so, .sl on HP-UX, .dll on Cygwin
 { echo "$as_me:$LINENO: checking SO" >&5
@@ -14715,36 +14717,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).
@@ -14756,26 +14769,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;;
@@ -14783,6 +14805,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].*)
@@ -14790,22 +14813,33 @@
 				   ;;
 				*)
 				   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
 { echo "$as_me:$LINENO: result: $LDSHARED" >&5
 echo "${ECHO_T}$LDSHARED" >&6; }
+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
@@ -28088,9 +28122,9 @@
 LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim
 SO!$SO$ac_delim
 LDSHARED!$LDSHARED$ac_delim
+LDCXXSHARED!$LDCXXSHARED$ac_delim
 BLDSHARED!$BLDSHARED$ac_delim
 CCSHARED!$CCSHARED$ac_delim
-LINKFORSHARED!$LINKFORSHARED$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -28132,6 +28166,7 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+LINKFORSHARED!$LINKFORSHARED$ac_delim
 CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim
 SHLIBS!$SHLIBS$ac_delim
 PKG_CONFIG!$PKG_CONFIG$ac_delim
@@ -28158,7 +28193,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: python/branches/py3k-cdecimal/configure.in
==============================================================================
--- python/branches/py3k-cdecimal/configure.in	(original)
+++ python/branches/py3k-cdecimal/configure.in	Sun Apr  4 13:32:56 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