[Python-checkins] r80304 - in python/branches/py3k-cdecimal: .bzrignore .hgignore Doc/c-api/import.rst Doc/data/refcounts.dat Doc/distutils/apiref.rst Doc/distutils/examples.rst Doc/faq/windows.rst Doc/glossary.rst Doc/library/_thread.rst Doc/library/collections.rst Doc/library/compileall.rst Doc/library/datetime.rst Doc/library/difflib.rst Doc/library/functools.rst Doc/library/imp.rst Doc/library/itertools.rst Doc/library/logging.rst Doc/library/math.rst Doc/library/os.rst Doc/library/py_compile.rst Doc/library/re.rst Doc/library/runpy.rst Doc/library/shutil.rst Doc/library/signal.rst Doc/library/socket.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/library/struct.rst Doc/library/subprocess.rst Doc/library/tarfile.rst Doc/library/test.rst Doc/library/threading.rst Doc/library/unittest.rst Doc/library/urllib.request.rst Doc/library/warnings.rst Doc/reference/expressions.rst Doc/tutorial/interpreter.rst Doc/using/cmdline.rst Doc/whatsnew/2.6.rst Doc/whatsnew/2.7.rst Doc/whatsnew/3.2.rst Include/Python.h Include/import.h Include/pyport.h Include/pythread.h LICENSE Lib Lib/_dummy_thread.py Lib/collections.py Lib/compileall.py Lib/ctypes Lib/ctypes/macholib Lib/ctypes/test Lib/curses Lib/dbm Lib/difflib.py Lib/distutils Lib/distutils/command Lib/distutils/tests Lib/distutils/tests/support.py Lib/email Lib/email/encoders.py Lib/email/message.py Lib/email/mime Lib/email/test Lib/email/test/data Lib/email/test/test_email.py Lib/encodings Lib/ftplib.py Lib/functools.py Lib/html Lib/http Lib/idlelib Lib/idlelib/Icons Lib/importlib Lib/importlib/_bootstrap.py Lib/importlib/test Lib/importlib/test/__main__.py Lib/importlib/test/builtin Lib/importlib/test/extension Lib/importlib/test/frozen Lib/importlib/test/import_ Lib/importlib/test/source Lib/importlib/test/source/test_file_loader.py Lib/importlib/test/source/test_finder.py Lib/importlib/test/source/test_source_encoding.py Lib/importlib/test/source/util.py Lib/importlib/util.py Lib/inspect.py Lib/json Lib/json/tests Lib/lib2to3 Lib/lib2to3/fixes Lib/lib2to3/pgen2 Lib/lib2to3/tests Lib/lib2to3/tests/data Lib/lib2to3/tests/data/fixers Lib/lib2to3/tests/data/fixers/myfixes Lib/locale.py Lib/logging Lib/logging/__init__.py Lib/logging/config.py Lib/logging/handlers.py Lib/msilib Lib/multiprocessing Lib/multiprocessing/dummy Lib/multiprocessing/pool.py Lib/pickle.py Lib/pickletools.py Lib/plat-aix4 Lib/plat-darwin Lib/plat-freebsd4 Lib/plat-freebsd5 Lib/plat-freebsd6 Lib/plat-freebsd7 Lib/plat-freebsd8 Lib/plat-generic Lib/plat-linux2 Lib/plat-netbsd1 Lib/plat-next3 Lib/plat-os2emx Lib/plat-sunos5 Lib/plat-unixware7 Lib/plistlib.py Lib/py_compile.py Lib/pydoc.py Lib/pydoc_data Lib/runpy.py Lib/shutil.py Lib/site-packages Lib/site.py Lib/sqlite3 Lib/sqlite3/test Lib/ssl.py Lib/subprocess.py Lib/test Lib/test/crashers Lib/test/decimaltestdata Lib/test/gdb_sample.py Lib/test/leakers Lib/test/lock_tests.py Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/script_helper.py Lib/test/support.py Lib/test/test_argparse.py Lib/test/test_bytes.py Lib/test/test_cmd_line.py Lib/test/test_cmd_line_script.py Lib/test/test_compileall.py Lib/test/test_datetime.py Lib/test/test_difflib.py Lib/test/test_frozen.py Lib/test/test_functools.py Lib/test/test_gdb.py Lib/test/test_genericpath.py Lib/test/test_imp.py Lib/test/test_import.py Lib/test/test_linecache.py Lib/test/test_locale.py Lib/test/test_logging.py Lib/test/test_os.py Lib/test/test_pkg.py Lib/test/test_pkgimport.py Lib/test/test_plistlib.py Lib/test/test_pydoc.py Lib/test/test_runpy.py Lib/test/test_set.py Lib/test/test_shutil.py Lib/test/test_signal.py Lib/test/test_site.py Lib/test/test_ssl.py Lib/test/test_urllib2net.py Lib/test/test_urlparse.py Lib/test/test_uuid.py Lib/test/test_warnings.py Lib/test/test_winsound.py Lib/test/test_zipfile.py Lib/test/test_zipimport.py Lib/test/win_console_handler.py Lib/test/xmltestdata Lib/threading.py Lib/tkinter Lib/tkinter/test Lib/tkinter/test/test_tkinter Lib/tkinter/test/test_ttk Lib/tkinter/test/test_ttk/test_widgets.py Lib/unittest Lib/unittest/case.py Lib/unittest/loader.py Lib/unittest/main.py Lib/unittest/result.py Lib/unittest/runner.py Lib/unittest/test Lib/unittest/test/dummy.py Lib/unittest/test/test_assertions.py Lib/unittest/test/test_break.py Lib/unittest/test/test_discovery.py Lib/unittest/test/test_loader.py Lib/unittest/test/test_result.py Lib/urllib Lib/urllib/parse.py Lib/urllib/request.py Lib/wsgiref Lib/xml Lib/xml/dom Lib/xml/etree Lib/xml/parsers Lib/xml/sax Lib/xmlrpc Lib/xmlrpc/server.py Lib/zipfile.py Mac/BuildScript/build-installer.py Mac/BuildScript/scripts/postflight.framework Mac/Makefile.in Mac/PythonLauncher/Makefile.in Mac/Tools/pythonw.c Makefile.pre.in Misc/ACKS Misc/NEWS Misc/developers.txt Misc/maintainers.rst Modules/_ctypes/callproc.c Modules/_ctypes/libffi/src/sparc/v8.S Modules/_pickle.c Modules/_posixsubprocess.c Modules/_scproxy.c Modules/_sre.c Modules/_ssl.c Modules/_threadmodule.c Modules/datetimemodule.c Modules/main.c Modules/posixmodule.c Modules/python.c Modules/signalmodule.c Objects/bytearrayobject.c Objects/bytesobject.c Objects/setobject.c PC/_subprocess.c Python/import.c Python/pythonrun.c Python/thread_nt.h Python/thread_pthread.h Tools/README Tools/gdb Tools/i18n/makelocalealias.py configure configure.in setup.py

stefan.krah python-checkins at python.org
Wed Apr 21 13:06:20 CEST 2010


Author: stefan.krah
Date: Wed Apr 21 13:06:18 2010
New Revision: 80304

Log:
Merged revisions 79906,79912,79922,79931,79933,79946,79948,79953,79955-79958,79960,79964-79976,79978,79980-79981,79983,79990,79992,79996-79997,79999,80002,80006,80008,80010,80016,80019-80020,80023,80027,80031,80036,80040,80044,80061,80066,80071,80075,80078,80083,80092,80102,80105-80106,80108-80109,80111-80112,80114-80116,80122,80125,80128,80130,80135,80137-80138,80140-80141,80143,80148,80153-80154,80157-80159,80161,80163,80167,80170,80176,80181-80182,80185,80190-80191,80195-80196,80198,80200,80205-80207,80211-80212,80217,80219,80224,80228,80230,80233,80240,80244,80246,80248,80251,80253,80256,80259,80261,80263,80266,80272-80273,80275-80276,80278,80280,80286,80289-80291,80293,80296,80299-80300,80302-80303 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79906 | brian.curtin | 2010-04-08 15:55:29 +0200 (Thu, 08 Apr 2010) | 2 lines
  
  Add MatchObject.groups which got messed up during a merge.
................
  r79912 | antoine.pitrou | 2010-04-09 22:42:09 +0200 (Fri, 09 Apr 2010) | 10 lines
  
  Merged revisions 79910 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79910 | antoine.pitrou | 2010-04-09 22:38:39 +0200 (ven., 09 avril 2010) | 4 lines
    
    SSL_MODE_AUTO_RETRY has been added in OpenSSL 0.9.6.  Fix compilation
    with earlier versions.
  ........
................
  r79922 | raymond.hettinger | 2010-04-10 09:09:53 +0200 (Sat, 10 Apr 2010) | 1 line
  
  Fixup new itertools recipes.
................
  r79931 | raymond.hettinger | 2010-04-10 18:59:03 +0200 (Sat, 10 Apr 2010) | 1 line
  
  Issue 8361: Remove assert from functools.total_ordering
................
  r79933 | benjamin.peterson | 2010-04-10 20:57:52 +0200 (Sat, 10 Apr 2010) | 20 lines
  
  Blocked revisions 79927-79928,79930,79932 via svnmerge
  
  ........
    r79927 | benjamin.peterson | 2010-04-10 11:22:05 -0500 (Sat, 10 Apr 2010) | 1 line
    
    bump version to 2.7b1
  ........
    r79928 | benjamin.peterson | 2010-04-10 11:28:34 -0500 (Sat, 10 Apr 2010) | 1 line
    
    update pydoc-topics
  ........
    r79930 | raymond.hettinger | 2010-04-10 11:57:36 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Issue 8361: Remove assert from functools.total_ordering
  ........
    r79932 | benjamin.peterson | 2010-04-10 13:53:58 -0500 (Sat, 10 Apr 2010) | 1 line
    
    towards beta 2
  ........
................
  r79946 | benjamin.peterson | 2010-04-11 03:43:16 +0200 (Sun, 11 Apr 2010) | 9 lines
  
  Merged revisions 79944 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79944 | benjamin.peterson | 2010-04-10 20:40:32 -0500 (Sat, 10 Apr 2010) | 1 line
    
    add test for class with no operations defined
  ........
................
  r79948 | benjamin.peterson | 2010-04-11 04:17:08 +0200 (Sun, 11 Apr 2010) | 162 lines
  
  Blocked revisions 79285,79292,79384,79387,79480-79481,79483,79509,79511,79528,79549,79569,79575-79578,79625,79650-79651,79706,79710,79713,79722,79730,79744,79750,79755,79808,79915,79918,79920,79937,79939 via svnmerge
  
  ................
    r79285 | jesus.cea | 2010-03-22 09:22:26 -0500 (Mon, 22 Mar 2010) | 1 line
    
    pybsddb 4.8.4 integration. Please, comment in issue #8156
  ................
    r79292 | jesus.cea | 2010-03-22 10:18:46 -0500 (Mon, 22 Mar 2010) | 1 line
    
    Missing testsuite files
  ................
    r79384 | antoine.pitrou | 2010-03-24 16:55:12 -0500 (Wed, 24 Mar 2010) | 3 lines
    
    Trying to fix #8108.  Will watch the buildbot(s).
  ................
    r79387 | antoine.pitrou | 2010-03-24 17:12:15 -0500 (Wed, 24 Mar 2010) | 3 lines
    
    Revert r79384 (the fix failed).
  ................
    r79480 | raymond.hettinger | 2010-03-28 13:02:41 -0500 (Sun, 28 Mar 2010) | 1 line
    
    Update itertools recipes.
  ................
    r79481 | raymond.hettinger | 2010-03-28 13:08:15 -0500 (Sun, 28 Mar 2010) | 1 line
    
    Add a note on optimizing the itertools recipes for production.
  ................
    r79483 | raymond.hettinger | 2010-03-28 13:25:01 -0500 (Sun, 28 Mar 2010) | 1 line
    
    Update itertools recipe for consume().
  ................
    r79509 | thomas.heller | 2010-03-30 14:46:23 -0500 (Tue, 30 Mar 2010) | 24 lines
    
    Merged revisions 79115,79424,79491 via svnmerge from 
    svn+ssh://pythondev@svn.python.org/python/branches/branch_libffi-3_0_10-win
    
    ........
      r79115 | thomas.heller | 2010-03-19 22:14:47 +0100 (Fr, 19 Mrz 2010) | 7 lines
      
      Work in progress.  2 tests fail on x86/win32 because the stack
      checking code in ffi_call_win32 is not yet implemented.
      
      Remove most files from _ctypes/libffi_msvc, only two include files
      stay (updated from _ctypes/libffi/...).  Other files are used in the
      cross-platform _ctypes/libffi directory.
    ........
      r79424 | thomas.heller | 2010-03-25 19:28:02 +0100 (Do, 25 Mrz 2010) | 1 line
      
      Build _ctypes on Win64.
    ........
      r79491 | thomas.heller | 2010-03-29 21:30:33 +0200 (Mo, 29 Mrz 2010) | 4 lines
      
      On Windows, ctypes does no longer check the stack before and after
      calling a foreign function.
      This allows to use the unmodified libffi library.
    ........
  ................
    r79511 | thomas.heller | 2010-03-30 14:55:34 -0500 (Tue, 30 Mar 2010) | 3 lines
    
    Removed merge tracking for "svnmerge" for 
    svn+ssh://pythondev@svn.python.org/python/branches/branch_libffi-3_0_10-win
  ................
    r79528 | ezio.melotti | 2010-03-31 03:33:50 -0500 (Wed, 31 Mar 2010) | 1 line
    
    Silence a py3k warning.
  ................
    r79549 | raymond.hettinger | 2010-04-01 02:54:16 -0500 (Thu, 01 Apr 2010) | 1 line
    
    Document link to Sorting HowTo
  ................
    r79569 | raymond.hettinger | 2010-04-01 21:44:31 -0500 (Thu, 01 Apr 2010) | 1 line
    
    Add and update itertools recipes.
  ................
    r79575 | raymond.hettinger | 2010-04-02 01:23:12 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Cleanup itertools recipes
  ................
    r79576 | florent.xicluna | 2010-04-02 02:24:52 -0500 (Fri, 02 Apr 2010) | 2 lines
    
    #7092: Fix additional "-3" warnings in the idlelib package, and convert to absolute imports.
  ................
    r79577 | florent.xicluna | 2010-04-02 03:15:26 -0500 (Fri, 02 Apr 2010) | 2 lines
    
    #7092: Drop the cmp argument.
  ................
    r79578 | florent.xicluna | 2010-04-02 03:30:21 -0500 (Fri, 02 Apr 2010) | 2 lines
    
    #7092: silence some py3k warnings
  ................
    r79625 | brian.curtin | 2010-04-02 16:51:37 -0500 (Fri, 02 Apr 2010) | 2 lines
    
    Add a line about #7347 to Misc\News
  ................
    r79650 | raymond.hettinger | 2010-04-02 22:14:28 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Improve clear() method.  Keeps key/value refcnts >= 1 until final dict.clear() so that decrefs to zero won't trigger arbitrary code .  Also runs a bit faster.
  ................
    r79651 | raymond.hettinger | 2010-04-03 02:57:09 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Factor-out constant expressions
  ................
    r79706 | benjamin.peterson | 2010-04-03 11:06:42 -0500 (Sat, 03 Apr 2010) | 1 line
    
    stop CObject deprecation warnings in test___all__
  ................
    r79710 | mark.dickinson | 2010-04-03 11:54:02 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Replace backquotes with repr(), to silence a SyntaxWarning.
  ................
    r79713 | raymond.hettinger | 2010-04-03 13:10:37 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Add count() method to collections.deque().
  ................
    r79722 | raymond.hettinger | 2010-04-03 17:34:15 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Expand test coverage for deque.count().
  ................
    r79730 | raymond.hettinger | 2010-04-03 20:24:59 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Issue 5479:  Add functools.total_ordering class decorator.
  ................
    r79744 | raymond.hettinger | 2010-04-04 02:33:46 -0500 (Sun, 04 Apr 2010) | 1 line
    
    Documentation nit
  ................
    r79750 | raymond.hettinger | 2010-04-04 13:34:45 -0500 (Sun, 04 Apr 2010) | 1 line
    
    Add functools.CmpToKey()
  ................
    r79755 | raymond.hettinger | 2010-04-04 16:45:01 -0500 (Sun, 04 Apr 2010) | 6 lines
    
    Add tests for cmp_to_key.
    Adopt PEP 8 compliant function name.
    Factor-out existing uses cmp_to_key.
    Update documentation to use internal pointers instead of external resource.
  ................
    r79808 | raymond.hettinger | 2010-04-05 13:53:43 -0500 (Mon, 05 Apr 2010) | 1 line
    
    Classes that override __eq__ also need to define __hash__.
  ................
    r79915 | antoine.pitrou | 2010-04-09 16:00:36 -0500 (Fri, 09 Apr 2010) | 3 lines
    
    Temporarily commit fix to issue #8108, to check for buildbot response
  ................
    r79918 | antoine.pitrou | 2010-04-09 17:41:31 -0500 (Fri, 09 Apr 2010) | 3 lines
    
    Revert r79915 (temporary commit to check for buildbots -> the fix was successful)
  ................
    r79920 | raymond.hettinger | 2010-04-10 02:01:32 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Fixup new itertools recipes.
  ................
    r79937 | antoine.pitrou | 2010-04-10 17:43:05 -0500 (Sat, 10 Apr 2010) | 3 lines
    
    Temporary commit of fix to issue #5380 (in order to watch buildbot response)
  ................
    r79939 | raymond.hettinger | 2010-04-10 19:01:23 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Add the sorting HOWTO to the main docs.
  ................
................
  r79953 | benjamin.peterson | 2010-04-11 16:49:17 +0200 (Sun, 11 Apr 2010) | 12 lines
  
  Blocked revisions 79938,79949 via svnmerge
  
  ........
    r79938 | antoine.pitrou | 2010-04-10 18:32:12 -0500 (Sat, 10 Apr 2010) | 3 lines
    
    Revert temporary commit in r79937
  ........
    r79949 | raymond.hettinger | 2010-04-11 03:14:45 -0500 (Sun, 11 Apr 2010) | 1 line
    
    Add descriptor howto to main documentation
  ........
................
  r79955 | benjamin.peterson | 2010-04-11 17:41:33 +0200 (Sun, 11 Apr 2010) | 20 lines
  
  Blocked revisions 79493,79515,79637,79760 via svnmerge
  
  ........
    r79493 | michael.foord | 2010-03-29 15:04:23 -0500 (Mon, 29 Mar 2010) | 1 line
    
    Backport of weakref.WeakSet and tests from Python 3.
  ........
    r79515 | thomas.heller | 2010-03-30 15:57:06 -0500 (Tue, 30 Mar 2010) | 1 line
    
    Revert rev. 79509; ctypes doesn't build on linux.
  ........
    r79637 | raymond.hettinger | 2010-04-02 19:39:26 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Clear cyclical references in list based OrderedDict.
  ........
    r79760 | raymond.hettinger | 2010-04-04 17:24:03 -0500 (Sun, 04 Apr 2010) | 1 line
    
    Add tests for functools.total_ordering.
  ........
................
  r79956 | benjamin.peterson | 2010-04-11 18:12:57 +0200 (Sun, 11 Apr 2010) | 122 lines
  
  Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79307 | florent.xicluna | 2010-03-22 17:45:50 -0500 (Mon, 22 Mar 2010) | 2 lines
    
    #7667: Fix doctest failures with non-ASCII paths.
  ........
    r79408 | victor.stinner | 2010-03-24 20:18:38 -0500 (Wed, 24 Mar 2010) | 2 lines
    
    Fix a gcc warning introduced by r79397.
  ........
    r79430 | brian.curtin | 2010-03-25 18:48:54 -0500 (Thu, 25 Mar 2010) | 2 lines
    
    Fix #6538. Markup RegexObject and MatchObject as classes. Patch by Ryan Arana.
  ........
    r79533 | barry.warsaw | 2010-03-31 16:07:16 -0500 (Wed, 31 Mar 2010) | 6 lines
    
    - 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
      patch by Piotr O?\197?\188arowski).
  ........
    r79542 | r.david.murray | 2010-03-31 20:28:39 -0500 (Wed, 31 Mar 2010) | 3 lines
    
    A couple small grammar fixes in test.rst, and rewrite the
    check_warnings docs to be clearer.
  ........
    r79579 | georg.brandl | 2010-04-02 03:34:41 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Add 2.6.5.
  ........
    r79580 | georg.brandl | 2010-04-02 03:39:09 -0500 (Fri, 02 Apr 2010) | 1 line
    
    #2768: add a note on how to get a file descriptor.
  ........
    r79585 | georg.brandl | 2010-04-02 04:03:18 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Remove col-spanning cells in logging docs.
  ........
    r79586 | georg.brandl | 2010-04-02 04:07:42 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Document PyImport_ExecCodeModuleEx().
  ........
    r79587 | georg.brandl | 2010-04-02 04:11:49 -0500 (Fri, 02 Apr 2010) | 1 line
    
    #8012: clarification in generator glossary entry.
  ........
    r79607 | andrew.kuchling | 2010-04-02 12:48:23 -0500 (Fri, 02 Apr 2010) | 1 line
    
    #6647: document that catch_warnings is not thread-safe
  ........
    r79608 | andrew.kuchling | 2010-04-02 12:54:26 -0500 (Fri, 02 Apr 2010) | 1 line
    
    #6647: add note to two examples
  ........
    r79622 | tarek.ziade | 2010-04-02 16:34:19 -0500 (Fri, 02 Apr 2010) | 1 line
    
    removed documentation on code that was reverted and pushed into distutils2
  ........
    r79717 | antoine.pitrou | 2010-04-03 16:22:38 -0500 (Sat, 03 Apr 2010) | 4 lines
    
    Fix wording / typography, and a slightly misleading statement
    (memoryviews don't support complex structures right now)
  ........
    r79820 | benjamin.peterson | 2010-04-05 22:34:09 -0500 (Mon, 05 Apr 2010) | 1 line
    
    ready _sre types
  ........
    r79822 | georg.brandl | 2010-04-06 03:18:15 -0500 (Tue, 06 Apr 2010) | 1 line
    
    #8320: document return value of recv_into().
  ........
    r79828 | georg.brandl | 2010-04-06 09:33:44 -0500 (Tue, 06 Apr 2010) | 1 line
    
    Add JP.
  ........
    r79862 | georg.brandl | 2010-04-06 15:27:59 -0500 (Tue, 06 Apr 2010) | 1 line
    
    Fix syntax.
  ........
    r79875 | mark.dickinson | 2010-04-06 17:18:23 -0500 (Tue, 06 Apr 2010) | 1 line
    
    More NaN consistency doc fixes.
  ........
    r79923 | georg.brandl | 2010-04-10 06:15:24 -0500 (Sat, 10 Apr 2010) | 1 line
    
    #8360: skipTest was added in 2.7.
  ........
    r79924 | georg.brandl | 2010-04-10 06:16:59 -0500 (Sat, 10 Apr 2010) | 1 line
    
    #8346: update version.
  ........
    r79941 | andrew.kuchling | 2010-04-10 20:39:36 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Two grammar fixes
  ........
    r79942 | andrew.kuchling | 2010-04-10 20:40:06 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Punctuation fix
  ........
    r79943 | andrew.kuchling | 2010-04-10 20:40:30 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Add various items
  ........
    r79945 | andrew.kuchling | 2010-04-10 20:40:49 -0500 (Sat, 10 Apr 2010) | 1 line
    
    name correct
  ........
    r79947 | andrew.kuchling | 2010-04-10 20:44:13 -0500 (Sat, 10 Apr 2010) | 1 line
    
    Remove distutils section
  ........
    r79951 | andrew.kuchling | 2010-04-11 07:48:08 -0500 (Sun, 11 Apr 2010) | 1 line
    
    Two typo fixes
  ........
    r79952 | andrew.kuchling | 2010-04-11 07:49:37 -0500 (Sun, 11 Apr 2010) | 1 line
    
    Add two items
  ........
................
  r79957 | benjamin.peterson | 2010-04-11 18:13:23 +0200 (Sun, 11 Apr 2010) | 1 line
  
  add 3.1.2
................
  r79958 | benjamin.peterson | 2010-04-11 18:25:06 +0200 (Sun, 11 Apr 2010) | 37 lines
  
  Merged revisions 79279,79284,79293,79373,79376,79379,79876,79888 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79279 | vinay.sajip | 2010-03-22 07:33:08 -0500 (Mon, 22 Mar 2010) | 1 line
    
    Issue #8200: logging: Handle errors when multiprocessing is not fully loaded when logging occurs.
  ........
    r79284 | vinay.sajip | 2010-03-22 08:02:28 -0500 (Mon, 22 Mar 2010) | 1 line
    
    Issue #8201: logging: Handle config errors when non-ASCII and Unicode logger names exist at the same time.
  ........
    r79293 | vinay.sajip | 2010-03-22 10:29:01 -0500 (Mon, 22 Mar 2010) | 1 line
    
    logging: Added getChild utility method to Logger and added isEnabledFor method to LoggerAdapter.
  ........
    r79373 | vinay.sajip | 2010-03-24 09:31:21 -0500 (Wed, 24 Mar 2010) | 1 line
    
    logging: Added LOG_FTP for SysLogHandler and updated documentation.
  ........
    r79376 | vinay.sajip | 2010-03-24 10:10:40 -0500 (Wed, 24 Mar 2010) | 1 line
    
    logging: Documentation tweak.
  ........
    r79379 | vinay.sajip | 2010-03-24 12:36:35 -0500 (Wed, 24 Mar 2010) | 1 line
    
    logging: Updated SysLogHandler documentation.
  ........
    r79876 | vinay.sajip | 2010-04-06 17:32:37 -0500 (Tue, 06 Apr 2010) | 1 line
    
    Issue #8327: logging: Clarification of propagation functionality in documentation.
  ........
    r79888 | vinay.sajip | 2010-04-07 04:40:52 -0500 (Wed, 07 Apr 2010) | 1 line
    
    Issue #8331: logging: fixed some grammatical errors in documentation.
  ........
................
  r79960 | stefan.krah | 2010-04-11 18:49:20 +0200 (Sun, 11 Apr 2010) | 22 lines
  
  Merged revisions 79954 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79954 | stefan.krah | 2010-04-11 17:15:54 +0200 (Sun, 11 Apr 2010) | 17 lines
    
    
    Fix for issues #3581, #1481 and #7650:
    
    1. The assumptions in check_node() were too restrictive:
    
         - Hardware addresses with universal_local_bit=1 are valid
           (locally administered).
    
         - Many of the tested functions (including uuid.getnode())
           may return valid RFC 4122 random node IDs. These are pretty
           much random 48-bit values with the multicast bit set to 1.
    
    2. _unixdll_getnode() calls _uuid_generate_time(), which may be None
       on some platforms. The resulting TypeError is now caught.
  ........
................
  r79964 | raymond.hettinger | 2010-04-11 22:41:56 +0200 (Sun, 11 Apr 2010) | 1 line
  
  Minor factoring
................
  r79965 | benjamin.peterson | 2010-04-11 22:43:16 +0200 (Sun, 11 Apr 2010) | 95 lines
  
  Merged revisions 79464,79471,79623,79626,79630,79632,79643,79648-79649,79679,79685,79711,79761,79774,79777,79792-79794,79877,79898-79900 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79464 | michael.foord | 2010-03-27 07:55:19 -0500 (Sat, 27 Mar 2010) | 1 line
    
    A fix for running unittest tests on platforms without the audioop module (e.g. jython and IronPython)
  ........
    r79471 | michael.foord | 2010-03-27 14:10:11 -0500 (Sat, 27 Mar 2010) | 4 lines
    
    Addition of delta keyword argument to unittest.TestCase.assertAlmostEquals and assertNotAlmostEquals
    
    This allows the comparison of objects by specifying a maximum difference; this includes the comparing of non-numeric objects that don't support rounding.
  ........
    r79623 | michael.foord | 2010-04-02 16:42:47 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Addition of -b command line option to unittest for buffering stdout and stderr during test runs.
  ........
    r79626 | michael.foord | 2010-04-02 17:08:29 -0500 (Fri, 02 Apr 2010) | 1 line
    
    TestResult stores original sys.stdout and tests no longer use sys.__stdout__ (etc) in tests for unittest -b command line option
  ........
    r79630 | michael.foord | 2010-04-02 17:30:56 -0500 (Fri, 02 Apr 2010) | 1 line
    
    unittest tests no longer replace the sys.stdout put in place by regrtest
  ........
    r79632 | michael.foord | 2010-04-02 17:55:59 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Issue #8038: Addition of unittest.TestCase.assertNotRegexpMatches
  ........
    r79643 | michael.foord | 2010-04-02 20:15:21 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Support dotted module names for test discovery paths in unittest. Issue 8038.
  ........
    r79648 | michael.foord | 2010-04-02 21:21:39 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Cross platform unittest.TestResult newline handling when buffering stdout / stderr.
  ........
    r79649 | michael.foord | 2010-04-02 21:33:55 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Another attempt at a fix for unittest.test.test_result for windows line endings
  ........
    r79679 | michael.foord | 2010-04-03 09:52:18 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Adding -b command line option to the unittest usage message.
  ........
    r79685 | michael.foord | 2010-04-03 10:20:00 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Minor tweak to unittest command line usage message
  ........
    r79711 | michael.foord | 2010-04-03 12:03:11 -0500 (Sat, 03 Apr 2010) | 1 line
    
    Documenting new features in unittest
  ........
    r79761 | michael.foord | 2010-04-04 17:41:54 -0500 (Sun, 04 Apr 2010) | 1 line
    
    unittest documentation formatting changes
  ........
    r79774 | michael.foord | 2010-04-04 18:28:44 -0500 (Sun, 04 Apr 2010) | 1 line
    
    Adding documentation for new unittest.main() parameters
  ........
    r79777 | michael.foord | 2010-04-04 19:39:50 -0500 (Sun, 04 Apr 2010) | 1 line
    
    Document signal handling functions in unittest.rst
  ........
    r79792 | michael.foord | 2010-04-05 05:26:26 -0500 (Mon, 05 Apr 2010) | 1 line
    
    Documentation fixes for unittest
  ........
    r79793 | michael.foord | 2010-04-05 05:28:27 -0500 (Mon, 05 Apr 2010) | 1 line
    
    Furterh documentation fix for unittest.rst
  ........
    r79794 | michael.foord | 2010-04-05 05:30:14 -0500 (Mon, 05 Apr 2010) | 1 line
    
    Further documentation fix for unittest.rst
  ........
    r79877 | michael.foord | 2010-04-06 18:18:16 -0500 (Tue, 06 Apr 2010) | 1 line
    
    Fix module directory finding logic for dotted paths in unittest test discovery.
  ........
    r79898 | michael.foord | 2010-04-07 18:04:22 -0500 (Wed, 07 Apr 2010) | 1 line
    
    unittest.result.TestResult does not create its buffers until they're used. It uses StringIO not cStringIO. Issue 8333.
  ........
    r79899 | michael.foord | 2010-04-07 19:04:24 -0500 (Wed, 07 Apr 2010) | 1 line
    
    Switch regrtest to use StringIO instead of cStringIO for test_multiprocessing on Windows. Issue 8333.
  ........
    r79900 | michael.foord | 2010-04-07 23:33:20 -0500 (Wed, 07 Apr 2010) | 1 line
    
    Correction of unittest documentation typos and omissions
  ........
................
  r79966 | benjamin.peterson | 2010-04-11 22:49:42 +0200 (Sun, 11 Apr 2010) | 8 lines
  
  Blocked revisions 79962 via svnmerge
  
  ........
    r79962 | raymond.hettinger | 2010-04-11 15:39:28 -0500 (Sun, 11 Apr 2010) | 1 line
    
    Minor factoring
  ........
................
  r79967 | benjamin.peterson | 2010-04-11 23:03:55 +0200 (Sun, 11 Apr 2010) | 15 lines
  
  Blocked revisions 79935 via svnmerge
  
  ........
    r79935 | jean-paul.calderone | 2010-04-10 14:59:28 -0500 (Sat, 10 Apr 2010) | 9 lines
    
    Refactor a couple inspect module tests to remove duplicate code
    
    The test_classify_oldstyle and test_classify_newstyle methods of
    test.test_inspect.TestClassesAndFunctions were previously almost
    identical (aside from irrelevant whitespace and one semantic
    difference).  They now share a single helper.
    
    Fixes issue #8363.
  ........
................
  r79968 | benjamin.peterson | 2010-04-11 23:16:33 +0200 (Sun, 11 Apr 2010) | 10 lines
  
  Merged revisions 79936 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79936 | philip.jenvey | 2010-04-10 15:27:15 -0500 (Sat, 10 Apr 2010) | 3 lines
    
    fix PYTHONWARNINGS handling to not modify the original env value and improve
    its tests
  ........
................
  r79969 | benjamin.peterson | 2010-04-11 23:22:10 +0200 (Sun, 11 Apr 2010) | 9 lines
  
  Merged revisions 79934 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79934 | philip.jenvey | 2010-04-10 14:39:07 -0500 (Sat, 10 Apr 2010) | 1 line
    
    adjust gc_collect for Jython
  ........
................
  r79970 | benjamin.peterson | 2010-04-11 23:39:55 +0200 (Sun, 11 Apr 2010) | 3 lines
  
  Rolled back revisions 79307 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
................
  r79971 | benjamin.peterson | 2010-04-11 23:49:28 +0200 (Sun, 11 Apr 2010) | 50 lines
  
  Merged revisions 79548,79557,79616-79617,79716,79778,79795,79803,79896 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79548 | martin.v.loewis | 2010-04-01 02:40:51 -0500 (Thu, 01 Apr 2010) | 3 lines
    
    Issue #8032: For gdb7, a python-gdb.py file is added to the build,
    allowing to use advanced gdb features when debugging Python.
  ........
    r79557 | antoine.pitrou | 2010-04-01 12:56:57 -0500 (Thu, 01 Apr 2010) | 5 lines
    
    Issue #8281: rename test_gdb_sample.py to gdb_sample.py, otherwise it gets picked
    as a regular test by regrtest.py, and fails.
  ........
    r79616 | mark.dickinson | 2010-04-02 15:22:21 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Add python.exe-gdb.py to svn:ignore, for the benefit of OS X developers.
  ........
    r79617 | mark.dickinson | 2010-04-02 15:34:26 -0500 (Fri, 02 Apr 2010) | 1 line
    
    Add python-gdb.py and python.exe-gdb.py to distclean target in Makefile.
  ........
    r79716 | martin.v.loewis | 2010-04-03 13:54:07 -0500 (Sat, 03 Apr 2010) | 2 lines
    
    Don't install python-gdb.py as an executable.
  ........
    r79778 | r.david.murray | 2010-04-04 20:34:50 -0500 (Sun, 04 Apr 2010) | 3 lines
    
    Issue 8287: try to fix the gdb-python install errors on Solaris
    and FreeBSD.  Patch by Dave Malcolm.
  ........
    r79795 | ronald.oussoren | 2010-04-05 06:21:21 -0500 (Mon, 05 Apr 2010) | 7 lines
    
    Ensure that the gdb hooks can be installed when
    srcdir != builddir.
    
    Without this patch it is no longer possible to
    build python when you don't run configure from
    the root of the source tree.
  ........
    r79803 | r.david.murray | 2010-04-05 11:28:49 -0500 (Mon, 05 Apr 2010) | 3 lines
    
    Issue 8316: make test_gdb robust in the face of differing terminal
    widths.  Patch by Dave Malcolm.
  ........
    r79896 | martin.v.loewis | 2010-04-07 14:11:32 -0500 (Wed, 07 Apr 2010) | 2 lines
    
    Issue #8337: Disable the remaining test also for now.
  ........
................
  r79972 | benjamin.peterson | 2010-04-11 23:56:02 +0200 (Sun, 11 Apr 2010) | 8 lines
  
  Blocked revisions 79307 via svnmerge
  
  ........
    r79307 | florent.xicluna | 2010-03-22 17:45:50 -0500 (Mon, 22 Mar 2010) | 2 lines
    
    #7667: Fix doctest failures with non-ASCII paths.
  ........
................
  r79973 | benjamin.peterson | 2010-04-11 23:59:57 +0200 (Sun, 11 Apr 2010) | 9 lines
  
  Merged revisions 79908 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79908 | martin.v.loewis | 2010-04-08 12:40:54 -0500 (Thu, 08 Apr 2010) | 2 lines
    
    Issue #8348: Fix test ftp url in test_urllib2net.
  ........
................
  r79974 | benjamin.peterson | 2010-04-12 00:04:51 +0200 (Mon, 12 Apr 2010) | 13 lines
  
  Merged revisions 79903,79907 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79903 | martin.v.loewis | 2010-04-08 04:47:40 -0500 (Thu, 08 Apr 2010) | 2 lines
    
    Issue #8344: Fix test_ttk bug on FreeBSD.
  ........
    r79907 | martin.v.loewis | 2010-04-08 12:38:32 -0500 (Thu, 08 Apr 2010) | 2 lines
    
    Issue #8204: Fix test_ttk notebook test by forcing focus.
  ........
................
  r79975 | benjamin.peterson | 2010-04-12 00:14:02 +0200 (Mon, 12 Apr 2010) | 15 lines
  
  Merged revisions 79902 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79902 | ronald.oussoren | 2010-04-08 03:13:31 -0500 (Thu, 08 Apr 2010) | 9 lines
    
    This check-in fixes two problems:
    
    1) A non-critical off-by-one error in pythonw
    
    2) A problem in the configure script that caused
       builds with '--enable-framework --enable-universalsdk=/'
       to fail on OSX 10.6.
  ........
................
  r79976 | benjamin.peterson | 2010-04-12 00:15:28 +0200 (Mon, 12 Apr 2010) | 1 line
  
  regen configure
................
  r79978 | antoine.pitrou | 2010-04-12 00:35:34 +0200 (Mon, 12 Apr 2010) | 10 lines
  
  Merged revisions 79977 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79977 | antoine.pitrou | 2010-04-12 00:32:39 +0200 (lun., 12 avril 2010) | 4 lines
    
    Issue #8374: Update the internal alias table in the :mod:`locale` module
    to cover recent locale changes and additions.
  ........
................
  r79980 | antoine.pitrou | 2010-04-12 00:47:34 +0200 (Mon, 12 Apr 2010) | 8 lines
  
  Blocked revisions 79979 via svnmerge
  
  ........
    r79979 | antoine.pitrou | 2010-04-12 00:45:47 +0200 (lun., 12 avril 2010) | 3 lines
    
    Fix misplaced items and incorrect title.
  ........
................
  r79981 | benjamin.peterson | 2010-04-12 01:51:24 +0200 (Mon, 12 Apr 2010) | 1 line
  
  compare with empty bytes
................
  r79983 | antoine.pitrou | 2010-04-12 02:16:50 +0200 (Mon, 12 Apr 2010) | 14 lines
  
  Merged revisions 79982 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79982 | antoine.pitrou | 2010-04-12 02:10:46 +0200 (lun., 12 avril 2010) | 8 lines
    
    It is possible to add extra testing options using EXTRATESTOPTS.
    When such extra options include "-x testname", subsequent arguments
    are all taken as test names to ignore. Therefore, standard options
    must be passed before *TESTOPTS.
    
    (witnessed on the ARM buildbots)
  ........
................
  r79990 | senthil.kumaran | 2010-04-12 09:03:17 +0200 (Mon, 12 Apr 2010) | 9 lines
  
  Merged revisions 79988 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79988 | senthil.kumaran | 2010-04-12 12:20:24 +0530 (Mon, 12 Apr 2010) | 3 lines
    
    Adding additional examples of valid urls as per RFC 3986 (for issue8339)
  ........
................
  r79992 | tarek.ziade | 2010-04-12 10:23:49 +0200 (Mon, 12 Apr 2010) | 1 line
  
  Fixed #8375 - test_distutils now checks what remains to be cleaned up during tearDown
................
  r79996 | r.david.murray | 2010-04-12 16:48:58 +0200 (Mon, 12 Apr 2010) | 15 lines
  
  Merged revisions 79994 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79994 | r.david.murray | 2010-04-12 10:26:06 -0400 (Mon, 12 Apr 2010) | 9 lines
    
    Issue #7472: ISO-2022 charsets now consistently use 7bit CTE.
    
    Fixed a typo in the email.encoders module so that messages output using
    an ISO-2022 character set will use a content-transfer-encoding of
    7bit consistently.  Previously if the input data had any eight bit
    characters the output data would get marked as 8bit even though it
    was actually 7bit.
  ........
................
  r79997 | barry.warsaw | 2010-04-12 16:50:57 +0200 (Mon, 12 Apr 2010) | 1 line
  
  typo
................
  r79999 | r.david.murray | 2010-04-12 17:19:03 +0200 (Mon, 12 Apr 2010) | 4 lines
  
  Kurt's roundup id is kbk, use that in maintainers.rst instead of
  his checkin id, since maintainers is for finding people to make
  nosy in the tracker.
................
  r80002 | stefan.krah | 2010-04-12 17:33:12 +0200 (Mon, 12 Apr 2010) | 9 lines
  
  Merged revisions 80000 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80000 | stefan.krah | 2010-04-12 17:21:25 +0200 (Mon, 12 Apr 2010) | 3 lines
    
    Issue #8367: Fix spurious test failure on systems without a sound card.
  ........
................
  r80006 | r.david.murray | 2010-04-12 18:58:02 +0200 (Mon, 12 Apr 2010) | 19 lines
  
  Merged revisions 80004 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80004 | r.david.murray | 2010-04-12 12:35:19 -0400 (Mon, 12 Apr 2010) | 13 lines
    
    Issue #7585: use tab between components in unified and context diff headers.
    
    Instead of spaces between the filename and date (or whatever the string
    is that follows the filename, if any) use tabs.  This is what the unix
    'diff' command does, for example, and difflib was intended to follow
    the 'standard' way of doing diffs.  This improves compatibility with
    patch tools.  The docs and examples are also changed to recommended that
    the date format used be the ISO 8601 format, which is what modern diff
    tools emit by default.
    
    Patch by Anatoly Techtonik.
  ........
................
  r80008 | brian.curtin | 2010-04-12 19:16:38 +0200 (Mon, 12 Apr 2010) | 2 lines
  
  Port #1220212 (os.kill for Win32) to py3k.
................
  r80010 | brian.curtin | 2010-04-12 20:10:10 +0200 (Mon, 12 Apr 2010) | 9 lines
  
  Merged revisions 80009 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80009 | brian.curtin | 2010-04-12 13:07:21 -0500 (Mon, 12 Apr 2010) | 2 lines
    
    Update the Windows FAQ's text about os.kill (#1220212).
  ........
................
  r80016 | mark.dickinson | 2010-04-12 23:00:59 +0200 (Mon, 12 Apr 2010) | 29 lines
  
  Merged revisions 80013-80015 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80013 | mark.dickinson | 2010-04-12 20:25:32 +0100 (Mon, 12 Apr 2010) | 14 lines
    
    Issue #7355: Various improvements to struct module documentation.
    
     - note early on that the result of struct.pack includes padding
       bytes by default
    
     - add examples showing how order of struct fields can affect size
       (due to padding)
    
     - better headers and references; introduction to format strings
    
     - integrate packing notes into table
    
    Many thanks to Meador Inge for the patch.
  ........
    r80014 | mark.dickinson | 2010-04-12 20:46:20 +0100 (Mon, 12 Apr 2010) | 1 line
    
    Rewrap some long lines in struct module doc source.
  ........
    r80015 | mark.dickinson | 2010-04-12 21:38:36 +0100 (Mon, 12 Apr 2010) | 1 line
    
    More struct doc tweaks.
  ........
................
  r80019 | benjamin.peterson | 2010-04-12 23:18:30 +0200 (Mon, 12 Apr 2010) | 8 lines
  
  Blocked revisions 80017 via svnmerge
  
  ........
    r80017 | raymond.hettinger | 2010-04-12 16:12:06 -0500 (Mon, 12 Apr 2010) | 1 line
    
    Add usage notes for collections.Counter().
  ........
................
  r80020 | raymond.hettinger | 2010-04-12 23:45:14 +0200 (Mon, 12 Apr 2010) | 1 line
  
  Add usage notes for collections.Counter()
................
  r80023 | brian.curtin | 2010-04-13 01:33:42 +0200 (Tue, 13 Apr 2010) | 9 lines
  
  Merged revisions 80022 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80022 | brian.curtin | 2010-04-12 18:30:49 -0500 (Mon, 12 Apr 2010) | 2 lines
    
    Fix #8364. Update the setquit docstring and change a built-in to builtin.
  ........
................
  r80027 | brian.curtin | 2010-04-13 04:32:40 +0200 (Tue, 13 Apr 2010) | 11 lines
  
  Merged revisions 80026 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80026 | brian.curtin | 2010-04-12 21:25:20 -0500 (Mon, 12 Apr 2010) | 4 lines
    
    Fix #7306. Add skips to test_winsound when no default sound is configured.
    
    These failures occur on a Windows Server 2003 machine I test on.
  ........
................
  r80031 | victor.stinner | 2010-04-13 13:07:24 +0200 (Tue, 13 Apr 2010) | 4 lines
  
  Issue #8383: pickle and pickletools use surrogatepass error handler when
  encoding unicode as utf8 to support lone surrogates and stay compatible with
  Python 2.x and 3.0
................
  r80036 | mark.dickinson | 2010-04-13 13:43:10 +0200 (Tue, 13 Apr 2010) | 9 lines
  
  Merged revisions 80035 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80035 | mark.dickinson | 2010-04-13 12:37:23 +0100 (Tue, 13 Apr 2010) | 1 line
    
    In test_winsound, don't try to import _winreg until after checking that winsound is supported.
  ........
................
  r80040 | mark.dickinson | 2010-04-13 13:54:59 +0200 (Tue, 13 Apr 2010) | 1 line
  
  Fix invalid syntax.
................
  r80044 | brian.curtin | 2010-04-13 14:43:07 +0200 (Tue, 13 Apr 2010) | 2 lines
  
  Fixed extraneous _winreg (changed to winreg in py3k). Thanks, Tim Golden.
................
  r80061 | antoine.pitrou | 2010-04-13 19:37:01 +0200 (Tue, 13 Apr 2010) | 11 lines
  
  Merged revisions 80060 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80060 | antoine.pitrou | 2010-04-13 19:36:07 +0200 (mar., 13 avril 2010) | 5 lines
    
    Fix overzealous patterns in .hgignore, which used to hide files containing e.g. "python".
    
    (also an occasional source of bugs on the hgsvn-generated hg mirrors)
  ........
................
  r80066 | philip.jenvey | 2010-04-14 05:01:39 +0200 (Wed, 14 Apr 2010) | 2 lines
  
  #7301: decode $PYTHONWARNINGS in the same way as argv, test non-ascii values
................
  r80071 | antoine.pitrou | 2010-04-14 17:44:10 +0200 (Wed, 14 Apr 2010) | 6 lines
  
  Issue #7316: the acquire() method of lock objects in the :mod:`threading`
  module now takes an optional timeout argument in seconds.  Timeout support
  relies on the system threading library, so as to avoid a semi-busy wait
  loop.
................
  r80075 | philip.jenvey | 2010-04-14 19:03:38 +0200 (Wed, 14 Apr 2010) | 2 lines
  
  strings from _Py_char2wchar need PyMem_Free
................
  r80078 | r.david.murray | 2010-04-14 20:59:18 +0200 (Wed, 14 Apr 2010) | 9 lines
  
  Merged revisions 80062 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80062 | r.david.murray | 2010-04-13 16:57:40 -0400 (Tue, 13 Apr 2010) | 2 lines
    
    Issue #5277: Fix quote counting when parsing RFC 2231 encoded parameters.
  ........
................
  r80083 | georg.brandl | 2010-04-14 23:42:41 +0200 (Wed, 14 Apr 2010) | 8 lines
  
  Blocked revisions 80082 via svnmerge
  
  ........
    r80082 | georg.brandl | 2010-04-14 23:36:49 +0200 (Mi, 14 Apr 2010) | 1 line
    
    #8370: fix module name in backported doc addition.
  ........
................
  r80092 | senthil.kumaran | 2010-04-15 19:18:22 +0200 (Thu, 15 Apr 2010) | 2 lines
  
  Fix Issue5419 - explaining bytes return value of urlopen, use of .decode() to convert to str.
................
  r80102 | senthil.kumaran | 2010-04-16 05:02:13 +0200 (Fri, 16 Apr 2010) | 9 lines
  
  Merged revisions 80101 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80101 | senthil.kumaran | 2010-04-16 08:16:46 +0530 (Fri, 16 Apr 2010) | 3 lines
    
    Fix issue2987: RFC2732 support for urlparse (IPv6 addresses)
  ........
................
  r80105 | victor.stinner | 2010-04-16 13:45:13 +0200 (Fri, 16 Apr 2010) | 3 lines
  
  Issue #8412: os.system() now accepts bytes, bytearray and str with
  surrogates.
................
  r80106 | victor.stinner | 2010-04-16 14:07:30 +0200 (Fri, 16 Apr 2010) | 9 lines
  
  Merged revisions 79892 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79892 | martin.v.loewis | 2010-04-07 13:01:46 +0200 (mer., 07 avril 2010) | 2 lines
    
    Issue #8314: Fix unsigned long long bug in libffi on Sparc v8.
  ........
................
  r80108 | victor.stinner | 2010-04-16 14:23:43 +0200 (Fri, 16 Apr 2010) | 4 lines
  
  Add CS_GNU_LIBC_VERSION and CS_GNU_LIBPTHREAD_VERSION constants for constr(),
  and disable test_execvpe_with_bad_program() of test_os if the libc uses
  linuxthreads to avoid the "unknown signal 32" bug (see issue #4970).
................
  r80109 | r.david.murray | 2010-04-16 14:34:45 +0200 (Fri, 16 Apr 2010) | 5 lines
  
  maintainers.rst additions.
  
  Add Giampaolo Rodola as an expert for ftplib, and Victor Stinner
  to the 'unicode' interest area.
................
  r80111 | mark.dickinson | 2010-04-16 14:47:52 +0200 (Fri, 16 Apr 2010) | 1 line
  
  Keep confstr entries in alphabetical order.
................
  r80112 | victor.stinner | 2010-04-16 15:28:05 +0200 (Fri, 16 Apr 2010) | 3 lines
  
  Issue #7606: XML-RPC traceback stored in X-traceback is now encoded to ASCII
  using backslashreplace error handler.
................
  r80114 | mark.dickinson | 2010-04-16 15:45:35 +0200 (Fri, 16 Apr 2010) | 1 line
  
  Issue #4970:  move linuxthreads check outside the affected test, and use skipIf
................
  r80115 | mark.dickinson | 2010-04-16 15:51:27 +0200 (Fri, 16 Apr 2010) | 1 line
  
  Don't assume that os.confstr_names exists.
................
  r80116 | victor.stinner | 2010-04-16 17:10:27 +0200 (Fri, 16 Apr 2010) | 2 lines
  
  Issue #7605: Fix test_cmd_line if the current working directory is not ASCII
................
  r80122 | benjamin.peterson | 2010-04-16 23:56:43 +0200 (Fri, 16 Apr 2010) | 8 lines
  
  Blocked revisions 80121 via svnmerge
  
  ........
    r80121 | benjamin.peterson | 2010-04-16 16:55:10 -0500 (Fri, 16 Apr 2010) | 1 line
    
    remove check for unicode
  ........
................
  r80125 | benjamin.peterson | 2010-04-17 00:35:32 +0200 (Sat, 17 Apr 2010) | 13 lines
  
  Merged revisions 80123-80124 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80123 | benjamin.peterson | 2010-04-16 17:24:16 -0500 (Fri, 16 Apr 2010) | 1 line
    
    bytearray -> type2test
  ........
    r80124 | benjamin.peterson | 2010-04-16 17:25:57 -0500 (Fri, 16 Apr 2010) | 1 line
    
    fix typo
  ........
................
  r80128 | benjamin.peterson | 2010-04-17 00:51:37 +0200 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80126 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80126 | benjamin.peterson | 2010-04-16 17:35:38 -0500 (Fri, 16 Apr 2010) | 1 line
    
    have a clear error when passing something > sys.maxsize to bytearray
  ........
................
  r80130 | benjamin.peterson | 2010-04-17 01:00:53 +0200 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80129 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80129 | benjamin.peterson | 2010-04-16 17:52:44 -0500 (Fri, 16 Apr 2010) | 1 line
    
    tiny simplification
  ........
................
  r80135 | victor.stinner | 2010-04-17 01:49:32 +0200 (Sat, 17 Apr 2010) | 5 lines
  
  Issue #8393: subprocess accepts bytes, bytearray and str with surrogates for
  the current working directory.
  
  Remove also a trailing space, and replace tabulation indentation by spaces.
................
  r80137 | barry.warsaw | 2010-04-17 02:19:56 +0200 (Sat, 17 Apr 2010) | 2 lines
  
  PEP 3147
................
  r80138 | collin.winter | 2010-04-17 02:20:57 +0200 (Sat, 17 Apr 2010) | 1 line
  
  Fix the --with-cxx-main build.
................
  r80140 | benjamin.peterson | 2010-04-17 02:29:51 +0200 (Sat, 17 Apr 2010) | 1 line
  
  change svn:ignore to __pycache__
................
  r80141 | barry.warsaw | 2010-04-17 02:31:11 +0200 (Sat, 17 Apr 2010) | 1 line
  
  Remove unnecessary XXX
................
  r80143 | benjamin.peterson | 2010-04-17 04:00:25 +0200 (Sat, 17 Apr 2010) | 1 line
  
  fix svn:ignore
................
  r80148 | senthil.kumaran | 2010-04-17 16:44:14 +0200 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80146 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80146 | senthil.kumaran | 2010-04-17 20:00:53 +0530 (Sat, 17 Apr 2010) | 3 lines
    
    Fix Issue5650 - Update the RFC List in the urlparse module.
  ........
................
  r80153 | martin.v.loewis | 2010-04-17 19:11:55 +0200 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80152 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80152 | martin.v.loewis | 2010-04-17 19:10:55 +0200 (Sa, 17 Apr 2010) | 2 lines
    
    Add Giampaolo.
  ........
................
  r80154 | antoine.pitrou | 2010-04-17 19:40:45 +0200 (Sat, 17 Apr 2010) | 10 lines
  
  Merged revisions 80151 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80151 | antoine.pitrou | 2010-04-17 19:10:38 +0200 (sam., 17 avril 2010) | 4 lines
    
    Issue #8322: Add a *ciphers* argument to SSL sockets, so as to change the
    available cipher list.  Helps fix test_ssl with OpenSSL 1.0.0.
  ........
................
  r80157 | antoine.pitrou | 2010-04-18 01:51:58 +0200 (Sun, 18 Apr 2010) | 4 lines
  
  Issue #850728: Add a *timeout* parameter to the `acquire()` method of
  `threading.Semaphore` objects.  Original patch by Torsten Landschoff.
................
  r80158 | antoine.pitrou | 2010-04-18 01:52:21 +0200 (Sun, 18 Apr 2010) | 3 lines
  
  Wording in NEWS.
................
  r80159 | victor.stinner | 2010-04-18 02:00:44 +0200 (Sun, 18 Apr 2010) | 3 lines
  
  Issue #8394: _ctypes.dlopen() accepts bytes, bytearray and str with
  surrogates.
................
  r80161 | victor.stinner | 2010-04-18 09:59:53 +0200 (Sun, 18 Apr 2010) | 4 lines
  
  Issue #8340, test_abs_path() of test_site: encode paths to ASCII with
  backslashreplace to avoid locale issues, don't write stderr to a pipe to ease
  debug, separate directories by newlines instead of a space.
................
  r80163 | victor.stinner | 2010-04-18 10:23:42 +0200 (Sun, 18 Apr 2010) | 4 lines
  
  Issue #8422, test_genericpath: skip the creation of a directory with an invalid
  UTF name on Mac OS X because the OS deny it (the name have to be a valid UTF8
  string).
................
  r80167 | victor.stinner | 2010-04-18 11:11:53 +0200 (Sun, 18 Apr 2010) | 14 lines
  
  Merged revisions 80166 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80166 | victor.stinner | 2010-04-18 11:07:49 +0200 (dim., 18 avril 2010) | 7 lines
  
    platform: use subprocess.Popen() instead of os.popen() in _syscmd_file()
  
     * Popen() avoids ugly shell escape: target.replace('"', '\\"')
     * Use proc.communicate() instead of f.stdout.read()
     * Get output from stdout by splitting with ": " instead of splitting by spaces
       to support filename with spaces
  ........
................
  r80170 | georg.brandl | 2010-04-18 11:50:07 +0200 (Sun, 18 Apr 2010) | 1 line
  
  Remove colspanning cells.
................
  r80176 | giampaolo.rodola | 2010-04-18 15:36:35 +0200 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80172 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80172 | giampaolo.rodola | 2010-04-18 14:55:03 +0200 (dom, 18 apr 2010) | 1 line
    
    Fix Issue #3817: 225 is now considered a valid response code for ABOR
  ........
................
  r80181 | ronald.oussoren | 2010-04-18 16:46:12 +0200 (Sun, 18 Apr 2010) | 7 lines
  
  Move _Py_char2wchar from python.c to main.c.
  
  This fixes issue #8441: python.c is not included
  in the framework while main.c is and without this
  patch you get a link error when building 
  Python.framework on OSX.
................
  r80182 | ronald.oussoren | 2010-04-18 17:02:38 +0200 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80178 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80178 | ronald.oussoren | 2010-04-18 15:47:49 +0200 (Sun, 18 Apr 2010) | 2 lines
    
    Fix for issue #7072
  ........
................
  r80185 | ronald.oussoren | 2010-04-18 17:24:17 +0200 (Sun, 18 Apr 2010) | 12 lines
  
  Merged revisions 80179 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80179 | ronald.oussoren | 2010-04-18 16:01:05 +0200 (Sun, 18 Apr 2010) | 5 lines
    
    Add check to build-installer.py to ensure that
    the right version of Tcl/Tk is available (on OSX)
    
    Fixes issue #5651
  ........
................
  r80190 | victor.stinner | 2010-04-18 20:28:09 +0200 (Sun, 18 Apr 2010) | 2 lines
  
  Revert r80167, it breaks build on many platforms
................
  r80191 | ronald.oussoren | 2010-04-18 21:07:43 +0200 (Sun, 18 Apr 2010) | 13 lines
  
  Merged revisions 80187 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80187 | ronald.oussoren | 2010-04-18 19:59:37 +0200 (Sun, 18 Apr 2010) | 6 lines
    
    Add the OSX universal binary related options
    to CFLAGS instead of BASECFLAGS.
    
    This fixes issue 8366 and is needed due to
    changes introduced in the fix for issue 1628484.
  ........
................
  r80195 | antoine.pitrou | 2010-04-18 21:17:01 +0200 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80194 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80194 | antoine.pitrou | 2010-04-18 21:14:38 +0200 (dim., 18 avril 2010) | 3 lines
    
    Fix catastrophic file opening and closing logic in test_linecache
  ........
................
  r80196 | raymond.hettinger | 2010-04-18 22:26:14 +0200 (Sun, 18 Apr 2010) | 1 line
  
  Issue 8420: Fix ref counting problem in set_repr().
................
  r80198 | ronald.oussoren | 2010-04-18 22:46:11 +0200 (Sun, 18 Apr 2010) | 4 lines
  
  For for issue #7154: Port the code that uses
  the SystemConfiguration framework to detect the
  proxy settings on OSX from the trunk to python 3.2
................
  r80200 | ronald.oussoren | 2010-04-18 22:53:49 +0200 (Sun, 18 Apr 2010) | 2 lines
  
  For for issue #5652
................
  r80205 | raymond.hettinger | 2010-04-19 01:05:22 +0200 (Mon, 19 Apr 2010) | 1 line
  
  Issue 8436: set.__init__ accepts keyword args
................
  r80206 | benjamin.peterson | 2010-04-19 01:08:30 +0200 (Mon, 19 Apr 2010) | 8 lines
  
  Blocked revisions 80202 via svnmerge
  
  ........
    r80202 | raymond.hettinger | 2010-04-18 17:57:57 -0500 (Sun, 18 Apr 2010) | 1 line
    
    Issue 8436: set.__init__ accepts keyword args
  ........
................
  r80207 | sean.reifschneider | 2010-04-19 08:06:12 +0200 (Mon, 19 Apr 2010) | 2 lines
  
  I'll maintain syslog.  I've made most of the "recent" changes to it anyway.
................
  r80211 | antoine.pitrou | 2010-04-19 16:05:51 +0200 (Mon, 19 Apr 2010) | 3 lines
  
  Add version{added,changed} for lock timeout support.
................
  r80212 | antoine.pitrou | 2010-04-19 16:09:57 +0200 (Mon, 19 Apr 2010) | 3 lines
  
  Remove obsolete mention of IRIX native threads -- we don't use them anymore.
................
  r80217 | antoine.pitrou | 2010-04-19 21:38:22 +0200 (Mon, 19 Apr 2010) | 9 lines
  
  Blocked revisions 80215 via svnmerge
  
  ........
    r80215 | antoine.pitrou | 2010-04-19 20:52:43 +0200 (lun., 19 avril 2010) | 4 lines
    
    Issue #8438: Remove reference to the missing "surrogateescape" encoding
    error handler from the new IO library.
  ........
................
  r80219 | tarek.ziade | 2010-04-19 23:19:57 +0200 (Mon, 19 Apr 2010) | 9 lines
  
  Merged revisions 80218 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80218 | tarek.ziade | 2010-04-19 23:13:03 +0200 (Mon, 19 Apr 2010) | 1 line
    
    few pep8 fixes
  ........
................
  r80224 | tarek.ziade | 2010-04-19 23:31:42 +0200 (Mon, 19 Apr 2010) | 9 lines
  
  Merged revisions 80221 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80221 | tarek.ziade | 2010-04-19 23:28:21 +0200 (Mon, 19 Apr 2010) | 1 line
    
    Fixed #8463: added missing reference to bztar in shutil's documentation.
  ........
................
  r80228 | giampaolo.rodola | 2010-04-20 00:05:54 +0200 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80226 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80226 | giampaolo.rodola | 2010-04-19 23:46:28 +0200 (lun, 19 apr 2010) | 1 line
    
    Fix Issue #4841: timeout is now applied for connections resulting from PORT/EPRT commands
  ........
................
  r80230 | tarek.ziade | 2010-04-20 00:30:51 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Fixed #1540112: now shutil.copytree will let you provide your own copy() function
................
  r80233 | ronald.oussoren | 2010-04-20 08:36:47 +0200 (Tue, 20 Apr 2010) | 10 lines
  
  Merged revisions 80232 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80232 | ronald.oussoren | 2010-04-20 07:50:44 +0200 (Tue, 20 Apr 2010) | 3 lines
    
    Explicitly set system default for $PATH to
    ensure we have a clean build environment (OSX installer)
  ........
................
  r80240 | stefan.krah | 2010-04-20 10:13:03 +0200 (Tue, 20 Apr 2010) | 15 lines
  
  Merged revisions 80238 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80238 | stefan.krah | 2010-04-20 09:59:10 +0200 (Tue, 20 Apr 2010) | 9 lines
    
    
    1) The timeout in the itimer tests was too low for slow or heavily
       loaded machines.
    
    2) Even with the increased timeout, the OS does not guarantee that
       a process will get a certain amount of virtual time in 60s, so
       the failure is changed to a diagnostic.
  ........
................
  r80244 | tarek.ziade | 2010-04-20 10:57:33 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Fixed #6547: Added the ignore_dangling_symlinks option to shutil.copytree
................
  r80246 | tarek.ziade | 2010-04-20 11:13:23 +0200 (Tue, 20 Apr 2010) | 1 line
  
  added a note on shutil.copytree improvements
................
  r80248 | ezio.melotti | 2010-04-20 11:32:54 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Fix versionadded in unittest.rst.
................
  r80251 | ezio.melotti | 2010-04-20 11:41:59 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Update the python version in the interpreter tutorial.
................
  r80253 | ezio.melotti | 2010-04-20 11:55:05 +0200 (Tue, 20 Apr 2010) | 29 lines
  
  Merged revisions 79963,80024,80064,80070,80085,80088 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79963 | andrew.kuchling | 2010-04-11 23:40:09 +0300 (Sun, 11 Apr 2010) | 1 line
    
    Add several items
  ........
    r80024 | andrew.kuchling | 2010-04-13 04:32:51 +0300 (Tue, 13 Apr 2010) | 1 line
    
    Add an item; stray edit
  ........
    r80064 | andrew.kuchling | 2010-04-14 04:14:59 +0300 (Wed, 14 Apr 2010) | 1 line
    
    Add argparse example
  ........
    r80070 | andrew.kuchling | 2010-04-14 17:28:31 +0300 (Wed, 14 Apr 2010) | 1 line
    
    Add some text
  ........
    r80085 | andrew.kuchling | 2010-04-15 02:55:17 +0300 (Thu, 15 Apr 2010) | 1 line
    
    Add various items; correct argparse output
  ........
    r80088 | andrew.kuchling | 2010-04-15 04:42:27 +0300 (Thu, 15 Apr 2010) | 1 line
    
    Add various items
  ........
................
  r80256 | senthil.kumaran | 2010-04-20 12:35:49 +0200 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80236 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80236 | senthil.kumaran | 2010-04-20 12:24:59 +0530 (Tue, 20 Apr 2010) | 3 lines
    
    Fix Issue8460: Victor's patch to add timeout in test_urllib2net test_urls.
  ........
................
  r80259 | ezio.melotti | 2010-04-20 12:57:44 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Fix two versionchanged.
................
  r80261 | ezio.melotti | 2010-04-20 13:26:51 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Add missing arg, fix indentation and spelling.
................
  r80263 | tarek.ziade | 2010-04-20 16:31:49 +0200 (Tue, 20 Apr 2010) | 1 line
  
  fixed typo -- thanks Nick
................
  r80266 | brian.curtin | 2010-04-20 17:28:06 +0200 (Tue, 20 Apr 2010) | 11 lines
  
  Updated version numbers from 2.7 to 3.2
  
  Merged revisions 80265 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80265 | brian.curtin | 2010-04-20 10:23:18 -0500 (Tue, 20 Apr 2010) | 2 lines
    
    Add version info for os.kill and signal changes from #1220212.
  ........
................
  r80272 | ezio.melotti | 2010-04-20 18:57:51 +0200 (Tue, 20 Apr 2010) | 8 lines
  
  Blocked revisions 80270 via svnmerge
  
  ........
    r80270 | ezio.melotti | 2010-04-20 19:49:48 +0300 (Tue, 20 Apr 2010) | 1 line
    
    #8472: fix wrong function name in functions.rst: itertools.filterfalse -> itertools.ifilterfalse
  ........
................
  r80273 | georg.brandl | 2010-04-20 20:15:54 +0200 (Tue, 20 Apr 2010) | 1 line
  
  Markup nit.
................
  r80275 | matthias.klose | 2010-04-20 21:48:04 +0200 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80274 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80274 | matthias.klose | 2010-04-20 21:45:34 +0200 (Di, 20 Apr 2010) | 2 lines
    
    fix typo in r79533, introduced by the fix for issue #8233
  ........
................
  r80276 | ronald.oussoren | 2010-04-20 21:51:33 +0200 (Tue, 20 Apr 2010) | 4 lines
  
  * Fixes cut&paste error in configure
  * Ensure that framework install works given the
    recent CFLAGS and BASECFLAGS changes
................
  r80278 | senthil.kumaran | 2010-04-20 22:42:50 +0200 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80277 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80277 | senthil.kumaran | 2010-04-21 02:07:59 +0530 (Wed, 21 Apr 2010) | 3 lines
    
    Issue2987 - Added additional Invalid URL and changed the Invalid URL checking code for better.
  ........
................
  r80280 | ronald.oussoren | 2010-04-20 23:00:34 +0200 (Tue, 20 Apr 2010) | 10 lines
  
  Merged revisions 80279 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80279 | ronald.oussoren | 2010-04-20 22:59:37 +0200 (Tue, 20 Apr 2010) | 3 lines
    
    Fix for issue 7852: the DTD for OSX Plists has changed due
    to a change in the company name for Apple.
  ........
................
  r80286 | tarek.ziade | 2010-04-20 23:40:47 +0200 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80282 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80282 | tarek.ziade | 2010-04-20 23:09:06 +0200 (Tue, 20 Apr 2010) | 1 line
    
    removed ztar support in shutil.make_archive
  ........
................
  r80289 | victor.stinner | 2010-04-21 00:32:07 +0200 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80288 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80288 | victor.stinner | 2010-04-21 00:28:31 +0200 (mer., 21 avril 2010) | 2 lines
    
    Issue #8437: Fix test_gdb failures, patch written by Dave Malcolm
  ........
................
  r80290 | mark.dickinson | 2010-04-21 00:32:49 +0200 (Wed, 21 Apr 2010) | 12 lines
  
  Issue #2706:  Add support for dividing a timedelta by another timedelta.
  
  Adds support for the three division operations:
  
    - timedelta / timedelta -> float
    - timedelta // timedelta -> int
    - timedelta % timedelta -> timedelta
  
  also adds support for divmod(timedelta, timedelta).
  
  Patch by Alexander Belopolsky.
................
  r80291 | mark.dickinson | 2010-04-21 00:39:53 +0200 (Wed, 21 Apr 2010) | 1 line
  
  Fix memory leak.
................
  r80293 | mark.dickinson | 2010-04-21 01:24:25 +0200 (Wed, 21 Apr 2010) | 1 line
  
  Rework delta_divmod to avoid use of PyTuple_SetItem.
................
  r80296 | r.david.murray | 2010-04-21 03:51:57 +0200 (Wed, 21 Apr 2010) | 14 lines
  
  Merged revisions 80144 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80144 | r.david.murray | 2010-04-17 01:26:26 -0400 (Sat, 17 Apr 2010) | 8 lines
    
    Issue #3864: Skip three test_signal tests on freebsd6 due to platform bug.
    
    Two itimer tests and an interprocess signal test fail on FreeBSD 6 if
    any test that starts a thread runs before test_signal.  Since FreeBSD7
    does not show this behavior, the bug is most likely a platform bug,
    so this patch just skips the failing tests on freebsd6.
  ........
................
  r80299 | ronald.oussoren | 2010-04-21 08:01:23 +0200 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80298 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80298 | ronald.oussoren | 2010-04-21 08:00:35 +0200 (Wed, 21 Apr 2010) | 2 lines
    
    Sync test_plistlib.py with plistlib.py
  ........
................
  r80300 | martin.v.loewis | 2010-04-21 08:05:58 +0200 (Wed, 21 Apr 2010) | 17 lines
  
  Merged revisions 79986-79987,80156 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79986 | martin.v.loewis | 2010-04-12 07:18:16 +0200 (Mo, 12 Apr 2010) | 2 lines
    
    Issue #8330: Fix expected output in test_gdb.
  ........
    r79987 | martin.v.loewis | 2010-04-12 07:22:25 +0200 (Mo, 12 Apr 2010) | 2 lines
    
    Re-enable all tests, to see which ones fail on the buildbots.
  ........
    r80156 | martin.v.loewis | 2010-04-18 00:40:40 +0200 (So, 18 Apr 2010) | 2 lines
    
    Issue #8279: Fix test_gdb failures.
  ........
................
  r80302 | martin.v.loewis | 2010-04-21 08:38:30 +0200 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80301 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80301 | martin.v.loewis | 2010-04-21 08:37:48 +0200 (Mi, 21 Apr 2010) | 2 lines
    
    Add Tim Golden.
  ........
................
  r80303 | tarek.ziade | 2010-04-21 09:30:43 +0200 (Wed, 21 Apr 2010) | 1 line
  
  fixed typo
................


Added:
   python/branches/py3k-cdecimal/Lib/test/gdb_sample.py
      - copied unchanged from r80303, /python/branches/py3k/Lib/test/gdb_sample.py
   python/branches/py3k-cdecimal/Lib/test/test_gdb.py
      - copied unchanged from r80303, /python/branches/py3k/Lib/test/test_gdb.py
   python/branches/py3k-cdecimal/Lib/test/win_console_handler.py
      - copied unchanged from r80303, /python/branches/py3k/Lib/test/win_console_handler.py
   python/branches/py3k-cdecimal/Lib/unittest/test/dummy.py
      - copied unchanged from r80303, /python/branches/py3k/Lib/unittest/test/dummy.py
   python/branches/py3k-cdecimal/Modules/_scproxy.c
      - copied unchanged from r80303, /python/branches/py3k/Modules/_scproxy.c
   python/branches/py3k-cdecimal/Tools/gdb/
      - copied from r80303, /python/branches/py3k/Tools/gdb/
Modified:
   python/branches/py3k-cdecimal/   (props changed)
   python/branches/py3k-cdecimal/.bzrignore
   python/branches/py3k-cdecimal/.hgignore
   python/branches/py3k-cdecimal/Doc/c-api/import.rst
   python/branches/py3k-cdecimal/Doc/data/refcounts.dat
   python/branches/py3k-cdecimal/Doc/distutils/apiref.rst
   python/branches/py3k-cdecimal/Doc/distutils/examples.rst
   python/branches/py3k-cdecimal/Doc/faq/windows.rst
   python/branches/py3k-cdecimal/Doc/glossary.rst
   python/branches/py3k-cdecimal/Doc/library/_thread.rst
   python/branches/py3k-cdecimal/Doc/library/collections.rst
   python/branches/py3k-cdecimal/Doc/library/compileall.rst
   python/branches/py3k-cdecimal/Doc/library/datetime.rst
   python/branches/py3k-cdecimal/Doc/library/difflib.rst
   python/branches/py3k-cdecimal/Doc/library/functools.rst
   python/branches/py3k-cdecimal/Doc/library/imp.rst
   python/branches/py3k-cdecimal/Doc/library/itertools.rst
   python/branches/py3k-cdecimal/Doc/library/logging.rst
   python/branches/py3k-cdecimal/Doc/library/math.rst
   python/branches/py3k-cdecimal/Doc/library/os.rst
   python/branches/py3k-cdecimal/Doc/library/py_compile.rst
   python/branches/py3k-cdecimal/Doc/library/re.rst
   python/branches/py3k-cdecimal/Doc/library/runpy.rst
   python/branches/py3k-cdecimal/Doc/library/shutil.rst
   python/branches/py3k-cdecimal/Doc/library/signal.rst
   python/branches/py3k-cdecimal/Doc/library/socket.rst
   python/branches/py3k-cdecimal/Doc/library/ssl.rst
   python/branches/py3k-cdecimal/Doc/library/stdtypes.rst
   python/branches/py3k-cdecimal/Doc/library/struct.rst
   python/branches/py3k-cdecimal/Doc/library/subprocess.rst
   python/branches/py3k-cdecimal/Doc/library/tarfile.rst
   python/branches/py3k-cdecimal/Doc/library/test.rst
   python/branches/py3k-cdecimal/Doc/library/threading.rst
   python/branches/py3k-cdecimal/Doc/library/unittest.rst
   python/branches/py3k-cdecimal/Doc/library/urllib.request.rst
   python/branches/py3k-cdecimal/Doc/library/warnings.rst
   python/branches/py3k-cdecimal/Doc/reference/expressions.rst
   python/branches/py3k-cdecimal/Doc/tutorial/interpreter.rst
   python/branches/py3k-cdecimal/Doc/using/cmdline.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/2.7.rst
   python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst
   python/branches/py3k-cdecimal/Include/Python.h
   python/branches/py3k-cdecimal/Include/import.h
   python/branches/py3k-cdecimal/Include/pyport.h
   python/branches/py3k-cdecimal/Include/pythread.h
   python/branches/py3k-cdecimal/LICENSE
   python/branches/py3k-cdecimal/Lib/   (props changed)
   python/branches/py3k-cdecimal/Lib/_dummy_thread.py
   python/branches/py3k-cdecimal/Lib/collections.py
   python/branches/py3k-cdecimal/Lib/compileall.py
   python/branches/py3k-cdecimal/Lib/ctypes/   (props changed)
   python/branches/py3k-cdecimal/Lib/ctypes/macholib/   (props changed)
   python/branches/py3k-cdecimal/Lib/ctypes/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/curses/   (props changed)
   python/branches/py3k-cdecimal/Lib/dbm/   (props changed)
   python/branches/py3k-cdecimal/Lib/difflib.py
   python/branches/py3k-cdecimal/Lib/distutils/   (props changed)
   python/branches/py3k-cdecimal/Lib/distutils/command/   (props changed)
   python/branches/py3k-cdecimal/Lib/distutils/tests/   (props changed)
   python/branches/py3k-cdecimal/Lib/distutils/tests/support.py
   python/branches/py3k-cdecimal/Lib/email/   (props changed)
   python/branches/py3k-cdecimal/Lib/email/encoders.py
   python/branches/py3k-cdecimal/Lib/email/message.py
   python/branches/py3k-cdecimal/Lib/email/mime/   (props changed)
   python/branches/py3k-cdecimal/Lib/email/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/email/test/data/   (props changed)
   python/branches/py3k-cdecimal/Lib/email/test/test_email.py
   python/branches/py3k-cdecimal/Lib/encodings/   (props changed)
   python/branches/py3k-cdecimal/Lib/ftplib.py
   python/branches/py3k-cdecimal/Lib/functools.py
   python/branches/py3k-cdecimal/Lib/html/   (props changed)
   python/branches/py3k-cdecimal/Lib/http/   (props changed)
   python/branches/py3k-cdecimal/Lib/idlelib/   (props changed)
   python/branches/py3k-cdecimal/Lib/idlelib/Icons/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/_bootstrap.py
   python/branches/py3k-cdecimal/Lib/importlib/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/__main__.py
   python/branches/py3k-cdecimal/Lib/importlib/test/builtin/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/extension/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/frozen/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/import_/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/source/   (props changed)
   python/branches/py3k-cdecimal/Lib/importlib/test/source/test_file_loader.py
   python/branches/py3k-cdecimal/Lib/importlib/test/source/test_finder.py
   python/branches/py3k-cdecimal/Lib/importlib/test/source/test_source_encoding.py
   python/branches/py3k-cdecimal/Lib/importlib/test/source/util.py
   python/branches/py3k-cdecimal/Lib/importlib/util.py
   python/branches/py3k-cdecimal/Lib/inspect.py
   python/branches/py3k-cdecimal/Lib/json/   (props changed)
   python/branches/py3k-cdecimal/Lib/json/tests/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/fixes/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/pgen2/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/tests/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/tests/data/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/tests/data/fixers/   (props changed)
   python/branches/py3k-cdecimal/Lib/lib2to3/tests/data/fixers/myfixes/   (props changed)
   python/branches/py3k-cdecimal/Lib/locale.py
   python/branches/py3k-cdecimal/Lib/logging/   (props changed)
   python/branches/py3k-cdecimal/Lib/logging/__init__.py
   python/branches/py3k-cdecimal/Lib/logging/config.py
   python/branches/py3k-cdecimal/Lib/logging/handlers.py
   python/branches/py3k-cdecimal/Lib/msilib/   (props changed)
   python/branches/py3k-cdecimal/Lib/multiprocessing/   (props changed)
   python/branches/py3k-cdecimal/Lib/multiprocessing/dummy/   (props changed)
   python/branches/py3k-cdecimal/Lib/multiprocessing/pool.py
   python/branches/py3k-cdecimal/Lib/pickle.py
   python/branches/py3k-cdecimal/Lib/pickletools.py
   python/branches/py3k-cdecimal/Lib/plat-aix4/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-darwin/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-freebsd4/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-freebsd5/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-freebsd6/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-freebsd7/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-freebsd8/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-generic/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-linux2/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-netbsd1/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-next3/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-os2emx/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-sunos5/   (props changed)
   python/branches/py3k-cdecimal/Lib/plat-unixware7/   (props changed)
   python/branches/py3k-cdecimal/Lib/plistlib.py
   python/branches/py3k-cdecimal/Lib/py_compile.py
   python/branches/py3k-cdecimal/Lib/pydoc.py
   python/branches/py3k-cdecimal/Lib/pydoc_data/   (props changed)
   python/branches/py3k-cdecimal/Lib/runpy.py
   python/branches/py3k-cdecimal/Lib/shutil.py
   python/branches/py3k-cdecimal/Lib/site-packages/   (props changed)
   python/branches/py3k-cdecimal/Lib/site.py
   python/branches/py3k-cdecimal/Lib/sqlite3/   (props changed)
   python/branches/py3k-cdecimal/Lib/sqlite3/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/ssl.py
   python/branches/py3k-cdecimal/Lib/subprocess.py
   python/branches/py3k-cdecimal/Lib/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/test/crashers/   (props changed)
   python/branches/py3k-cdecimal/Lib/test/decimaltestdata/   (props changed)
   python/branches/py3k-cdecimal/Lib/test/leakers/   (props changed)
   python/branches/py3k-cdecimal/Lib/test/lock_tests.py
   python/branches/py3k-cdecimal/Lib/test/pickletester.py
   python/branches/py3k-cdecimal/Lib/test/regrtest.py
   python/branches/py3k-cdecimal/Lib/test/script_helper.py
   python/branches/py3k-cdecimal/Lib/test/support.py
   python/branches/py3k-cdecimal/Lib/test/test_argparse.py
   python/branches/py3k-cdecimal/Lib/test/test_bytes.py
   python/branches/py3k-cdecimal/Lib/test/test_cmd_line.py
   python/branches/py3k-cdecimal/Lib/test/test_cmd_line_script.py
   python/branches/py3k-cdecimal/Lib/test/test_compileall.py
   python/branches/py3k-cdecimal/Lib/test/test_datetime.py
   python/branches/py3k-cdecimal/Lib/test/test_difflib.py
   python/branches/py3k-cdecimal/Lib/test/test_frozen.py
   python/branches/py3k-cdecimal/Lib/test/test_functools.py
   python/branches/py3k-cdecimal/Lib/test/test_genericpath.py
   python/branches/py3k-cdecimal/Lib/test/test_imp.py
   python/branches/py3k-cdecimal/Lib/test/test_import.py
   python/branches/py3k-cdecimal/Lib/test/test_linecache.py
   python/branches/py3k-cdecimal/Lib/test/test_locale.py
   python/branches/py3k-cdecimal/Lib/test/test_logging.py
   python/branches/py3k-cdecimal/Lib/test/test_os.py
   python/branches/py3k-cdecimal/Lib/test/test_pkg.py
   python/branches/py3k-cdecimal/Lib/test/test_pkgimport.py
   python/branches/py3k-cdecimal/Lib/test/test_plistlib.py
   python/branches/py3k-cdecimal/Lib/test/test_pydoc.py
   python/branches/py3k-cdecimal/Lib/test/test_runpy.py
   python/branches/py3k-cdecimal/Lib/test/test_set.py
   python/branches/py3k-cdecimal/Lib/test/test_shutil.py
   python/branches/py3k-cdecimal/Lib/test/test_signal.py
   python/branches/py3k-cdecimal/Lib/test/test_site.py
   python/branches/py3k-cdecimal/Lib/test/test_ssl.py
   python/branches/py3k-cdecimal/Lib/test/test_urllib2net.py
   python/branches/py3k-cdecimal/Lib/test/test_urlparse.py
   python/branches/py3k-cdecimal/Lib/test/test_uuid.py
   python/branches/py3k-cdecimal/Lib/test/test_warnings.py
   python/branches/py3k-cdecimal/Lib/test/test_winsound.py
   python/branches/py3k-cdecimal/Lib/test/test_zipfile.py
   python/branches/py3k-cdecimal/Lib/test/test_zipimport.py
   python/branches/py3k-cdecimal/Lib/test/xmltestdata/   (props changed)
   python/branches/py3k-cdecimal/Lib/threading.py
   python/branches/py3k-cdecimal/Lib/tkinter/   (props changed)
   python/branches/py3k-cdecimal/Lib/tkinter/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/tkinter/test/test_tkinter/   (props changed)
   python/branches/py3k-cdecimal/Lib/tkinter/test/test_ttk/   (props changed)
   python/branches/py3k-cdecimal/Lib/tkinter/test/test_ttk/test_widgets.py
   python/branches/py3k-cdecimal/Lib/unittest/   (props changed)
   python/branches/py3k-cdecimal/Lib/unittest/case.py
   python/branches/py3k-cdecimal/Lib/unittest/loader.py
   python/branches/py3k-cdecimal/Lib/unittest/main.py
   python/branches/py3k-cdecimal/Lib/unittest/result.py
   python/branches/py3k-cdecimal/Lib/unittest/runner.py
   python/branches/py3k-cdecimal/Lib/unittest/test/   (props changed)
   python/branches/py3k-cdecimal/Lib/unittest/test/test_assertions.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_break.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_discovery.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_loader.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_result.py
   python/branches/py3k-cdecimal/Lib/urllib/   (props changed)
   python/branches/py3k-cdecimal/Lib/urllib/parse.py
   python/branches/py3k-cdecimal/Lib/urllib/request.py
   python/branches/py3k-cdecimal/Lib/wsgiref/   (props changed)
   python/branches/py3k-cdecimal/Lib/xml/   (props changed)
   python/branches/py3k-cdecimal/Lib/xml/dom/   (props changed)
   python/branches/py3k-cdecimal/Lib/xml/etree/   (props changed)
   python/branches/py3k-cdecimal/Lib/xml/parsers/   (props changed)
   python/branches/py3k-cdecimal/Lib/xml/sax/   (props changed)
   python/branches/py3k-cdecimal/Lib/xmlrpc/   (props changed)
   python/branches/py3k-cdecimal/Lib/xmlrpc/server.py
   python/branches/py3k-cdecimal/Lib/zipfile.py
   python/branches/py3k-cdecimal/Mac/BuildScript/build-installer.py
   python/branches/py3k-cdecimal/Mac/BuildScript/scripts/postflight.framework
   python/branches/py3k-cdecimal/Mac/Makefile.in
   python/branches/py3k-cdecimal/Mac/PythonLauncher/Makefile.in
   python/branches/py3k-cdecimal/Mac/Tools/pythonw.c
   python/branches/py3k-cdecimal/Makefile.pre.in
   python/branches/py3k-cdecimal/Misc/ACKS
   python/branches/py3k-cdecimal/Misc/NEWS
   python/branches/py3k-cdecimal/Misc/developers.txt
   python/branches/py3k-cdecimal/Misc/maintainers.rst
   python/branches/py3k-cdecimal/Modules/_ctypes/callproc.c
   python/branches/py3k-cdecimal/Modules/_ctypes/libffi/src/sparc/v8.S
   python/branches/py3k-cdecimal/Modules/_pickle.c
   python/branches/py3k-cdecimal/Modules/_posixsubprocess.c
   python/branches/py3k-cdecimal/Modules/_sre.c
   python/branches/py3k-cdecimal/Modules/_ssl.c
   python/branches/py3k-cdecimal/Modules/_threadmodule.c
   python/branches/py3k-cdecimal/Modules/datetimemodule.c
   python/branches/py3k-cdecimal/Modules/main.c
   python/branches/py3k-cdecimal/Modules/posixmodule.c
   python/branches/py3k-cdecimal/Modules/python.c
   python/branches/py3k-cdecimal/Modules/signalmodule.c
   python/branches/py3k-cdecimal/Objects/bytearrayobject.c
   python/branches/py3k-cdecimal/Objects/bytesobject.c
   python/branches/py3k-cdecimal/Objects/setobject.c
   python/branches/py3k-cdecimal/PC/_subprocess.c
   python/branches/py3k-cdecimal/Python/import.c
   python/branches/py3k-cdecimal/Python/pythonrun.c
   python/branches/py3k-cdecimal/Python/thread_nt.h
   python/branches/py3k-cdecimal/Python/thread_pthread.h
   python/branches/py3k-cdecimal/Tools/README
   python/branches/py3k-cdecimal/Tools/i18n/makelocalealias.py
   python/branches/py3k-cdecimal/configure
   python/branches/py3k-cdecimal/configure.in
   python/branches/py3k-cdecimal/setup.py

Modified: python/branches/py3k-cdecimal/.bzrignore
==============================================================================
--- python/branches/py3k-cdecimal/.bzrignore	(original)
+++ python/branches/py3k-cdecimal/.bzrignore	Wed Apr 21 13:06:18 2010
@@ -14,6 +14,7 @@
 pyconfig.h
 libpython*.a
 python.exe
+python-gdb.py
 reflog.txt
 tags
 TAGS
@@ -32,3 +33,4 @@
 Lib/test/data/*
 Lib/lib2to3/Grammar*.pickle
 Lib/lib2to3/PatternGrammar*.pickle
+__pycache__

Modified: python/branches/py3k-cdecimal/.hgignore
==============================================================================
--- python/branches/py3k-cdecimal/.hgignore	(original)
+++ python/branches/py3k-cdecimal/.hgignore	Wed Apr 21 13:06:18 2010
@@ -1,23 +1,23 @@
 .gdb_history
 .purify
-.svn
+.svn/
 Makefile$
 Makefile.pre$
-TAGS
-autom4te.cache
-build
-buildno
+TAGS$
+autom4te.cache$
+build/
+buildno$
 config.cache
 config.log
 config.status
 config.status.lineno
 db_home
-platform
-pyconfig.h
-python
-python.exe
-reflog.txt
-tags
+platform$
+pyconfig.h$
+python$
+python.exe$
+reflog.txt$
+tags$
 Lib/plat-mac/errors.rsrc.df.rsrc
 Doc/tools/sphinx/
 Doc/tools/docutils/
@@ -25,12 +25,13 @@
 Doc/tools/jinja2/
 Doc/tools/pygments/
 Misc/python.pc
-Modules/Setup
+Modules/Setup$
 Modules/Setup.config
 Modules/Setup.local
 Modules/config.c
-Parser/pgen
-core
+Parser/pgen$
+^core
+^python-gdb.py
 
 syntax: glob
 libpython*.a
@@ -53,3 +54,4 @@
 PCbuild/*.ncb
 PCbuild/*.bsc
 PCbuild/Win32-temp-*
+__pycache__

Modified: python/branches/py3k-cdecimal/Doc/c-api/import.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/c-api/import.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/c-api/import.rst	Wed Apr 21 13:06:18 2010
@@ -115,12 +115,33 @@
    such modules have no way to know that the module object is an unknown (and
    probably damaged with respect to the module author's intents) state.
 
+   The module's :attr:`__file__` attribute will be set to the code object's
+   :cmember:`co_filename`.
+
    This function will reload the module if it was already imported.  See
    :cfunc:`PyImport_ReloadModule` for the intended way to reload a module.
 
    If *name* points to a dotted name of the form ``package.module``, any package
    structures not already created will still not be created.
 
+   See also :func:`PyImport_ExecCodeModuleEx` and
+   :func:`PyImport_ExecCodeModuleWithPathnames`.
+
+
+.. cfunction:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
+
+   Like :cfunc:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of
+   the module object is set to *pathname* if it is non-``NULL``.
+
+   See also :func:`PyImport_ExecCodeModuleWithPathnames`.
+
+
+.. cfunction:: PyObject* PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname, char *cpathname)
+
+   Like :cfunc:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__`
+   attribute of the module object is set to *cpathname* if it is
+   non-``NULL``.  Of the three functions, this is the preferred one to use.
+
 
 .. cfunction:: long PyImport_GetMagicNumber()
 
@@ -129,6 +150,11 @@
    of the bytecode file, in little-endian byte order.
 
 
+.. cfunction:: const char * PyImport_GetMagicTag()
+
+   Return the magic tag string for :pep:`3147` format Python bytecode file
+   names.
+
 .. cfunction:: PyObject* PyImport_GetModuleDict()
 
    Return the dictionary used for the module administration (a.k.a.

Modified: python/branches/py3k-cdecimal/Doc/data/refcounts.dat
==============================================================================
--- python/branches/py3k-cdecimal/Doc/data/refcounts.dat	(original)
+++ python/branches/py3k-cdecimal/Doc/data/refcounts.dat	Wed Apr 21 13:06:18 2010
@@ -499,6 +499,11 @@
 PyImport_ExecCodeModule:char*:name::
 PyImport_ExecCodeModule:PyObject*:co:0:
 
+PyImport_ExecCodeModuleEx:PyObject*::+1:
+PyImport_ExecCodeModuleEx:char*:name::
+PyImport_ExecCodeModuleEx:PyObject*:co:0:
+PyImport_ExecCodeModuleEx:char*:pathname::
+
 PyImport_GetMagicNumber:long:::
 
 PyImport_GetModuleDict:PyObject*::0:
@@ -518,6 +523,13 @@
 PyImport_ImportModuleEx:PyObject*:locals:0:???
 PyImport_ImportModuleEx:PyObject*:fromlist:0:???
 
+PyImport_ImportModuleLevel:PyObject*::+1:
+PyImport_ImportModuleLevel:char*:name::
+PyImport_ImportModuleLevel:PyObject*:globals:0:???
+PyImport_ImportModuleLevel:PyObject*:locals:0:???
+PyImport_ImportModuleLevel:PyObject*:fromlist:0:???
+PyImport_ImportModuleLevel:int:level::
+
 PyImport_ReloadModule:PyObject*::+1:
 PyImport_ReloadModule:PyObject*:m:0:
 

Modified: python/branches/py3k-cdecimal/Doc/distutils/apiref.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/distutils/apiref.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/distutils/apiref.rst	Wed Apr 21 13:06:18 2010
@@ -1944,19 +1944,6 @@
 
 .. % todo
 
-:mod:`distutils.command.check` --- Check the meta-data of a package
-===================================================================
-
-.. module:: distutils.command.check
-   :synopsis: Check the metadata of a package
-
-
-The ``check`` command performs some tests on the meta-data of a package.
-For example, it verifies that all required meta-data are provided as
-the arguments passed to the :func:`setup` function.
-
-.. % todo
-
 
 Creating a new Distutils command
 ================================

Modified: python/branches/py3k-cdecimal/Doc/distutils/examples.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/distutils/examples.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/distutils/examples.rst	Wed Apr 21 13:06:18 2010
@@ -233,103 +233,6 @@
          ext_modules=[Extension('foopkg.foo', ['foo.c'])],
          )
 
-Checking a package
-==================
-
-The ``check`` command allows you to verify if your package meta-data
-meet the minimum requirements to build a distribution.
-
-To run it, just call it using your :file:`setup.py` script. If something is
-missing, ``check`` will display a warning.
-
-Let's take an example with a simple script::
-
-    from distutils.core import setup
-
-    setup(name='foobar')
-
-Running the ``check`` command will display some warnings::
-
-    $ python setup.py check
-    running check
-    warning: check: missing required meta-data: version, url
-    warning: check: missing meta-data: either (author and author_email) or
-             (maintainer and maintainer_email) must be supplied
-
-
-If you use the reStructuredText syntax in the ``long_description`` field and
-`docutils <http://docutils.sourceforge.net/>`_ is installed you can check if
-the syntax is fine with the ``check`` command, using the ``restructuredtext``
-option.
-
-For example, if the :file:`setup.py` script is changed like this::
-
-    from distutils.core import setup
-
-    desc = """\
-    My description
-    =============
-
-    This is the description of the ``foobar`` package.
-    """
-
-    setup(name='foobar', version='1', author='tarek',
-        author_email='tarek at ziade.org',
-        url='http://example.com', long_description=desc)
-
-Where the long description is broken, ``check`` will be able to detect it
-by using the :mod:`docutils` parser::
-
-    $ pythontrunk setup.py check --restructuredtext
-    running check
-    warning: check: Title underline too short. (line 2)
-    warning: check: Could not finish the parsing.
-
-
-.. _reading-metadata:
-
-Reading the metadata
-====================
-
-The :func:`distutils.core.setup` function provides a command-line interface
-that allows you to query the metadata fields of a project through the
-:file:`setup.py` script of a given project::
-
-    $ python setup.py --name
-    distribute
-
-This call reads the ``name`` metadata by running the
-:func:`distutils.core.setup`  function. Although, when a source or binary
-distribution is created with Distutils, the metadata fields are written
-in a static file called :file:`PKG-INFO`. When a Distutils-based project is
-installed in Python, the :file:`PKG-INFO` file is copied alongside the modules
-and packages of the distribution under :file:`NAME-VERSION-pyX.X.egg-info`,
-where ``NAME`` is the name of the project, ``VERSION`` its version as defined
-in the Metadata, and ``pyX.X`` the major and minor version of Python like
-``2.7`` or ``3.2``.
-
-You can read back this static file, by using the
-:class:`distutils.dist.DistributionMetadata` class and its
-:func:`read_pkg_file` method::
-
-    >>> from distutils.dist import DistributionMetadata
-    >>> metadata = DistributionMetadata()
-    >>> metadata.read_pkg_file(open('distribute-0.6.8-py2.7.egg-info'))
-    >>> metadata.name
-    'distribute'
-    >>> metadata.version
-    '0.6.8'
-    >>> metadata.description
-    'Easily download, build, install, upgrade, and uninstall Python packages'
-
-Notice that the class can also be instanciated with a metadata file path to
-loads its values::
-
-    >>> pkg_info_path = 'distribute-0.6.8-py2.7.egg-info'
-    >>> DistributionMetadata(pkg_info_path).name
-    'distribute'
-
-
 .. % \section{Multiple extension modules}
 .. % \label{multiple-ext}
 

Modified: python/branches/py3k-cdecimal/Doc/faq/windows.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/faq/windows.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/faq/windows.rst	Wed Apr 21 13:06:18 2010
@@ -445,7 +445,7 @@
 How do I emulate os.kill() in Windows?
 --------------------------------------
 
-To terminate a process, you can use ctypes::
+Prior to Python 2.7 and 3.2, to terminate a process, you can use :mod:`ctypes`::
 
    import ctypes
 
@@ -455,6 +455,11 @@
        handle = kernel32.OpenProcess(1, 0, pid)
        return (0 != kernel32.TerminateProcess(handle, 0))
 
+In 2.7 and 3.2, :func:`os.kill` is implemented similar to the above function,
+with the additional feature of being able to send CTRL+C and CTRL+BREAK
+to console subprocesses which are designed to handle those signals. See
+:func:`os.kill` for further details.
+
 
 Why does os.path.isdir() fail on NT shared directories?
 -------------------------------------------------------

Modified: python/branches/py3k-cdecimal/Doc/glossary.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/glossary.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/glossary.rst	Wed Apr 21 13:06:18 2010
@@ -212,6 +212,8 @@
       performs garbage collection via reference counting and a cyclic garbage
       collector that is able to detect and break reference cycles.
 
+      .. index:: single: generator
+
    generator
       A function which returns an iterator.  It looks like a normal function
       except that values are returned to the caller using a :keyword:`yield`
@@ -225,7 +227,7 @@
       .. index:: single: generator expression
 
    generator expression
-      An expression that returns a generator.  It looks like a normal expression
+      An expression that returns an iterator.  It looks like a normal expression
       followed by a :keyword:`for` expression defining a loop variable, range,
       and an optional :keyword:`if` expression.  The combined expression
       generates values for an enclosing function::

Modified: python/branches/py3k-cdecimal/Doc/library/_thread.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/_thread.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/_thread.rst	Wed Apr 21 13:06:18 2010
@@ -28,7 +28,7 @@
 :mod:`_dummy_thread` module is available. It duplicates this module's interface
 and can be used as a drop-in replacement.
 
-It defines the following constant and functions:
+It defines the following constants and functions:
 
 
 .. exception:: error
@@ -103,19 +103,39 @@
    Availability: Windows, systems with POSIX threads.
 
 
+.. data:: TIMEOUT_MAX
+
+   The maximum value allowed for the *timeout* parameter of
+   :meth:`Lock.acquire`. Specifiying a timeout greater than this value will
+   raise an :exc:`OverflowError`.
+
+   .. versionadded:: 3.2
+
+
 Lock objects have the following methods:
 
 
-.. method:: lock.acquire([waitflag])
+.. method:: lock.acquire(waitflag=1, timeout=-1)
 
-   Without the optional argument, this method acquires the lock unconditionally, if
+   Without any optional argument, this method acquires the lock unconditionally, if
    necessary waiting until it is released by another thread (only one thread at a
-   time can acquire a lock --- that's their reason for existence).  If the integer
-   *waitflag* argument is present, the action depends on its value: if it is zero,
-   the lock is only acquired if it can be acquired immediately without waiting,
-   while if it is nonzero, the lock is acquired unconditionally as before.  The
-   return value is ``True`` if the lock is acquired successfully, ``False`` if not.
+   time can acquire a lock --- that's their reason for existence).
 
+   If the integer *waitflag* argument is present, the action depends on its
+   value: if it is zero, the lock is only acquired if it can be acquired
+   immediately without waiting, while if it is nonzero, the lock is acquired
+   unconditionally as above.
+
+   If the floating-point *timeout* argument is present and positive, it
+   specifies the maximum wait time in seconds before returning.  A negative
+   *timeout* argument specifies an unbounded wait.  You cannot specify
+   a *timeout* if *waitflag* is zero.
+
+   The return value is ``True`` if the lock is acquired successfully,
+   ``False`` if not.
+
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
 
 .. method:: lock.release()
 
@@ -156,12 +176,10 @@
 * It is not possible to interrupt the :meth:`acquire` method on a lock --- the
   :exc:`KeyboardInterrupt` exception will happen after the lock has been acquired.
 
-  .. index:: pair: threads; IRIX
-
 * When the main thread exits, it is system defined whether the other threads
-  survive.  On SGI IRIX using the native thread implementation, they survive.  On
-  most other systems, they are killed without executing :keyword:`try` ...
-  :keyword:`finally` clauses or executing object destructors.
+  survive.  On most systems, they are killed without executing
+  :keyword:`try` ... :keyword:`finally` clauses or executing object
+  destructors.
 
 * When the main thread exits, it does not do any of its usual cleanup (except
   that :keyword:`try` ... :keyword:`finally` clauses are honored), and the

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	Wed Apr 21 13:06:18 2010
@@ -271,6 +271,33 @@
     >>> c | d                       # union:  max(c[x], d[x])
     Counter({'a': 3, 'b': 2})
 
+.. note::
+
+   Counters were primarily designed to work with positive integers to represent
+   running counts; however, care was taken to not unnecessarily preclude use
+   cases needing other types or negative values.  To help with those use cases,
+   this section documents the minimum range and type restrictions.
+
+   * The :class:`Counter` class itself is a dictionary subclass with no
+     restrictions on its keys and values.  The values are intended to be numbers
+     representing counts, but you *could* store anything in the value field.
+
+   * The :meth:`most_common` method requires only that the values be orderable.
+
+   * For in-place operations such as ``c[key] += 1``, the value type need only
+     support addition and subtraction.  So fractions, floats, and decimals would
+     work and negative values are supported.  The same is also true for
+     :meth:`update` and :meth:`subtract` which allow negative and zero values
+     for both inputs and outputs.
+
+   * The multiset methods are designed only for use cases with positive values.
+     The inputs may be negative or zero, but only outputs with positive values
+     are created.  There are no type restrictions, but the value type needs to
+     support support addition, subtraction, and comparison.
+
+   * The :meth:`elements` method requires integer counts.  It ignores zero and
+     negative counts.
+
 .. seealso::
 
     * `Counter class <http://code.activestate.com/recipes/576611/>`_

Modified: python/branches/py3k-cdecimal/Doc/library/compileall.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/compileall.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/compileall.rst	Wed Apr 21 13:06:18 2010
@@ -17,9 +17,11 @@
 sys.path``.  Printing lists of the files compiled can be disabled with the
 :option:`-q` flag.  In addition, the :option:`-x` option takes a regular
 expression argument.  All files that match the expression will be skipped.
+The :option:`-b` flag may be given to write legacy ``.pyc`` file path names,
+otherwise :pep:`3147` style byte-compiled path names are written.
 
 
-.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False)
+.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=False, legacy=False)
 
    Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
    files along the way.  The *maxlevels* parameter is used to limit the depth of
@@ -34,12 +36,16 @@
    If *quiet* is true, nothing is printed to the standard output in normal
    operation.
 
+   If *legacy* is true, old-style ``.pyc`` file path names are written,
+   otherwise (the default), :pep:`3147` style path names are written.
 
-.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False)
+
+.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False, legacy=False)
 
    Byte-compile all the :file:`.py` files found along ``sys.path``. If
    *skip_curdir* is true (the default), the current directory is not included in
-   the search.  The *maxlevels* and *force* parameters default to ``0`` and are
+   the search.  The *maxlevels* parameter defaults to ``0``, and the *force*
+   and *legacy* parameters default to ``False``. All are
    passed to the :func:`compile_dir` function.
 
 To force a recompile of all the :file:`.py` files in the :file:`Lib/`

Modified: python/branches/py3k-cdecimal/Doc/library/datetime.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/datetime.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/datetime.rst	Wed Apr 21 13:06:18 2010
@@ -220,8 +220,20 @@
 |                                | In general, *t1* \* i == *t1* \* (i-1) + *t1* |
 |                                | is true. (1)                                  |
 +--------------------------------+-----------------------------------------------+
-| ``t1 = t2 // i``               | The floor is computed and the remainder (if   |
-|                                | any) is thrown away. (3)                      |
+| ``f = t2 / t3``                | Division (3) of *t2* by *t3*.  Returns a      |
+|                                | :class:`float` object.                        |
++--------------------------------+-----------------------------------------------+
+| ``t1 = t2 // i`` or            | The floor is computed and the remainder (if   |
+| ``t1 = t2 // t3``              | any) is thrown away.  In the second case, an  |
+|                                | integer is returned (3)                       |
++--------------------------------+-----------------------------------------------+
+| ``t1 = t2 % t3``               | The remainder is computed as a                |
+|                                | :class:`timedelta` object. (3)                |
++--------------------------------+-----------------------------------------------+
+| ``q, r = divmod(t1, t2)``      | Computes the quotient and the remainder:      |
+|                                | ``q = t1 // t2`` (3) and ``r = t1 % t2``.     |
+|                                | q is an integer and r is a :class:`timedelta` |
+|                                | object.                                       |
 +--------------------------------+-----------------------------------------------+
 | ``+t1``                        | Returns a :class:`timedelta` object with the  |
 |                                | same value. (2)                               |
@@ -252,6 +264,12 @@
 certain additions and subtractions with :class:`date` and :class:`datetime`
 objects (see below).
 
+.. versionadded:: 3.2
+   Floor division and true division of a :class:`timedelta` object by
+   another :class:`timedelta` object are now supported, as are
+   remainder operations and the :func:`divmod` function.
+
+
 Comparisons of :class:`timedelta` objects are supported with the
 :class:`timedelta` object representing the smaller duration considered to be the
 smaller timedelta. In order to stop mixed-type comparisons from falling back to

Modified: python/branches/py3k-cdecimal/Doc/library/difflib.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/difflib.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/difflib.rst	Wed Apr 21 13:06:18 2010
@@ -140,8 +140,8 @@
 
    The context diff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for *fromfile*,
-   *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
-   expressed in the format returned by :func:`time.ctime`.  If not specified, the
+   *tofile*, *fromfiledate*, and *tofiledate*.  The modification times are normally
+   expressed in the ISO 8601 format. If not specified, the
    strings default to blanks.
 
       >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
@@ -272,8 +272,8 @@
 
    The context diff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for *fromfile*,
-   *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
-   expressed in the format returned by :func:`time.ctime`.  If not specified, the
+   *tofile*, *fromfiledate*, and *tofiledate*.  The modification times are normally
+   expressed in the ISO 8601 format. If not specified, the
    strings default to blanks.
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/functools.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/functools.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/functools.rst	Wed Apr 21 13:06:18 2010
@@ -40,7 +40,7 @@
 .. function:: total_ordering(cls)
 
    Given a class defining one or more rich comparison ordering methods, this
-   class decorator supplies the rest.  This simplies the effort involved
+   class decorator supplies the rest.  This simplifies the effort involved
    in specifying all of the possible rich comparison operations:
 
    The class must define one of :meth:`__lt__`, :meth:`__le__`,

Modified: python/branches/py3k-cdecimal/Doc/library/imp.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/imp.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/imp.rst	Wed Apr 21 13:06:18 2010
@@ -204,8 +204,41 @@
    function does nothing.
 
 
-The following constants with integer values, defined in this module, are used to
-indicate the search result of :func:`find_module`.
+The following functions and data provide conveniences for handling :pep:`3147`
+byte-compiled file paths.
+
+.. versionadded:: 3.2
+
+.. function:: cache_from_source(path, debug_override=None)
+
+   Return the PEP 3147 path to the byte-compiled file associated with the
+   source *path*.  For example, if *path* is ``/foo/bar/baz.py`` the return
+   value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python 3.2.
+   The ``cpython-32`` string comes from the current magic tag (see
+   :func:`get_tag`).  The returned path will end in ``.pyc`` when
+   ``__debug__`` is True or ``.pyo`` for an optimized Python
+   (i.e. ``__debug__`` is False).  By passing in True or False for
+   *debug_override* you can override the system's value for ``__debug__`` for
+   extension selection.
+
+   *path* need not exist.
+
+.. function:: source_from_cache(path)
+
+   Given the *path* to a PEP 3147 file name, return the associated source code
+   file path.  For example, if *path* is
+   ``/foo/bar/__pycache__/baz.cpython-32.pyc`` the returned path would be
+   ``/foo/bar/baz.py``.  *path* need not exist, however if it does not conform
+   to PEP 3147 format, a ``ValueError`` is raised.
+
+.. function:: get_tag()
+
+   Return the PEP 3147 magic tag string matching this version of Python's
+   magic number, as returned by :func:`get_magic`.
+
+
+The following constants with integer values, defined in this module, are used
+to indicate the search result of :func:`find_module`.
 
 
 .. data:: PY_SOURCE

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	Wed Apr 21 13:06:18 2010
@@ -709,7 +709,7 @@
        pools = [tuple(pool) for pool in args] * repeat
        return tuple(random.choice(pool) for pool in pools)
 
-   def random_permuation(iterable, r=None):
+   def random_permutation(iterable, r=None):
        "Random selection from itertools.permutations(iterable, r)"
        pool = tuple(iterable)
        r = len(pool) if r is None else r
@@ -718,12 +718,16 @@
    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))
+       n = len(pool)
+       indices = sorted(random.sample(range(n), r))
+       return tuple(pool[i] for i in indices)
 
    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))
+       n = len(pool)
+       indices = sorted(random.randrange(n) for i in range(r))
+       return tuple(pool[i] for i in indices)
 
 Note, many of the above recipes can be optimized by replacing global lookups
 with local variables defined as default values.  For example, the

Modified: python/branches/py3k-cdecimal/Doc/library/logging.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/logging.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/logging.rst	Wed Apr 21 13:06:18 2010
@@ -244,16 +244,16 @@
   methods listed above, but this is how to log at custom log levels.
 
 :func:`getLogger` returns a reference to a logger instance with the specified
-if it it is provided, or ``root`` if not.  The names are period-separated
+if it is provided, or ``root`` if not.  The names are period-separated
 hierarchical structures.  Multiple calls to :func:`getLogger` with the same name
 will return a reference to the same logger object.  Loggers that are further
 down in the hierarchical list are children of loggers higher up in the list.
 For example, given a logger with a name of ``foo``, loggers with names of
-``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all children of ``foo``.
-Child loggers propagate messages up to their parent loggers.  Because of this,
-it is unnecessary to define and configure all the loggers an application uses.
-It is sufficient to configure a top-level logger and create child loggers as
-needed.
+``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all descendants of ``foo``.
+Child loggers propagate messages up to the handlers associated with their
+ancestor loggers.  Because of this, it is unnecessary to define and configure
+handlers for all the loggers an application uses. It is sufficient to
+configure handlers for a top-level logger and create child loggers as needed.
 
 
 Handlers
@@ -281,15 +281,16 @@
   are there two :func:`setLevel` methods?  The level set in the logger
   determines which severity of messages it will pass to its handlers.  The level
   set in each handler determines which messages that handler will send on.
-  :func:`setFormatter` selects a Formatter object for this handler to use.
+
+* :func:`setFormatter` selects a Formatter object for this handler to use.
 
 * :func:`addFilter` and :func:`removeFilter` respectively configure and
   deconfigure filter objects on handlers.
 
-Application code should not directly instantiate and use handlers.  Instead, the
-:class:`Handler` class is a base class that defines the interface that all
-Handlers should have and establishes some default behavior that child classes
-can use (or override).
+Application code should not directly instantiate and use instances of
+:class:`Handler`.  Instead, the :class:`Handler` class is a base class that
+defines the interface that all handlers should have and establishes some
+default behavior that child classes can use (or override).
 
 
 Formatters
@@ -521,7 +522,9 @@
 can have zero, one or more handlers associated with it (via the
 :meth:`addHandler` method of :class:`Logger`). In addition to any handlers
 directly associated with a logger, *all handlers associated with all ancestors
-of the logger* are called to dispatch the message.
+of the logger* are called to dispatch the message (unless the *propagate* flag
+for a logger is set to a false value, at which point the passing to ancestor
+handlers stops).
 
 Just as for loggers, handlers can have levels associated with them. A handler's
 level acts as a filter in the same way as a logger's level does. If a handler
@@ -849,8 +852,8 @@
 .. attribute:: Logger.propagate
 
    If this evaluates to false, logging messages are not passed by this logger or by
-   child loggers to higher level (ancestor) loggers. The constructor sets this
-   attribute to 1.
+   its child loggers to the handlers of higher level (ancestor) loggers. The
+   constructor sets this attribute to 1.
 
 
 .. method:: Logger.setLevel(lvl)
@@ -889,6 +892,16 @@
    :const:`NOTSET` is found, and that value is returned.
 
 
+.. method:: Logger.getChild(suffix)
+
+   Returns a logger which is a descendant to this logger, as determined by the suffix.
+   Thus, ``logging.getLogger('abc').getChild('def.ghi')`` would return the same
+   logger as would be returned by ``logging.getLogger('abc.def.ghi')``. This is a
+   convenience method, useful when the parent logger is named using e.g. ``__name__``
+   rather than a literal string.
+
+   .. versionadded:: 3.2
+
 .. method:: Logger.debug(msg, *args, **kwargs)
 
    Logs a message with level :const:`DEBUG` on this logger. The *msg* is the
@@ -2012,6 +2025,87 @@
       or integers - if strings are passed, internal mapping dictionaries are
       used to convert them to integers.
 
+      The symbolic ``LOG_`` values are defined in :class:`SysLogHandler` and
+      mirror the values defined in the ``sys/syslog.h`` header file.
+
+      **Priorities**
+
+      +--------------------------+---------------+
+      | Name (string)            | Symbolic value|
+      +==========================+===============+
+      | ``alert``                | LOG_ALERT     |
+      +--------------------------+---------------+
+      | ``crit`` or ``critical`` | LOG_CRIT      |
+      +--------------------------+---------------+
+      | ``debug``                | LOG_DEBUG     |
+      +--------------------------+---------------+
+      | ``emerg`` or ``panic``   | LOG_EMERG     |
+      +--------------------------+---------------+
+      | ``err`` or ``error``     | LOG_ERR       |
+      +--------------------------+---------------+
+      | ``info``                 | LOG_INFO      |
+      +--------------------------+---------------+
+      | ``notice``               | LOG_NOTICE    |
+      +--------------------------+---------------+
+      | ``warn`` or ``warning``  | LOG_WARNING   |
+      +--------------------------+---------------+
+
+      **Facilities**
+
+      +---------------+---------------+
+      | Name (string) | Symbolic value|
+      +===============+===============+
+      | ``auth``      | LOG_AUTH      |
+      +---------------+---------------+
+      | ``authpriv``  | LOG_AUTHPRIV  |
+      +---------------+---------------+
+      | ``cron``      | LOG_CRON      |
+      +---------------+---------------+
+      | ``daemon``    | LOG_DAEMON    |
+      +---------------+---------------+
+      | ``ftp``       | LOG_FTP       |
+      +---------------+---------------+
+      | ``kern``      | LOG_KERN      |
+      +---------------+---------------+
+      | ``lpr``       | LOG_LPR       |
+      +---------------+---------------+
+      | ``mail``      | LOG_MAIL      |
+      +---------------+---------------+
+      | ``news``      | LOG_NEWS      |
+      +---------------+---------------+
+      | ``syslog``    | LOG_SYSLOG    |
+      +---------------+---------------+
+      | ``user``      | LOG_USER      |
+      +---------------+---------------+
+      | ``uucp``      | LOG_UUCP      |
+      +---------------+---------------+
+      | ``local0``    | LOG_LOCAL0    |
+      +---------------+---------------+
+      | ``local1``    | LOG_LOCAL1    |
+      +---------------+---------------+
+      | ``local2``    | LOG_LOCAL2    |
+      +---------------+---------------+
+      | ``local3``    | LOG_LOCAL3    |
+      +---------------+---------------+
+      | ``local4``    | LOG_LOCAL4    |
+      +---------------+---------------+
+      | ``local5``    | LOG_LOCAL5    |
+      +---------------+---------------+
+      | ``local6``    | LOG_LOCAL6    |
+      +---------------+---------------+
+      | ``local7``    | LOG_LOCAL7    |
+      +---------------+---------------+
+
+   .. method:: mapPriority(levelname)
+
+      Maps a logging level name to a syslog priority name.
+      You may need to override this if you are using custom levels, or
+      if the default algorithm is not suitable for your needs. The
+      default algorithm maps ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR`` and
+      ``CRITICAL`` to the equivalent syslog names, and all other level
+      names to "warning".
+
+.. _nt-eventlog-handler:
 
 NTEventLogHandler
 ^^^^^^^^^^^^^^^^^
@@ -2403,6 +2497,11 @@
 methods have the same signatures as their counterparts in :class:`Logger`, so
 you can use the two types of instances interchangeably.
 
+.. versionchanged:: 3.2
+
+The :meth:`isEnabledFor` method was added to :class:`LoggerAdapter`. This method
+delegates to the underlying logger.
+
 
 Thread Safety
 -------------

Modified: python/branches/py3k-cdecimal/Doc/library/math.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/math.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/math.rst	Wed Apr 21 13:06:18 2010
@@ -345,9 +345,9 @@
    :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)``
    (where C99 Annex F recommends signaling invalid operation or divide-by-zero),
    and :exc:`OverflowError` for results that overflow (for example,
-   ``exp(1000.0)``).  A *NaN* will not be returned from any of the functions
-   above unless one or more of the input arguments was a *NaN*; in that case,
-   most functions will return a *NaN*, but (again following C99 Annex F) there
+   ``exp(1000.0)``).  A NaN will not be returned from any of the functions
+   above unless one or more of the input arguments was a NaN; in that case,
+   most functions will return a NaN, but (again following C99 Annex F) there
    are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or
    ``hypot(float('nan'), float('inf'))``.
 

Modified: python/branches/py3k-cdecimal/Doc/library/os.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/os.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/os.rst	Wed Apr 21 13:06:18 2010
@@ -437,6 +437,10 @@
 is slightly deceptive; on Unix platforms, sockets and pipes are also referenced
 by file descriptors.
 
+The :meth:`~file.fileno` method can be used to obtain the file descriptor
+associated with a file object when required.  Note that using the file
+descriptor directly will bypass the file object methods, ignoring aspects such
+as internal buffering of data.
 
 .. function:: close(fd)
 
@@ -1487,7 +1491,16 @@
 
    Send signal *sig* to the process *pid*.  Constants for the specific signals
    available on the host platform are defined in the :mod:`signal` module.
-   Availability: Unix.
+
+   Windows: The :data:`signal.CTRL_C_EVENT` and
+   :data:`signal.CTRL_BREAK_EVENT` signals are special signals which can
+   only be sent to console processes which share a common console window,
+   e.g., some subprocesses. Any other value for *sig* will cause the process
+   to be unconditionally killed by the TerminateProcess API, and the exit code
+   will be set to *sig*. The Windows version of :func:`kill` additionally takes
+   process handles to be killed.
+
+   .. versionadded:: 3.2 Windows support
 
 
 .. function:: killpg(pgid, sig)

Modified: python/branches/py3k-cdecimal/Doc/library/py_compile.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/py_compile.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/py_compile.rst	Wed Apr 21 13:06:18 2010
@@ -26,12 +26,16 @@
 
    Compile a source file to byte-code and write out the byte-code cache  file.  The
    source code is loaded from the file name *file*.  The  byte-code is written to
-   *cfile*, which defaults to *file* ``+`` ``'c'`` (``'o'`` if optimization is
-   enabled in the current interpreter).  If *dfile* is specified, it is used as the
+   *cfile*, which defaults to the :PEP:`3147` path, ending in ``.pyc``
+   (``'.pyo`` if optimization is enabled in the current interpreter).  For
+   example, if *file* is ``/foo/bar/baz.py`` *cfile* will default to
+   ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python 3.2.  If *dfile* is specified, it is used as the
    name of the source file in error messages instead of *file*.  If *doraise* is
    true, a :exc:`PyCompileError` is raised when an error is encountered while
    compiling *file*. If *doraise* is false (the default), an error string is
-   written to ``sys.stderr``, but no exception is raised.
+   written to ``sys.stderr``, but no exception is raised.  This function
+   returns the path to byte-compiled file, i.e. whatever *cfile* value was
+   used.
 
 
 .. function:: main(args=None)

Modified: python/branches/py3k-cdecimal/Doc/library/re.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/re.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/re.rst	Wed Apr 21 13:06:18 2010
@@ -871,6 +871,9 @@
          >>> m.group(1)                        # Returns only the last match.
          'c3'
 
+
+   .. method:: MatchObject.groups(default=None)
+
       Return a tuple containing all the subgroups of the match, from 1 up to however
       many groups are in the pattern.  The *default* argument is used for groups that
       did not participate in the match; it defaults to ``None``.  (Incompatibility

Modified: python/branches/py3k-cdecimal/Doc/library/runpy.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/runpy.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/runpy.rst	Wed Apr 21 13:06:18 2010
@@ -32,7 +32,8 @@
    below are defined in the supplied dictionary, those definitions are
    overridden by :func:`run_module`.
 
-   The special global variables ``__name__``, ``__file__``, ``__loader__``
+   The special global variables ``__name__``, ``__file__``, ``__cached__``,
+   ``__loader__``
    and ``__package__`` are set in the globals dictionary before the module
    code is executed (Note that this is a minimal set of variables - other
    variables may be set implicitly as an interpreter implementation detail).
@@ -45,6 +46,8 @@
    loader does not make filename information available, this variable is set
    to :const:`None`.
 
+    ``__cached__`` will be set to ``None``.
+
    ``__loader__`` is set to the PEP 302 module loader used to retrieve the
    code for the module (This loader may be a wrapper around the standard
    import mechanism).

Modified: python/branches/py3k-cdecimal/Doc/library/shutil.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/shutil.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/shutil.rst	Wed Apr 21 13:06:18 2010
@@ -87,7 +87,7 @@
    match one of the glob-style *patterns* provided.  See the example below.
 
 
-.. function:: copytree(src, dst, symlinks=False, ignore=None)
+.. function:: copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False)
 
    Recursively copy an entire directory tree rooted at *src*.  The destination
    directory, named by *dst*, must not already exist; it will be created as well
@@ -99,6 +99,12 @@
    symbolic links in the new tree; if false or omitted, the contents of the
    linked files are copied to the new tree.
 
+   When *symlinks* is false, if the file pointed by the symlink doesn't
+   exist, a exception will be added in the list of errors raised in
+   a :exc:`Error` exception at the end of the copy process.
+   You can set the optional *ignore_dangling_symlinks* flag to true if you
+   want to silence this exception.
+
    If *ignore* is given, it must be a callable that will receive as its
    arguments the directory being visited by :func:`copytree`, and a list of its
    contents, as returned by :func:`os.listdir`.  Since :func:`copytree` is
@@ -111,8 +117,18 @@
 
    If exception(s) occur, an :exc:`Error` is raised with a list of reasons.
 
-   The source code for this should be considered an example rather than the
-   ultimate tool.
+   If *copy_function* is given, it must be a callable that will be used
+   to copy each file. It will be called with the source path and the
+   destination path as arguments. By default, :func:`copy2` is used, but any
+   function that supports the same signature (like :func:`copy`) can be used.
+
+   .. versionchanged:: 3.2
+      Added the *copy_function* argument to be able to provide a custom copy
+      function.
+
+   .. versionchanged:: 3.2
+      Added the *ignore_dangling_symlinks* argument to silent dangling symlinks
+      errors when *symlinks* is false.
 
 
 .. function:: rmtree(path, ignore_errors=False, onerror=None)
@@ -217,18 +233,18 @@
 
 .. function:: make_archive(base_name, format, [root_dir, [base_dir, [verbose, [dry_run, [owner, [group, [logger]]]]]]])
 
-   Create an archive file (eg. zip or tar) and returns its name.
+   Create an archive file (e.g. zip or tar) and returns its name.
 
    *base_name* is the name of the file to create, including the path, minus
    any format-specific extension. *format* is the archive format: one of
-   "zip", "tar", "ztar", or "gztar".
+   "zip", "tar", "bztar" or "gztar".
 
    *root_dir* is a directory that will be the root directory of the
-   archive; ie. we typically chdir into *root_dir* before creating the
+   archive; i.e. we typically chdir into *root_dir* before creating the
    archive.
 
    *base_dir* is the directory where we start archiving from;
-   ie. *base_dir* will be the common prefix of all files and
+   i.e. *base_dir* will be the common prefix of all files and
    directories in the archive.
 
    *root_dir* and *base_dir* both default to the current directory.
@@ -248,7 +264,6 @@
 
    - *gztar*: gzip'ed tar-file
    - *bztar*: bzip2'ed tar-file
-   - *ztar*: compressed tar file
    - *tar*: uncompressed tar file
    - *zip*: ZIP file
 

Modified: python/branches/py3k-cdecimal/Doc/library/signal.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/signal.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/signal.rst	Wed Apr 21 13:06:18 2010
@@ -74,6 +74,22 @@
    the system are defined by this module.
 
 
+.. data:: CTRL_C_EVENT
+
+   The signal corresponding to the CTRL+C keystroke event.
+   Availability: Windows.
+
+   .. versionadded:: 3.2
+
+
+.. data:: CTRL_BREAK_EVENT
+
+   The signal corresponding to the CTRL+BREAK keystroke event.
+   Availability: Windows.
+
+   .. versionadded:: 3.2
+
+
 .. data:: NSIG
 
    One more than the number of the highest signal number.

Modified: python/branches/py3k-cdecimal/Doc/library/socket.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/socket.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/socket.rst	Wed Apr 21 13:06:18 2010
@@ -622,9 +622,9 @@
 
    Receive up to *nbytes* bytes from the socket, storing the data into a buffer
    rather than creating a new bytestring.  If *nbytes* is not specified (or 0),
-   receive up to the size available in the given buffer. See the Unix manual page
-   :manpage:`recv(2)` for the meaning of the optional argument *flags*; it defaults
-   to zero.
+   receive up to the size available in the given buffer.  Returns the number of
+   bytes received.  See the Unix manual page :manpage:`recv(2)` for the meaning
+   of the optional argument *flags*; it defaults to zero.
 
 
 .. method:: socket.send(bytes[, flags])

Modified: python/branches/py3k-cdecimal/Doc/library/ssl.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/ssl.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/ssl.rst	Wed Apr 21 13:06:18 2010
@@ -47,7 +47,7 @@
    is a subtype of :exc:`socket.error`, which in turn is a subtype of
    :exc:`IOError`.
 
-.. function:: wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True)
+.. function:: wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True, ciphers=None)
 
    Takes an instance ``sock`` of :class:`socket.socket`, and returns an instance
    of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, which wraps
@@ -110,14 +110,23 @@
        ========================  =========  =========  ==========  =========
         *client* / **server**    **SSLv2**  **SSLv3**  **SSLv23**  **TLSv1**
        ------------------------  ---------  ---------  ----------  ---------
-        *SSLv2*                    yes        no         yes*        no
+        *SSLv2*                    yes        no         yes         no
         *SSLv3*                    yes        yes        yes         no
         *SSLv23*                   yes        no         yes         no
         *TLSv1*                    no         no         yes         yes
        ========================  =========  =========  ==========  =========
 
-   In some older versions of OpenSSL (for instance, 0.9.7l on OS X 10.4), an
-   SSLv2 client could not connect to an SSLv23 server.
+   .. note::
+
+      This information varies depending on the version of OpenSSL.
+      For instance, in some older versions of OpenSSL (such as 0.9.7l on
+      OS X 10.4), an SSLv2 client could not connect to an SSLv23 server.
+      Conversely, starting from 1.0.0, an SSLv23 client will actually
+      try the SSLv3 protocol unless you explicitly enable SSLv2 ciphers.
+
+   The parameter ``ciphers`` sets the available ciphers for this SSL object.
+   It should be a string in the `OpenSSL cipher list format
+   <http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT>`_.
 
    The parameter ``do_handshake_on_connect`` specifies whether to do the SSL
    handshake automatically after doing a :meth:`socket.connect`, or whether the
@@ -132,6 +141,9 @@
    normal EOF in response to unexpected EOF errors raised from the underlying
    socket; if :const:`False`, it will raise the exceptions back to the caller.
 
+   .. versionchanged:: 3.2
+      New optional argument *ciphers*.
+
 .. function:: RAND_status()
 
    Returns True if the SSL pseudo-random number generator has been seeded with

Modified: python/branches/py3k-cdecimal/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/stdtypes.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/stdtypes.rst	Wed Apr 21 13:06:18 2010
@@ -2143,12 +2143,12 @@
 
 .. _typememoryview:
 
-memoryview Types
-================
+memoryview type
+===============
 
-:class:`memoryview`\s allow Python code to access the internal data of an object
-that supports the buffer protocol without copying.  Memory can be interpreted as
-simple bytes or complex data structures.
+:class:`memoryview` objects allow Python code to access the internal data
+of an object that supports the buffer protocol without copying.  Memory
+is generally interpreted as simple bytes.
 
 .. class:: memoryview(obj)
 

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	Wed Apr 21 13:06:18 2010
@@ -9,18 +9,31 @@
    triple: packing; binary; data
 
 This module performs conversions between Python values and C structs represented
-as Python :class:`bytes` objects.  It uses :dfn:`format strings` (explained
-below) as compact descriptions of the lay-out of the C structs and the
-intended conversion to/from Python values.  This can be used in handling
-binary data stored in files or from network connections, among other sources.
+as Python :class:`bytes` objects.  This can be used in handling binary data
+stored in files or from network connections, among other sources.  It uses
+:ref:`struct-format-strings` as compact descriptions of the layout of the C
+structs and the intended conversion to/from Python values.
+
+.. note::
+
+   By default, the result of packing a given C struct includes pad bytes in
+   order to maintain proper alignment for the C types involved; similarly,
+   alignment is taken into account when unpacking.  This behavior is chosen so
+   that the bytes of a packed struct correspond exactly to the layout in memory
+   of the corresponding C struct.  To omit pad bytes, use `standard` size and
+   alignment instead of `native` size and alignment: see :ref:`struct-alignment`
+   for details.
+
+Functions and Exceptions
+------------------------
 
 The module defines the following exception and functions:
 
 
 .. exception:: error
 
-   Exception raised on various occasions; argument is a string describing what is
-   wrong.
+   Exception raised on various occasions; argument is a string describing what
+   is wrong.
 
 
 .. function:: pack(fmt, v1, v2, ...)
@@ -32,25 +45,25 @@
 
 .. function:: pack_into(fmt, buffer, offset, v1, v2, ...)
 
-   Pack the values ``v1, v2, ...`` according to the given format, write the packed
-   bytes into the writable *buffer* starting at *offset*. Note that the offset is
-   a required argument.
+   Pack the values ``v1, v2, ...`` according to the given format, write the
+   packed bytes into the writable *buffer* starting at *offset*. Note that the
+   offset is a required argument.
 
 
 .. function:: unpack(fmt, bytes)
 
    Unpack the bytes (presumably packed by ``pack(fmt, ...)``) according to the
-   given format.  The result is a tuple even if it contains exactly one item.  The
-   bytes must contain exactly the amount of data required by the format
+   given format.  The result is a tuple even if it contains exactly one item.
+   The bytes must contain exactly the amount of data required by the format
    (``len(bytes)`` must equal ``calcsize(fmt)``).
 
 
 .. function:: unpack_from(fmt, buffer, offset=0)
 
    Unpack the *buffer* according to the given format. The result is a tuple even
-   if it contains exactly one item. The *buffer* must contain at least the amount
-   of data required by the format (``len(buffer[offset:])`` must be at least
-   ``calcsize(fmt)``).
+   if it contains exactly one item. The *buffer* must contain at least the
+   amount of data required by the format (``len(buffer[offset:])`` must be at
+   least ``calcsize(fmt)``).
 
 
 .. function:: calcsize(fmt)
@@ -58,49 +71,62 @@
    Return the size of the struct (and hence of the bytes) corresponding to the
    given format.
 
+.. _struct-format-strings:
+
+Format Strings
+--------------
+
+Format strings are the mechanism used to specify the expected layout when
+packing and unpacking data.  They are built up from format characters, which
+specify the type of data being packed/unpacked.  In addition, there are
+special characters for controlling the byte order, size, and alignment.
+
+Format Characters
+^^^^^^^^^^^^^^^^^
+
 Format characters have the following meaning; the conversion between C and
 Python values should be obvious given their types:
 
-+--------+-------------------------+--------------------+-------+
-| Format | C Type                  | Python             | Notes |
-+========+=========================+====================+=======+
-| ``x``  | pad byte                | no value           |       |
-+--------+-------------------------+--------------------+-------+
-| ``c``  | :ctype:`char`           | bytes of length 1  |       |
-+--------+-------------------------+--------------------+-------+
-| ``b``  | :ctype:`signed char`    | integer            | \(1)  |
-+--------+-------------------------+--------------------+-------+
-| ``B``  | :ctype:`unsigned char`  | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``?``  | :ctype:`_Bool`          | bool               | \(2)  |
-+--------+-------------------------+--------------------+-------+
-| ``h``  | :ctype:`short`          | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``H``  | :ctype:`unsigned short` | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``i``  | :ctype:`int`            | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``I``  | :ctype:`unsigned int`   | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``l``  | :ctype:`long`           | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``L``  | :ctype:`unsigned long`  | integer            |       |
-+--------+-------------------------+--------------------+-------+
-| ``q``  | :ctype:`long long`      | integer            | \(3)  |
-+--------+-------------------------+--------------------+-------+
-| ``Q``  | :ctype:`unsigned long   | integer            | \(3)  |
-|        | long`                   |                    |       |
-+--------+-------------------------+--------------------+-------+
-| ``f``  | :ctype:`float`          | float              |       |
-+--------+-------------------------+--------------------+-------+
-| ``d``  | :ctype:`double`         | float              |       |
-+--------+-------------------------+--------------------+-------+
-| ``s``  | :ctype:`char[]`         | bytes              | \(1)  |
-+--------+-------------------------+--------------------+-------+
-| ``p``  | :ctype:`char[]`         | bytes              | \(1)  |
-+--------+-------------------------+--------------------+-------+
-| ``P``  | :ctype:`void \*`        | integer            |       |
-+--------+-------------------------+--------------------+-------+
++--------+-------------------------+--------------------+------------+
+| Format | C Type                  | Python             | Notes      |
++========+=========================+====================+============+
+| ``x``  | pad byte                | no value           |            |
++--------+-------------------------+--------------------+------------+
+| ``c``  | :ctype:`char`           | bytes of length 1  |            |
++--------+-------------------------+--------------------+------------+
+| ``b``  | :ctype:`signed char`    | integer            | \(1),\(4)  |
++--------+-------------------------+--------------------+------------+
+| ``B``  | :ctype:`unsigned char`  | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``?``  | :ctype:`_Bool`          | bool               | \(2)       |
++--------+-------------------------+--------------------+------------+
+| ``h``  | :ctype:`short`          | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``H``  | :ctype:`unsigned short` | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``i``  | :ctype:`int`            | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``I``  | :ctype:`unsigned int`   | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``l``  | :ctype:`long`           | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``L``  | :ctype:`unsigned long`  | integer            | \(4)       |
++--------+-------------------------+--------------------+------------+
+| ``q``  | :ctype:`long long`      | integer            | \(3), \(4) |
++--------+-------------------------+--------------------+------------+
+| ``Q``  | :ctype:`unsigned long   | integer            | \(3), \(4) |
+|        | long`                   |                    |            |
++--------+-------------------------+--------------------+------------+
+| ``f``  | :ctype:`float`          | float              |            |
++--------+-------------------------+--------------------+------------+
+| ``d``  | :ctype:`double`         | float              |            |
++--------+-------------------------+--------------------+------------+
+| ``s``  | :ctype:`char[]`         | bytes              | \(1)       |
++--------+-------------------------+--------------------+------------+
+| ``p``  | :ctype:`char[]`         | bytes              | \(1)       |
++--------+-------------------------+--------------------+------------+
+| ``P``  | :ctype:`void \*`        | integer            |            |
++--------+-------------------------+--------------------+------------+
 
 Notes:
 
@@ -169,7 +195,13 @@
 Either 0 or 1 in the native or standard bool representation will be packed, and
 any non-zero value will be True when unpacking.
 
-By default, C numbers are represented in the machine's native format and byte
+
+.. _struct-alignment:
+
+Byte Order, Size, and Alignment
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+By default, C types are represented in the machine's native format and byte
 order, and properly aligned by skipping pad bytes if necessary (according to the
 rules used by the C compiler).
 
@@ -223,8 +255,29 @@
 the host system. The struct module does not interpret this as native ordering,
 so the ``'P'`` format is not available.
 
-Examples (all using native byte order, size and alignment, on a big-endian
-machine)::
+Notes:
+
+(1) Padding is only automatically added between successive structure members.
+    No padding is added at the beginning or the end of the encoded struct.
+
+(2) No padding is added when using non-native size and alignment, e.g.
+    with '<', '>', '=', and '!'.
+
+(3) To align the end of a structure to the alignment requirement of a
+    particular type, end the format with the code for that type with a repeat
+    count of zero.  See :ref:`struct-examples`.
+
+
+.. _struct-examples:
+
+Examples
+^^^^^^^^
+
+.. note::
+   All examples assume a native byte order, size, and alignment with a
+   big-endian machine.
+
+A basic example of packing/unpacking three integers::
 
    >>> from struct import *
    >>> pack('hhl', 1, 2, 3)
@@ -234,13 +287,6 @@
    >>> calcsize('hhl')
    8
 
-Hint: to align the end of a structure to the alignment requirement of a
-particular type, end the format with the code for that type with a repeat count
-of zero.  For example, the format ``'llh0l'`` specifies two pad bytes at the
-end, assuming longs are aligned on 4-byte boundaries.  This only works when
-native size and alignment are in effect; standard size and alignment does not
-enforce any alignment.
-
 Unpacked fields can be named by assigning them to variables or by wrapping
 the result in a named tuple::
 
@@ -252,6 +298,28 @@
     >>> Student._make(unpack('<10sHHb', record))
     Student(name=b'raymond   ', serialnum=4658, school=264, gradelevel=8)
 
+The ordering of format characters may have an impact on size since the padding
+needed to satisfy alignment requirements is different::
+
+    >>> pack('ci', '*', 0x12131415)
+    b'*\x00\x00\x00\x12\x13\x14\x15'
+    >>> pack('ic', 0x12131415, '*')
+    b'\x12\x13\x14\x15*'
+    >>> calcsize('ci')
+    8
+    >>> calcsize('ic')
+    5
+
+The following format ``'llh0l'`` specifies two pad bytes at the end, assuming
+longs are aligned on 4-byte boundaries::
+
+    >>> pack('llh0l', 1, 2, 3)
+    b'\x00\x00\x00\x01\x00\x00\x00\x02\x00\x03\x00\x00'
+
+This only works when native size and alignment are in effect; standard size and
+alignment does not enforce any alignment.
+
+
 .. seealso::
 
    Module :mod:`array`
@@ -263,18 +331,18 @@
 
 .. _struct-objects:
 
-Struct Objects
---------------
+Objects
+-------
 
 The :mod:`struct` module also defines the following type:
 
 
 .. class:: Struct(format)
 
-   Return a new Struct object which writes and reads binary data according to the
-   format string *format*.  Creating a Struct object once and calling its methods
-   is more efficient than calling the :mod:`struct` functions with the same format
-   since the format string only needs to be compiled once.
+   Return a new Struct object which writes and reads binary data according to
+   the format string *format*.  Creating a Struct object once and calling its
+   methods is more efficient than calling the :mod:`struct` functions with the
+   same format since the format string only needs to be compiled once.
 
 
    Compiled Struct objects support the following methods and attributes:

Modified: python/branches/py3k-cdecimal/Doc/library/subprocess.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/subprocess.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/subprocess.rst	Wed Apr 21 13:06:18 2010
@@ -373,8 +373,9 @@
 
    .. note::
 
-      On Windows only SIGTERM is supported so far. It's an alias for
-      :meth:`terminate`.
+      On Windows, SIGTERM is an alias for :meth:`terminate`. CTRL_C_EVENT and
+      CTRL_BREAK_EVENT can be sent to processes started with a `creationflags`
+      parameter which includes `CREATE_NEW_PROCESS_GROUP`.
 
 
 .. method:: Popen.terminate()

Modified: python/branches/py3k-cdecimal/Doc/library/tarfile.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/tarfile.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/tarfile.rst	Wed Apr 21 13:06:18 2010
@@ -212,7 +212,7 @@
 A :class:`TarFile` object can be used as a context manager in a :keyword:`with`
 statement. It will automatically be closed when the block is completed. Please
 note that in the event of an exception an archive opened for writing will not
-be finalized, only the internally used file object will be closed. See the
+be finalized; only the internally used file object will be closed. See the
 :ref:`tar-examples` section for a use case.
 
 .. versionadded:: 3.2

Modified: python/branches/py3k-cdecimal/Doc/library/test.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/test.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/test.rst	Wed Apr 21 13:06:18 2010
@@ -221,15 +221,15 @@
 
 .. data:: TESTFN
 
-   Set to the name that a temporary file could use. Any temporary file that is
-   created should be closed and unlinked (removed).
+   Set to a name that is safe to use as the name of a temporary file.  Any
+   temporary file that is created should be closed and unlinked (removed).
 
 The :mod:`test.support` module defines the following functions:
 
 
 .. function:: forget(module_name)
 
-   Remove the module named *module_name* from ``sys.modules`` and deletes any
+   Remove the module named *module_name* from ``sys.modules`` and delete any
    byte-compiled files of the module.
 
 
@@ -272,49 +272,55 @@
    This will run all tests defined in the named module.
 
 
-.. function:: check_warnings(*filters, quiet=None)
+.. function:: check_warnings(*filters, quiet=True)
 
-   A convenience wrapper for ``warnings.catch_warnings()`` that makes
-   it easier to test that a warning was correctly raised with a single
-   assertion. It is approximately equivalent to calling
-   ``warnings.catch_warnings(record=True)``.
-
-   It accepts 2-tuples ``("message regexp", WarningCategory)`` as positional
-   arguments. If there's some ``*filters`` defined, or if the optional keyword
-   argument ``quiet`` is :const:`False`, it checks if the warnings are
-   effective. If some filter did not catch any warning, the test fails. If some
-   warnings are not caught, the test fails, too. To disable these checks, set
-   argument ``quiet`` to :const:`True`.
+   A convenience wrapper for :func:`warnings.catch_warnings()` that makes it
+   easier to test that a warning was correctly raised.  It is approximately
+   equivalent to calling ``warnings.catch_warnings(record=True)`` with
+   :meth:`warnings.simplefilter` set to ``always`` and with the option to
+   automatically validate the results that are recorded.
+
+   ``check_warnings`` accepts 2-tuples of the form ``("message regexp",
+   WarningCategory)`` as positional arguments. If one or more *filters* are
+   provided, or if the optional keyword argument *quiet* is :const:`False`,
+   it checks to make sure the warnings are as expected:  each specified filter
+   must match at least one of the warnings raised by the enclosed code or the
+   test fails, and if any warnings are raised that do not match any of the
+   specified filters the test fails.  To disable the first of these checks,
+   set *quiet* to :const:`True`.
 
-   Without argument, it defaults to::
+   If no arguments are specified, it defaults to::
 
       check_warnings(("", Warning), quiet=True)
 
-   Additionally, on entry to the context manager, a :class:`WarningRecorder`
-   instance is returned. The underlying warnings list is available via the
-   recorder object's :attr:`warnings` attribute, while the attributes of the
-   last raised warning are also accessible directly on the object. If no
-   warning has been raised, then the latter attributes will all be
-   :const:`None`.
+   In this case all warnings are caught and no errors are raised.
 
-   A :meth:`reset` method is also provided on the recorder object. This
-   method simply clears the warnings list.
+   On entry to the context manager, a :class:`WarningRecorder` instance is
+   returned. The underlying warnings list from
+   :func:`~warnings.catch_warnings` is available via the recorder object's
+   :attr:`warnings` attribute.  As a convenience, the attributes of the object
+   representing the most recent warning can also be accessed directly through
+   the recorder object (see example below).  If no warning has been raised,
+   then any of the attributes that would otherwise be expected on an object
+   representing a warning will return :const:`None`.
 
-   The context manager may be used like this::
+   The recorder object also has a :meth:`reset` method, which clears the
+   warnings list.
 
-      import warnings
-
-      with check_warnings(quiet=False):
-          exec('assert(False, "Hey!")')
-          warnings.warn(UserWarning("Hide me!"))
+   The context manager is designed to be used like this::
 
       with check_warnings(("assertion is always true", SyntaxWarning),
                           ("", UserWarning)):
           exec('assert(False, "Hey!")')
           warnings.warn(UserWarning("Hide me!"))
 
+   In this case if either warning was not raised, or some other warning was
+   raised, :func:`check_warnings` would raise an error.
+
+   When a test needs to look more deeply into the warnings, rather than
+   just checking whether or not they occurred, code like this can be used::
+
       with check_warnings(quiet=True) as w:
-          warnings.simplefilter("always")
           warnings.warn("foo")
           assert str(w.args[0]) == "foo"
           warnings.warn("bar")
@@ -324,8 +330,12 @@
           w.reset()
           assert len(w.warnings) == 0
 
+
+   Here all warnings will be caught, and the test code tests the captured
+   warnings directly.
+
    .. versionchanged:: 3.2
-      New optional attributes ``*filters`` and ``quiet``.
+      New optional arguments *filters* and *quiet*.
 
 
 .. function:: captured_stdout()

Modified: python/branches/py3k-cdecimal/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/threading.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/threading.rst	Wed Apr 21 13:06:18 2010
@@ -155,6 +155,17 @@
    Availability: Windows, systems with POSIX threads.
 
 
+This module also defines the following constant:
+
+.. data:: TIMEOUT_MAX
+
+   The maximum value allowed for the *timeout* parameter of blocking functions
+   (:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.).
+   Specifiying a timeout greater than this value will raise an
+   :exc:`OverflowError`.
+
+   .. versionadded:: 3.2
+
 Detailed interfaces for the objects are documented below.
 
 The design of this module is loosely based on Java's threading model. However,
@@ -349,7 +360,7 @@
 All methods are executed atomically.
 
 
-.. method:: Lock.acquire(blocking=True)
+.. method:: Lock.acquire(blocking=True, timeout=-1)
 
    Acquire a lock, blocking or non-blocking.
 
@@ -363,6 +374,17 @@
    without an argument would block, return false immediately; otherwise, do the
    same thing as when called without arguments, and return true.
 
+   When invoked with the floating-point *timeout* argument set to a positive
+   value, block for at most the number of seconds specified by *timeout*
+   and as long as the lock cannot be acquired.  A negative *timeout* argument
+   specifies an unbounded wait.  It is forbidden to specify a *timeout*
+   when *blocking* is false.
+
+   The return value is ``True`` if the lock is acquired successfully,
+   ``False`` if not (for example if the *timeout* expired).
+
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
 
 .. method:: Lock.release()
 
@@ -396,7 +418,7 @@
 :meth:`acquire` to proceed.
 
 
-.. method:: RLock.acquire(blocking=True)
+.. method:: RLock.acquire(blocking=True, timeout=-1)
 
    Acquire a lock, blocking or non-blocking.
 
@@ -415,6 +437,14 @@
    without an argument would block, return false immediately; otherwise, do the
    same thing as when called without arguments, and return true.
 
+   When invoked with the floating-point *timeout* argument set to a positive
+   value, block for at most the number of seconds specified by *timeout*
+   and as long as the lock cannot be acquired.  Return true if the lock has
+   been acquired, false if the timeout has elapsed.
+
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
+
 
 .. method:: RLock.release()
 
@@ -572,7 +602,7 @@
    defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is
    raised.
 
-   .. method:: acquire(blocking=True)
+   .. method:: acquire(blocking=True, timeout=None)
 
       Acquire a semaphore.
 
@@ -583,14 +613,18 @@
       interlocking so that if multiple :meth:`acquire` calls are blocked,
       :meth:`release` will wake exactly one of them up.  The implementation may
       pick one at random, so the order in which blocked threads are awakened
-      should not be relied on.  There is no return value in this case.
-
-      When invoked with *blocking* set to true, do the same thing as when called
-      without arguments, and return true.
+      should not be relied on.  Returns true (or blocks indefinitely).
 
       When invoked with *blocking* set to false, do not block.  If a call
-      without an argument would block, return false immediately; otherwise, do
-      the same thing as when called without arguments, and return true.
+      without an argument would block, return false immediately; otherwise,
+      do the same thing as when called without arguments, and return true.
+
+      When invoked with a *timeout* other than None, it will block for at
+      most *timeout* seconds.  If acquire does not complete successfully in
+      that interval, return false.  Return true otherwise.
+
+      .. versionchanged:: 3.2
+         The *timeout* parameter is new.
 
    .. method:: release()
 

Modified: python/branches/py3k-cdecimal/Doc/library/unittest.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/unittest.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/unittest.rst	Wed Apr 21 13:06:18 2010
@@ -74,6 +74,11 @@
    Module :mod:`doctest`
       Another test-support module with a very different flavor.
 
+   `unittest2: A backport of new unittest features for Python 2.4-2.6 <http://pypi.python.org/pypi/unittest2>`_
+      Many new features were added to unittest in Python 2.7, including test
+      discovery. unittest2 allows you to use these features with earlier
+      versions of Python.
+
    `Simple Smalltalk Testing: With Patterns <http://www.XProgramming.com/testfram.htm>`_
       Kent Beck's original paper on testing frameworks using the pattern shared
       by :mod:`unittest`.
@@ -82,41 +87,13 @@
       Third-party unittest frameworks with a lighter-weight syntax for writing
       tests.  For example, ``assert func(10) == 42``.
 
-   `python-mock <http://python-mock.sourceforge.net/>`_ and `minimock <http://blog.ianbicking.org/minimock.html>`_
-      Tools for creating mock test objects (objects simulating external
-      resources).
-
-
-.. _unittest-command-line-interface:
-
-Command Line Interface
-----------------------
-
-The unittest module can be used from the command line to run tests from
-modules, classes or even individual test methods::
-
-   python -m unittest test_module1 test_module2
-   python -m unittest test_module.TestClass
-   python -m unittest test_module.TestClass.test_method
-
-You can pass in a list with any combination of module names, and fully
-qualified class or method names.
-
-You can run tests with more detail (higher verbosity) by passing in the -v flag::
-
-   python -m unittest -v test_module
-
-For a list of all the command line options::
-
-   python -m unittest -h
-
-.. versionchanged:: 3.2
-   In earlier versions it was only possible to run individual test methods and
-   not modules or classes.
-
-The command line can also be used for test discovery, for running all of the
-tests in a project or just a subset.
-
+   `The Python Testing Tools Taxonomy <http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy>`_
+      An extensive list of Python testing tools including functional testing
+      frameworks and mock object libraries.
+
+   `Testing in Python Mailing List <http://lists.idyll.org/listinfo/testing-in-python>`_
+      A special-interest-group for discussion of testing, and testing tools,
+      in Python.
 
 .. _unittest-test-discovery:
 
@@ -243,6 +220,100 @@
 are sufficient to meet many everyday testing needs.  The remainder of the
 documentation explores the full feature set from first principles.
 
+
+.. _unittest-command-line-interface:
+
+Command Line Interface
+----------------------
+
+The unittest module can be used from the command line to run tests from
+modules, classes or even individual test methods::
+
+   python -m unittest test_module1 test_module2
+   python -m unittest test_module.TestClass
+   python -m unittest test_module.TestClass.test_method
+
+You can pass in a list with any combination of module names, and fully
+qualified class or method names.
+
+You can run tests with more detail (higher verbosity) by passing in the -v flag::
+
+   python -m unittest -v test_module
+
+For a list of all the command line options::
+
+   python -m unittest -h
+
+..  versionchanged:: 3.2
+   In earlier versions it was only possible to run individual test methods and
+   not modules or classes.
+
+
+failfast, catch and buffer command line options
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+unittest supports three command options.
+
+* -f / --failfast
+
+  Stop the test run on the first error or failure.
+
+* -c / --catch
+
+  Control-c during the test run waits for the current test to end and then
+  reports all the results so far. A second control-c raises the normal
+  ``KeyboardInterrupt`` exception.
+
+  See `Signal Handling`_ for the functions that provide this functionality.
+
+* -b / --buffer
+
+  The standard out and standard error streams are buffered during the test
+  run. Output during a passing test is discarded. Output is echoed normally
+  on test fail or error and is added to the failure messages.
+
+.. versionadded:: 3.2
+   The command line options ``-c``, ``-b`` and ``-f`` where added.
+
+The command line can also be used for test discovery, for running all of the
+tests in a project or just a subset.
+
+
+.. _unittest-test-discovery:
+
+Test Discovery
+--------------
+
+.. versionadded:: 3.2
+
+Unittest supports simple test discovery. For a project's tests to be
+compatible with test discovery they must all be importable from the top level
+directory of the project (in other words, they must all be in Python packages).
+
+Test discovery is implemented in :meth:`TestLoader.discover`, but can also be
+used from the command line. The basic command line usage is::
+
+   cd project_directory
+   python -m unittest discover
+
+The ``discover`` sub-command has the following options:
+
+   -v, --verbose    Verbose output
+   -s directory     Directory to start discovery ('.' default)
+   -p pattern       Pattern to match test files ('test*.py' default)
+   -t directory     Top level directory of project (default to
+                    start directory)
+
+The -s, -p, & -t options can be passsed in as positional arguments. The
+following two command lines are equivalent::
+
+   python -m unittest discover -s project_directory -p '*_test.py'
+   python -m unittest discover project_directory '*_test.py'
+
+Test modules and packages can customize test loading and discovery by through
+the `load_tests protocol`_.
+
+
 .. _organizing-tests:
 
 Organizing test code
@@ -580,6 +651,9 @@
    Mark the test as an expected failure.  If the test fails when run, the test
    is not counted as a failure.
 
+Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them.
+Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run.
+
 
 .. _unittest-contents:
 
@@ -645,6 +719,36 @@
       the outcome of the test method. The default implementation does nothing.
 
 
+   .. method:: setUpClass()
+
+      A class method called before tests in an individual class run.
+      ``setUpClass`` is called with the class as the only argument
+      and must be decorated as a :func:`classmethod`::
+
+        @classmethod
+        def setUpClass(cls):
+            ...
+
+      See `Class and Module Fixtures`_ for more details.
+
+      .. versionadded:: 3.2
+
+
+   .. method:: tearDownClass()
+
+      A class method called after tests in an individual class have run.
+      ``tearDownClass`` is called with the class as the only argument
+      and must be decorated as a :meth:`classmethod`::
+
+        @classmethod
+        def tearDownClass(cls):
+            ...
+
+      See `Class and Module Fixtures`_ for more details.
+
+      .. versionadded:: 3.2
+
+
    .. method:: run(result=None)
 
       Run the test, collecting the result into the test result object passed as
@@ -661,6 +765,8 @@
       Calling this during the a test method or :meth:`setUp` skips the current
       test.  See :ref:`unittest-skipping` for more information.
 
+      .. versionadded:: 3.1
+
 
    .. method:: debug()
 
@@ -725,8 +831,8 @@
          :meth:`failIfEqual`; use :meth:`assertNotEqual`.
 
 
-   .. method:: assertAlmostEqual(first, second, *, places=7, msg=None)
-               failUnlessAlmostEqual(first, second, *, places=7, msg=None)
+   .. method:: assertAlmostEqual(first, second, *, places=7, msg=None, delta=None)
+               failUnlessAlmostEqual(first, second, *, places=7, msg=None, delta=None)
 
       Test that *first* and *second* are approximately equal by computing the
       difference, rounding to the given number of decimal *places* (default 7),
@@ -739,13 +845,14 @@
 
       .. versionchanged:: 3.2
          Objects that compare equal are automatically almost equal.
+         Added the ``delta`` keyword argument.
 
       .. deprecated:: 3.1
          :meth:`failUnlessAlmostEqual`; use :meth:`assertAlmostEqual`.
 
 
-   .. method:: assertNotAlmostEqual(first, second, *, places=7, msg=None)
-               failIfAlmostEqual(first, second, *, places=7, msg=None)
+   .. method:: assertNotAlmostEqual(first, second, *, places=7, msg=None, delta=None)
+               failIfAlmostEqual(first, second, *, places=7, msg=None, delta=None)
 
       Test that *first* and *second* are not approximately equal by computing
       the difference, rounding to the given number of decimal *places* (default
@@ -756,8 +863,14 @@
       compare equal, the test will fail with the explanation given by *msg*, or
       :const:`None`.
 
+      If *delta* is supplied instead of *places* then the the difference
+      between *first* and *second* must be more than *delta*.
+
+      Supplying both *delta* and *places* raises a ``TypeError``.
+
       .. versionchanged:: 3.2
          Objects that compare equal automatically fail.
+         Added the ``delta`` keyword argument.
 
       .. deprecated:: 3.1
          :meth:`failIfAlmostEqual`; use :meth:`assertNotAlmostEqual`.
@@ -800,6 +913,16 @@
       .. versionadded:: 3.1
 
 
+   .. method:: assertNotRegexpMatches(text, regexp, msg=None)
+
+      Verifies that a *regexp* search does not match *text*.  Fails with an error
+      message including the pattern and the *text*.  *regexp* may be
+      a regular expression object or a string containing a regular expression
+      suitable for use by :func:`re.search`.
+
+      .. versionadded:: 3.2
+
+
    .. method:: assertIn(first, second, msg=None)
                assertNotIn(first, second, msg=None)
 
@@ -1132,7 +1255,7 @@
 
    .. method:: doCleanups()
 
-      This method is called uncoditionally after :meth:`tearDown`, or
+      This method is called unconditionally after :meth:`tearDown`, or
       after :meth:`setUp` if :meth:`setUp` raises an exception.
 
       It is responsible for calling all the cleanup functions added by
@@ -1340,6 +1463,8 @@
       ``load_tests`` does not need to pass this argument in to
       ``loader.discover()``.
 
+      *start_dir* can be a dotted module name as well as a directory.
+
       .. versionadded:: 3.2
 
 
@@ -1431,6 +1556,24 @@
       The total number of tests run so far.
 
 
+   .. attribute:: buffer
+
+      If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in between
+      :meth:`startTest` and :meth:`stopTest` being called. Collected output will
+      only be echoed onto the real ``sys.stdout`` and ``sys.stderr`` if the test
+      fails or errors. Any output is also attached to the failure / error message.
+
+      .. versionadded:: 3.2
+
+
+   .. attribute:: failfast
+
+      If set to true :meth:`stop` will be called on the first failure or error,
+      halting the test run.
+
+      .. versionadded:: 3.2
+
+
    .. method:: wasSuccessful()
 
       Return :const:`True` if all tests run so far have passed, otherwise returns
@@ -1459,18 +1602,11 @@
 
       Called when the test case *test* is about to be run.
 
-      The default implementation simply increments the instance's :attr:`testsRun`
-      counter.
-
-
    .. method:: stopTest(test)
 
       Called after the test case *test* has been executed, regardless of the
       outcome.
 
-      The default implementation does nothing.
-
-
    .. method:: startTestRun(test)
 
       Called once before any tests are executed.
@@ -1570,12 +1706,12 @@
 
       ``_makeResult()`` instantiates the class or callable passed in the
       ``TextTestRunner`` constructor as the ``resultclass`` argument. It
-      defaults to :class::`TextTestResult` if no ``resultclass`` is provided.
+      defaults to :class:`TextTestResult` if no ``resultclass`` is provided.
       The result class is instantiated with the following arguments::
 
         stream, descriptions, verbosity
 
-.. function:: main(module='__main__', defaultTest=None, argv=None, testRunner=None, testLoader=unittest.loader.defaultTestLoader, exit=True, verbosity=1)
+.. function:: main(module='__main__', defaultTest=None, argv=None, testRunner=None, testLoader=unittest.loader.defaultTestLoader, exit=True, verbosity=1, failfast=None, catchbreak=None, buffer=None)
 
    A command-line program that runs a set of tests; this is primarily for making
    test modules conveniently executable.  The simplest use for this function is to
@@ -1601,11 +1737,15 @@
       >>> from unittest import main
       >>> main(module='test_module', exit=False)
 
+   The ``failfast``, ``catchbreak`` and ``buffer`` parameters have the same
+   effect as the `failfast, catch and buffer command line options`_.
+
    Calling ``main`` actually returns an instance of the ``TestProgram`` class.
    This stores the result of the tests run as the ``result`` attribute.
 
    .. versionchanged:: 3.2
-      The ``exit`` and ``verbosity`` parameters were added.
+      The ``exit``, ``verbosity``, ``failfast``, ``catchbreak`` and ``buffer``
+      parameters were added.
 
 
 load_tests Protocol
@@ -1675,3 +1815,113 @@
         package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
         standard_tests.addTests(package_tests)
         return standard_tests
+
+
+Class and Module Fixtures
+-------------------------
+
+Class and module level fixtures are implemented in :class:`TestSuite`. When
+the test suite encounters a test from a new class then :meth:`tearDownClass`
+from the previous class (if there is one) is called, followed by
+:meth:`setUpClass` from the new class.
+
+Similarly if a test is from a different module from the previous test then
+``tearDownModule`` from the previous module is run, followed by
+``setUpModule`` from the new module.
+
+After all the tests have run the final ``tearDownClass`` and
+``tearDownModule`` are run.
+
+Note that shared fixtures do not play well with [potential] features like test
+parallelization and they break test isolation. They should be used with care.
+
+The default ordering of tests created by the unittest test loaders is to group
+all tests from the same modules and classes together. This will lead to
+``setUpClass`` / ``setUpModule`` (etc) being called exactly once per class and
+module. If you randomize the order, so that tests from different modules and
+classes are adjacent to each other, then these shared fixture functions may be
+called multiple times in a single test run.
+
+Shared fixtures are not intended to work with suites with non-standard
+ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to
+support shared fixtures.
+
+If there are any exceptions raised during one of the shared fixture functions
+the test is reported as an error. Because there is no corresponding test
+instance an ``_ErrorHolder`` object (that has the same interface as a
+:class:`TestCase`) is created to represent the error. If you are just using
+the standard unittest test runner then this detail doesn't matter, but if you
+are a framework author it may be relevant.
+
+
+setUpClass and tearDownClass
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+These must be implemented as class methods::
+
+    import unittest
+
+    class Test(unittest.TestCase):
+        @classmethod
+        def setUpClass(cls):
+            cls._connection = createExpensiveConnectionObject()
+
+        @classmethod
+        def tearDownClass(cls):
+            cls._connection.destroy()
+
+If you want the ``setUpClass`` and ``tearDownClass`` on base classes called
+then you must call up to them yourself. The implementations in
+:class:`TestCase` are empty.
+
+If an exception is raised during a ``setUpClass`` then the tests in the class
+are not run and the ``tearDownClass`` is not run. Skipped classes will not
+have ``setUpClass`` or ``tearDownClass`` run.
+
+
+setUpModule and tearDownModule
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+These should be implemented as functions::
+
+    def setUpModule():
+        createConnection()
+
+    def tearDownModule():
+        closeConnection()
+
+If an exception is raised in a ``setUpModule`` then none of the tests in the
+module will be run and the ``tearDownModule`` will not be run.
+
+
+Signal Handling
+---------------
+
+The -c / --catch command line option to unittest, along with the ``catchbreak``
+parameter to :func:`unittest.main()`, provide more friendly handling of
+control-c during a test run. With catch break behavior enabled control-c will
+allow the currently running test to complete, and the test run will then end
+and report all the results so far. A second control-c will raise a
+``KeyboardInterrupt`` in the usual way.
+
+There are a few utility functions for framework authors to enable this
+functionality within test frameworks.
+
+.. function:: installHandler()
+
+   Install the control-c handler. When a :const:`signal.SIGINT` is received
+   (usually in response to the user pressing control-c) all registered results
+   have :meth:`~TestResult.stop` called.
+
+.. function:: registerResult(result)
+
+   Register a :class:`TestResult` object for control-c handling. Registering a
+   result stores a weak reference to it, so it doesn't prevent the result from
+   being garbage collected.
+
+.. function:: removeResult(result)
+
+   Remove a registered result. Once a result has been removed then
+   :meth:`~TestResult.stop` will no longer be called on that result object in
+   response to a control-c.
+

Modified: python/branches/py3k-cdecimal/Doc/library/urllib.request.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/urllib.request.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/urllib.request.rst	Wed Apr 21 13:06:18 2010
@@ -1073,23 +1073,39 @@
 --------
 
 This example gets the python.org main page and displays the first 100 bytes of
-it::
+it. ::
 
    >>> import urllib.request
    >>> f = urllib.request.urlopen('http://www.python.org/')
    >>> print(f.read(100))
+   b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+   <?xml-stylesheet href="./css/ht2html'
+
+Note that in Python 3, urlopen returns a bytes object by default. In many
+circumstances, you might expect the output of urlopen to be a string. This
+might be a carried over expectation from Python 2, where urlopen returned
+string or it might even the common usecase. In those cases, you should
+explicitly decode the bytes to string.
+
+In the examples below, we have chosen *utf-8* encoding for demonstration, you
+might choose the encoding which is suitable for the webpage you are
+requesting::
+
+   >>> import urllib.request
+   >>> f = urllib.request.urlopen('http://www.python.org/')
+   >>> print(f.read(100).decode('utf-8')
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <?xml-stylesheet href="./css/ht2html
 
-Here we are sending a data-stream to the stdin of a CGI and reading the data it
-returns to us. Note that this example will only work when the Python
-installation supports SSL. ::
+In the following example, we are sending a data-stream to the stdin of a CGI
+and reading the data it returns to us. Note that this example will only work
+when the Python installation supports SSL. ::
 
    >>> import urllib.request
    >>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',
    ...                       data='This data is passed to stdin of the CGI')
    >>> f = urllib.request.urlopen(req)
-   >>> print(f.read())
+   >>> print(f.read().decode('utf-8'))
    Got Data: "This data is passed to stdin of the CGI"
 
 The code for the sample CGI used in the above example is::
@@ -1161,7 +1177,7 @@
    >>> import urllib.parse
    >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >>> f = urllib.request.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
-   >>> print(f.read())
+   >>> print(f.read().decode('utf-8'))
 
 The following example uses the ``POST`` method instead::
 
@@ -1169,7 +1185,7 @@
    >>> import urllib.parse
    >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >>> f = urllib.request.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
-   >>> print(f.read())
+   >>> print(f.read().decode('utf-8'))
 
 The following example uses an explicitly specified HTTP proxy, overriding
 environment settings::
@@ -1178,14 +1194,14 @@
    >>> proxies = {'http': 'http://proxy.example.com:8080/'}
    >>> opener = urllib.request.FancyURLopener(proxies)
    >>> f = opener.open("http://www.python.org")
-   >>> f.read()
+   >>> f.read().decode('utf-8')
 
 The following example uses no proxies at all, overriding environment settings::
 
    >>> import urllib.request
    >>> opener = urllib.request.FancyURLopener({})
    >>> f = opener.open("http://www.python.org/")
-   >>> f.read()
+   >>> f.read().decode('utf-8')
 
 
 :mod:`urllib.request` Restrictions

Modified: python/branches/py3k-cdecimal/Doc/library/warnings.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/warnings.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/warnings.rst	Wed Apr 21 13:06:18 2010
@@ -180,7 +180,10 @@
 While within the context manager all warnings will simply be ignored. This
 allows you to use known-deprecated code without having to see the warning while
 not suppressing the warning for other code that might not be aware of its use
-of deprecated code.
+of deprecated code.  Note: this can only be guaranteed in a single-threaded
+application. If two or more threads use the :class:`catch_warnings` context
+manager at the same time, the behavior is undefined.
+
 
 
 .. _warning-testing:
@@ -218,7 +221,9 @@
 when the context was entered. This prevents tests from changing the warnings
 filter in unexpected ways between tests and leading to indeterminate test
 results. The :func:`showwarning` function in the module is also restored to
-its original value.
+its original value.  Note: this can only be guaranteed in a single-threaded
+application. If two or more threads use the :class:`catch_warnings` context
+manager at the same time, the behavior is undefined.
 
 When testing multiple operations that raise the same kind of warning, it
 is important to test them in a manner that confirms each operation is raising
@@ -337,3 +342,11 @@
     module returned when you import :mod:`warnings` whose filter will be
     protected. This argument exists primarily for testing the :mod:`warnings`
     module itself.
+
+    .. note::
+
+        The :class:`catch_warnings` manager works by replacing and
+        then later restoring the module's
+        :func:`showwarning` function and internal list of filter
+        specifications.  This means the context manager is modifying
+        global state and therefore is not thread-safe.

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	Wed Apr 21 13:06:18 2010
@@ -914,7 +914,9 @@
 A right shift by *n* bits is defined as division by ``pow(2,n)``.  A left shift
 by *n* bits is defined as multiplication with ``pow(2,n)``.
 
-.. note:: In the current implementation, the right-hand operand is required
+.. note::
+
+   In the current implementation, the right-hand operand is required
    to be at most :attr:`sys.maxsize`.  If the right-hand operand is larger than
    :attr:`sys.maxsize` an :exc:`OverflowError` exception is raised.
 

Modified: python/branches/py3k-cdecimal/Doc/tutorial/interpreter.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/tutorial/interpreter.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/tutorial/interpreter.rst	Wed Apr 21 13:06:18 2010
@@ -155,7 +155,7 @@
 On BSD'ish Unix systems, Python scripts can be made directly executable, like
 shell scripts, by putting the line ::
 
-   #! /usr/bin/env python3.1
+   #! /usr/bin/env python3.2
 
 (assuming that the interpreter is on the user's :envvar:`PATH`) at the beginning
 of the script and giving the file an executable mode.  The ``#!`` must be the

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	Wed Apr 21 13:06:18 2010
@@ -297,7 +297,7 @@
    the remaining fields.  Empty fields match all values; trailing empty fields
    may be omitted.  The *message* field matches the start of the warning message
    printed; this match is case-insensitive.  The *category* field matches the
-   warning category.  This must be a class name; the match test whether the
+   warning category.  This must be a class name; the match tests whether the
    actual warning category of the message is a subclass of the specified warning
    category.  The full class name must be given.  The *module* field matches the
    (fully-qualified) module name; this match is case-sensitive.  The *line*
@@ -476,7 +476,7 @@
 
 .. envvar:: PYTHONWARNINGS
 
-   This is the equivalent to the :option:`-W` option. If set to a comma
+   This is equivalent to the :option:`-W` option. If set to a comma
    separated string, it is equivalent to specifying :option:`-W` multiple
    times.
 

Modified: python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/2.6.rst	Wed Apr 21 13:06:18 2010
@@ -1792,7 +1792,7 @@
   were applied.  (Maintained by Josiah Carlson; see :issue:`1736190` for
   one patch.)
 
-* The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the package
+* The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avion, and the package
   is now available as a standalone package.  The web page for the package is
   `www.jcea.es/programacion/pybsddb.htm
   <http://www.jcea.es/programacion/pybsddb.htm>`__.

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	Wed Apr 21 13:06:18 2010
@@ -8,8 +8,9 @@
 
 .. Fix accents on Kristjan Valur Jonsson, Fuerstenau
 
-.. Big jobs: argparse, ElementTree 1.3, pep 391, 3106, sysconfig
+.. Big jobs: ElementTree 1.3, pep 391, sysconfig
 ..  unittest test discovery
+..  hyperlink all the methods & functions.
 
 .. $Id$
    Rules for maintenance:
@@ -57,8 +58,9 @@
 schedule is described in :pep:`373`.
 
 Python 2.7 is planned to be the last major release in the 2.x series.
-Though more major releases have not been absolutely ruled out, it's
-likely that the 2.7 release will have an extended period of
+Though more major releases have not been absolutely ruled out, the
+Python maintainers are planning to focus more on Python 3.x.  Despite
+that, it's likely that the 2.7 release will have a longer period of
 maintenance compared to earlier 2.x versions.
 
 .. Compare with previous release in 2 - 3 sentences here.
@@ -180,14 +182,21 @@
 ..     :meth:`~collections.namedtuple._asdict()` (see below)
 
 The standard library now supports use of ordered dictionaries in several
-modules.  The :mod:`configparser` module uses them by default.  This lets
-configuration files be read, modified, and then written back in their original
-order.  The :meth:`~collections.somenamedtuple._asdict()` method for
-:func:`collections.namedtuple` now returns an ordered dictionary with the
-values appearing in the same order as the underlying tuple indices.
-The :mod:`json` module is being built-out with an *object_pairs_hook* to allow
-OrderedDicts to be built by the decoder.
-Support was also added for third-party tools like `PyYAML <http://pyyaml.org/>`_.
+modules.
+
+* The :mod:`ConfigParser` module uses them by default, letting
+  configuration files be read, modified, and then written back in their original
+  order.
+
+* The :meth:`~collections.somenamedtuple._asdict()` method for
+  :func:`collections.namedtuple` now returns an ordered dictionary with the
+  values appearing in the same order as the underlying tuple indices.
+
+* The :mod:`json` module's :class:`~json.JSONDecoder` class
+  constructor was extended with an *object_pairs_hook* parameter to
+  allow :class:`OrderedDict` instances to be built by the decoder.
+  Support was also added for third-party tools like
+  `PyYAML <http://pyyaml.org/>`_.
 
 .. seealso::
 
@@ -238,17 +247,119 @@
 PEP 389: The argparse Module for Parsing Command Lines
 ======================================================
 
-XXX write this section.
+The :mod:`argparse` module for parsing command-line arguments was
+added, intended as a more powerful replacement for the
+:mod:`optparse` module.
+
+This means Python now supports three different modules for parsing
+command-line arguments: :mod:`getopt`, :mod:`optparse`, and
+:mod:`argparse`.  The :mod:`getopt` module closely resembles the C
+:cfunc:`getopt` function, so it remains useful if you're writing a
+Python prototype that will eventually be rewritten in C.
+:mod:`optparse` becomes redundant, but there are no plans to remove it
+because there are many scripts still using it, and there's no
+automated way to update these scripts.  (Making the :mod:`argparse`
+API consistent with :mod:`optparse`'s interface was discussed but
+rejected as too messy and difficult.)
+
+In short, if you're writing a new script and don't need to worry
+about compatibility with earlier versions of Python, use
+:mod:`argparse` instead of :mod:`optparse`.
+
+Here's an example::
+
+    import argparse
+
+    parser = argparse.ArgumentParser(description='Command-line example.')
+
+    # Add optional switches
+    parser.add_argument('-v', action='store_true', dest='is_verbose',
+                        help='produce verbose output')
+    parser.add_argument('-o', action='store', dest='output',
+                        metavar='FILE',
+                        help='direct output to FILE instead of stdout')
+    parser.add_argument('-C', action='store', type=int, dest='context',
+                        metavar='NUM', default=0,
+                        help='display NUM lines of added context')
+
+    # Allow any number of additional arguments.
+    parser.add_argument(nargs='*', action='store', dest='inputs',
+                        help='input filenames (default is stdin)')
+
+    args = parser.parse_args()
+    print args.__dict__
+
+Unless you override it, :option:`-h` and :option:`--help` switches
+are automatically added, and produce neatly formatted output::
+
+    -> ./python.exe argparse-example.py --help
+    usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs [inputs ...]]
+
+    Command-line example.
+
+    positional arguments:
+      inputs      input filenames (default is stdin)
+
+    optional arguments:
+      -h, --help  show this help message and exit
+      -v          produce verbose output
+      -o FILE     direct output to FILE instead of stdout
+      -C NUM      display NUM lines of added context
+
+Similarly to :mod:`optparse`, the command-line switches and arguments
+are returned as an object with attributes named by the *dest* parameters::
+
+    -> ./python.exe argparse-example.py -v
+    {'output': None, 'is_verbose': True, 'context': 0, 'inputs': []}
+
+    -> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2
+    {'output': '/tmp/output', 'is_verbose': True, 'context': 4,
+     'inputs': ['file1', 'file2']}
+
+:mod:`argparse` has much fancier validation than :mod:`optparse`; you
+can specify an exact number of arguments as an integer, 0 or more
+arguments by passing ``'*'``, 1 or more by passing ``'+'``, or an
+optional argument with ``'?'``.  A top-level parser can contain
+sub-parsers, so you can define subcommands that have different sets of
+switches, as in ``svn commit``, ``svn checkout``, etc.  You can
+specify an argument type as :class:`~argparse.FileType`, which will
+automatically open files for you and understands that ``'-'`` means
+standard input or output.
 
 .. seealso::
 
+   `argparse module documentation <http://docs.python.org/dev/library/argparse.html>`__
+
+   `Upgrading optparse code to use argparse <http://docs.python.org/dev/library/argparse.html#upgrading-optparse-code>`__
+
    :pep:`389` - argparse - New Command Line Parsing Module
      PEP written and implemented by Steven Bethard.
 
 PEP 391: Dictionary-Based Configuration For Logging
 ====================================================
 
-XXX write this section.
+.. not documented in library reference yet.
+
+The :mod:`logging` module is very flexible; an application can define
+a tree of logging subsystems, and each logger in this tree can filter
+out certain messages, format them differently, and direct messages to
+a varying number of handlers.
+
+All this flexibility can require a lot of configuration.  You can
+write Python statements to create objects and set their properties,
+but a complex set-up would require verbose but boring code.
+:mod:`logging` also supports a :func:`~logging.config.fileConfig`
+function that parses a file, but the file format doesn't support
+configuring filters, and it's messier to generate programmatically.
+
+Python 2.7 adds a :func:`~logging.config.dictConfig` function that
+uses a dictionary, and there are many ways to produce a dictionary
+from different sources.  You can construct one with code, of course.
+Python's standard library now includes a JSON parser, so you could
+parse a file containing JSON, or you could use a YAML parsing library
+if one is installed.
+
+XXX describe an example.
 
 Two smaller enhancements to the logging module are:
 
@@ -272,7 +383,48 @@
 PEP 3106: Dictionary Views
 ====================================================
 
-XXX write this section.
+The dictionary methods :meth:`keys`, :meth:`values`, and :meth:`items`
+are different in Python 3.x.  They return an object called a :dfn:`view`
+instead of a fully materialized list.
+
+.. Views can be iterated over, but they also behave like sets.  XXX not working.
+
+It's not possible to change the return values of :meth:`keys`,
+:meth:`values`, and :meth:`items` in Python 2.7 because too much code
+would break.  Instead the 3.x versions were added under the new names
+of :meth:`viewkeys`, :meth:`viewvalues`, and :meth:`viewitems`.
+
+::
+
+    >>> d = dict((i*10, chr(65+i)) for i in range(26))
+    >>> d
+    {0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}
+    >>> d.viewkeys()
+    dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])
+
+The view keeps track of the dictionary and its contents change as the
+dictionary is modified::
+
+    >>> vk = d.viewkeys()
+    >>> vk
+    dict_keys([0, 130, 10, ..., 250])
+    >>> d[260] = '&'
+    >>> vk
+    dict_keys([0, 130, 260, 10, ..., 250])
+
+However, note that you can't add or remove keys while you're iterating
+over the view::
+
+    >>> for k in vk:
+    ...     d[k*2] = k
+    ...
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    RuntimeError: dictionary changed size during iteration
+
+You can use the view methods in Python 2.x code, and the 2to3
+converter will change them to the standard :meth:`keys`,
+:meth:`values`, and :meth:`items` methods.
 
 .. seealso::
 
@@ -472,12 +624,39 @@
   Python3-warning mode, Python 2.7 will now warn about this odd usage.
   (Noted by James Lingard; :issue:`7362`.)
 
+* It's now possible to create weak references to old-style class
+  objects.  New-style classes were always weak-referenceable.  (Fixed
+  by Antoine Pitrou; :issue:`8268`.)
+
 * When a module object is garbage-collected, the module's dictionary is
   now only cleared if no one else is holding a reference to the
   dictionary (:issue:`7140`).
 
 .. ======================================================================
 
+.. _new-27-interpreter:
+
+Interpreter Changes
+-------------------------------
+
+A new environment variable, :envvar:`PYTHONWARNINGS`,
+allows controlling warnings.  It should be set to a string
+containing warning settings, equivalent to those
+used with the :option:`-W` switch, separated by commas.
+(Contributed by Brian Curtin; :issue:`7301`.)
+
+For example, the following setting will print warnings every time
+they occur, but turn warnings from the :mod:`Cookie` module into an
+error.  (The exact syntax for setting an environment variable varies
+across operating systems and shells, so it may be different for you.)
+
+::
+
+  export PYTHONWARNINGS=all,error:::Cookie:0
+
+
+.. ======================================================================
+
 
 Optimizations
 -------------
@@ -637,11 +816,15 @@
      >>> c['z']
      0
 
-  There are two additional :class:`~collections.Counter` methods:
-  :meth:`~collections.Counter.most_common` returns the N most common elements
-  and their counts, and :meth:`~collections.Counter.elements`
-  returns an iterator over the contained element, repeating each element
-  as many times as its count::
+  There are three additional :class:`~collections.Counter` methods:
+  :meth:`~collections.Counter.most_common` returns the N most common
+  elements and their counts.  :meth:`~collections.Counter.elements`
+  returns an iterator over the contained elements, repeating each
+  element as many times as its count.
+  :meth:`~collections.Counter.subtract` takes an iterable and
+  subtracts one for each element instead of adding; if the argument is
+  a dictionary or another :class:`Counter`, the counts are
+  subtracted. ::
 
     >>> c.most_common(5)
     [(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]
@@ -650,11 +833,16 @@
        'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',
        'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
        's', 's', 'r', 't', 't', 'x'
-
-  .. maybe it's better to use list(c.elements()) here
+    >>> c['e']
+    5
+    >>> c.subtract('very heavy on the letter e')
+    >>> c['e']    # Count is now lower
+    -1
 
   Contributed by Raymond Hettinger; :issue:`1696199`.
 
+  .. revision 79660
+
   The new :class:`~collections.OrderedDict` class is described in the earlier
   section :ref:`pep-0372`.
 
@@ -671,10 +859,13 @@
 
   (Added by Raymond Hettinger; :issue:`1818`.)
 
-  The :class:`~collections.deque` data type now exposes its maximum length as the
-  read-only :attr:`~collections.deque.maxlen` attribute, and has a
-  :meth:`~collections.deque.reverse` method that reverses the elements of the deque in-place.
-  (Added by Raymond Hettinger.)
+  The :class:`~collections.deque` data type now has a
+  :meth:`~collections.deque.count` method that returns the number of
+  contained elements equal to the supplied argument *x*, and a
+  :meth:`~collections.deque.reverse` method that reverses the elements
+  of the deque in-place.  :class:`deque` also exposes its maximum
+  length as the read-only :attr:`~collections.deque.maxlen` attribute.
+  (Both features added by Raymond Hettinger.)
 
 * The :mod:`copy` module's :func:`~copy.deepcopy` function will now
   correctly copy bound instance methods.  (Implemented by
@@ -707,18 +898,34 @@
   :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context.is_canonical`
   methods.  (Patch by Juan José Conti; :issue:`7633`.)
 
-  The constructor for :class:`~decimal.Decimal` now accepts non-European
-  Unicode characters, such as Arabic-Indic digits.  (Contributed by
-  Mark Dickinson; :issue:`6595`.)
+  The constructor for :class:`~decimal.Decimal` now accepts
+  floating-point numbers (added by Raymond Hettinger; :issue:`8257`)
+  and non-European Unicode characters such as Arabic-Indic digits
+  (contributed by Mark Dickinson; :issue:`6595`).
 
   When using :class:`~decimal.Decimal` instances with a string's
   :meth:`~str.format` method, the default alignment was previously
   left-alignment.  This has been changed to right-alignment, which seems
   more sensible for numeric types.  (Changed by Mark Dickinson; :issue:`6857`.)
 
-* The :class:`~fractions.Fraction` class now accepts two rational numbers
-  as arguments to its constructor.
-  (Implemented by Mark Dickinson; :issue:`5812`.)
+* The :mod:`difflib` module now produces output that is more
+  compatible with modern :command:`diff`/:command:`patch` tools thanks
+  to two changes: 1) the header giving the filename now uses a tab
+  character instead of spaces as a separator, and 2) the date format
+  used is now ISO-8601 style, ``2005-01-26 23:30:50``.  (Fixed by
+  Anatoly Techtonik; :issue:`7585`.)
+
+* The :class:`~fractions.Fraction` class now accepts a single float or
+  :class:`~decimal.Decimal` instance, or two rational numbers, as
+  arguments to its constructor.  (Implemented by Mark Dickinson;
+  rationals added in :issue:`5812`, and float/decimal in
+  :issue:`8294`.)
+
+  An oversight was fixed, making the :class:`Fraction` match the other
+  numeric types; ordering comparisons (``<``, ``<=``, ``>``, ``>=``) between
+  fractions and complex numbers now raise a :exc:`TypeError`.
+
+  .. revision 79455
 
 * New class: a new :class:`~ftplib.FTP_TLS` class in
   the :mod:`ftplib` module provides secure FTP
@@ -730,6 +937,21 @@
   uploads thanks to an added *rest* parameter (patch by Pablo Mouzo;
   :issue:`6845`.)
 
+* New class decorator: :func:`total_ordering` in the :mod:`functools`
+  module takes a class that defines an :meth:`__eq__` method and one of
+  :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`,
+  and generates the missing comparison methods.  Since the
+  :meth:`__cmp__` method is being deprecated in Python 3.x,
+  this decorator makes it easier to define ordered classes.
+  (Added by Raymond Hettinger; :issue:`5479`.)
+
+  New function: :func:`cmp_to_key` will take an old-style comparison
+  function that expects two arguments and return a new callable that
+  can be used as the *key* parameter to functions such as
+  :func:`sorted`, :func:`min` and :func:`max`, etc.  The primary
+  intended use is to help with making code compatible with Python 3.x.
+  (Added by Raymond Hettinger.)
+
 * New function: the :mod:`gc` module's :func:`~gc.is_tracked` returns
   true if a given instance is tracked by the garbage collector, false
   otherwise. (Contributed by Antoine Pitrou; :issue:`4688`.)
@@ -766,6 +988,25 @@
 * The :mod:`imaplib` module now supports IPv6 addresses.
   (Contributed by Derek Morr; :issue:`1655`.)
 
+* New function: the :mod:`inspect` module's :func:`~inspect.getcallargs`
+  takes a callable and its positional and keyword arguments,
+  and figures out which of the callable's parameters will receive each argument,
+  returning a dictionary mapping argument names to their values.  For example::
+
+    >>> from inspect import getcallargs
+    >>> def f(a, b=1, *pos, **named):
+    ...     pass
+    >>> getcallargs(f, 1, 2, 3)
+    {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}
+    >>> getcallargs(f, a=2, x=4)
+    {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}
+    >>> getcallargs(f)
+    Traceback (most recent call last):
+    ...
+    TypeError: f() takes at least 1 argument (0 given)
+
+  Contributed by George Sakkis; :issue:`3135`.
+
 * Updated module: The :mod:`io` library has been upgraded to the version shipped with
   Python 3.1.  For 3.1, the I/O library was entirely rewritten in C
   and is 2 to 20 times faster depending on the task being performed.  The
@@ -904,8 +1145,17 @@
   Victor Stinner; :issue:`3137`.)
 
 * The :mod:`socket` module's :class:`~ssl.SSL` objects now support the
-  buffer API, which fixed a test suite failure.  (Fixed by Antoine
-  Pitrou; :issue:`7133`.)
+  buffer API, which fixed a test suite failure (fix by Antoine Pitrou;
+  :issue:`7133`).  :class:`SSL` objects also now automatically set
+  OpenSSL's :cmacro:`SSL_MODE_AUTO_RETRY`, which will prevent an error
+  code being returned from :meth:`recv` operations that trigger an SSL
+  renegotiation (fix by Antoine Pitrou; :issue:`8222`).
+
+  The version of OpenSSL being used is now available as the module
+  attributes :attr:`OPENSSL_VERSION` (a string),
+  :attr:`OPENSSL_VERSION_INFO` (a 5-tuple), and
+  :attr:`OPENSSL_VERSION_NUMBER` (an integer).  (Added by Antoine
+  Pitrou; :issue:`8321`.)
 
   The :func:`~socket.create_connection` function
   gained a *source_address* parameter, a ``(host, port)`` 2-tuple
@@ -935,7 +1185,10 @@
   errors when a value is too large for a particular integer format
   code (one of ``bBhHiIlLqQ``); it now always raises a
   :exc:`struct.error` exception.  (Changed by Mark Dickinson;
-  :issue:`1523`.)
+  :issue:`1523`.)  The :func:`~struct.pack` function will also
+  attempt to use :meth:`__index__` to convert and pack non-integers
+  before trying the :meth:`__int__` method or reporting an error.
+  (Changed by Mark Dickinson; :issue:`8300`.)
 
 * New function: the :mod:`subprocess` module's
   :func:`~subprocess.check_output` runs a command with a specified set of arguments
@@ -1057,58 +1310,6 @@
 .. whole new modules get described in subsections here
 
 
-Distutils Enhancements
----------------------------------
-
-XXX all of this work has been moved to Distutils2
-XXX Not sure what we should say here
-
-Distutils is being more actively developed, thanks to Tarek Ziadé
-who has taken over maintenance of the package, so there are a number
-of fixes and improvements.
-
-A new :file:`setup.py` subcommand, ``check``, will check that the
-arguments being passed to the :func:`setup` function are complete
-and correct (:issue:`5732`).
-
-Byte-compilation by the ``install_lib``  subcommand is now only done
-if the ``sys.dont_write_bytecode`` setting allows it (:issue:`7071`).
-
-:func:`distutils.sdist.add_defaults` now uses
-*package_dir* and *data_files* to create the MANIFEST file.
-:mod:`distutils.sysconfig` now reads the :envvar:`AR` and
-:envvar:`ARFLAGS` environment variables.
-
-.. ARFLAGS done in #5941
-
-It is no longer mandatory to store clear-text passwords in the
-:file:`.pypirc` file when registering and uploading packages to PyPI. As long
-as the username is present in that file, the :mod:`distutils` package will
-prompt for the password if not present.  (Added by Tarek Ziadé,
-based on an initial contribution by Nathan Van Gheem; :issue:`4394`.)
-
-A Distutils setup can now specify that a C extension is optional by
-setting the *optional* option setting to true.  If this optional is
-supplied, failure to build the extension will not abort the build
-process, but instead simply not install the failing extension.
-(Contributed by Georg Brandl; :issue:`5583`.)
-
-The :class:`distutils.dist.DistributionMetadata` class'
-:meth:`read_pkg_file` method will read the contents of a package's
-:file:`PKG-INFO` metadata file.  For an example of its use, see
-:ref:`reading-metadata`.
-(Contributed by Tarek Ziadé; :issue:`7457`.)
-
-:file:`setup.py` files will now accept a :option:`--no-user-cfg` switch
-to skip reading the :file:`~/.pydistutils.cfg` file.  (Suggested by
-by Michael Hoffman, and implemented by Paul Winkler; :issue:`1180`.)
-
-When creating a tar-format archive, the ``sdist`` subcommand now
-allows specifying the user id and group that will own the files in the
-archives using the :option:`--owner` and :option:`--group` switches
-(:issue:`6516`).
-
-
 Unit Testing Enhancements
 ---------------------------------
 
@@ -1322,6 +1523,18 @@
 
 Changes to Python's build process and to the C API include:
 
+* The latest release of the GNU Debugger, GDB 7, can be `scripted
+  using Python
+  <http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html>`__.
+  When you begin debugging an executable program P, GDB will look for
+  a file named ``P-gdb.py`` and automatically read it.  Dave Malcolm
+  contributed a :file:`python-gdb.py` that adds a number of useful
+  commands when debugging Python itself.  For example, there are
+  ``py-up`` and ``py-down`` that go up or down one Python stack frame,
+  which usually corresponds to several C stack frames.  ``py-print``
+  prints the value of a Python variable, and ``py-bt`` prints the
+  Python stack trace.  (Added as a result of :issue:`8032`.)
+
 * If you use the :file:`.gdbinit` file provided with Python,
   the "pyo" macro in the 2.7 version now works correctly when the thread being
   debugged doesn't hold the GIL; the macro now acquires it before printing.
@@ -1418,9 +1631,10 @@
   building the :mod:`pyexpat` module to use the system Expat library.
   (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:`7609`.)
 
-* New configure option: Compiling Python with the
+* New configure option: compiling Python with the
   :option:`--with-valgrind` option will now disable the pymalloc
-  allocator, which is difficult for the Valgrind to analyze correctly.
+  allocator, which is difficult for the Valgrind memory-error detector
+  to analyze correctly.
   Valgrind will therefore be better at detecting memory leaks and
   overruns. (Contributed by James Henstridge; :issue:`2422`.)
 
@@ -1435,6 +1649,10 @@
   but it's available if anyone wishes to use it.
   (Added by Mark Dickinson; :issue:`2937`.)
 
+  :program:`configure` also now sets a :envvar:`LDCXXSHARED` Makefile
+  variable for supporting C++ linking.  (Contributed by Arfrever
+  Frehtes Taifersar Arahesis; :issue:`1222585`.)
+
 * The build process now creates the necessary files for pkg-config
   support.  (Contributed by Clinton Roy; :issue:`3585`.)
 
@@ -1458,6 +1676,13 @@
   the native thread-local storage functions are now used.
   (Contributed by Kristjan Valur Jonsson; :issue:`3582`.)
 
+* The :func:`os.kill` function now works on Windows.  The signal value
+  can be the constants :const:`CTRL_C_EVENT`,
+  :const:`CTRL_BREAK_EVENT`, or any integer.  The Control-C and
+  Control-Break keystroke events can be sent to subprocesses; any
+  other value will use the :cfunc:`TerminateProcess` API.
+  (Contributed by Miki Tebeka; :issue:`1220212`.)
+
 * The :func:`os.listdir` function now correctly fails
   for an empty path.  (Fixed by Hirokazu Yamamoto; :issue:`5913`.)
 
@@ -1509,6 +1734,11 @@
   with a new :option:`-F` switch that runs selected tests in a loop
   until they fail.  (Added by Antoine Pitrou; :issue:`7312`.)
 
+* When executed as a script, the :file:`py_compile.py` module now
+  accepts ``'-'`` as an argument, which will read standard input for
+  the list of filenames to be compiled.  (Contributed by Piotr
+  Ożarowski; :issue:`8233`.)
+
 .. ======================================================================
 
 Porting to Python 2.7
@@ -1567,5 +1797,5 @@
 
 The author would like to thank the following people for offering
 suggestions, corrections and assistance with various drafts of this
-article: Ryan Lovett, Hugh Secker-Walker.
+article: Ryan Lovett, R. David Murray, Hugh Secker-Walker.
 

Modified: python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst	Wed Apr 21 13:06:18 2010
@@ -85,6 +85,17 @@
   (Contributed by Georg Brandl and Mattias Brändström;
   `appspot issue 53094 <http://codereview.appspot.com/53094>`_.)
 
+* The :func:`shutil.copytree` function has two new options
+
+  * ignore_dangling_symlinks: when symlinks=false (meaning that the function
+    copy the file pointed by the symlink, not the symlink itself)
+    this option will silence the error thrown if the file doesn't exists.
+
+  * copy_function: a callable that will be used to copy files.
+    :func:`shutil.copy2` is used by default.
+
+  (Contributed by Tarek Ziade)
+
 Multi-threading
 ===============
 

Modified: python/branches/py3k-cdecimal/Include/Python.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/Python.h	(original)
+++ python/branches/py3k-cdecimal/Include/Python.h	Wed Apr 21 13:06:18 2010
@@ -120,9 +120,18 @@
 #include "pystrcmp.h"
 #include "dtoa.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* _Py_Mangle is defined in compile.c */
 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
 
+/* _Py_char2wchar lives in main.c */
+PyAPI_FUNC(wchar_t *) _Py_char2wchar(char *);
+#ifdef __cplusplus
+}
+#endif
+
 /* Convert a possibly signed character to a nonnegative int */
 /* XXX This assumes characters are 8 bits wide */
 #ifdef __CHAR_UNSIGNED__

Modified: python/branches/py3k-cdecimal/Include/import.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/import.h	(original)
+++ python/branches/py3k-cdecimal/Include/import.h	Wed Apr 21 13:06:18 2010
@@ -8,9 +8,12 @@
 #endif
 
 PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
+PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
 	char *name, PyObject *co, char *pathname);
+PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
+	char *name, PyObject *co, char *pathname, char *cpathname);
 PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
 PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
 PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);

Modified: python/branches/py3k-cdecimal/Include/pyport.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/pyport.h	(original)
+++ python/branches/py3k-cdecimal/Include/pyport.h	Wed Apr 21 13:06:18 2010
@@ -625,6 +625,16 @@
 #ifdef __FreeBSD__
 #include <osreldate.h>
 #if __FreeBSD_version > 500039
+# define _PY_PORT_CTYPE_UTF8_ISSUE
+#endif
+#endif
+
+
+#if defined(__APPLE__)
+# define _PY_PORT_CTYPE_UTF8_ISSUE
+#endif
+
+#ifdef _PY_PORT_CTYPE_UTF8_ISSUE
 #include <ctype.h>
 #include <wctype.h>
 #undef isalnum
@@ -642,7 +652,6 @@
 #undef toupper
 #define toupper(c) towupper(btowc(c))
 #endif
-#endif
 
 
 /* Declarations for symbol visibility.

Modified: python/branches/py3k-cdecimal/Include/pythread.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/pythread.h	(original)
+++ python/branches/py3k-cdecimal/Include/pythread.h	Wed Apr 21 13:06:18 2010
@@ -19,6 +19,41 @@
 PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
 #define WAIT_LOCK	1
 #define NOWAIT_LOCK	0
+
+/* PY_TIMEOUT_T is the integral type used to specify timeouts when waiting
+   on a lock (see PyThread_acquire_lock_timed() below).
+   PY_TIMEOUT_MAX is the highest usable value (in microseconds) of that
+   type, and depends on the system threading API.
+   
+   NOTE: this isn't the same value as `_thread.TIMEOUT_MAX`.  The _thread
+   module exposes a higher-level API, with timeouts expressed in seconds
+   and floating-point numbers allowed.
+*/
+#if defined(HAVE_LONG_LONG)
+#define PY_TIMEOUT_T PY_LONG_LONG
+#define PY_TIMEOUT_MAX PY_LLONG_MAX
+#else
+#define PY_TIMEOUT_T long
+#define PY_TIMEOUT_MAX LONG_MAX
+#endif
+
+/* In the NT API, the timeout is a DWORD and is expressed in milliseconds */
+#if defined (NT_THREADS)
+#if (0xFFFFFFFFLL * 1000 < PY_TIMEOUT_MAX)
+#undef PY_TIMEOUT_MAX
+#define PY_TIMEOUT_MAX (0xFFFFFFFFLL * 1000)
+#endif
+#endif
+
+/* If microseconds == 0, the call is non-blocking: it returns immediately
+   even when the lock can't be acquired.
+   If microseconds > 0, the call waits up to the specified duration.
+   If microseconds < 0, the call waits until success (or abnormal failure)
+   
+   microseconds must be less than PY_TIMEOUT_MAX. Behaviour otherwise is
+   undefined. */
+PyAPI_FUNC(int) PyThread_acquire_lock_timed(PyThread_type_lock,
+					    PY_TIMEOUT_T microseconds);
 PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock);
 
 PyAPI_FUNC(size_t) PyThread_get_stacksize(void);

Modified: python/branches/py3k-cdecimal/LICENSE
==============================================================================
--- python/branches/py3k-cdecimal/LICENSE	(original)
+++ python/branches/py3k-cdecimal/LICENSE	Wed Apr 21 13:06:18 2010
@@ -62,10 +62,12 @@
     2.6.2           2.6.1       2009        PSF         yes
     2.6.3           2.6.2       2009        PSF         yes
     2.6.4           2.6.3       2009        PSF         yes
+    2.6.5           2.6.4       2010        PSF         yes
     3.0             2.6         2008        PSF         yes
     3.0.1           3.0         2009        PSF         yes
     3.1             3.0.1       2009        PSF         yes
     3.1.1           3.1         2009        PSF         yes
+    3.1.2           3.1         2010        PSF         yes
 
 Footnotes:
 

Modified: python/branches/py3k-cdecimal/Lib/_dummy_thread.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/_dummy_thread.py	(original)
+++ python/branches/py3k-cdecimal/Lib/_dummy_thread.py	Wed Apr 21 13:06:18 2010
@@ -17,6 +17,10 @@
            'interrupt_main', 'LockType']
 
 import traceback as _traceback
+import time
+
+# A dummy value
+TIMEOUT_MAX = 2**31
 
 class error(Exception):
     """Dummy implementation of _thread.error."""
@@ -92,7 +96,7 @@
     def __init__(self):
         self.locked_status = False
 
-    def acquire(self, waitflag=None):
+    def acquire(self, waitflag=None, timeout=-1):
         """Dummy implementation of acquire().
 
         For blocking calls, self.locked_status is automatically set to
@@ -111,6 +115,8 @@
                 self.locked_status = True
                 return True
             else:
+                if timeout > 0:
+                    time.sleep(timeout)
                 return False
 
     __enter__ = acquire

Modified: python/branches/py3k-cdecimal/Lib/collections.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/collections.py	(original)
+++ python/branches/py3k-cdecimal/Lib/collections.py	Wed Apr 21 13:06:18 2010
@@ -453,12 +453,11 @@
 
         '''
         if iterable is not None:
+            self_get = self.get
             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:

Modified: python/branches/py3k-cdecimal/Lib/compileall.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/compileall.py	(original)
+++ python/branches/py3k-cdecimal/Lib/compileall.py	Wed Apr 21 13:06:18 2010
@@ -12,6 +12,7 @@
 
 """
 import os
+import errno
 import sys
 import py_compile
 import struct
@@ -20,7 +21,7 @@
 __all__ = ["compile_dir","compile_file","compile_path"]
 
 def compile_dir(dir, maxlevels=10, ddir=None,
-                force=0, rx=None, quiet=0):
+                force=False, rx=None, quiet=False, legacy=False):
     """Byte-compile all modules in the given directory tree.
 
     Arguments (only dir is required):
@@ -29,8 +30,9 @@
     maxlevels: maximum recursion level (default 10)
     ddir:      if given, purported directory name (this is the
                directory name that will show up in error messages)
-    force:     if 1, force compilation, even if timestamps are up-to-date
-    quiet:     if 1, be quiet during compilation
+    force:     if True, force compilation, even if timestamps are up-to-date
+    quiet:     if True, be quiet during compilation
+    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
 
     """
     if not quiet:
@@ -49,24 +51,26 @@
         else:
             dfile = None
         if not os.path.isdir(fullname):
-            if not compile_file(fullname, ddir, force, rx, quiet):
+            if not compile_file(fullname, ddir, force, rx, quiet, legacy):
                 success = 0
         elif maxlevels > 0 and \
              name != os.curdir and name != os.pardir and \
              os.path.isdir(fullname) and \
              not os.path.islink(fullname):
             if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
-                               quiet):
+                               quiet, legacy):
                 success = 0
     return success
 
-def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
+def compile_file(fullname, ddir=None, force=0, rx=None, quiet=False,
+                 legacy=False):
     """Byte-compile file.
-    file:      the file to byte-compile
+    fullname:  the file to byte-compile
     ddir:      if given, purported directory name (this is the
                directory name that will show up in error messages)
-    force:     if 1, force compilation, even if timestamps are up-to-date
-    quiet:     if 1, be quiet during compilation
+    force:     if True, force compilation, even if timestamps are up-to-date
+    quiet:     if True, be quiet during compilation
+    legacy:    if True, produce legacy pyc paths instead of PEP 3147 paths
 
     """
     success = 1
@@ -80,13 +84,22 @@
         if mo:
             return success
     if os.path.isfile(fullname):
+        if legacy:
+            cfile = fullname + ('c' if __debug__ else 'o')
+        else:
+            cfile = imp.cache_from_source(fullname)
+            cache_dir = os.path.dirname(cfile)
+            try:
+                os.mkdir(cache_dir)
+            except OSError as error:
+                if error.errno != errno.EEXIST:
+                    raise
         head, tail = name[:-3], name[-3:]
         if tail == '.py':
             if not force:
                 try:
                     mtime = int(os.stat(fullname).st_mtime)
                     expect = struct.pack('<4sl', imp.get_magic(), mtime)
-                    cfile = fullname + (__debug__ and 'c' or 'o')
                     with open(cfile, 'rb') as chandle:
                         actual = chandle.read(8)
                     if expect == actual:
@@ -96,14 +109,15 @@
             if not quiet:
                 print('Compiling', fullname, '...')
             try:
-                ok = py_compile.compile(fullname, None, dfile, True)
+                ok = py_compile.compile(fullname, cfile, dfile, True)
             except py_compile.PyCompileError as err:
                 if quiet:
                     print('*** Error compiling', fullname, '...')
                 else:
                     print('*** ', end='')
                 # escape non-printable characters in msg
-                msg = err.msg.encode(sys.stdout.encoding, errors='backslashreplace')
+                msg = err.msg.encode(sys.stdout.encoding,
+                                     errors='backslashreplace')
                 msg = msg.decode(sys.stdout.encoding)
                 print(msg)
                 success = 0
@@ -119,15 +133,17 @@
                     success = 0
     return success
 
-def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
+def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False,
+                 legacy=False):
     """Byte-compile all module on sys.path.
 
     Arguments (all optional):
 
     skip_curdir: if true, skip current directory (default true)
     maxlevels:   max recursion level (default 0)
-    force: as for compile_dir() (default 0)
-    quiet: as for compile_dir() (default 0)
+    force: as for compile_dir() (default False)
+    quiet: as for compile_dir() (default False)
+    legacy: as for compile_dir() (default False)
 
     """
     success = 1
@@ -136,7 +152,8 @@
             print('Skipping current directory')
         else:
             success = success and compile_dir(dir, maxlevels, None,
-                                              force, quiet=quiet)
+                                              force, quiet=quiet,
+                                              legacy=legacy)
     return success
 
 def expand_args(args, flist):
@@ -162,10 +179,10 @@
     """Script main program."""
     import getopt
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:')
+        opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:b')
     except getopt.error as msg:
         print(msg)
-        print("usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
+        print("usage: python compileall.py [-l] [-f] [-q] [-d destdir] "
               "[-x regexp] [-i list] [directory|file ...]")
         print("-l: don't recurse down")
         print("-f: force rebuild even if timestamps are up-to-date")
@@ -174,23 +191,27 @@
         print("   if no directory arguments, -l sys.path is assumed")
         print("-x regexp: skip files matching the regular expression regexp")
         print("   the regexp is searched for in the full path of the file")
-        print("-i list: expand list with its content (file and directory names)")
+        print("-i list: expand list with its content "
+              "(file and directory names)")
+        print("-b: Produce legacy byte-compile file paths")
         sys.exit(2)
     maxlevels = 10
     ddir = None
-    force = 0
-    quiet = 0
+    force = False
+    quiet = False
     rx = None
     flist = None
+    legacy = False
     for o, a in opts:
         if o == '-l': maxlevels = 0
         if o == '-d': ddir = a
-        if o == '-f': force = 1
-        if o == '-q': quiet = 1
+        if o == '-f': force = True
+        if o == '-q': quiet = True
         if o == '-x':
             import re
             rx = re.compile(a)
         if o == '-i': flist = a
+        if o == '-b': legacy = True
     if ddir:
         if len(args) != 1 and not os.path.isdir(args[0]):
             print("-d destdir require exactly one directory argument")
@@ -207,13 +228,14 @@
                 for arg in args:
                     if os.path.isdir(arg):
                         if not compile_dir(arg, maxlevels, ddir,
-                                           force, rx, quiet):
+                                           force, rx, quiet, legacy):
                             success = 0
                     else:
-                        if not compile_file(arg, ddir, force, rx, quiet):
+                        if not compile_file(arg, ddir, force, rx,
+                                            quiet, legacy):
                             success = 0
         else:
-            success = compile_path()
+            success = compile_path(legacy=legacy)
     except KeyboardInterrupt:
         print("\n[interrupt]")
         success = 0

Modified: python/branches/py3k-cdecimal/Lib/difflib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/difflib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/difflib.py	Wed Apr 21 13:06:18 2010
@@ -1160,18 +1160,18 @@
 
     The unidiff format normally has a header for filenames and modification
     times.  Any or all of these may be specified using strings for
-    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.  The modification
-    times are normally expressed in the format returned by time.ctime().
+    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
+    The modification times are normally expressed in the ISO 8601 format.
 
     Example:
 
     >>> for line in unified_diff('one two three four'.split(),
     ...             'zero one tree four'.split(), 'Original', 'Current',
-    ...             'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:20:52 2003',
+    ...             '2005-01-26 23:30:50', '2010-04-02 10:20:52',
     ...             lineterm=''):
-    ...     print(line)
-    --- Original Sat Jan 26 23:30:50 1991
-    +++ Current Fri Jun 06 10:20:52 2003
+    ...     print(line)                 # doctest: +NORMALIZE_WHITESPACE
+    --- Original        2005-01-26 23:30:50
+    +++ Current         2010-04-02 10:20:52
     @@ -1,4 +1,4 @@
     +zero
      one
@@ -1184,8 +1184,10 @@
     started = False
     for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
         if not started:
-            yield '--- %s %s%s' % (fromfile, fromfiledate, lineterm)
-            yield '+++ %s %s%s' % (tofile, tofiledate, lineterm)
+            fromdate = '\t%s' % fromfiledate if fromfiledate else ''
+            todate = '\t%s' % tofiledate if tofiledate else ''
+            yield '--- %s%s%s' % (fromfile, fromdate, lineterm)
+            yield '+++ %s%s%s' % (tofile, todate, lineterm)
             started = True
         i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4]
         yield "@@ -%d,%d +%d,%d @@%s" % (i1+1, i2-i1, j1+1, j2-j1, lineterm)
@@ -1223,17 +1225,16 @@
     The context diff format normally has a header for filenames and
     modification times.  Any or all of these may be specified using
     strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
-    The modification times are normally expressed in the format returned
-    by time.ctime().  If not specified, the strings default to blanks.
+    The modification times are normally expressed in the ISO 8601 format.
+    If not specified, the strings default to blanks.
 
     Example:
 
     >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(1),
-    ...       'zero\none\ntree\nfour\n'.splitlines(1), 'Original', 'Current',
-    ...       'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:22:46 2003')),
+    ...       'zero\none\ntree\nfour\n'.splitlines(1), 'Original', 'Current')),
     ...       end="")
-    *** Original Sat Jan 26 23:30:50 1991
-    --- Current Fri Jun 06 10:22:46 2003
+    *** Original
+    --- Current
     ***************
     *** 1,4 ****
       one
@@ -1251,8 +1252,10 @@
     prefixmap = {'insert':'+ ', 'delete':'- ', 'replace':'! ', 'equal':'  '}
     for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
         if not started:
-            yield '*** %s %s%s' % (fromfile, fromfiledate, lineterm)
-            yield '--- %s %s%s' % (tofile, tofiledate, lineterm)
+            fromdate = '\t%s' % fromfiledate if fromfiledate else ''
+            todate = '\t%s' % tofiledate if tofiledate else ''
+            yield '*** %s%s%s' % (fromfile, fromdate, lineterm)
+            yield '--- %s%s%s' % (tofile, todate, lineterm)
             started = True
 
         yield '***************%s' % (lineterm,)

Modified: python/branches/py3k-cdecimal/Lib/distutils/tests/support.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/distutils/tests/support.py	(original)
+++ python/branches/py3k-cdecimal/Lib/distutils/tests/support.py	Wed Apr 21 13:06:18 2010
@@ -63,6 +63,8 @@
         super().tearDown()
         while self.tempdirs:
             d = self.tempdirs.pop()
+            if not os.path.exists(d):
+                continue
             shutil.rmtree(d, os.name in ('nt', 'cygwin'))
 
     def mkdtemp(self):

Modified: python/branches/py3k-cdecimal/Lib/email/encoders.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/email/encoders.py	(original)
+++ python/branches/py3k-cdecimal/Lib/email/encoders.py	Wed Apr 21 13:06:18 2010
@@ -62,7 +62,7 @@
         # iso-2022-* is non-ASCII but still 7-bit
         charset = msg.get_charset()
         output_cset = charset and charset.output_charset
-        if output_cset and output_cset.lower().startswith('iso-2202-'):
+        if output_cset and output_cset.lower().startswith('iso-2022-'):
             msg['Content-Transfer-Encoding'] = '7bit'
         else:
             msg['Content-Transfer-Encoding'] = '8bit'

Modified: python/branches/py3k-cdecimal/Lib/email/message.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/email/message.py	(original)
+++ python/branches/py3k-cdecimal/Lib/email/message.py	Wed Apr 21 13:06:18 2010
@@ -63,7 +63,7 @@
     while s[:1] == ';':
         s = s[1:]
         end = s.find(';')
-        while end > 0 and s.count('"', 0, end) % 2:
+        while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
             end = s.find(';', end + 1)
         if end < 0:
             end = len(s)

Modified: python/branches/py3k-cdecimal/Lib/email/test/test_email.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/email/test/test_email.py	(original)
+++ python/branches/py3k-cdecimal/Lib/email/test/test_email.py	Wed Apr 21 13:06:18 2010
@@ -322,6 +322,14 @@
         self.assertEqual(msg.get_param('name', unquote=False),
                          '"Jim&amp;&amp;Jill"')
 
+    def test_get_param_with_quotes(self):
+        msg = email.message_from_string(
+            'Content-Type: foo; bar*0="baz\\"foobar"; bar*1="\\"baz"')
+        self.assertEqual(msg.get_param('bar'), 'baz"foobar"baz')
+        msg = email.message_from_string(
+            "Content-Type: foo; bar*0=\"baz\\\"foobar\"; bar*1=\"\\\"baz\"")
+        self.assertEqual(msg.get_param('bar'), 'baz"foobar"baz')
+
     def test_field_containment(self):
         unless = self.assertTrue
         msg = email.message_from_string('Header: exists')

Modified: python/branches/py3k-cdecimal/Lib/ftplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/ftplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/ftplib.py	Wed Apr 21 13:06:18 2010
@@ -237,7 +237,7 @@
         if self.debugging > 1: print('*put urgent*', self.sanitize(line))
         self.sock.sendall(line, MSG_OOB)
         resp = self.getmultiline()
-        if resp[:3] not in ('426', '226'):
+        if resp[:3] not in ('426', '225', '226'):
             raise error_proto(resp)
 
     def sendcmd(self, cmd):
@@ -297,6 +297,8 @@
             resp = self.sendport(host, port)
         else:
             resp = self.sendeprt(host, port)
+        if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
+            sock.settimeout(self.timeout)
         return sock
 
     def makepasv(self):
@@ -349,6 +351,8 @@
             if resp[0] != '1':
                 raise error_reply(resp)
             conn, sockaddr = sock.accept()
+            if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
+                conn.settimeout(self.timeout)
         if resp[:3] == '150':
             # this is conditional in case we received a 125
             size = parse150(resp)

Modified: python/branches/py3k-cdecimal/Lib/functools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/functools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/functools.py	Wed Apr 21 13:06:18 2010
@@ -67,8 +67,9 @@
                    ('__lt__', lambda self, other: not self >= other)]
     }
     roots = set(dir(cls)) & set(convert)
-    assert roots, 'must define at least one ordering operation: < > <= >='
-    root = max(roots)       # prefer __lt __ to __le__ to __gt__ to __ge__
+    if not roots:
+        raise ValueError('must define at least one ordering operation: < > <= >=')
+    root = max(roots)       # prefer __lt__ to __le__ to __gt__ to __ge__
     for opname, opfunc in convert[root]:
         if opname not in roots:
             opfunc.__name__ = opname

Modified: python/branches/py3k-cdecimal/Lib/importlib/_bootstrap.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/_bootstrap.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/_bootstrap.py	Wed Apr 21 13:06:18 2010
@@ -488,6 +488,16 @@
 
     """Load a module from a source or bytecode file."""
 
+    def _find_path(self, ext_type):
+        """Return PEP 3147 path if ext_type is PY_COMPILED, otherwise
+        super()._find_path() is called."""
+        if ext_type == imp.PY_COMPILED:
+            # We don't really care what the extension on self._base_path is,
+            # as long as it has exactly one dot.
+            bytecode_path = imp.cache_from_source(self._base_path + '.py')
+            return (bytecode_path if _path_exists(bytecode_path) else None)
+        return super()._find_path(ext_type)
+
     @_check_name
     def source_mtime(self, name):
         """Return the modification time of the source for the specified
@@ -515,7 +525,16 @@
         """
         bytecode_path = self.bytecode_path(name)
         if not bytecode_path:
-            bytecode_path = self._base_path + _suffix_list(imp.PY_COMPILED)[0]
+            source_path = self.source_path(name)
+            bytecode_path = imp.cache_from_source(source_path)
+            # Ensure that the __pycache__ directory exists.  We can't use
+            # os.path.dirname() here.
+            dirname, sep, basename = bytecode_path.rpartition(path_sep)
+            try:
+                _os.mkdir(dirname)
+            except OSError as error:
+                if error.errno != errno.EEXIST:
+                    raise
         try:
             # Assuming bytes.
             with _closing(_io.FileIO(bytecode_path, 'w')) as bytecode_file:

Modified: python/branches/py3k-cdecimal/Lib/importlib/test/__main__.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/test/__main__.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/test/__main__.py	Wed Apr 21 13:06:18 2010
@@ -13,7 +13,11 @@
 
 
 def test_main():
-    start_dir = os.path.dirname(__file__)
+    if '__pycache__' in __file__:
+        parts = __file__.split(os.path.sep)
+        start_dir = sep.join(parts[:-2])
+    else:
+        start_dir = os.path.dirname(__file__)
     top_dir = os.path.dirname(os.path.dirname(start_dir))
     test_loader = unittest.TestLoader()
     if '--builtin' in sys.argv:

Modified: python/branches/py3k-cdecimal/Lib/importlib/test/source/test_file_loader.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/test/source/test_file_loader.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/test/source/test_file_loader.py	Wed Apr 21 13:06:18 2010
@@ -127,7 +127,7 @@
         except KeyError:
             pass
         py_compile.compile(mapping[name])
-        bytecode_path = source_util.bytecode_path(mapping[name])
+        bytecode_path = imp.cache_from_source(mapping[name])
         with open(bytecode_path, 'rb') as file:
             bc = file.read()
         new_bc = manipulator(bc)
@@ -226,7 +226,7 @@
         zeros = b'\x00\x00\x00\x00'
         with source_util.create_modules('_temp') as mapping:
             py_compile.compile(mapping['_temp'])
-            bytecode_path = source_util.bytecode_path(mapping['_temp'])
+            bytecode_path = imp.cache_from_source(mapping['_temp'])
             with open(bytecode_path, 'r+b') as bytecode_file:
                 bytecode_file.seek(4)
                 bytecode_file.write(zeros)
@@ -242,9 +242,10 @@
     def test_bad_marshal(self):
         # Bad marshal data should raise a ValueError.
         with source_util.create_modules('_temp') as mapping:
-            bytecode_path = source_util.bytecode_path(mapping['_temp'])
+            bytecode_path = imp.cache_from_source(mapping['_temp'])
             source_mtime = os.path.getmtime(mapping['_temp'])
             source_timestamp = importlib._w_long(source_mtime)
+            source_util.ensure_bytecode_path(bytecode_path)
             with open(bytecode_path, 'wb') as bytecode_file:
                 bytecode_file.write(imp.get_magic())
                 bytecode_file.write(source_timestamp)
@@ -260,7 +261,7 @@
         with source_util.create_modules('_temp') as mapping:
             # Create bytecode that will need to be re-created.
             py_compile.compile(mapping['_temp'])
-            bytecode_path = source_util.bytecode_path(mapping['_temp'])
+            bytecode_path = imp.cache_from_source(mapping['_temp'])
             with open(bytecode_path, 'r+b') as bytecode_file:
                 bytecode_file.seek(0)
                 bytecode_file.write(b'\x00\x00\x00\x00')

Modified: python/branches/py3k-cdecimal/Lib/importlib/test/source/test_finder.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/test/source/test_finder.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/test/source/test_finder.py	Wed Apr 21 13:06:18 2010
@@ -1,7 +1,9 @@
 from importlib import _bootstrap
 from .. import abc
 from . import util as source_util
+from test.support import make_legacy_pyc
 import os
+import errno
 import py_compile
 import unittest
 import warnings
@@ -52,6 +54,14 @@
             if unlink:
                 for name in unlink:
                     os.unlink(mapping[name])
+                    try:
+                        make_legacy_pyc(mapping[name])
+                    except OSError as error:
+                        # Some tests do not set compile_=True so the source
+                        # module will not get compiled and there will be no
+                        # PEP 3147 pyc file to rename.
+                        if error.errno != errno.ENOENT:
+                            raise
             loader = self.import_(mapping['.root'], test)
             self.assertTrue(hasattr(loader, 'load_module'))
             return loader
@@ -60,7 +70,8 @@
         # [top-level source]
         self.run_test('top_level')
         # [top-level bc]
-        self.run_test('top_level', compile_={'top_level'}, unlink={'top_level'})
+        self.run_test('top_level', compile_={'top_level'},
+                      unlink={'top_level'})
         # [top-level both]
         self.run_test('top_level', compile_={'top_level'})
 

Modified: python/branches/py3k-cdecimal/Lib/importlib/test/source/test_source_encoding.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/test/source/test_source_encoding.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/test/source/test_source_encoding.py	Wed Apr 21 13:06:18 2010
@@ -33,7 +33,7 @@
 
     def run_test(self, source):
         with source_util.create_modules(self.module_name) as mapping:
-            with open(mapping[self.module_name], 'wb')as file:
+            with open(mapping[self.module_name], 'wb') as file:
                 file.write(source)
             loader = _bootstrap._PyPycFileLoader(self.module_name,
                                        mapping[self.module_name], False)

Modified: python/branches/py3k-cdecimal/Lib/importlib/test/source/util.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/test/source/util.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/test/source/util.py	Wed Apr 21 13:06:18 2010
@@ -1,5 +1,6 @@
 from .. import util
 import contextlib
+import errno
 import functools
 import imp
 import os
@@ -26,14 +27,16 @@
     return wrapper
 
 
-def bytecode_path(source_path):
-    for suffix, _, type_ in imp.get_suffixes():
-        if type_ == imp.PY_COMPILED:
-            bc_suffix = suffix
-            break
-    else:
-        raise ValueError("no bytecode suffix is defined")
-    return os.path.splitext(source_path)[0] + bc_suffix
+def ensure_bytecode_path(bytecode_path):
+    """Ensure that the __pycache__ directory for PEP 3147 pyc file exists.
+
+    :param bytecode_path: File system path to PEP 3147 pyc file.
+    """
+    try:
+        os.mkdir(os.path.dirname(bytecode_path))
+    except OSError as error:
+        if error.errno != errno.EEXIST:
+            raise
 
 
 @contextlib.contextmanager

Modified: python/branches/py3k-cdecimal/Lib/importlib/util.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/importlib/util.py	(original)
+++ python/branches/py3k-cdecimal/Lib/importlib/util.py	Wed Apr 21 13:06:18 2010
@@ -1,4 +1,5 @@
 """Utility code for constructing importers, etc."""
+
 from ._bootstrap import module_for_loader
 from ._bootstrap import set_loader
 from ._bootstrap import set_package

Modified: python/branches/py3k-cdecimal/Lib/inspect.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/inspect.py	(original)
+++ python/branches/py3k-cdecimal/Lib/inspect.py	Wed Apr 21 13:06:18 2010
@@ -54,6 +54,7 @@
     """Return true if the object is a module.
 
     Module objects provide these attributes:
+        __cached__      pathname to byte compiled file
         __doc__         documentation string
         __file__        filename (missing for built-in modules)"""
     return isinstance(object, types.ModuleType)

Modified: python/branches/py3k-cdecimal/Lib/locale.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/locale.py	(original)
+++ python/branches/py3k-cdecimal/Lib/locale.py	Wed Apr 21 13:06:18 2010
@@ -710,6 +710,28 @@
 #    updated 'sr_yu.microsoftcp1251 at cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
 #    updated 'sr_yu.utf8 at cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
 #    updated 'sr_yu at cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+#
+# AP 2010-04-12:
+# Updated alias mapping to most recent locale.alias file
+# from X.org distribution using makelocalealias.py.
+#
+# These are the differences compared to the old mapping (Python 2.6.5
+# and older):
+#
+#    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
+#    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
+#    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8 at latin'
+#    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8 at latin'
+#    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8 at latin'
+#    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+#    updated 'sr at cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+#    updated 'sr at latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8 at latin'
+#    updated 'sr_cs.utf8 at latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8 at latin'
+#    updated 'sr_cs at latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8 at latin'
+#    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8 at latin'
+#    updated 'sr_yu.utf8 at cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
+#    updated 'sr_yu at cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+#
 
 locale_alias = {
     'a3':                                   'a3_AZ.KOI8-C',
@@ -761,13 +783,17 @@
     'ar_ye.iso88596':                       'ar_YE.ISO8859-6',
     'arabic':                               'ar_AA.ISO8859-6',
     'arabic.iso88596':                      'ar_AA.ISO8859-6',
+    'as':                                   'as_IN.UTF-8',
     'az':                                   'az_AZ.ISO8859-9E',
     'az_az':                                'az_AZ.ISO8859-9E',
     'az_az.iso88599e':                      'az_AZ.ISO8859-9E',
     'be':                                   'be_BY.CP1251',
+    'be at latin':                             'be_BY.UTF-8 at latin',
     'be_by':                                'be_BY.CP1251',
     'be_by.cp1251':                         'be_BY.CP1251',
     'be_by.microsoftcp1251':                'be_BY.CP1251',
+    'be_by.utf8 at latin':                     'be_BY.UTF-8 at latin',
+    'be_by at latin':                          'be_BY.UTF-8 at latin',
     'bg':                                   'bg_BG.CP1251',
     'bg_bg':                                'bg_BG.CP1251',
     'bg_bg.cp1251':                         'bg_BG.CP1251',
@@ -797,12 +823,30 @@
     'c_c':                                  'C',
     'c_c.c':                                'C',
     'ca':                                   'ca_ES.ISO8859-1',
+    'ca_ad':                                'ca_AD.ISO8859-1',
+    'ca_ad.iso88591':                       'ca_AD.ISO8859-1',
+    'ca_ad.iso885915':                      'ca_AD.ISO8859-15',
+    'ca_ad.iso885915 at euro':                 'ca_AD.ISO8859-15',
+    'ca_ad.utf8 at euro':                      'ca_AD.UTF-8',
+    'ca_ad at euro':                           'ca_AD.ISO8859-15',
     'ca_es':                                'ca_ES.ISO8859-1',
     'ca_es.iso88591':                       'ca_ES.ISO8859-1',
     'ca_es.iso885915':                      'ca_ES.ISO8859-15',
     'ca_es.iso885915 at euro':                 'ca_ES.ISO8859-15',
     'ca_es.utf8 at euro':                      'ca_ES.UTF-8',
     'ca_es at euro':                           'ca_ES.ISO8859-15',
+    'ca_fr':                                'ca_FR.ISO8859-1',
+    'ca_fr.iso88591':                       'ca_FR.ISO8859-1',
+    'ca_fr.iso885915':                      'ca_FR.ISO8859-15',
+    'ca_fr.iso885915 at euro':                 'ca_FR.ISO8859-15',
+    'ca_fr.utf8 at euro':                      'ca_FR.UTF-8',
+    'ca_fr at euro':                           'ca_FR.ISO8859-15',
+    'ca_it':                                'ca_IT.ISO8859-1',
+    'ca_it.iso88591':                       'ca_IT.ISO8859-1',
+    'ca_it.iso885915':                      'ca_IT.ISO8859-15',
+    'ca_it.iso885915 at euro':                 'ca_IT.ISO8859-15',
+    'ca_it.utf8 at euro':                      'ca_IT.UTF-8',
+    'ca_it at euro':                           'ca_IT.ISO8859-15',
     'catalan':                              'ca_ES.ISO8859-1',
     'cextend':                              'en_US.ISO8859-1',
     'cextend.en':                           'en_US.ISO8859-1',
@@ -824,6 +868,7 @@
     'cz_cz':                                'cs_CZ.ISO8859-2',
     'czech':                                'cs_CZ.ISO8859-2',
     'da':                                   'da_DK.ISO8859-1',
+    'da.iso885915':                         'da_DK.ISO8859-15',
     'da_dk':                                'da_DK.ISO8859-1',
     'da_dk.88591':                          'da_DK.ISO8859-1',
     'da_dk.885915':                         'da_DK.ISO8859-15',
@@ -834,6 +879,7 @@
     'danish.iso88591':                      'da_DK.ISO8859-1',
     'dansk':                                'da_DK.ISO8859-1',
     'de':                                   'de_DE.ISO8859-1',
+    'de.iso885915':                         'de_DE.ISO8859-15',
     'de_at':                                'de_AT.ISO8859-1',
     'de_at.iso88591':                       'de_AT.ISO8859-1',
     'de_at.iso885915':                      'de_AT.ISO8859-15',
@@ -1015,6 +1061,7 @@
     'fa_ir':                                'fa_IR.UTF-8',
     'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',
     'fi':                                   'fi_FI.ISO8859-15',
+    'fi.iso885915':                         'fi_FI.ISO8859-15',
     'fi_fi':                                'fi_FI.ISO8859-15',
     'fi_fi.88591':                          'fi_FI.ISO8859-1',
     'fi_fi.iso88591':                       'fi_FI.ISO8859-1',
@@ -1030,6 +1077,7 @@
     'fo_fo.iso885915':                      'fo_FO.ISO8859-15',
     'fo_fo at euro':                           'fo_FO.ISO8859-15',
     'fr':                                   'fr_FR.ISO8859-1',
+    'fr.iso885915':                         'fr_FR.ISO8859-15',
     'fr_be':                                'fr_BE.ISO8859-1',
     'fr_be.88591':                          'fr_BE.ISO8859-1',
     'fr_be.iso88591':                       'fr_BE.ISO8859-1',
@@ -1116,6 +1164,7 @@
     'hi':                                   'hi_IN.ISCII-DEV',
     'hi_in':                                'hi_IN.ISCII-DEV',
     'hi_in.isciidev':                       'hi_IN.ISCII-DEV',
+    'hne':                                  'hne_IN.UTF-8',
     'hr':                                   'hr_HR.ISO8859-2',
     'hr_hr':                                'hr_HR.ISO8859-2',
     'hr_hr.iso88592':                       'hr_HR.ISO8859-2',
@@ -1142,6 +1191,7 @@
     'iso_8859_1':                           'en_US.ISO8859-1',
     'iso_8859_15':                          'en_US.ISO8859-15',
     'it':                                   'it_IT.ISO8859-1',
+    'it.iso885915':                         'it_IT.ISO8859-15',
     'it_ch':                                'it_CH.ISO8859-1',
     'it_ch.iso88591':                       'it_CH.ISO8859-1',
     'it_ch.iso885915':                      'it_CH.ISO8859-15',
@@ -1173,6 +1223,7 @@
     'ja_jp.jis':                            'ja_JP.JIS7',
     'ja_jp.jis7':                           'ja_JP.JIS7',
     'ja_jp.mscode':                         'ja_JP.SJIS',
+    'ja_jp.pck':                            'ja_JP.SJIS',
     'ja_jp.sjis':                           'ja_JP.SJIS',
     'ja_jp.ujis':                           'ja_JP.eucJP',
     'japan':                                'ja_JP.eucJP',
@@ -1192,6 +1243,7 @@
     'kl_gl.iso885915':                      'kl_GL.ISO8859-15',
     'kl_gl at euro':                           'kl_GL.ISO8859-15',
     'km_kh':                                'km_KH.UTF-8',
+    'kn':                                   'kn_IN.UTF-8',
     'kn_in':                                'kn_IN.UTF-8',
     'ko':                                   'ko_KR.eucKR',
     'ko_kr':                                'ko_KR.eucKR',
@@ -1199,6 +1251,8 @@
     'ko_kr.euckr':                          'ko_KR.eucKR',
     'korean':                               'ko_KR.eucKR',
     'korean.euc':                           'ko_KR.eucKR',
+    'ks':                                   'ks_IN.UTF-8',
+    'ks_in at devanagari':                     'ks_IN at devanagari.UTF-8',
     'kw':                                   'kw_GB.ISO8859-1',
     'kw_gb':                                'kw_GB.ISO8859-1',
     'kw_gb.iso88591':                       'kw_GB.ISO8859-1',
@@ -1221,6 +1275,7 @@
     'lv_lv':                                'lv_LV.ISO8859-13',
     'lv_lv.iso885913':                      'lv_LV.ISO8859-13',
     'lv_lv.iso88594':                       'lv_LV.ISO8859-4',
+    'mai':                                  'mai_IN.UTF-8',
     'mi':                                   'mi_NZ.ISO8859-1',
     'mi_nz':                                'mi_NZ.ISO8859-1',
     'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',
@@ -1229,6 +1284,8 @@
     'mk_mk.cp1251':                         'mk_MK.CP1251',
     'mk_mk.iso88595':                       'mk_MK.ISO8859-5',
     'mk_mk.microsoftcp1251':                'mk_MK.CP1251',
+    'ml':                                   'ml_IN.UTF-8',
+    'mr':                                   'mr_IN.UTF-8',
     'mr_in':                                'mr_IN.UTF-8',
     'ms':                                   'ms_MY.ISO8859-1',
     'ms_my':                                'ms_MY.ISO8859-1',
@@ -1243,6 +1300,7 @@
     'nb_no.iso885915':                      'nb_NO.ISO8859-15',
     'nb_no at euro':                           'nb_NO.ISO8859-15',
     'nl':                                   'nl_NL.ISO8859-1',
+    'nl.iso885915':                         'nl_NL.ISO8859-15',
     'nl_be':                                'nl_BE.ISO8859-1',
     'nl_be.88591':                          'nl_BE.ISO8859-1',
     'nl_be.iso88591':                       'nl_BE.ISO8859-1',
@@ -1269,6 +1327,8 @@
     'no_no.88591':                          'no_NO.ISO8859-1',
     'no_no.iso88591':                       'no_NO.ISO8859-1',
     'no_no.iso885915':                      'no_NO.ISO8859-15',
+    'no_no.iso88591 at bokmal':                'no_NO.ISO8859-1',
+    'no_no.iso88591 at nynorsk':               'no_NO.ISO8859-1',
     'no_no at euro':                           'no_NO.ISO8859-15',
     'norwegian':                            'no_NO.ISO8859-1',
     'norwegian.iso88591':                   'no_NO.ISO8859-1',
@@ -1290,6 +1350,8 @@
     'oc_fr.iso88591':                       'oc_FR.ISO8859-1',
     'oc_fr.iso885915':                      'oc_FR.ISO8859-15',
     'oc_fr at euro':                           'oc_FR.ISO8859-15',
+    'or':                                   'or_IN.UTF-8',
+    'pa':                                   'pa_IN.UTF-8',
     'pa_in':                                'pa_IN.UTF-8',
     'pd':                                   'pd_US.ISO8859-1',
     'pd_de':                                'pd_DE.ISO8859-1',
@@ -1317,6 +1379,7 @@
     'pp_an':                                'pp_AN.ISO8859-1',
     'pp_an.iso88591':                       'pp_AN.ISO8859-1',
     'pt':                                   'pt_PT.ISO8859-1',
+    'pt.iso885915':                         'pt_PT.ISO8859-15',
     'pt_br':                                'pt_BR.ISO8859-1',
     'pt_br.88591':                          'pt_BR.ISO8859-1',
     'pt_br.iso88591':                       'pt_BR.ISO8859-1',
@@ -1333,8 +1396,9 @@
     'ro_ro':                                'ro_RO.ISO8859-2',
     'ro_ro.iso88592':                       'ro_RO.ISO8859-2',
     'romanian':                             'ro_RO.ISO8859-2',
-    'ru':                                   'ru_RU.ISO8859-5',
-    'ru_ru':                                'ru_RU.ISO8859-5',
+    'ru':                                   'ru_RU.UTF-8',
+    'ru.koi8r':                             'ru_RU.KOI8-R',
+    'ru_ru':                                'ru_RU.UTF-8',
     'ru_ru.cp1251':                         'ru_RU.CP1251',
     'ru_ru.iso88595':                       'ru_RU.ISO8859-5',
     'ru_ru.koi8r':                          'ru_RU.KOI8-R',
@@ -1348,13 +1412,15 @@
     'rw':                                   'rw_RW.ISO8859-1',
     'rw_rw':                                'rw_RW.ISO8859-1',
     'rw_rw.iso88591':                       'rw_RW.ISO8859-1',
+    'sd':                                   'sd_IN at devanagari.UTF-8',
     'se_no':                                'se_NO.UTF-8',
-    'serbocroatian':                        'sr_CS.ISO8859-2',
-    'sh':                                   'sr_CS.ISO8859-2',
+    'serbocroatian':                        'sr_RS.UTF-8 at latin',
+    'sh':                                   'sr_RS.UTF-8 at latin',
+    'sh_ba.iso88592 at bosnia':                'sr_CS.ISO8859-2',
     'sh_hr':                                'sh_HR.ISO8859-2',
     'sh_hr.iso88592':                       'hr_HR.ISO8859-2',
     'sh_sp':                                'sr_CS.ISO8859-2',
-    'sh_yu':                                'sr_CS.ISO8859-2',
+    'sh_yu':                                'sr_RS.UTF-8 at latin',
     'si':                                   'si_LK.UTF-8',
     'si_lk':                                'si_LK.UTF-8',
     'sinhala':                              'si_LK.UTF-8',
@@ -1377,23 +1443,30 @@
     'sq':                                   'sq_AL.ISO8859-2',
     'sq_al':                                'sq_AL.ISO8859-2',
     'sq_al.iso88592':                       'sq_AL.ISO8859-2',
-    'sr':                                   'sr_CS.ISO8859-5',
-    'sr at cyrillic':                          'sr_CS.ISO8859-5',
-    'sr at latn':                              'sr_CS.ISO8859-2',
+    'sr':                                   'sr_RS.UTF-8',
+    'sr at cyrillic':                          'sr_RS.UTF-8',
+    'sr at latin':                             'sr_RS.UTF-8 at latin',
+    'sr at latn':                              'sr_RS.UTF-8 at latin',
+    'sr_cs':                                'sr_RS.UTF-8',
     'sr_cs.iso88592':                       'sr_CS.ISO8859-2',
     'sr_cs.iso88592 at latn':                  'sr_CS.ISO8859-2',
     'sr_cs.iso88595':                       'sr_CS.ISO8859-5',
-    'sr_cs.utf8 at latn':                      'sr_CS.UTF-8',
-    'sr_cs at latn':                           'sr_CS.ISO8859-2',
+    'sr_cs.utf8 at latn':                      'sr_RS.UTF-8 at latin',
+    'sr_cs at latn':                           'sr_RS.UTF-8 at latin',
+    'sr_me':                                'sr_ME.UTF-8',
+    'sr_rs':                                'sr_RS.UTF-8',
+    'sr_rs.utf8 at latn':                      'sr_RS.UTF-8 at latin',
+    'sr_rs at latin':                          'sr_RS.UTF-8 at latin',
+    'sr_rs at latn':                           'sr_RS.UTF-8 at latin',
     'sr_sp':                                'sr_CS.ISO8859-2',
-    'sr_yu':                                'sr_CS.ISO8859-5',
+    'sr_yu':                                'sr_RS.UTF-8 at latin',
     'sr_yu.cp1251 at cyrillic':                'sr_CS.CP1251',
     'sr_yu.iso88592':                       'sr_CS.ISO8859-2',
     'sr_yu.iso88595':                       'sr_CS.ISO8859-5',
     'sr_yu.iso88595 at cyrillic':              'sr_CS.ISO8859-5',
     'sr_yu.microsoftcp1251 at cyrillic':       'sr_CS.CP1251',
-    'sr_yu.utf8 at cyrillic':                  'sr_CS.UTF-8',
-    'sr_yu at cyrillic':                       'sr_CS.ISO8859-5',
+    'sr_yu.utf8 at cyrillic':                  'sr_RS.UTF-8',
+    'sr_yu at cyrillic':                       'sr_RS.UTF-8',
     'ss':                                   'ss_ZA.ISO8859-1',
     'ss_za':                                'ss_ZA.ISO8859-1',
     'ss_za.iso88591':                       'ss_ZA.ISO8859-1',
@@ -1401,6 +1474,7 @@
     'st_za':                                'st_ZA.ISO8859-1',
     'st_za.iso88591':                       'st_ZA.ISO8859-1',
     'sv':                                   'sv_SE.ISO8859-1',
+    'sv.iso885915':                         'sv_SE.ISO8859-15',
     'sv_fi':                                'sv_FI.ISO8859-1',
     'sv_fi.iso88591':                       'sv_FI.ISO8859-1',
     'sv_fi.iso885915':                      'sv_FI.ISO8859-15',
@@ -1418,6 +1492,7 @@
     'ta_in':                                'ta_IN.TSCII-0',
     'ta_in.tscii':                          'ta_IN.TSCII-0',
     'ta_in.tscii0':                         'ta_IN.TSCII-0',
+    'te':                                   'te_IN.UTF-8',
     'tg':                                   'tg_TJ.KOI8-C',
     'tg_tj':                                'tg_TJ.KOI8-C',
     'tg_tj.koi8c':                          'tg_TJ.KOI8-C',
@@ -1493,6 +1568,7 @@
     'zh_cn.gbk':                            'zh_CN.gbk',
     'zh_hk':                                'zh_HK.big5hkscs',
     'zh_hk.big5':                           'zh_HK.big5',
+    'zh_hk.big5hk':                         'zh_HK.big5hkscs',
     'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',
     'zh_tw':                                'zh_TW.big5',
     'zh_tw.big5':                           'zh_TW.big5',

Modified: python/branches/py3k-cdecimal/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/logging/__init__.py	(original)
+++ python/branches/py3k-cdecimal/Lib/logging/__init__.py	Wed Apr 21 13:06:18 2010
@@ -285,10 +285,18 @@
             self.threadName = None
         if not logMultiprocessing:
             self.processName = None
-        elif 'multiprocessing' not in sys.modules:
-            self.processName = 'MainProcess'
         else:
-            self.processName = sys.modules['multiprocessing'].current_process().name
+            self.processName = 'MainProcess'
+            mp = sys.modules.get('multiprocessing')
+            if mp is not None:
+                # Errors may occur if multiprocessing has not finished loading
+                # yet - e.g. if a custom import hook causes third-party code
+                # to run when multiprocessing calls import. See issue 8200
+                # for an example
+                try:
+                    self.processName = mp.current_process().name
+                except StandardError:
+                    pass
         if logProcesses and hasattr(os, 'getpid'):
             self.process = os.getpid()
         else:
@@ -1306,6 +1314,25 @@
             return 0
         return level >= self.getEffectiveLevel()
 
+    def getChild(self, suffix):
+        """
+        Get a logger which is a descendant to this one.
+
+        This is a convenience method, such that
+
+        logging.getLogger('abc').getChild('def.ghi')
+
+        is the same as
+
+        logging.getLogger('abc.def.ghi')
+
+        It's useful, for example, when the parent logger is named using
+        __name__ rather than a literal string.
+        """
+        if self.root is not self:
+            suffix = '.'.join((self.name, suffix))
+        return self.manager.getLogger(suffix)
+
 class RootLogger(Logger):
     """
     A root logger is not that different to any other logger, except that
@@ -1410,6 +1437,12 @@
         msg, kwargs = self.process(msg, kwargs)
         self.logger.log(level, msg, *args, **kwargs)
 
+    def isEnabledFor(self, level):
+        """
+        See if the underlying logger is enabled for the specified level.
+        """
+        return self.logger.isEnabledFor(level)
+
 root = RootLogger(WARNING)
 Logger.root = root
 Logger.manager = Manager(Logger.root)

Modified: python/branches/py3k-cdecimal/Lib/logging/config.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/logging/config.py	(original)
+++ python/branches/py3k-cdecimal/Lib/logging/config.py	Wed Apr 21 13:06:18 2010
@@ -98,6 +98,9 @@
 def _strip_spaces(alist):
     return map(lambda x: x.strip(), alist)
 
+def _encoded(s):
+    return s if isinstance(s, str) else s.encode('utf-8')
+
 def _create_formatters(cp):
     """Create and return formatters"""
     flist = cp.get("formatters", "keys")
@@ -208,7 +211,7 @@
     #avoid disabling child loggers of explicitly
     #named loggers. With a sorted list it is easier
     #to find the child loggers.
-    existing.sort()
+    existing.sort(key=_encoded)
     #We'll keep the list of existing loggers
     #which are children of named loggers here...
     child_loggers = []
@@ -579,7 +582,7 @@
                 #avoid disabling child loggers of explicitly
                 #named loggers. With a sorted list it is easier
                 #to find the child loggers.
-                existing.sort()
+                existing.sort(key=_encoded)
                 #We'll keep the list of existing loggers
                 #which are children of named loggers here...
                 child_loggers = []

Modified: python/branches/py3k-cdecimal/Lib/logging/handlers.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/logging/handlers.py	(original)
+++ python/branches/py3k-cdecimal/Lib/logging/handlers.py	Wed Apr 21 13:06:18 2010
@@ -633,7 +633,8 @@
     LOG_NEWS      = 7       #  network news subsystem
     LOG_UUCP      = 8       #  UUCP subsystem
     LOG_CRON      = 9       #  clock daemon
-    LOG_AUTHPRIV  = 10  #  security/authorization messages (private)
+    LOG_AUTHPRIV  = 10      #  security/authorization messages (private)
+    LOG_FTP       = 11      #  FTP daemon
 
     #  other codes through 15 reserved for system use
     LOG_LOCAL0    = 16      #  reserved for local use
@@ -665,6 +666,7 @@
         "authpriv": LOG_AUTHPRIV,
         "cron":     LOG_CRON,
         "daemon":   LOG_DAEMON,
+        "ftp":      LOG_FTP,
         "kern":     LOG_KERN,
         "lpr":      LOG_LPR,
         "mail":     LOG_MAIL,

Modified: python/branches/py3k-cdecimal/Lib/multiprocessing/pool.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/multiprocessing/pool.py	(original)
+++ python/branches/py3k-cdecimal/Lib/multiprocessing/pool.py	Wed Apr 21 13:06:18 2010
@@ -440,10 +440,10 @@
                     p.terminate()
 
         debug('joining task handler')
-        task_handler.join(1e100)
+        task_handler.join()
 
         debug('joining result handler')
-        result_handler.join(1e100)
+        task_handler.join()
 
         if pool and hasattr(pool[0], 'terminate'):
             debug('joining pool workers')

Modified: python/branches/py3k-cdecimal/Lib/pickle.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pickle.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pickle.py	Wed Apr 21 13:06:18 2010
@@ -499,7 +499,7 @@
 
     def save_str(self, obj, pack=struct.pack):
         if self.bin:
-            encoded = obj.encode('utf-8')
+            encoded = obj.encode('utf-8', 'surrogatepass')
             n = len(encoded)
             self.write(BINUNICODE + pack("<i", n) + encoded)
         else:
@@ -966,7 +966,7 @@
 
     def load_binunicode(self):
         len = mloads(b'i' + self.read(4))
-        self.append(str(self.read(len), 'utf-8'))
+        self.append(str(self.read(len), 'utf-8', 'surrogatepass'))
     dispatch[BINUNICODE[0]] = load_binunicode
 
     def load_short_binstring(self):

Modified: python/branches/py3k-cdecimal/Lib/pickletools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pickletools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pickletools.py	Wed Apr 21 13:06:18 2010
@@ -469,7 +469,7 @@
         raise ValueError("unicodestring4 byte count < 0: %d" % n)
     data = f.read(n)
     if len(data) == n:
-        return str(data, 'utf-8')
+        return str(data, 'utf-8', 'surrogatepass')
     raise ValueError("expected %d bytes in a unicodestring4, but only %d "
                      "remain" % (n, len(data)))
 

Modified: python/branches/py3k-cdecimal/Lib/plistlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/plistlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/plistlib.py	Wed Apr 21 13:06:18 2010
@@ -186,7 +186,7 @@
 
 PLISTHEADER = b"""\
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 """
 
 class PlistWriter(DumbXMLWriter):

Modified: python/branches/py3k-cdecimal/Lib/py_compile.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/py_compile.py	(original)
+++ python/branches/py3k-cdecimal/Lib/py_compile.py	Wed Apr 21 13:06:18 2010
@@ -4,6 +4,7 @@
 """
 
 import builtins
+import errno
 import imp
 import marshal
 import os
@@ -37,16 +38,18 @@
                     can be accesses as class variable 'file'
 
         msg:        string message to be written as error message
-                    If no value is given, a default exception message will be given,
-                    consistent with 'standard' py_compile output.
-                    message (or default) can be accesses as class variable 'msg'
+                    If no value is given, a default exception message will be
+                    given, consistent with 'standard' py_compile output.
+                    message (or default) can be accesses as class variable
+                    'msg'
 
     """
 
     def __init__(self, exc_type, exc_value, file, msg=''):
         exc_type_name = exc_type.__name__
         if exc_type is SyntaxError:
-            tbtext = ''.join(traceback.format_exception_only(exc_type, exc_value))
+            tbtext = ''.join(traceback.format_exception_only(
+                exc_type, exc_value))
             errmsg = tbtext.replace('File "<string>"', 'File "%s"' % file)
         else:
             errmsg = "Sorry: %s: %s" % (exc_type_name,exc_value)
@@ -64,7 +67,7 @@
 
 def wr_long(f, x):
     """Internal; write a 32-bit int to a file in little-endian order."""
-    f.write(bytes([x        & 0xff,
+    f.write(bytes([x         & 0xff,
                    (x >> 8)  & 0xff,
                    (x >> 16) & 0xff,
                    (x >> 24) & 0xff]))
@@ -72,20 +75,18 @@
 def compile(file, cfile=None, dfile=None, doraise=False):
     """Byte-compile one Python source file to Python bytecode.
 
-    Arguments:
-
-    file:    source filename
-    cfile:   target filename; defaults to source with 'c' or 'o' appended
-             ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo)
-    dfile:   purported filename; defaults to source (this is the filename
-             that will show up in error messages)
-    doraise: flag indicating whether or not an exception should be
-             raised when a compile error is found. If an exception
-             occurs and this flag is set to False, a string
-             indicating the nature of the exception will be printed,
-             and the function will return to the caller. If an
-             exception occurs and this flag is set to True, a
-             PyCompileError exception will be raised.
+    :param file: The source file name.
+    :param cfile: The target byte compiled file name.  When not given, this
+        defaults to the PEP 3147 location.
+    :param dfile: Purported file name, i.e. the file name that shows up in
+        error messages.  Defaults to the source file name.
+    :param doraise: Flag indicating whether or not an exception should be
+        raised when a compile error is found.  If an exception occurs and this
+        flag is set to False, a string indicating the nature of the exception
+        will be printed, and the function will return to the caller. If an
+        exception occurs and this flag is set to True, a PyCompileError
+        exception will be raised.
+    :return: Path to the resulting byte compiled file.
 
     Note that it isn't necessary to byte-compile Python modules for
     execution efficiency -- Python itself byte-compiles a module when
@@ -102,7 +103,6 @@
     See compileall.py for a script/module that uses this module to
     byte-compile all installed files (or all files in selected
     directories).
-
     """
     with open(file, "rb") as f:
         encoding = tokenize.detect_encoding(f.readline)[0]
@@ -122,7 +122,12 @@
             sys.stderr.write(py_exc.msg + '\n')
             return
     if cfile is None:
-        cfile = file + (__debug__ and 'c' or 'o')
+        cfile = imp.cache_from_source(file)
+        try:
+            os.mkdir(os.path.dirname(cfile))
+        except OSError as error:
+            if error.errno != errno.EEXIST:
+                raise
     with open(cfile, 'wb') as fc:
         fc.write(b'\0\0\0\0')
         wr_long(fc, timestamp)
@@ -130,6 +135,7 @@
         fc.flush()
         fc.seek(0, 0)
         fc.write(MAGIC)
+    return cfile
 
 def main(args=None):
     """Compile several source files.
@@ -163,7 +169,7 @@
         for filename in args:
             try:
                 compile(filename, doraise=True)
-            except PyCompileError as err:
+            except PyCompileError as error:
                 # return value to indicate at least one failure
                 rv = 1
                 sys.stderr.write(error.msg)

Modified: python/branches/py3k-cdecimal/Lib/pydoc.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pydoc.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pydoc.py	Wed Apr 21 13:06:18 2010
@@ -159,7 +159,8 @@
     """Decide whether to show documentation on a variable."""
     # Certain special names are redundant.
     _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__',
-                     '__module__', '__name__', '__slots__', '__package__')
+                     '__module__', '__name__', '__slots__', '__package__',
+                     '__cached__')
     if name in _hidden_names: return 0
     # Private names are hidden, but special names are displayed.
     if name.startswith('__') and name.endswith('__'): return 1

Modified: python/branches/py3k-cdecimal/Lib/runpy.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/runpy.py	(original)
+++ python/branches/py3k-cdecimal/Lib/runpy.py	Wed Apr 21 13:06:18 2010
@@ -67,6 +67,7 @@
         run_globals.update(init_globals)
     run_globals.update(__name__ = mod_name,
                        __file__ = mod_fname,
+                       __cached__ = None,
                        __loader__ = mod_loader,
                        __package__ = pkg_name)
     exec(code, run_globals)
@@ -130,6 +131,7 @@
        At the very least, these variables in __main__ will be overwritten:
            __name__
            __file__
+           __cached__
            __loader__
            __package__
     """

Modified: python/branches/py3k-cdecimal/Lib/shutil.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/shutil.py	(original)
+++ python/branches/py3k-cdecimal/Lib/shutil.py	Wed Apr 21 13:06:18 2010
@@ -53,7 +53,7 @@
 
 def _samefile(src, dst):
     # Macintosh, Unix.
-    if hasattr(os.path,'samefile'):
+    if hasattr(os.path, 'samefile'):
         try:
             return os.path.samefile(src, dst)
         except OSError:
@@ -109,7 +109,8 @@
         try:
             os.chflags(dst, st.st_flags)
         except OSError as why:
-            if not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP:
+            if (not hasattr(errno, 'EOPNOTSUPP') or
+                why.errno != errno.EOPNOTSUPP):
                 raise
 
 def copy(src, dst):
@@ -146,8 +147,9 @@
         return set(ignored_names)
     return _ignore_patterns
 
-def copytree(src, dst, symlinks=False, ignore=None):
-    """Recursively copy a directory tree using copy2().
+def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
+             ignore_dangling_symlinks=False):
+    """Recursively copy a directory tree.
 
     The destination directory must not already exist.
     If exception(s) occur, an Error is raised with a list of reasons.
@@ -155,7 +157,13 @@
     If the optional symlinks flag is true, symbolic links in the
     source tree result in symbolic links in the destination tree; if
     it is false, the contents of the files pointed to by symbolic
-    links are copied.
+    links are copied. If the file pointed by the symlink doesn't
+    exist, an exception will be added in the list of errors raised in
+    an Error exception at the end of the copy process.
+
+    You can set the optional ignore_dangling_symlinks flag to true if you
+    want to silence this exception.
+
 
     The optional ignore argument is a callable. If given, it
     is called with the `src` parameter, which is the directory
@@ -169,7 +177,10 @@
     list of names relative to the `src` directory that should
     not be copied.
 
-    XXX Consider this example code rather than the ultimate tool.
+    The optional copy_function argument is a callable that will be used
+    to copy each file. It will be called with the source path and the
+    destination path as arguments. By default, copy2() is used, but any
+    function that supports the same signature (like copy()) can be used.
 
     """
     names = os.listdir(src)
@@ -186,14 +197,21 @@
         srcname = os.path.join(src, name)
         dstname = os.path.join(dst, name)
         try:
-            if symlinks and os.path.islink(srcname):
+            if os.path.islink(srcname):
                 linkto = os.readlink(srcname)
-                os.symlink(linkto, dstname)
+                if symlinks:
+                    os.symlink(linkto, dstname)
+                else:
+                    # ignore dangling symlink if the flag is on
+                    if not os.path.exists(linkto) and ignore_dangling_symlinks:
+                        continue
+                    # otherwise let the copy occurs. copy2 will raise an error
+                    copy_function(srcname, dstname)
             elif os.path.isdir(srcname):
-                copytree(srcname, dstname, symlinks, ignore)
+                copytree(srcname, dstname, symlinks, ignore, copy_function)
             else:
                 # Will raise a SpecialFileError for unsupported file types
-                copy2(srcname, dstname)
+                copy_function(srcname, dstname)
         # catch the Error from the recursive copytree so that we can
         # continue with other files
         except Error as err:
@@ -337,31 +355,28 @@
     """Create a (possibly compressed) tar file from all the files under
     'base_dir'.
 
-    'compress' must be "gzip" (the default), "compress", "bzip2", or None.
-    (compress will be deprecated in Python 3.2)
+    'compress' must be "gzip" (the default), "bzip2", or None.
 
     'owner' and 'group' can be used to define an owner and a group for the
     archive that is being built. If not provided, the current owner and group
     will be used.
 
     The output tar file will be named 'base_dir' +  ".tar", possibly plus
-    the appropriate compression extension (".gz", ".bz2" or ".Z").
+    the appropriate compression extension (".gz", or ".bz2").
 
     Returns the output filename.
     """
-    tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: '', 'compress': ''}
-    compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'compress': '.Z'}
+    tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: ''}
+    compress_ext = {'gzip': '.gz', 'bzip2': '.bz2'}
 
     # flags for compression program, each element of list will be an argument
     if compress is not None and compress not in compress_ext.keys():
-        raise ValueError("bad value for 'compress': must be None, 'gzip', "
-                         "'bzip2' or 'compress'")
-
-    archive_name = base_name + '.tar'
-    if compress != 'compress':
-        archive_name += compress_ext.get(compress, '')
+        raise ValueError("bad value for 'compress': must be None, 'gzip', or "
+                         "'bzip2'")
 
+    archive_name = base_name + '.tar' + compress_ext.get(compress, '')
     archive_dir = os.path.dirname(archive_name)
+
     if not os.path.exists(archive_dir):
         logger.info("creating %s" % archive_dir)
         if not dry_run:
@@ -393,20 +408,6 @@
         finally:
             tar.close()
 
-    # compression using `compress`
-    # XXX this block will be removed in Python 3.2
-    if compress == 'compress':
-        warn("'compress' will be deprecated.", PendingDeprecationWarning)
-        # the option varies depending on the platform
-        compressed_name = archive_name + compress_ext[compress]
-        if sys.platform == 'win32':
-            cmd = [compress, archive_name, compressed_name]
-        else:
-            cmd = [compress, '-f', archive_name]
-        from distutils.spawn import spawn
-        spawn(cmd, dry_run=dry_run)
-        return compressed_name
-
     return archive_name
 
 def _call_external_zip(directory, verbose=False):
@@ -476,8 +477,6 @@
 _ARCHIVE_FORMATS = {
     'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
     'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
-    'ztar':  (_make_tarball, [('compress', 'compress')],
-                "compressed tar file"),
     'tar':   (_make_tarball, [('compress', None)], "uncompressed tar file"),
     'zip':   (_make_zipfile, [],"ZIP file")
     }
@@ -521,7 +520,7 @@
     """Create an archive file (eg. zip or tar).
 
     'base_name' is the name of the file to create, minus any format-specific
-    extension; 'format' is the archive format: one of "zip", "tar", "ztar",
+    extension; 'format' is the archive format: one of "zip", "tar", "bztar"
     or "gztar".
 
     'root_dir' is a directory that will be the root directory of the

Modified: python/branches/py3k-cdecimal/Lib/site.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/site.py	(original)
+++ python/branches/py3k-cdecimal/Lib/site.py	Wed Apr 21 13:06:18 2010
@@ -74,15 +74,19 @@
     return dir, os.path.normcase(dir)
 
 
-def abs__file__():
-    """Set all module' __file__ attribute to an absolute path"""
+def abs_paths():
+    """Set all module __file__ and __cached__ attributes to an absolute path"""
     for m in set(sys.modules.values()):
         if hasattr(m, '__loader__'):
             continue   # don't mess with a PEP 302-supplied __file__
         try:
             m.__file__ = os.path.abspath(m.__file__)
         except AttributeError:
-            continue
+            pass
+        try:
+            m.__cached__ = os.path.abspath(m.__cached__)
+        except AttributeError:
+            pass
 
 
 def removeduppaths():
@@ -318,8 +322,10 @@
 
 
 def setquit():
-    """Define new built-ins 'quit' and 'exit'.
-    These are simply strings that display a hint on how to exit.
+    """Define new builtins 'quit' and 'exit'.
+
+    These are objects which make the interpreter exit when called.
+    The repr of each object contains a hint at how it works.
 
     """
     if os.sep == ':':
@@ -431,7 +437,7 @@
 
 
 class _Helper(object):
-    """Define the built-in 'help'.
+    """Define the builtin 'help'.
     This is a wrapper around pydoc.help (with a twist).
 
     """
@@ -516,7 +522,7 @@
 def main():
     global ENABLE_USER_SITE
 
-    abs__file__()
+    abs_paths()
     known_paths = removeduppaths()
     if (os.name == "posix" and sys.path and
         os.path.basename(sys.path[-1]) == "Modules"):

Modified: python/branches/py3k-cdecimal/Lib/ssl.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/ssl.py	(original)
+++ python/branches/py3k-cdecimal/Lib/ssl.py	Wed Apr 21 13:06:18 2010
@@ -94,7 +94,7 @@
                  ssl_version=PROTOCOL_SSLv23, ca_certs=None,
                  do_handshake_on_connect=True,
                  family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None,
-                 suppress_ragged_eofs=True):
+                 suppress_ragged_eofs=True, ciphers=None):
 
         if sock is not None:
             socket.__init__(self,
@@ -123,7 +123,8 @@
             try:
                 self._sslobj = _ssl.sslwrap(self, server_side,
                                             keyfile, certfile,
-                                            cert_reqs, ssl_version, ca_certs)
+                                            cert_reqs, ssl_version, ca_certs,
+                                            ciphers)
                 if do_handshake_on_connect:
                     timeout = self.gettimeout()
                     if timeout == 0.0:
@@ -140,6 +141,7 @@
         self.cert_reqs = cert_reqs
         self.ssl_version = ssl_version
         self.ca_certs = ca_certs
+        self.ciphers = ciphers
         self.do_handshake_on_connect = do_handshake_on_connect
         self.suppress_ragged_eofs = suppress_ragged_eofs
 
@@ -325,7 +327,7 @@
         socket.connect(self, addr)
         self._sslobj = _ssl.sslwrap(self, False, self.keyfile, self.certfile,
                                     self.cert_reqs, self.ssl_version,
-                                    self.ca_certs)
+                                    self.ca_certs, self.ciphers)
         try:
             if self.do_handshake_on_connect:
                 self.do_handshake()
@@ -345,6 +347,7 @@
                           cert_reqs=self.cert_reqs,
                           ssl_version=self.ssl_version,
                           ca_certs=self.ca_certs,
+                          ciphers=self.ciphers,
                           do_handshake_on_connect=
                               self.do_handshake_on_connect),
                 addr)
@@ -358,13 +361,14 @@
                 server_side=False, cert_reqs=CERT_NONE,
                 ssl_version=PROTOCOL_SSLv23, ca_certs=None,
                 do_handshake_on_connect=True,
-                suppress_ragged_eofs=True):
+                suppress_ragged_eofs=True, ciphers=None):
 
     return SSLSocket(sock=sock, keyfile=keyfile, certfile=certfile,
                      server_side=server_side, cert_reqs=cert_reqs,
                      ssl_version=ssl_version, ca_certs=ca_certs,
                      do_handshake_on_connect=do_handshake_on_connect,
-                     suppress_ragged_eofs=suppress_ragged_eofs)
+                     suppress_ragged_eofs=suppress_ragged_eofs,
+                     ciphers=ciphers)
 
 # some utility functions
 

Modified: python/branches/py3k-cdecimal/Lib/subprocess.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/subprocess.py	(original)
+++ python/branches/py3k-cdecimal/Lib/subprocess.py	Wed Apr 21 13:06:18 2010
@@ -980,6 +980,10 @@
             """
             if sig == signal.SIGTERM:
                 self.terminate()
+            elif sig == signal.CTRL_C_EVENT:
+                os.kill(self.pid, signal.CTRL_C_EVENT)
+            elif sig == signal.CTRL_BREAK_EVENT:
+                os.kill(self.pid, signal.CTRL_BREAK_EVENT)
             else:
                 raise ValueError("Only SIGTERM is supported on Windows")
 

Modified: python/branches/py3k-cdecimal/Lib/test/lock_tests.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/lock_tests.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/lock_tests.py	Wed Apr 21 13:06:18 2010
@@ -4,7 +4,7 @@
 
 import sys
 import time
-from _thread import start_new_thread, get_ident
+from _thread import start_new_thread, get_ident, TIMEOUT_MAX
 import threading
 import unittest
 
@@ -62,6 +62,14 @@
         support.threading_cleanup(*self._threads)
         support.reap_children()
 
+    def assertTimeout(self, actual, expected):
+        # The waiting and/or time.time() can be imprecise, which
+        # is why comparing to the expected value would sometimes fail
+        # (especially under Windows).
+        self.assertGreaterEqual(actual, expected * 0.6)
+        # Test nothing insane happened
+        self.assertLess(actual, expected * 10.0)
+
 
 class BaseLockTests(BaseTestCase):
     """
@@ -143,6 +151,32 @@
         Bunch(f, 15).wait_for_finished()
         self.assertEqual(n, len(threading.enumerate()))
 
+    def test_timeout(self):
+        lock = self.locktype()
+        # Can't set timeout if not blocking
+        self.assertRaises(ValueError, lock.acquire, 0, 1)
+        # Invalid timeout values
+        self.assertRaises(ValueError, lock.acquire, timeout=-100)
+        self.assertRaises(OverflowError, lock.acquire, timeout=1e100)
+        self.assertRaises(OverflowError, lock.acquire, timeout=TIMEOUT_MAX + 1)
+        # TIMEOUT_MAX is ok
+        lock.acquire(timeout=TIMEOUT_MAX)
+        lock.release()
+        t1 = time.time()
+        self.assertTrue(lock.acquire(timeout=5))
+        t2 = time.time()
+        # Just a sanity test that it didn't actually wait for the timeout.
+        self.assertLess(t2 - t1, 5)
+        results = []
+        def f():
+            t1 = time.time()
+            results.append(lock.acquire(timeout=0.5))
+            t2 = time.time()
+            results.append(t2 - t1)
+        Bunch(f, 1).wait_for_finished()
+        self.assertFalse(results[0])
+        self.assertTimeout(results[1], 0.5)
+
 
 class LockTests(BaseLockTests):
     """
@@ -284,14 +318,14 @@
         def f():
             results1.append(evt.wait(0.0))
             t1 = time.time()
-            r = evt.wait(0.2)
+            r = evt.wait(0.5)
             t2 = time.time()
             results2.append((r, t2 - t1))
         Bunch(f, N).wait_for_finished()
         self.assertEqual(results1, [False] * N)
         for r, dt in results2:
             self.assertFalse(r)
-            self.assertTrue(dt >= 0.2, dt)
+            self.assertTimeout(dt, 0.5)
         # The event is set
         results1 = []
         results2 = []
@@ -397,14 +431,14 @@
         def f():
             cond.acquire()
             t1 = time.time()
-            cond.wait(0.2)
+            cond.wait(0.5)
             t2 = time.time()
             cond.release()
             results.append(t2 - t1)
         Bunch(f, N).wait_for_finished()
         self.assertEqual(len(results), 5)
         for dt in results:
-            self.assertTrue(dt >= 0.2, dt)
+            self.assertTimeout(dt, 0.5)
 
 
 class BaseSemaphoreTests(BaseTestCase):
@@ -487,6 +521,19 @@
         # ordered.
         self.assertEqual(sorted(results), [False] * 7 + [True] *  3 )
 
+    def test_acquire_timeout(self):
+        sem = self.semtype(2)
+        self.assertRaises(ValueError, sem.acquire, False, timeout=1.0)
+        self.assertTrue(sem.acquire(timeout=0.005))
+        self.assertTrue(sem.acquire(timeout=0.005))
+        self.assertFalse(sem.acquire(timeout=0.005))
+        sem.release()
+        self.assertTrue(sem.acquire(timeout=0.005))
+        t = time.time()
+        self.assertFalse(sem.acquire(timeout=0.5))
+        dt = time.time() - t
+        self.assertTimeout(dt, 0.5)
+
     def test_default_value(self):
         # The default initial value is 1.
         sem = self.semtype()

Modified: python/branches/py3k-cdecimal/Lib/test/pickletester.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/pickletester.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/pickletester.py	Wed Apr 21 13:06:18 2010
@@ -515,7 +515,9 @@
 
     def test_unicode(self):
         endcases = ['', '<\\u>', '<\\\u1234>', '<\n>',
-                    '<\\>', '<\\\U00012345>']
+                    '<\\>', '<\\\U00012345>',
+                    # surrogates
+                    '<\udc80>']
         for proto in protocols:
             for u in endcases:
                 p = self.dumps(u, proto)

Modified: python/branches/py3k-cdecimal/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/regrtest.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/regrtest.py	Wed Apr 21 13:06:18 2010
@@ -880,6 +880,10 @@
                   testdir=None, huntrleaks=False, debug=False):
     support.unload(test)
     testdir = findtestdir(testdir)
+    if verbose:
+        capture_stdout = None
+    else:
+        capture_stdout = io.StringIO()
 
     test_time = 0.0
     refleak = False  # True if the test leaked references.

Modified: python/branches/py3k-cdecimal/Lib/test/script_helper.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/script_helper.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/script_helper.py	Wed Apr 21 13:06:18 2010
@@ -11,6 +11,9 @@
 import shutil
 import zipfile
 
+from imp import source_from_cache
+from test.support import make_legacy_pyc
+
 # Executing the interpreter in a subprocess
 def python_exit_code(*args):
     cmd_line = [sys.executable, '-E']
@@ -62,20 +65,18 @@
     script_file.close()
     return script_name
 
-def compile_script(script_name):
-    py_compile.compile(script_name, doraise=True)
-    if __debug__:
-        compiled_name = script_name + 'c'
-    else:
-        compiled_name = script_name + 'o'
-    return compiled_name
-
 def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):
     zip_filename = zip_basename+os.extsep+'zip'
     zip_name = os.path.join(zip_dir, zip_filename)
     zip_file = zipfile.ZipFile(zip_name, 'w')
     if name_in_zip is None:
-        name_in_zip = os.path.basename(script_name)
+        parts = script_name.split(os.sep)
+        if len(parts) >= 2 and parts[-2] == '__pycache__':
+            legacy_pyc = make_legacy_pyc(source_from_cache(script_name))
+            name_in_zip = os.path.basename(legacy_pyc)
+            script_name = legacy_pyc
+        else:
+            name_in_zip = os.path.basename(script_name)
     zip_file.write(script_name, name_in_zip)
     zip_file.close()
     #if test.test_support.verbose:
@@ -98,8 +99,8 @@
     script_name = make_script(zip_dir, script_basename, source)
     unlink.append(script_name)
     if compiled:
-        init_name = compile_script(init_name)
-        script_name = compile_script(script_name)
+        init_name = py_compile(init_name, doraise=True)
+        script_name = py_compile(script_name, doraise=True)
         unlink.extend((init_name, script_name))
     pkg_names = [os.sep.join([pkg_name]*i) for i in range(1, depth+1)]
     script_name_in_zip = os.path.join(pkg_names[-1], os.path.basename(script_name))

Modified: python/branches/py3k-cdecimal/Lib/test/support.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/support.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/support.py	Wed Apr 21 13:06:18 2010
@@ -17,21 +17,25 @@
 import importlib
 import collections
 import re
+import imp
+import time
 
-__all__ = ["Error", "TestFailed", "ResourceDenied", "import_module",
-           "verbose", "use_resources", "max_memuse", "record_original_stdout",
-           "get_original_stdout", "unload", "unlink", "rmtree", "forget",
-           "is_resource_enabled", "requires", "find_unused_port", "bind_port",
-           "fcmp", "is_jython", "TESTFN", "HOST", "FUZZ", "SAVEDCWD", "temp_cwd",
-           "findfile", "sortdict", "check_syntax_error", "open_urlresource",
-           "check_warnings", "CleanImport", "EnvironmentVarGuard",
-           "TransientResource", "captured_output", "captured_stdout",
-           "time_out", "socket_peer_reset", "ioerror_peer_reset",
-           "run_with_locale",
-           "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner",
-           "run_unittest", "run_doctest", "threading_setup", "threading_cleanup",
-           "reap_children", "cpython_only", "check_impl_detail", "get_attribute",
-           "swap_item", "swap_attr"]
+__all__ = [
+    "Error", "TestFailed", "ResourceDenied", "import_module",
+    "verbose", "use_resources", "max_memuse", "record_original_stdout",
+    "get_original_stdout", "unload", "unlink", "rmtree", "forget",
+    "is_resource_enabled", "requires", "find_unused_port", "bind_port",
+    "fcmp", "is_jython", "TESTFN", "HOST", "FUZZ", "SAVEDCWD", "temp_cwd",
+    "findfile", "sortdict", "check_syntax_error", "open_urlresource",
+    "check_warnings", "CleanImport", "EnvironmentVarGuard",
+    "TransientResource", "captured_output", "captured_stdout",
+    "time_out", "socket_peer_reset", "ioerror_peer_reset",
+    "run_with_locale", 'temp_umask',
+    "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner",
+    "run_unittest", "run_doctest", "threading_setup", "threading_cleanup",
+    "reap_children", "cpython_only", "check_impl_detail", "get_attribute",
+    "swap_item", "swap_attr",
+    ]
 
 
 class Error(Exception):
@@ -176,27 +180,50 @@
 def unlink(filename):
     try:
         os.unlink(filename)
-    except OSError:
-        pass
+    except OSError as error:
+        # The filename need not exist.
+        if error.errno != errno.ENOENT:
+            raise
 
 def rmtree(path):
     try:
         shutil.rmtree(path)
-    except OSError as e:
+    except OSError as error:
         # Unix returns ENOENT, Windows returns ESRCH.
-        if e.errno not in (errno.ENOENT, errno.ESRCH):
+        if error.errno not in (errno.ENOENT, errno.ESRCH):
             raise
 
+def make_legacy_pyc(source):
+    """Move a PEP 3147 pyc/pyo file to its legacy pyc/pyo location.
+
+    The choice of .pyc or .pyo extension is done based on the __debug__ flag
+    value.
+
+    :param source: The file system path to the source file.  The source file
+        does not need to exist, however the PEP 3147 pyc file must exist.
+    :return: The file system path to the legacy pyc file.
+    """
+    pyc_file = imp.cache_from_source(source)
+    up_one = os.path.dirname(os.path.abspath(source))
+    legacy_pyc = os.path.join(up_one, source + ('c' if __debug__ else 'o'))
+    os.rename(pyc_file, legacy_pyc)
+    return legacy_pyc
+
 def forget(modname):
-    '''"Forget" a module was ever imported by removing it from sys.modules and
-    deleting any .pyc and .pyo files.'''
+    """'Forget' a module was ever imported.
+
+    This removes the module from sys.modules and deletes any PEP 3147 or
+    legacy .pyc and .pyo files.
+    """
     unload(modname)
     for dirname in sys.path:
-        unlink(os.path.join(dirname, modname + '.pyc'))
-        # Deleting the .pyo file cannot be within the 'try' for the .pyc since
-        # the chance exists that there is no .pyc (and thus the 'try' statement
-        # is exited) but there is a .pyo file.
-        unlink(os.path.join(dirname, modname + '.pyo'))
+        source = os.path.join(dirname, modname + '.py')
+        # It doesn't matter if they exist or not, unlink all possible
+        # combinations of PEP 3147 and legacy pyc and pyo files.
+        unlink(source + 'c')
+        unlink(source + 'o')
+        unlink(imp.cache_from_source(source, debug_override=True))
+        unlink(imp.cache_from_source(source, debug_override=False))
 
 def is_resource_enabled(resource):
     """Test whether a resource is enabled.  Known resources are set by
@@ -207,7 +234,9 @@
     """Raise ResourceDenied if the specified resource is not available.
 
     If the caller's module is __main__ then automatically return True.  The
-    possibility of False being returned occurs when regrtest.py is executing."""
+    possibility of False being returned occurs when regrtest.py is
+    executing.
+    """
     # see if the caller's module is __main__ - if so, treat as if
     # the resource was set
     if sys._getframe(1).f_globals.get("__name__") == "__main__":
@@ -404,6 +433,16 @@
             rmtree(name)
 
 
+ at contextlib.contextmanager
+def temp_umask(umask):
+    """Context manager that temporarily sets the process umask."""
+    oldmask = os.umask(umask)
+    try:
+        yield
+    finally:
+        os.umask(oldmask)
+
+
 def findfile(file, here=__file__, subdir=None):
     """Try to find a file on sys.path and the working directory.  If it is not
     found the argument passed to the function is returned (this does not
@@ -750,6 +789,8 @@
     objects to disappear.
     """
     gc.collect()
+    if is_jython:
+        time.sleep(0.1)
     gc.collect()
     gc.collect()
 
@@ -1064,7 +1105,6 @@
 
 def threading_cleanup(nb_threads):
     import _thread
-    import time
 
     _MAX_COUNT = 10
     for count in range(_MAX_COUNT):

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	Wed Apr 21 13:06:18 2010
@@ -12,6 +12,8 @@
 from io import StringIO
 
 from test import support
+class StdIOBuffer(StringIO):
+    pass
 
 class TestCase(unittest.TestCase):
 
@@ -25,6 +27,7 @@
         super(TestCase, self).assertEqual(obj1, obj2)
 
 
+
 class TempDirMixin(object):
 
     def setUp(self):
@@ -81,15 +84,15 @@
     # if this is being called recursively and stderr or stdout is already being
     # redirected, simply call the function and let the enclosing function
     # catch the exception
-    if isinstance(sys.stderr, StringIO) or isinstance(sys.stdout, StringIO):
+    if isinstance(sys.stderr, StdIOBuffer) or isinstance(sys.stdout, StdIOBuffer):
         return parse_args(*args, **kwargs)
 
     # if this is not being called recursively, redirect stderr and
     # use it as the ArgumentParserError message
     old_stdout = sys.stdout
     old_stderr = sys.stderr
-    sys.stdout = StringIO()
-    sys.stderr = StringIO()
+    sys.stdout = StdIOBuffer()
+    sys.stderr = StdIOBuffer()
     try:
         try:
             result = parse_args(*args, **kwargs)
@@ -2634,7 +2637,7 @@
                 parser = self._get_parser(tester)
                 print_ = getattr(parser, 'print_%s' % self.func_suffix)
                 old_stream = getattr(sys, self.std_name)
-                setattr(sys, self.std_name, StringIO())
+                setattr(sys, self.std_name, StdIOBuffer())
                 try:
                     print_()
                     parser_text = getattr(sys, self.std_name).getvalue()
@@ -2645,7 +2648,7 @@
             def test_print_file(self, tester):
                 parser = self._get_parser(tester)
                 print_ = getattr(parser, 'print_%s' % self.func_suffix)
-                sfile = StringIO()
+                sfile = StdIOBuffer()
                 print_(sfile)
                 parser_text = sfile.getvalue()
                 self._test(tester, parser_text)

Modified: python/branches/py3k-cdecimal/Lib/test/test_bytes.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_bytes.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_bytes.py	Wed Apr 21 13:06:18 2010
@@ -64,17 +64,18 @@
         b = self.type2test([Indexable(), Indexable(1), Indexable(254),
                             Indexable(255)])
         self.assertEqual(list(b), [0, 1, 254, 255])
-        self.assertRaises(ValueError, bytearray, [Indexable(-1)])
-        self.assertRaises(ValueError, bytearray, [Indexable(256)])
+        self.assertRaises(ValueError, self.type2test, [Indexable(-1)])
+        self.assertRaises(ValueError, self.type2test, [Indexable(256)])
 
     def test_from_ssize(self):
-        self.assertEqual(bytearray(0), b'')
-        self.assertEqual(bytearray(1), b'\x00')
-        self.assertEqual(bytearray(5), b'\x00\x00\x00\x00\x00')
-        self.assertRaises(ValueError, bytearray, -1)
-
-        self.assertEqual(bytearray('0', 'ascii'), b'0')
-        self.assertEqual(bytearray(b'0'), b'0')
+        self.assertEqual(self.type2test(0), b'')
+        self.assertEqual(self.type2test(1), b'\x00')
+        self.assertEqual(self.type2test(5), b'\x00\x00\x00\x00\x00')
+        self.assertRaises(ValueError, self.type2test, -1)
+
+        self.assertEqual(self.type2test('0', 'ascii'), b'0')
+        self.assertEqual(self.type2test(b'0'), b'0')
+        self.assertRaises(OverflowError, self.type2test, sys.maxsize + 1)
 
     def test_constructor_type_errors(self):
         self.assertRaises(TypeError, self.type2test, 0.0)

Modified: python/branches/py3k-cdecimal/Lib/test/test_cmd_line.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_cmd_line.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_cmd_line.py	Wed Apr 21 13:06:18 2010
@@ -162,8 +162,15 @@
             path1 = "ABCDE" * 100
             path2 = "FGHIJ" * 100
             env['PYTHONPATH'] = path1 + os.pathsep + path2
-            p = _spawn_python_with_env('-S', '-c',
-                                       'import sys; print(sys.path)')
+
+            code = """
+import sys
+path = ":".join(sys.path)
+path = path.encode("ascii", "backslashreplace")
+sys.stdout.buffer.write(path)"""
+            code = code.strip().splitlines()
+            code = '; '.join(code)
+            p = _spawn_python_with_env('-S', '-c', code)
             stdout, _ = p.communicate()
             self.assertIn(path1.encode('ascii'), stdout)
             self.assertIn(path2.encode('ascii'), stdout)

Modified: python/branches/py3k-cdecimal/Lib/test/test_cmd_line_script.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_cmd_line_script.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_cmd_line_script.py	Wed Apr 21 13:06:18 2010
@@ -1,12 +1,14 @@
-# Tests command line execution of scripts
+# tests command line execution of scripts
 
 import unittest
 import os
 import os.path
+import py_compile
+
 import test.support
-from test.script_helper import (run_python,
-                                temp_dir, make_script, compile_script,
-                                make_pkg, make_zip_script, make_zip_pkg)
+from test.script_helper import (
+    make_pkg, make_script, make_zip_pkg, make_zip_script, run_python,
+    temp_dir)
 
 verbose = test.support.verbose
 
@@ -28,6 +30,7 @@
 # Check population of magic variables
 assertEqual(__name__, '__main__')
 print('__file__==%r' % __file__)
+assertEqual(__cached__, None)
 print('__package__==%r' % __package__)
 # Check the sys module
 import sys
@@ -101,9 +104,10 @@
     def test_script_compiled(self):
         with temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, 'script')
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            self._check_script(compiled_name, compiled_name, compiled_name, None)
+            self._check_script(compiled_name, compiled_name,
+                               compiled_name, None)
 
     def test_directory(self):
         with temp_dir() as script_dir:
@@ -113,9 +117,10 @@
     def test_directory_compiled(self):
         with temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            self._check_script(script_dir, compiled_name, script_dir, '')
+            pyc_file = test.support.make_legacy_pyc(script_name)
+            self._check_script(script_dir, pyc_file, script_dir, '')
 
     def test_directory_error(self):
         with temp_dir() as script_dir:
@@ -131,7 +136,7 @@
     def test_zipfile_compiled(self):
         with temp_dir() as script_dir:
             script_name = _make_test_script(script_dir, '__main__')
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             zip_name, run_name = make_zip_script(script_dir, 'test_zip', compiled_name)
             self._check_script(zip_name, run_name, zip_name, '')
 
@@ -176,11 +181,12 @@
             pkg_dir = os.path.join(script_dir, 'test_pkg')
             make_pkg(pkg_dir)
             script_name = _make_test_script(pkg_dir, '__main__')
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
+            pyc_file = test.support.make_legacy_pyc(script_name)
             launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
-            self._check_script(launch_name, compiled_name,
-                               compiled_name, 'test_pkg')
+            self._check_script(launch_name, pyc_file,
+                               pyc_file, 'test_pkg')
 
     def test_package_error(self):
         with temp_dir() as script_dir:

Modified: python/branches/py3k-cdecimal/Lib/test/test_compileall.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_compileall.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_compileall.py	Wed Apr 21 13:06:18 2010
@@ -5,22 +5,23 @@
 import py_compile
 import shutil
 import struct
+import subprocess
 import tempfile
-from test import support
 import unittest
 import io
 
+from test import support
 
 class CompileallTests(unittest.TestCase):
 
     def setUp(self):
         self.directory = tempfile.mkdtemp()
         self.source_path = os.path.join(self.directory, '_test.py')
-        self.bc_path = self.source_path + ('c' if __debug__ else 'o')
+        self.bc_path = imp.cache_from_source(self.source_path)
         with open(self.source_path, 'w') as file:
             file.write('x = 123\n')
         self.source_path2 = os.path.join(self.directory, '_test2.py')
-        self.bc_path2 = self.source_path2 + ('c' if __debug__ else 'o')
+        self.bc_path2 = imp.cache_from_source(self.source_path2)
         shutil.copyfile(self.source_path, self.source_path2)
 
     def tearDown(self):
@@ -65,17 +66,19 @@
             except:
                 pass
         compileall.compile_file(self.source_path, force=False, quiet=True)
-        self.assertTrue(os.path.isfile(self.bc_path) \
-                        and not os.path.isfile(self.bc_path2))
+        self.assertTrue(os.path.isfile(self.bc_path) and
+                        not os.path.isfile(self.bc_path2))
         os.unlink(self.bc_path)
         compileall.compile_dir(self.directory, force=False, quiet=True)
-        self.assertTrue(os.path.isfile(self.bc_path) \
-                        and os.path.isfile(self.bc_path2))
+        self.assertTrue(os.path.isfile(self.bc_path) and
+                        os.path.isfile(self.bc_path2))
         os.unlink(self.bc_path)
         os.unlink(self.bc_path2)
 
+
 class EncodingTest(unittest.TestCase):
-    'Issue 6716: compileall should escape source code when printing errors to stdout.'
+    """Issue 6716: compileall should escape source code when printing errors
+    to stdout."""
 
     def setUp(self):
         self.directory = tempfile.mkdtemp()
@@ -95,9 +98,65 @@
         finally:
             sys.stdout = orig_stdout
 
+class CommandLineTests(unittest.TestCase):
+    """Test some aspects of compileall's CLI."""
+
+    def setUp(self):
+        self.addCleanup(self._cleanup)
+        self.directory = tempfile.mkdtemp()
+        self.pkgdir = os.path.join(self.directory, 'foo')
+        os.mkdir(self.pkgdir)
+        # Touch the __init__.py and a package module.
+        with open(os.path.join(self.pkgdir, '__init__.py'), 'w'):
+            pass
+        with open(os.path.join(self.pkgdir, 'bar.py'), 'w'):
+            pass
+        sys.path.insert(0, self.directory)
+
+    def _cleanup(self):
+        support.rmtree(self.directory)
+        assert sys.path[0] == self.directory, 'Missing path'
+        del sys.path[0]
+
+    def test_pep3147_paths(self):
+        # Ensure that the default behavior of compileall's CLI is to create
+        # PEP 3147 pyc/pyo files.
+        retcode = subprocess.call(
+            (sys.executable, '-m', 'compileall', '-q', self.pkgdir))
+        self.assertEqual(retcode, 0)
+        # Verify the __pycache__ directory contents.
+        cachedir = os.path.join(self.pkgdir, '__pycache__')
+        self.assertTrue(os.path.exists(cachedir))
+        ext = ('pyc' if __debug__ else 'pyo')
+        expected = sorted(base.format(imp.get_tag(), ext) for base in
+                          ('__init__.{}.{}', 'bar.{}.{}'))
+        self.assertEqual(sorted(os.listdir(cachedir)), expected)
+        # Make sure there are no .pyc files in the source directory.
+        self.assertFalse([pyc_file for pyc_file in os.listdir(self.pkgdir)
+                          if pyc_file.endswith(ext)])
+
+    def test_legacy_paths(self):
+        # Ensure that with the proper switch, compileall leaves legacy
+        # pyc/pyo files, and no __pycache__ directory.
+        retcode = subprocess.call(
+            (sys.executable, '-m', 'compileall', '-b', '-q', self.pkgdir))
+        self.assertEqual(retcode, 0)
+        # Verify the __pycache__ directory contents.
+        cachedir = os.path.join(self.pkgdir, '__pycache__')
+        self.assertFalse(os.path.exists(cachedir))
+        ext = ('pyc' if __debug__ else 'pyo')
+        expected = [base.format(ext) for base in ('__init__.{}', 'bar.{}')]
+        expected.extend(['__init__.py', 'bar.py'])
+        expected.sort()
+        self.assertEqual(sorted(os.listdir(self.pkgdir)), expected)
+
+
 def test_main():
-    support.run_unittest(CompileallTests,
-                         EncodingTest)
+    support.run_unittest(
+        CommandLineTests,
+        CompileallTests,
+        EncodingTest,
+        )
 
 
 if __name__ == "__main__":

Modified: python/branches/py3k-cdecimal/Lib/test/test_datetime.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_datetime.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_datetime.py	Wed Apr 21 13:06:18 2010
@@ -7,7 +7,7 @@
 import pickle
 import unittest
 
-from operator import lt, le, gt, ge, eq, ne
+from operator import lt, le, gt, ge, eq, ne, truediv, floordiv, mod
 
 from test import support
 
@@ -469,6 +469,58 @@
         self.assertEqual(str(t3), str(t4))
         self.assertEqual(t4.as_hours(), -1)
 
+    def test_division(self):
+        t = timedelta(hours=1, minutes=24, seconds=19)
+        second = timedelta(seconds=1)
+        self.assertEqual(t / second, 5059.0)
+        self.assertEqual(t // second, 5059)
+
+        t = timedelta(minutes=2, seconds=30)
+        minute = timedelta(minutes=1)
+        self.assertEqual(t / minute, 2.5)
+        self.assertEqual(t // minute, 2)
+
+        zerotd = timedelta(0)
+        self.assertRaises(ZeroDivisionError, truediv, t, zerotd)
+        self.assertRaises(ZeroDivisionError, floordiv, t, zerotd)
+
+        self.assertRaises(TypeError, truediv, t, 2)
+        # note: floor division of a timedelta by an integer *is*
+        # currently permitted.
+
+    def test_remainder(self):
+        t = timedelta(minutes=2, seconds=30)
+        minute = timedelta(minutes=1)
+        r = t % minute
+        self.assertEqual(r, timedelta(seconds=30))
+
+        t = timedelta(minutes=-2, seconds=30)
+        r = t %  minute
+        self.assertEqual(r, timedelta(seconds=30))
+
+        zerotd = timedelta(0)
+        self.assertRaises(ZeroDivisionError, mod, t, zerotd)
+
+        self.assertRaises(TypeError, mod, t, 10)
+
+    def test_divmod(self):
+        t = timedelta(minutes=2, seconds=30)
+        minute = timedelta(minutes=1)
+        q, r = divmod(t, minute)
+        self.assertEqual(q, 2)
+        self.assertEqual(r, timedelta(seconds=30))
+
+        t = timedelta(minutes=-2, seconds=30)
+        q, r = divmod(t, minute)
+        self.assertEqual(q, -2)
+        self.assertEqual(r, timedelta(seconds=30))
+
+        zerotd = timedelta(0)
+        self.assertRaises(ZeroDivisionError, divmod, t, zerotd)
+
+        self.assertRaises(TypeError, divmod, t, 10)
+
+
 #############################################################################
 # date tests
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_difflib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_difflib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_difflib.py	Wed Apr 21 13:06:18 2010
@@ -159,10 +159,32 @@
         difflib.SequenceMatcher(None, old, new).get_opcodes()
 
 
+class TestOutputFormat(unittest.TestCase):
+    def test_tab_delimiter(self):
+        args = ['one', 'two', 'Original', 'Current',
+            '2005-01-26 23:30:50', '2010-04-02 10:20:52']
+        ud = difflib.unified_diff(*args, lineterm='')
+        self.assertEqual(list(ud)[0:2], [
+                           "--- Original\t2005-01-26 23:30:50",
+                           "+++ Current\t2010-04-02 10:20:52"])
+        cd = difflib.context_diff(*args, lineterm='')
+        self.assertEqual(list(cd)[0:2], [
+                           "*** Original\t2005-01-26 23:30:50",
+                           "--- Current\t2010-04-02 10:20:52"])
+
+    def test_no_trailing_tab_on_empty_filedate(self):
+        args = ['one', 'two', 'Original', 'Current']
+        ud = difflib.unified_diff(*args, lineterm='')
+        self.assertEqual(list(ud)[0:2], ["--- Original", "+++ Current"])
+
+        cd = difflib.context_diff(*args, lineterm='')
+        self.assertEqual(list(cd)[0:2], ["*** Original", "--- Current"])
+
+
 def test_main():
     difflib.HtmlDiff._default_prefix = 0
     Doctests = doctest.DocTestSuite(difflib)
-    run_unittest(TestSFpatches, TestSFbugs, Doctests)
+    run_unittest(TestSFpatches, TestSFbugs, TestOutputFormat, Doctests)
 
 if __name__ == '__main__':
     test_main()

Modified: python/branches/py3k-cdecimal/Lib/test/test_frozen.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_frozen.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_frozen.py	Wed Apr 21 13:06:18 2010
@@ -11,7 +11,7 @@
         except ImportError as x:
             self.fail("import __hello__ failed:" + str(x))
         self.assertEqual(__hello__.initialized, True)
-        self.assertEqual(len(dir(__hello__)), 6, dir(__hello__))
+        self.assertEqual(len(dir(__hello__)), 7, dir(__hello__))
 
         try:
             import __phello__
@@ -19,9 +19,9 @@
             self.fail("import __phello__ failed:" + str(x))
         self.assertEqual(__phello__.initialized, True)
         if not "__phello__.spam" in sys.modules:
-            self.assertEqual(len(dir(__phello__)), 7, dir(__phello__))
-        else:
             self.assertEqual(len(dir(__phello__)), 8, dir(__phello__))
+        else:
+            self.assertEqual(len(dir(__phello__)), 9, dir(__phello__))
         self.assertEquals(__phello__.__path__, [__phello__.__name__])
 
         try:
@@ -29,8 +29,8 @@
         except ImportError as x:
             self.fail("import __phello__.spam failed:" + str(x))
         self.assertEqual(__phello__.spam.initialized, True)
-        self.assertEqual(len(dir(__phello__.spam)), 6)
-        self.assertEqual(len(dir(__phello__)), 8)
+        self.assertEqual(len(dir(__phello__.spam)), 7)
+        self.assertEqual(len(dir(__phello__)), 9)
 
         try:
             import __phello__.foo

Modified: python/branches/py3k-cdecimal/Lib/test/test_functools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_functools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_functools.py	Wed Apr 21 13:06:18 2010
@@ -448,6 +448,11 @@
         self.assert_(A(2) <= A(2))
         self.assert_(A(2) >= A(2))
 
+    def test_no_operations_defined(self):
+        with self.assertRaises(ValueError):
+            @functools.total_ordering
+            class A:
+                pass
 
 def test_main(verbose=None):
     test_classes = (

Modified: python/branches/py3k-cdecimal/Lib/test/test_genericpath.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_genericpath.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_genericpath.py	Wed Apr 21 13:06:18 2010
@@ -6,6 +6,7 @@
 from test import support
 import os
 import genericpath
+import sys
 
 
 def safe_rmdir(dirname):
@@ -284,6 +285,9 @@
                 for path in ('', 'fuu', 'f\xf9\xf9', '/fuu', 'U:\\'):
                     self.assertIsInstance(abspath(path), str)
 
+    @unittest.skipIf(sys.platform == 'darwin',
+        "Mac OS X deny the creation of a directory with an invalid utf8 name")
+    def test_nonascii_abspath(self):
         # Test non-ASCII, non-UTF8 bytes in the path.
         with support.temp_cwd(b'\xe7w\xf0'):
             self.test_abspath()

Modified: python/branches/py3k-cdecimal/Lib/test/test_imp.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_imp.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_imp.py	Wed Apr 21 13:06:18 2010
@@ -1,6 +1,7 @@
 import imp
 import os
 import os.path
+import shutil
 import sys
 import unittest
 from test import support
@@ -139,7 +140,8 @@
             mod = imp.load_source(temp_mod_name, temp_mod_name + '.py')
             self.assertEqual(mod.a, 1)
 
-            mod = imp.load_compiled(temp_mod_name, temp_mod_name + '.pyc')
+            mod = imp.load_compiled(
+                temp_mod_name, imp.cache_from_source(temp_mod_name + '.py'))
             self.assertEqual(mod.a, 1)
 
             if not os.path.exists(test_package_name):
@@ -184,11 +186,132 @@
             imp.reload(marshal)
 
 
+class PEP3147Tests(unittest.TestCase):
+    """Tests of PEP 3147."""
+
+    tag = imp.get_tag()
+
+    def test_cache_from_source(self):
+        # Given the path to a .py file, return the path to its PEP 3147
+        # defined .pyc file (i.e. under __pycache__).
+        self.assertEqual(
+            imp.cache_from_source('/foo/bar/baz/qux.py', True),
+            '/foo/bar/baz/__pycache__/qux.{}.pyc'.format(self.tag))
+
+    def test_cache_from_source_optimized(self):
+        # Given the path to a .py file, return the path to its PEP 3147
+        # defined .pyo file (i.e. under __pycache__).
+        self.assertEqual(
+            imp.cache_from_source('/foo/bar/baz/qux.py', False),
+            '/foo/bar/baz/__pycache__/qux.{}.pyo'.format(self.tag))
+
+    def test_cache_from_source_cwd(self):
+        self.assertEqual(imp.cache_from_source('foo.py', True),
+                         os.sep.join(('__pycache__',
+                                      'foo.{}.pyc'.format(self.tag))))
+
+    def test_cache_from_source_override(self):
+        # When debug_override is not None, it can be any true-ish or false-ish
+        # value.
+        self.assertEqual(
+            imp.cache_from_source('/foo/bar/baz.py', []),
+            '/foo/bar/__pycache__/baz.{}.pyo'.format(self.tag))
+        self.assertEqual(
+            imp.cache_from_source('/foo/bar/baz.py', [17]),
+            '/foo/bar/__pycache__/baz.{}.pyc'.format(self.tag))
+        # However if the bool-ishness can't be determined, the exception
+        # propagates.
+        class Bearish:
+            def __bool__(self): raise RuntimeError
+        self.assertRaises(
+            RuntimeError,
+            imp.cache_from_source, '/foo/bar/baz.py', Bearish())
+
+    @unittest.skipIf(os.altsep is None,
+                     'test meaningful only where os.altsep is defined')
+    def test_altsep_cache_from_source(self):
+        # Windows path and PEP 3147.
+        self.assertEqual(
+            imp.cache_from_source('\\foo\\bar\\baz\\qux.py', True),
+            '\\foo\\bar\\baz\\__pycache__\\qux.{}.pyc'.format(self.tag))
+
+    @unittest.skipIf(os.altsep is None,
+                     'test meaningful only where os.altsep is defined')
+    def test_altsep_and_sep_cache_from_source(self):
+        # Windows path and PEP 3147 where altsep is right of sep.
+        self.assertEqual(
+            imp.cache_from_source('\\foo\\bar/baz\\qux.py', True),
+            '\\foo\\bar/baz\\__pycache__\\qux.{}.pyc'.format(self.tag))
+
+    @unittest.skipIf(os.altsep is None,
+                     'test meaningful only where os.altsep is defined')
+    def test_sep_altsep_and_sep_cache_from_source(self):
+        # Windows path and PEP 3147 where sep is right of altsep.
+        self.assertEqual(
+            imp.cache_from_source('\\foo\\bar\\baz/qux.py', True),
+            '\\foo\\bar\\baz/__pycache__/qux.{}.pyc'.format(self.tag))
+
+    def test_source_from_cache(self):
+        # Given the path to a PEP 3147 defined .pyc file, return the path to
+        # its source.  This tests the good path.
+        self.assertEqual(imp.source_from_cache(
+            '/foo/bar/baz/__pycache__/qux.{}.pyc'.format(self.tag)),
+            '/foo/bar/baz/qux.py')
+
+    def test_source_from_cache_bad_path(self):
+        # When the path to a pyc file is not in PEP 3147 format, a ValueError
+        # is raised.
+        self.assertRaises(
+            ValueError, imp.source_from_cache, '/foo/bar/bazqux.pyc')
+
+    def test_source_from_cache_no_slash(self):
+        # No slashes at all in path -> ValueError
+        self.assertRaises(
+            ValueError, imp.source_from_cache, 'foo.cpython-32.pyc')
+
+    def test_source_from_cache_too_few_dots(self):
+        # Too few dots in final path component -> ValueError
+        self.assertRaises(
+            ValueError, imp.source_from_cache, '__pycache__/foo.pyc')
+
+    def test_source_from_cache_too_many_dots(self):
+        # Too many dots in final path component -> ValueError
+        self.assertRaises(
+            ValueError, imp.source_from_cache,
+            '__pycache__/foo.cpython-32.foo.pyc')
+
+    def test_source_from_cache_no__pycache__(self):
+        # Another problem with the path -> ValueError
+        self.assertRaises(
+            ValueError, imp.source_from_cache,
+            '/foo/bar/foo.cpython-32.foo.pyc')
+
+    def test_package___file__(self):
+        # Test that a package's __file__ points to the right source directory.
+        os.mkdir('pep3147')
+        sys.path.insert(0, os.curdir)
+        def cleanup():
+            if sys.path[0] == os.curdir:
+                del sys.path[0]
+            shutil.rmtree('pep3147')
+        self.addCleanup(cleanup)
+        # Touch the __init__.py file.
+        with open('pep3147/__init__.py', 'w'):
+            pass
+        m = __import__('pep3147')
+        # Ensure we load the pyc file.
+        support.forget('pep3147')
+        m = __import__('pep3147')
+        self.assertEqual(m.__file__,
+                         os.sep.join(('.', 'pep3147', '__init__.py')))
+
+
 def test_main():
     tests = [
         ImportTests,
+        PEP3147Tests,
         ReloadTests,
-    ]
+        ]
     try:
         import _thread
     except ImportError:

Modified: python/branches/py3k-cdecimal/Lib/test/test_import.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_import.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_import.py	Wed Apr 21 13:06:18 2010
@@ -1,4 +1,5 @@
 import builtins
+import errno
 import imp
 import marshal
 import os
@@ -8,8 +9,11 @@
 import stat
 import sys
 import unittest
-from test.support import (unlink, TESTFN, unload, run_unittest, is_jython,
-                          check_warnings, EnvironmentVarGuard, swap_attr, swap_item)
+
+from test.support import (
+    EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
+    make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
+    unlink, unload)
 
 
 def remove_files(name):
@@ -19,12 +23,18 @@
               name + ".pyw",
               name + "$py.class"):
         unlink(f)
+    try:
+        shutil.rmtree('__pycache__')
+    except OSError as error:
+        if error.errno != errno.ENOENT:
+            raise
 
 
 class ImportTests(unittest.TestCase):
 
     def tearDown(self):
         unload(TESTFN)
+
     setUp = tearDown
 
     def test_case_sensitivity(self):
@@ -53,8 +63,8 @@
                 pyc = TESTFN + ".pyc"
 
             with open(source, "w") as f:
-                print("# This tests Python's ability to import a", ext, "file.",
-                      file=f)
+                print("# This tests Python's ability to import a",
+                      ext, "file.", file=f)
                 a = random.randrange(1000)
                 b = random.randrange(1000)
                 print("a =", a, file=f)
@@ -73,10 +83,10 @@
                 self.assertEqual(mod.b, b,
                     "module loaded (%s) but contents invalid" % mod)
             finally:
+                forget(TESTFN)
                 unlink(source)
                 unlink(pyc)
                 unlink(pyo)
-                unload(TESTFN)
 
         sys.path.insert(0, os.curdir)
         try:
@@ -87,32 +97,31 @@
         finally:
             del sys.path[0]
 
-    @unittest.skipUnless(os.name == 'posix', "test meaningful only on posix systems")
+    @unittest.skipUnless(os.name == 'posix',
+                         "test meaningful only on posix systems")
     def test_execute_bit_not_copied(self):
         # Issue 6070: under posix .pyc files got their execute bit set if
         # the .py file had the execute bit set, but they aren't executable.
-        oldmask = os.umask(0o022)
-        sys.path.insert(0, os.curdir)
-        try:
-            fname = TESTFN + os.extsep + "py"
-            f = open(fname, 'w').close()
-            os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
-                             stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
-            __import__(TESTFN)
-            fn = fname + 'c'
-            if not os.path.exists(fn):
-                fn = fname + 'o'
+        with temp_umask(0o022):
+            sys.path.insert(0, os.curdir)
+            try:
+                fname = TESTFN + os.extsep + "py"
+                f = open(fname, 'w').close()
+                os.chmod(fname, (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
+                                 stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH))
+                __import__(TESTFN)
+                fn = imp.cache_from_source(fname)
                 if not os.path.exists(fn):
                     self.fail("__import__ did not result in creation of "
                               "either a .pyc or .pyo file")
-            s = os.stat(fn)
-            self.assertEqual(stat.S_IMODE(s.st_mode),
-                             stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
-        finally:
-            os.umask(oldmask)
-            remove_files(TESTFN)
-            unload(TESTFN)
-            del sys.path[0]
+                    s = os.stat(fn)
+                    self.assertEqual(
+                        stat.S_IMODE(s.st_mode),
+                        stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
+            finally:
+                del sys.path[0]
+                remove_files(TESTFN)
+                unload(TESTFN)
 
     def test_imp_module(self):
         # Verify that the imp module can correctly load and find .py files
@@ -144,10 +153,12 @@
                 f.write('"",\n')
             f.write(']')
 
-        # Compile & remove .py file, we only need .pyc (or .pyo).
+        # Compile & remove .py file, we only need .pyc (or .pyo), but that
+        # must be relocated to the PEP 3147 bytecode-only location.
         with open(filename, 'r') as f:
             py_compile.compile(filename)
         unlink(filename)
+        make_legacy_pyc(filename)
 
         # Need to be able to load from current dir.
         sys.path.append('')
@@ -247,8 +258,9 @@
             self.assertTrue(mod.__file__.endswith('.py'))
             os.remove(source)
             del sys.modules[TESTFN]
+            make_legacy_pyc(source)
             mod = __import__(TESTFN)
-            ext = mod.__file__[-4:]
+            base, ext = os.path.splitext(mod.__file__)
             self.assertIn(ext, ('.pyc', '.pyo'))
         finally:
             del sys.path[0]
@@ -298,7 +310,7 @@
 """
     dir_name = os.path.abspath(TESTFN)
     file_name = os.path.join(dir_name, module_name) + os.extsep + "py"
-    compiled_name = file_name + ("c" if __debug__ else "o")
+    compiled_name = imp.cache_from_source(file_name)
 
     def setUp(self):
         self.sys_path = sys.path[:]
@@ -346,8 +358,9 @@
         target = "another_module.py"
         py_compile.compile(self.file_name, dfile=target)
         os.remove(self.file_name)
+        pyc_file = make_legacy_pyc(self.file_name)
         mod = self.import_module()
-        self.assertEqual(mod.module_filename, self.compiled_name)
+        self.assertEqual(mod.module_filename, pyc_file)
         self.assertEqual(mod.code_filename, target)
         self.assertEqual(mod.func_filename, target)
 
@@ -476,10 +489,143 @@
             self.assertEqual(foo(), os)
 
 
+class PycacheTests(unittest.TestCase):
+    # Test the various PEP 3147 related behaviors.
+
+    tag = imp.get_tag()
+
+    def _clean(self):
+        forget(TESTFN)
+        rmtree('__pycache__')
+        unlink(self.source)
+
+    def setUp(self):
+        self.source = TESTFN + '.py'
+        self._clean()
+        with open(self.source, 'w') as fp:
+            print('# This is a test file written by test_import.py', file=fp)
+        sys.path.insert(0, os.curdir)
+
+    def tearDown(self):
+        assert sys.path[0] == os.curdir, 'Unexpected sys.path[0]'
+        del sys.path[0]
+        self._clean()
+
+    def test_import_pyc_path(self):
+        self.assertFalse(os.path.exists('__pycache__'))
+        __import__(TESTFN)
+        self.assertTrue(os.path.exists('__pycache__'))
+        self.assertTrue(os.path.exists(os.path.join(
+            '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag))))
+
+    @unittest.skipUnless(os.name == 'posix',
+                         "test meaningful only on posix systems")
+    def test_unwritable_directory(self):
+        # When the umask causes the new __pycache__ directory to be
+        # unwritable, the import still succeeds but no .pyc file is written.
+        with temp_umask(0o222):
+            __import__(TESTFN)
+        self.assertTrue(os.path.exists('__pycache__'))
+        self.assertFalse(os.path.exists(os.path.join(
+            '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag))))
+
+    def test_missing_source(self):
+        # With PEP 3147 cache layout, removing the source but leaving the pyc
+        # file does not satisfy the import.
+        __import__(TESTFN)
+        pyc_file = imp.cache_from_source(self.source)
+        self.assertTrue(os.path.exists(pyc_file))
+        os.remove(self.source)
+        forget(TESTFN)
+        self.assertRaises(ImportError, __import__, TESTFN)
+
+    def test_missing_source_legacy(self):
+        # Like test_missing_source() except that for backward compatibility,
+        # when the pyc file lives where the py file would have been (and named
+        # without the tag), it is importable.  The __file__ of the imported
+        # module is the pyc location.
+        __import__(TESTFN)
+        # pyc_file gets removed in _clean() via tearDown().
+        pyc_file = make_legacy_pyc(self.source)
+        os.remove(self.source)
+        unload(TESTFN)
+        m = __import__(TESTFN)
+        self.assertEqual(m.__file__,
+                         os.path.join(os.curdir, os.path.relpath(pyc_file)))
+
+    def test___cached__(self):
+        # Modules now also have an __cached__ that points to the pyc file.
+        m = __import__(TESTFN)
+        pyc_file = imp.cache_from_source(TESTFN + '.py')
+        self.assertEqual(m.__cached__, os.path.join(os.curdir, pyc_file))
+
+    def test___cached___legacy_pyc(self):
+        # Like test___cached__() except that for backward compatibility,
+        # when the pyc file lives where the py file would have been (and named
+        # without the tag), it is importable.  The __cached__ of the imported
+        # module is the pyc location.
+        __import__(TESTFN)
+        # pyc_file gets removed in _clean() via tearDown().
+        pyc_file = make_legacy_pyc(self.source)
+        os.remove(self.source)
+        unload(TESTFN)
+        m = __import__(TESTFN)
+        self.assertEqual(m.__cached__,
+                         os.path.join(os.curdir, os.path.relpath(pyc_file)))
+
+    def test_package___cached__(self):
+        # Like test___cached__ but for packages.
+        def cleanup():
+            shutil.rmtree('pep3147')
+        os.mkdir('pep3147')
+        self.addCleanup(cleanup)
+        # Touch the __init__.py
+        with open(os.path.join('pep3147', '__init__.py'), 'w'):
+            pass
+        with open(os.path.join('pep3147', 'foo.py'), 'w'):
+            pass
+        unload('pep3147.foo')
+        unload('pep3147')
+        m = __import__('pep3147.foo')
+        init_pyc = imp.cache_from_source(
+            os.path.join('pep3147', '__init__.py'))
+        self.assertEqual(m.__cached__, os.path.join(os.curdir, init_pyc))
+        foo_pyc = imp.cache_from_source(os.path.join('pep3147', 'foo.py'))
+        self.assertEqual(sys.modules['pep3147.foo'].__cached__,
+                         os.path.join(os.curdir, foo_pyc))
+
+    def test_package___cached___from_pyc(self):
+        # Like test___cached__ but ensuring __cached__ when imported from a
+        # PEP 3147 pyc file.
+        def cleanup():
+            shutil.rmtree('pep3147')
+        os.mkdir('pep3147')
+        self.addCleanup(cleanup)
+        unload('pep3147.foo')
+        unload('pep3147')
+        # Touch the __init__.py
+        with open(os.path.join('pep3147', '__init__.py'), 'w'):
+            pass
+        with open(os.path.join('pep3147', 'foo.py'), 'w'):
+            pass
+        m = __import__('pep3147.foo')
+        unload('pep3147.foo')
+        unload('pep3147')
+        m = __import__('pep3147.foo')
+        init_pyc = imp.cache_from_source(
+            os.path.join('pep3147', '__init__.py'))
+        self.assertEqual(m.__cached__, os.path.join(os.curdir, init_pyc))
+        foo_pyc = imp.cache_from_source(os.path.join('pep3147', 'foo.py'))
+        self.assertEqual(sys.modules['pep3147.foo'].__cached__,
+                         os.path.join(os.curdir, foo_pyc))
+
+
 def test_main(verbose=None):
-    run_unittest(ImportTests, PycRewritingTests, PathsTests, RelativeImportTests,
+    run_unittest(ImportTests, PycacheTests,
+                 PycRewritingTests, PathsTests, RelativeImportTests,
                  OverridingImportBuiltinTests)
 
+
 if __name__ == '__main__':
     # Test needs to be a package, so we can do relative imports.
     from test.test_import import test_main

Modified: python/branches/py3k-cdecimal/Lib/test/test_linecache.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_linecache.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_linecache.py	Wed Apr 21 13:06:18 2010
@@ -86,31 +86,28 @@
             source_name = support.TESTFN + '.py'
             with open(source_name, 'w') as source:
                 source.write(SOURCE_1)
-                source.close()
-                getline(source_name, 1)
+            getline(source_name, 1)
 
-                # Keep a copy of the old contents
-                source_list = []
-                source = open(source_name)
+            # Keep a copy of the old contents
+            source_list = []
+            with open(source_name) as source:
                 for index, line in enumerate(source):
                     self.assertEquals(line, getline(source_name, index + 1))
                     source_list.append(line)
-                source.close()
 
-                source = open(source_name, 'w')
+            with open(source_name, 'w') as source:
                 source.write(SOURCE_2)
-                source.close()
-
-                # Try to update a bogus cache entry
-                linecache.checkcache('dummy')
 
-                # Check that the cache matches the old contents
-                for index, line in enumerate(source_list):
-                    self.assertEquals(line, getline(source_name, index + 1))
+            # Try to update a bogus cache entry
+            linecache.checkcache('dummy')
 
-                # Update the cache and check whether it matches the new source file
-                linecache.checkcache(source_name)
-                source = open(source_name)
+            # Check that the cache matches the old contents
+            for index, line in enumerate(source_list):
+                self.assertEquals(line, getline(source_name, index + 1))
+
+            # Update the cache and check whether it matches the new source file
+            linecache.checkcache(source_name)
+            with open(source_name) as source:
                 for index, line in enumerate(source):
                     self.assertEquals(line, getline(source_name, index + 1))
                     source_list.append(line)

Modified: python/branches/py3k-cdecimal/Lib/test/test_locale.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_locale.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_locale.py	Wed Apr 21 13:06:18 2010
@@ -8,7 +8,15 @@
 
 def get_enUS_locale():
     global enUS_locale
-    if sys.platform.startswith("win"):
+    if sys.platform == 'darwin':
+        import os
+        tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US")
+        if int(os.uname()[2].split('.')[0]) < 10:
+            # The locale test work fine on OSX 10.6, I (ronaldoussoren)
+            # haven't had time yet to verify if tests work on OSX 10.5
+            # (10.4 is known to be bad)
+            raise unittest.SkipTest("Locale support on MacOSX is minimal")
+    elif sys.platform.startswith("win"):
         tlocs = ("En", "English")
     else:
         tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US.US-ASCII", "en_US")

Modified: python/branches/py3k-cdecimal/Lib/test/test_logging.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_logging.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_logging.py	Wed Apr 21 13:06:18 2010
@@ -68,6 +68,12 @@
         finally:
             logging._releaseLock()
 
+        # Set two unused loggers: one non-ASCII and one Unicode.
+        # This is to test correct operation when sorting existing
+        # loggers in the configuration code. See issue 8201.
+        logging.getLogger("\xab\xd7\xbb")
+        logging.getLogger("\u013f\u00d6\u0047")
+
         self.root_logger = logging.getLogger("")
         self.original_logging_level = self.root_logger.getEffectiveLevel()
 
@@ -1731,6 +1737,23 @@
         self.assertEqual(logged, ['should appear in logged'])
 
 
+class ChildLoggerTest(BaseTest):
+    def test_child_loggers(self):
+        r = logging.getLogger()
+        l1 = logging.getLogger('abc')
+        l2 = logging.getLogger('def.ghi')
+        c1 = r.getChild('xyz')
+        c2 = r.getChild('uvw.xyz')
+        self.assertTrue(c1 is logging.getLogger('xyz'))
+        self.assertTrue(c2 is logging.getLogger('uvw.xyz'))
+        c1 = l1.getChild('def')
+        c2 = c1.getChild('ghi')
+        c3 = l1.getChild('def.ghi')
+        self.assertTrue(c1 is logging.getLogger('abc.def'))
+        self.assertTrue(c2 is logging.getLogger('abc.def.ghi'))
+        self.assertTrue(c2 is c3)
+
+
 # Set the locale to the platform-dependent default.  I have no idea
 # why the test does this, but in any case we save the current locale
 # first and restore it at the end.
@@ -1739,7 +1762,8 @@
     run_unittest(BuiltinLevelsTest, BasicFilterTest,
                  CustomLevelsAndFiltersTest, MemoryHandlerTest,
                  ConfigFileTest, SocketHandlerTest, MemoryTest,
-                 EncodingTest, WarningsTest, ConfigDictTest, ManagerTest)
+                 EncodingTest, WarningsTest, ConfigDictTest, ManagerTest,
+                 ChildLoggerTest)
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-cdecimal/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_os.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_os.py	Wed Apr 21 13:06:18 2010
@@ -7,9 +7,23 @@
 import unittest
 import warnings
 import sys
+import signal
+import subprocess
+import time
 import shutil
 from test import support
 
+# Detect whether we're on a Linux system that uses the (now outdated
+# and unmaintained) linuxthreads threading library.  There's an issue
+# when combining linuxthreads with a failed execv call: see
+# http://bugs.python.org/issue4970.
+if (hasattr(os, "confstr_names") and
+    "CS_GNU_LIBPTHREAD_VERSION" in os.confstr_names):
+    libpthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")
+    USING_LINUXTHREADS= libpthread.startswith("linuxthreads")
+else:
+    USING_LINUXTHREADS= False
+
 # Tests creating TESTFN
 class FileTests(unittest.TestCase):
     def setUp(self):
@@ -584,8 +598,11 @@
             pass
 
 class ExecTests(unittest.TestCase):
+    @unittest.skipIf(USING_LINUXTHREADS,
+                     "avoid triggering a linuxthreads bug: see issue #4970")
     def test_execvpe_with_bad_program(self):
-        self.assertRaises(OSError, os.execvpe, 'no such app-', ['no such app-'], None)
+        self.assertRaises(OSError, os.execvpe, 'no such app-',
+                          ['no such app-'], None)
 
     def test_execvpe_with_bad_arglist(self):
         self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
@@ -739,7 +756,6 @@
             def test_setreuid_neg1(self):
                 # Needs to accept -1.  We run this in a subprocess to avoid
                 # altering the test runner's process state (issue8045).
-                import subprocess
                 subprocess.check_call([
                         sys.executable, '-c',
                         'import os,sys;os.setreuid(-1,-1);sys.exit(0)'])
@@ -754,7 +770,6 @@
             def test_setregid_neg1(self):
                 # Needs to accept -1.  We run this in a subprocess to avoid
                 # altering the test runner's process state (issue8045).
-                import subprocess
                 subprocess.check_call([
                         sys.executable, '-c',
                         'import os,sys;os.setregid(-1,-1);sys.exit(0)'])
@@ -798,6 +813,63 @@
     class Pep383Tests(unittest.TestCase):
         pass
 
+ at unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
+class Win32KillTests(unittest.TestCase):
+    def _kill(self, sig, *args):
+        # Send a subprocess a signal (or in some cases, just an int to be
+        # the return value)
+        proc = subprocess.Popen(*args)
+        os.kill(proc.pid, sig)
+        self.assertEqual(proc.wait(), sig)
+
+    def test_kill_sigterm(self):
+        # SIGTERM doesn't mean anything special, but make sure it works
+        self._kill(signal.SIGTERM, [sys.executable])
+
+    def test_kill_int(self):
+        # os.kill on Windows can take an int which gets set as the exit code
+        self._kill(100, [sys.executable])
+
+    def _kill_with_event(self, event, name):
+        # Run a script which has console control handling enabled.
+        proc = subprocess.Popen([sys.executable,
+                   os.path.join(os.path.dirname(__file__),
+                                "win_console_handler.py")],
+                   creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
+        # Let the interpreter startup before we send signals. See #3137.
+        time.sleep(0.5)
+        os.kill(proc.pid, event)
+        # proc.send_signal(event) could also be done here.
+        # Allow time for the signal to be passed and the process to exit.
+        time.sleep(0.5)
+        if not proc.poll():
+            # Forcefully kill the process if we weren't able to signal it.
+            os.kill(proc.pid, signal.SIGINT)
+            self.fail("subprocess did not stop on {}".format(name))
+
+    @unittest.skip("subprocesses aren't inheriting CTRL+C property")
+    def test_CTRL_C_EVENT(self):
+        from ctypes import wintypes
+        import ctypes
+
+        # Make a NULL value by creating a pointer with no argument.
+        NULL = ctypes.POINTER(ctypes.c_int)()
+        SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler
+        SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int),
+                                          wintypes.BOOL)
+        SetConsoleCtrlHandler.restype = wintypes.BOOL
+
+        # Calling this with NULL and FALSE causes the calling process to
+        # handle CTRL+C, rather than ignore it. This property is inherited
+        # by subprocesses.
+        SetConsoleCtrlHandler(NULL, 0)
+
+        self._kill_with_event(signal.CTRL_C_EVENT, "CTRL_C_EVENT")
+
+    def test_CTRL_BREAK_EVENT(self):
+        self._kill_with_event(signal.CTRL_BREAK_EVENT, "CTRL_BREAK_EVENT")
+
+
 def test_main():
     support.run_unittest(
         ArgTests,
@@ -812,7 +884,8 @@
         Win32ErrorTests,
         TestInvalidFD,
         PosixUidGidTests,
-        Pep383Tests
+        Pep383Tests,
+        Win32KillTests
     )
 
 if __name__ == "__main__":

Modified: python/branches/py3k-cdecimal/Lib/test/test_pkg.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_pkg.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_pkg.py	Wed Apr 21 13:06:18 2010
@@ -196,14 +196,14 @@
 
         import t5
         self.assertEqual(fixdir(dir(t5)),
-                         ['__doc__', '__file__', '__name__',
+                         ['__cached__', '__doc__', '__file__', '__name__',
                           '__package__', '__path__', 'foo', 'string', 't5'])
         self.assertEqual(fixdir(dir(t5.foo)),
-                         ['__doc__', '__file__', '__name__', '__package__',
-                          'string'])
+                         ['__cached__', '__doc__', '__file__', '__name__',
+                          '__package__', 'string'])
         self.assertEqual(fixdir(dir(t5.string)),
-                         ['__doc__', '__file__', '__name__','__package__',
-                          'spam'])
+                         ['__cached__', '__doc__', '__file__', '__name__',
+                          '__package__', 'spam'])
 
     def test_6(self):
         hier = [
@@ -218,13 +218,13 @@
 
         import t6
         self.assertEqual(fixdir(dir(t6)),
-                         ['__all__', '__doc__', '__file__',
+                         ['__all__', '__cached__', '__doc__', '__file__',
                           '__name__', '__package__', '__path__'])
         s = """
             import t6
             from t6 import *
             self.assertEqual(fixdir(dir(t6)),
-                             ['__all__', '__doc__', '__file__',
+                             ['__all__', '__cached__', '__doc__', '__file__',
                               '__name__', '__package__', '__path__',
                               'eggs', 'ham', 'spam'])
             self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
@@ -252,18 +252,18 @@
         t7, sub, subsub = None, None, None
         import t7 as tas
         self.assertEqual(fixdir(dir(tas)),
-                         ['__doc__', '__file__', '__name__',
+                         ['__cached__', '__doc__', '__file__', '__name__',
                           '__package__', '__path__'])
         self.assertFalse(t7)
         from t7 import sub as subpar
         self.assertEqual(fixdir(dir(subpar)),
-                         ['__doc__', '__file__', '__name__',
+                         ['__cached__', '__doc__', '__file__', '__name__',
                           '__package__', '__path__'])
         self.assertFalse(t7)
         self.assertFalse(sub)
         from t7.sub import subsub as subsubsub
         self.assertEqual(fixdir(dir(subsubsub)),
-                         ['__doc__', '__file__', '__name__',
+                         ['__cached__', '__doc__', '__file__', '__name__',
                          '__package__', '__path__', 'spam'])
         self.assertFalse(t7)
         self.assertFalse(sub)

Modified: python/branches/py3k-cdecimal/Lib/test/test_pkgimport.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_pkgimport.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_pkgimport.py	Wed Apr 21 13:06:18 2010
@@ -1,5 +1,12 @@
-import os, sys, string, random, tempfile, unittest
+import os
+import sys
+import shutil
+import string
+import random
+import tempfile
+import unittest
 
+from imp import cache_from_source
 from test.support import run_unittest
 
 class TestImport(unittest.TestCase):
@@ -26,22 +33,17 @@
         self.module_path = os.path.join(self.package_dir, 'foo.py')
 
     def tearDown(self):
-        for file in os.listdir(self.package_dir):
-            os.remove(os.path.join(self.package_dir, file))
-        os.rmdir(self.package_dir)
-        os.rmdir(self.test_dir)
+        shutil.rmtree(self.test_dir)
         self.assertNotEqual(sys.path.count(self.test_dir), 0)
         sys.path.remove(self.test_dir)
         self.remove_modules()
 
     def rewrite_file(self, contents):
-        for extension in "co":
-            compiled_path = self.module_path + extension
-            if os.path.exists(compiled_path):
-                os.remove(compiled_path)
-        f = open(self.module_path, 'w')
-        f.write(contents)
-        f.close()
+        compiled_path = cache_from_source(self.module_path)
+        if os.path.exists(compiled_path):
+            os.remove(compiled_path)
+        with open(self.module_path, 'w') as f:
+            f.write(contents)
 
     def test_package_import__semantics(self):
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_plistlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_plistlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_plistlib.py	Wed Apr 21 13:06:18 2010
@@ -9,7 +9,7 @@
 
 # This test data was generated through Cocoa's NSDictionary class
 TESTDATA = b"""<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" \
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>

Modified: python/branches/py3k-cdecimal/Lib/test/test_pydoc.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_pydoc.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_pydoc.py	Wed Apr 21 13:06:18 2010
@@ -19,8 +19,7 @@
 if hasattr(pydoc_mod, "__loader__"):
     del pydoc_mod.__loader__
 
-expected_text_pattern = \
-"""
+expected_text_pattern = """
 NAME
     test.pydoc_mod - This is a test module for test_pydoc
 
@@ -87,8 +86,7 @@
     Nobody
 """.strip()
 
-expected_html_pattern = \
-"""
+expected_html_pattern = """
 <table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
 <tr bgcolor="#7799ee">
 <td valign=bottom>&nbsp;<br>
@@ -186,7 +184,7 @@
 \x20\x20\x20\x20
 <tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
 <td width="100%%">Nobody</td></tr></table>
-""".strip()
+""".strip() # ' <- emacs turd
 
 
 # output pattern for missing module
@@ -287,7 +285,8 @@
             ('i_am_not_here', 'i_am_not_here'),
             ('test.i_am_not_here_either', 'i_am_not_here_either'),
             ('test.i_am_not_here.neither_am_i', 'i_am_not_here.neither_am_i'),
-            ('i_am_not_here.{}'.format(modname), 'i_am_not_here.{}'.format(modname)),
+            ('i_am_not_here.{}'.format(modname),
+             'i_am_not_here.{}'.format(modname)),
             ('test.{}'.format(modname), modname),
             )
 
@@ -304,9 +303,8 @@
             fullmodname = os.path.join(TESTFN, modname)
             sourcefn = fullmodname + os.extsep + "py"
             for importstring, expectedinmsg in testpairs:
-                f = open(sourcefn, 'w')
-                f.write("import {}\n".format(importstring))
-                f.close()
+                with open(sourcefn, 'w') as f:
+                    f.write("import {}\n".format(importstring))
                 try:
                     result = run_pydoc(modname).decode("ascii")
                 finally:

Modified: python/branches/py3k-cdecimal/Lib/test/test_runpy.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_runpy.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_runpy.py	Wed Apr 21 13:06:18 2010
@@ -5,9 +5,10 @@
 import sys
 import re
 import tempfile
-from test.support import verbose, run_unittest, forget
-from test.script_helper import (temp_dir, make_script, compile_script,
-                                make_pkg, make_zip_script, make_zip_pkg)
+import py_compile
+from test.support import forget, make_legacy_pyc, run_unittest, verbose
+from test.script_helper import (
+    make_pkg, make_script, make_zip_pkg, make_zip_script, temp_dir)
 
 
 from runpy import _run_code, _run_module_code, run_module, run_path
@@ -45,6 +46,7 @@
         self.assertEqual(d["result"], self.expected_result)
         self.assertIs(d["__name__"], None)
         self.assertIs(d["__file__"], None)
+        self.assertIs(d["__cached__"], None)
         self.assertIs(d["__loader__"], None)
         self.assertIs(d["__package__"], None)
         self.assertIs(d["run_argv0"], saved_argv0)
@@ -73,6 +75,7 @@
         self.assertTrue(d2["run_name_in_sys_modules"])
         self.assertTrue(d2["module_in_sys_modules"])
         self.assertIs(d2["__file__"], file)
+        self.assertIs(d2["__cached__"], None)
         self.assertIs(d2["run_argv0"], file)
         self.assertIs(d2["__loader__"], loader)
         self.assertIs(d2["__package__"], package)
@@ -170,6 +173,7 @@
             del d1 # Ensure __loader__ entry doesn't keep file open
             __import__(mod_name)
             os.remove(mod_fname)
+            make_legacy_pyc(mod_fname)
             if verbose: print("Running from compiled:", mod_name)
             d2 = run_module(mod_name) # Read from bytecode
             self.assertIn("x", d2)
@@ -192,6 +196,7 @@
             del d1 # Ensure __loader__ entry doesn't keep file open
             __import__(mod_name)
             os.remove(mod_fname)
+            make_legacy_pyc(mod_fname)
             if verbose: print("Running from compiled:", pkg_name)
             d2 = run_module(pkg_name) # Read from bytecode
             self.assertIn("x", d2)
@@ -246,6 +251,7 @@
             del d1 # Ensure __loader__ entry doesn't keep file open
             __import__(mod_name)
             os.remove(mod_fname)
+            make_legacy_pyc(mod_fname)
             if verbose: print("Running from compiled:", mod_name)
             d2 = run_module(mod_name, run_name=run_name) # Read from bytecode
             self.assertIn("__package__", d2)
@@ -313,6 +319,7 @@
         result = run_path(script_name)
         self.assertEqual(result["__name__"], expected_name)
         self.assertEqual(result["__file__"], expected_file)
+        self.assertEqual(result["__cached__"], None)
         self.assertIn("argv0", result)
         self.assertEqual(result["argv0"], expected_argv0)
         self.assertEqual(result["__package__"], expected_package)
@@ -332,7 +339,7 @@
         with temp_dir() as script_dir:
             mod_name = 'script'
             script_name = self._make_test_script(script_dir, mod_name)
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
             self._check_script(compiled_name, "<run_path>", compiled_name,
                                compiled_name, None)
@@ -348,9 +355,10 @@
         with temp_dir() as script_dir:
             mod_name = '__main__'
             script_name = self._make_test_script(script_dir, mod_name)
-            compiled_name = compile_script(script_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
             os.remove(script_name)
-            self._check_script(script_dir, "<run_path>", compiled_name,
+            legacy_pyc = make_legacy_pyc(script_name)
+            self._check_script(script_dir, "<run_path>", legacy_pyc,
                                script_dir, '')
 
     def test_directory_error(self):
@@ -371,8 +379,9 @@
         with temp_dir() as script_dir:
             mod_name = '__main__'
             script_name = self._make_test_script(script_dir, mod_name)
-            compiled_name = compile_script(script_name)
-            zip_name, fname = make_zip_script(script_dir, 'test_zip', compiled_name)
+            compiled_name = py_compile.compile(script_name, doraise=True)
+            zip_name, fname = make_zip_script(script_dir, 'test_zip',
+                                              compiled_name)
             self._check_script(zip_name, "<run_path>", fname, zip_name, '')
 
     def test_zipfile_error(self):

Modified: python/branches/py3k-cdecimal/Lib/test/test_set.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_set.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_set.py	Wed Apr 21 13:06:18 2010
@@ -48,6 +48,7 @@
 
     def test_new_or_init(self):
         self.assertRaises(TypeError, self.thetype, [], 2)
+        self.assertRaises(TypeError, set().__init__, a=1)
 
     def test_uniquification(self):
         actual = sorted(self.s)

Modified: python/branches/py3k-cdecimal/Lib/test/test_shutil.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_shutil.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_shutil.py	Wed Apr 21 13:06:18 2010
@@ -13,7 +13,7 @@
 from distutils.spawn import find_executable, spawn
 from shutil import (_make_tarball, _make_zipfile, make_archive,
                     register_archive_format, unregister_archive_format,
-                    get_archive_formats)
+                    get_archive_formats, Error)
 import tarfile
 import warnings
 
@@ -74,6 +74,7 @@
         d = tempfile.mkdtemp()
         self.tempdirs.append(d)
         return d
+
     def test_rmtree_errors(self):
         # filename is guaranteed not to exist
         filename = tempfile.mktemp()
@@ -140,11 +141,12 @@
         self.assertRaises(OSError, shutil.rmtree, path)
         os.remove(path)
 
+    def _write_data(self, path, data):
+        f = open(path, "w")
+        f.write(data)
+        f.close()
+
     def test_copytree_simple(self):
-        def write_data(path, data):
-            f = open(path, "w")
-            f.write(data)
-            f.close()
 
         def read_data(path):
             f = open(path)
@@ -154,11 +156,9 @@
 
         src_dir = tempfile.mkdtemp()
         dst_dir = os.path.join(tempfile.mkdtemp(), 'destination')
-
-        write_data(os.path.join(src_dir, 'test.txt'), '123')
-
+        self._write_data(os.path.join(src_dir, 'test.txt'), '123')
         os.mkdir(os.path.join(src_dir, 'test_dir'))
-        write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
+        self._write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
 
         try:
             shutil.copytree(src_dir, dst_dir)
@@ -187,11 +187,6 @@
 
     def test_copytree_with_exclude(self):
 
-        def write_data(path, data):
-            f = open(path, "w")
-            f.write(data)
-            f.close()
-
         def read_data(path):
             f = open(path)
             data = f.read()
@@ -204,16 +199,18 @@
         src_dir = tempfile.mkdtemp()
         try:
             dst_dir = join(tempfile.mkdtemp(), 'destination')
-            write_data(join(src_dir, 'test.txt'), '123')
-            write_data(join(src_dir, 'test.tmp'), '123')
+            self._write_data(join(src_dir, 'test.txt'), '123')
+            self._write_data(join(src_dir, 'test.tmp'), '123')
             os.mkdir(join(src_dir, 'test_dir'))
-            write_data(join(src_dir, 'test_dir', 'test.txt'), '456')
+            self._write_data(join(src_dir, 'test_dir', 'test.txt'), '456')
             os.mkdir(join(src_dir, 'test_dir2'))
-            write_data(join(src_dir, 'test_dir2', 'test.txt'), '456')
+            self._write_data(join(src_dir, 'test_dir2', 'test.txt'), '456')
             os.mkdir(join(src_dir, 'test_dir2', 'subdir'))
             os.mkdir(join(src_dir, 'test_dir2', 'subdir2'))
-            write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456')
-            write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456')
+            self._write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'),
+                             '456')
+            self._write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'),
+                             '456')
 
 
             # testing glob-like patterns
@@ -339,6 +336,41 @@
                 shutil.rmtree(TESTFN, ignore_errors=True)
                 shutil.rmtree(TESTFN2, ignore_errors=True)
 
+    def test_copytree_special_func(self):
+
+        src_dir = self.mkdtemp()
+        dst_dir = os.path.join(self.mkdtemp(), 'destination')
+        self._write_data(os.path.join(src_dir, 'test.txt'), '123')
+        os.mkdir(os.path.join(src_dir, 'test_dir'))
+        self._write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
+
+        copied = []
+        def _copy(src, dst):
+            copied.append((src, dst))
+
+        shutil.copytree(src_dir, dst_dir, copy_function=_copy)
+        self.assertEquals(len(copied), 2)
+
+    def test_copytree_dangling_symlinks(self):
+
+        # a dangling symlink raises an error at the end
+        src_dir = self.mkdtemp()
+        dst_dir = os.path.join(self.mkdtemp(), 'destination')
+        os.symlink('IDONTEXIST', os.path.join(src_dir, 'test.txt'))
+        os.mkdir(os.path.join(src_dir, 'test_dir'))
+        self._write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
+        self.assertRaises(Error, shutil.copytree, src_dir, dst_dir)
+
+        # a dangling symlink is ignored with the proper flag
+        dst_dir = os.path.join(self.mkdtemp(), 'destination2')
+        shutil.copytree(src_dir, dst_dir, ignore_dangling_symlinks=True)
+        self.assertNotIn('test.txt', os.listdir(dst_dir))
+
+        # a dangling symlink is copied if symlinks=True
+        dst_dir = os.path.join(self.mkdtemp(), 'destination3')
+        shutil.copytree(src_dir, dst_dir, symlinks=True)
+        self.assertIn('test.txt', os.listdir(dst_dir))
+
     @unittest.skipUnless(zlib, "requires zlib")
     def test_make_tarball(self):
         # creating something to tar
@@ -455,36 +487,6 @@
         tarball = base_name + '.tar'
         self.assertTrue(os.path.exists(tarball))
 
-    @unittest.skipUnless(find_executable('compress'),
-                         'The compress program is required')
-    def test_compress_deprecated(self):
-        tmpdir, tmpdir2, base_name =  self._create_files()
-
-        # using compress and testing the PendingDeprecationWarning
-        old_dir = os.getcwd()
-        os.chdir(tmpdir)
-        try:
-            with captured_stdout() as s, check_warnings(quiet=False) as w:
-                _make_tarball(base_name, 'dist', compress='compress')
-        finally:
-            os.chdir(old_dir)
-        tarball = base_name + '.tar.Z'
-        self.assertTrue(os.path.exists(tarball))
-        self.assertEqual(len(w.warnings), 1)
-
-        # same test with dry_run
-        os.remove(tarball)
-        old_dir = os.getcwd()
-        os.chdir(tmpdir)
-        try:
-            with captured_stdout() as s, check_warnings(quiet=False) as w:
-                _make_tarball(base_name, 'dist', compress='compress',
-                              dry_run=True)
-        finally:
-            os.chdir(old_dir)
-        self.assertFalse(os.path.exists(tarball))
-        self.assertEqual(len(w.warnings), 1)
-
     @unittest.skipUnless(zlib, "Requires zlib")
     @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run')
     def test_make_zipfile(self):
@@ -728,6 +730,7 @@
         finally:
             shutil.rmtree(TESTFN, ignore_errors=True)
 
+
 def test_main():
     support.run_unittest(TestShutil, TestMove)
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_signal.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_signal.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_signal.py	Wed Apr 21 13:06:18 2010
@@ -139,6 +139,10 @@
             self.fail("pause returned of its own accord, and the signal"
                       " didn't arrive after another second.")
 
+    # Issue 3864, unknown if this affects earlier versions of freebsd also
+    @unittest.skipIf(sys.platform=='freebsd6',
+        'inter process signals not reliable (do not mix well with threading) '
+        'on freebsd6')
     def test_main(self):
         # This function spawns a child process to insulate the main
         # test-running process from all the signals. It then
@@ -355,40 +359,48 @@
 
         self.assertEqual(self.hndl_called, True)
 
+    # Issue 3864, unknown if this affects earlier versions of freebsd also
+    @unittest.skipIf(sys.platform=='freebsd6',
+        'itimer not reliable (does not mix well with threading) on freebsd6')
     def test_itimer_virtual(self):
         self.itimer = signal.ITIMER_VIRTUAL
         signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
         signal.setitimer(self.itimer, 0.3, 0.2)
 
         start_time = time.time()
-        while time.time() - start_time < 5.0:
+        while time.time() - start_time < 60.0:
             # use up some virtual time by doing real work
             _ = pow(12345, 67890, 10000019)
             if signal.getitimer(self.itimer) == (0.0, 0.0):
                 break # sig_vtalrm handler stopped this itimer
-        else:
-            self.fail('timeout waiting for sig_vtalrm signal; '
-                      'signal.getitimer(self.itimer) gives: %s' %
-                       (signal.getitimer(self.itimer),))
+        else: # Issue 8424
+            sys.stdout.write("test_itimer_virtual: timeout: likely cause: "
+                             "machine too slow or load too high.\n")
+            return
 
         # virtual itimer should be (0.0, 0.0) now
         self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))
         # and the handler should have been called
         self.assertEquals(self.hndl_called, True)
 
+    # Issue 3864, unknown if this affects earlier versions of freebsd also
+    @unittest.skipIf(sys.platform=='freebsd6',
+        'itimer not reliable (does not mix well with threading) on freebsd6')
     def test_itimer_prof(self):
         self.itimer = signal.ITIMER_PROF
         signal.signal(signal.SIGPROF, self.sig_prof)
         signal.setitimer(self.itimer, 0.2, 0.2)
 
         start_time = time.time()
-        while time.time() - start_time < 5.0:
+        while time.time() - start_time < 60.0:
             # do some work
             _ = pow(12345, 67890, 10000019)
             if signal.getitimer(self.itimer) == (0.0, 0.0):
                 break # sig_prof handler stopped this itimer
-        else:
-            self.fail('timeout waiting for sig_prof signal')
+        else: # Issue 8424
+            sys.stdout.write("test_itimer_prof: timeout: likely cause: "
+                             "machine too slow or load too high.\n")
+            return
 
         # profiling itimer should be (0.0, 0.0) now
         self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))

Modified: python/branches/py3k-cdecimal/Lib/test/test_site.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_site.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_site.py	Wed Apr 21 13:06:18 2010
@@ -258,19 +258,43 @@
         """Restore sys.path"""
         sys.path[:] = self.sys_path
 
-    def test_abs__file__(self):
-        # Make sure all imported modules have their __file__ attribute
-        # as an absolute path.
-        # Handled by abs__file__()
-        site.abs__file__()
-        for module in (sys, os, builtins):
-            try:
-                self.assertTrue(os.path.isabs(module.__file__), repr(module))
-            except AttributeError:
-                continue
-        # We could try everything in sys.modules; however, when regrtest.py
-        # runs something like test_frozen before test_site, then we will
-        # be testing things loaded *after* test_site did path normalization
+    def test_abs_paths(self):
+        # Make sure all imported modules have their __file__ and __cached__
+        # attributes as absolute paths.  Arranging to put the Lib directory on
+        # PYTHONPATH would cause the os module to have a relative path for
+        # __file__ if abs_paths() does not get run.  sys and builtins (the
+        # only other modules imported before site.py runs) do not have
+        # __file__ or __cached__ because they are built-in.
+        parent = os.path.relpath(os.path.dirname(os.__file__))
+        env = os.environ.copy()
+        env['PYTHONPATH'] = parent
+        code = ('import os, sys',
+            # use ASCII to avoid locale issues with non-ASCII directories
+            'os_file = os.__file__.encode("ascii", "backslashreplace")',
+            r'sys.stdout.buffer.write(os_file + b"\n")',
+            'os_cached = os.__cached__.encode("ascii", "backslashreplace")',
+            r'sys.stdout.buffer.write(os_cached + b"\n")')
+        command = '\n'.join(code)
+        # First, prove that with -S (no 'import site'), the paths are
+        # relative.
+        proc = subprocess.Popen([sys.executable, '-S', '-c', command],
+                                env=env,
+                                stdout=subprocess.PIPE)
+        stdout, stderr = proc.communicate()
+
+        self.assertEqual(proc.returncode, 0)
+        os__file__, os__cached__ = stdout.splitlines()[:2]
+        self.assertFalse(os.path.isabs(os__file__))
+        self.assertFalse(os.path.isabs(os__cached__))
+        # Now, with 'import site', it works.
+        proc = subprocess.Popen([sys.executable, '-c', command],
+                                env=env,
+                                stdout=subprocess.PIPE)
+        stdout, stderr = proc.communicate()
+        self.assertEqual(proc.returncode, 0)
+        os__file__, os__cached__ = stdout.splitlines()[:2]
+        self.assertTrue(os.path.isabs(os__file__))
+        self.assertTrue(os.path.isabs(os__cached__))
 
     def test_no_duplicate_paths(self):
         # No duplicate paths should exist in sys.path

Modified: python/branches/py3k-cdecimal/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_ssl.py	Wed Apr 21 13:06:18 2010
@@ -121,6 +121,23 @@
         self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
                         (s, t))
 
+    def test_ciphers(self):
+        if not support.is_resource_enabled('network'):
+            return
+        remote = ("svn.python.org", 443)
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="ALL")
+        s.connect(remote)
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT")
+        s.connect(remote)
+        # Error checking occurs when connecting, because the SSL context
+        # isn't created before.
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx")
+        with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
+            s.connect(remote)
+
 
 class NetworkedTests(unittest.TestCase):
 
@@ -234,7 +251,8 @@
                                                    certfile=self.server.certificate,
                                                    ssl_version=self.server.protocol,
                                                    ca_certs=self.server.cacerts,
-                                                   cert_reqs=self.server.certreqs)
+                                                   cert_reqs=self.server.certreqs,
+                                                   ciphers=self.server.ciphers)
                 except:
                     if self.server.chatty:
                         handle_error("\n server:  bad connection attempt from " + repr(self.addr) + ":\n")
@@ -333,7 +351,8 @@
 
         def __init__(self, certificate, ssl_version=None,
                      certreqs=None, cacerts=None, expect_bad_connects=False,
-                     chatty=True, connectionchatty=False, starttls_server=False):
+                     chatty=True, connectionchatty=False, starttls_server=False,
+                     ciphers=None):
             if ssl_version is None:
                 ssl_version = ssl.PROTOCOL_TLSv1
             if certreqs is None:
@@ -342,6 +361,7 @@
             self.protocol = ssl_version
             self.certreqs = certreqs
             self.cacerts = cacerts
+            self.ciphers = ciphers
             self.expect_bad_connects = expect_bad_connects
             self.chatty = chatty
             self.connectionchatty = connectionchatty
@@ -648,12 +668,13 @@
     def serverParamsTest (certfile, protocol, certreqs, cacertsfile,
                           client_certfile, client_protocol=None,
                           indata="FOO\n",
-                          chatty=False, connectionchatty=False):
+                          ciphers=None, chatty=False, connectionchatty=False):
 
         server = ThreadedEchoServer(certfile,
                                     certreqs=certreqs,
                                     ssl_version=protocol,
                                     cacerts=cacertsfile,
+                                    ciphers=ciphers,
                                     chatty=chatty,
                                     connectionchatty=False)
         flag = threading.Event()
@@ -669,6 +690,7 @@
                                 certfile=client_certfile,
                                 ca_certs=cacertsfile,
                                 cert_reqs=certreqs,
+                                ciphers=ciphers,
                                 ssl_version=client_protocol)
             s.connect((HOST, server.port))
         except ssl.SSLError as x:
@@ -723,8 +745,12 @@
                               ssl.get_protocol_name(server_protocol),
                               certtype))
         try:
+            # NOTE: we must enable "ALL" ciphers, otherwise an SSLv23 client
+            # will send an SSLv3 hello (rather than SSLv2) starting from
+            # OpenSSL 1.0.0 (see issue #8322).
             serverParamsTest(CERTFILE, server_protocol, certsreqs,
                              CERTFILE, CERTFILE, client_protocol,
+                             ciphers="ALL",
                              chatty=False, connectionchatty=False)
         except support.TestFailed:
             if expectedToWork:

Modified: python/branches/py3k-cdecimal/Lib/test/test_urllib2net.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_urllib2net.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_urllib2net.py	Wed Apr 21 13:06:18 2010
@@ -8,6 +8,9 @@
 import socket
 import urllib.error
 import urllib.request
+import sys
+
+TIMEOUT = 60  # seconds
 
 
 def _retry_thrice(func, exc, *args, **kwargs):
@@ -162,20 +165,29 @@
                 req = expected_err = None
             debug(url)
             try:
-                f = urlopen(url, req)
+                f = urlopen(url, req, TIMEOUT)
             except EnvironmentError as err:
                 debug(err)
                 if expected_err:
                     msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" %
                            (expected_err, url, req, type(err), err))
                     self.assertIsInstance(err, expected_err, msg)
+            except urllib.error.URLError as err:
+                if isinstance(err[0], socket.timeout):
+                    print("<timeout: %s>" % url, file=sys.stderr)
+                    continue
+                else:
+                    raise
             else:
-                with support.time_out, \
-                     support.socket_peer_reset, \
-                     support.ioerror_peer_reset:
-                    buf = f.read()
+                try:
+                    with support.time_out, \
+                         support.socket_peer_reset, \
+                         support.ioerror_peer_reset:
+                        buf = f.read()
+                        debug("read %d bytes" % len(buf))
+                except socket.timeout:
+                    print("<timeout: %s>" % url, file=sys.stderr)
                 f.close()
-                debug("read %d bytes" % len(buf))
             debug("******** next url coming up...")
             time.sleep(0.1)
 
@@ -217,7 +229,7 @@
         u = _urlopen_with_retry("http://www.python.org", timeout=120)
         self.assertEqual(u.fp.raw._sock.gettimeout(), 120)
 
-    FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/"
+    FTP_HOST = "ftp://ftp.mirror.nl/pub/gnu/"
 
     def test_ftp_basic(self):
         self.assertTrue(socket.getdefaulttimeout() is None)

Modified: python/branches/py3k-cdecimal/Lib/test/test_urlparse.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_urlparse.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_urlparse.py	Wed Apr 21 13:06:18 2010
@@ -142,7 +142,7 @@
                          (base, relurl, expected))
 
     def test_unparse_parse(self):
-        for u in ['Python', './Python', 'x-newscheme://foo.com/stuff']:
+        for u in ['Python', './Python','x-newscheme://foo.com/stuff','x://y','x:/y','x:/','/',]:
             self.assertEqual(urllib.parse.urlunsplit(urllib.parse.urlsplit(u)), u)
             self.assertEqual(urllib.parse.urlunparse(urllib.parse.urlparse(u)), u)
 
@@ -239,10 +239,45 @@
         #self.checkJoin(RFC2396_BASE, '?y', 'http://a/b/c/?y')
         #self.checkJoin(RFC2396_BASE, ';x', 'http://a/b/c/;x')
 
+
     def test_RFC3986(self):
         self.checkJoin(RFC3986_BASE, '?y','http://a/b/c/d;p?y')
         self.checkJoin(RFC2396_BASE, ';x', 'http://a/b/c/;x')
 
+    def test_RFC2732(self):
+        for url, hostname, port in [
+            ('http://Test.python.org:5432/foo/', 'test.python.org', 5432),
+            ('http://12.34.56.78:5432/foo/', '12.34.56.78', 5432),
+            ('http://[::1]:5432/foo/', '::1', 5432),
+            ('http://[dead:beef::1]:5432/foo/', 'dead:beef::1', 5432),
+            ('http://[dead:beef::]:5432/foo/', 'dead:beef::', 5432),
+            ('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:5432/foo/',
+             'dead:beef:cafe:5417:affe:8fa3:deaf:feed', 5432),
+            ('http://[::12.34.56.78]:5432/foo/', '::12.34.56.78', 5432),
+            ('http://[::ffff:12.34.56.78]:5432/foo/',
+             '::ffff:12.34.56.78', 5432),
+            ('http://Test.python.org/foo/', 'test.python.org', None),
+            ('http://12.34.56.78/foo/', '12.34.56.78', None),
+            ('http://[::1]/foo/', '::1', None),
+            ('http://[dead:beef::1]/foo/', 'dead:beef::1', None),
+            ('http://[dead:beef::]/foo/', 'dead:beef::', None),
+            ('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/',
+             'dead:beef:cafe:5417:affe:8fa3:deaf:feed', None),
+            ('http://[::12.34.56.78]/foo/', '::12.34.56.78', None),
+            ('http://[::ffff:12.34.56.78]/foo/',
+             '::ffff:12.34.56.78', None),
+            ]:
+            urlparsed = urllib.parse.urlparse(url)
+            self.assertEqual((urlparsed.hostname, urlparsed.port) , (hostname, port))
+
+        for invalid_url in [
+                'http://::12.34.56.78]/',
+                'http://[::1/foo/',
+                'http://[::1/foo/bad]/bad',
+                'http://[::ffff:12.34.56.78']:
+            self.assertRaises(ValueError, lambda : urllib.parse.urlparse(invalid_url).hostname)
+            self.assertRaises(ValueError, lambda : urllib.parse.urlparse(invalid_url))
+
     def test_urldefrag(self):
         for url, defrag, frag in [
             ('http://python.org#frag', 'http://python.org', 'frag'),

Modified: python/branches/py3k-cdecimal/Lib/test/test_uuid.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_uuid.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_uuid.py	Wed Apr 21 13:06:18 2010
@@ -292,14 +292,8 @@
         badtype(lambda: setattr(u, 'node', 0))
 
     def check_node(self, node, source):
-        individual_group_bit = (node >> 40) & 1
-        universal_local_bit = (node >> 40) & 2
-        message = "%012x doesn't look like a real MAC address" % node
-        self.assertEqual(individual_group_bit, 0, message)
-        self.assertEqual(universal_local_bit, 0, message)
-        self.assertNotEqual(node, 0, message)
-        self.assertNotEqual(node, 0xffffffffffff, message)
-        self.assertTrue(0 <= node, message)
+        message = "%012x is not an RFC 4122 node ID" % node
+        self.assertTrue(0 < node, message)
         self.assertTrue(node < (1 << 48), message)
 
         TestUUID.source2node[source] = node
@@ -318,10 +312,6 @@
 
     def test_ifconfig_getnode(self):
         import sys
-        print("""    WARNING: uuid._ifconfig_getnode is unreliable on many platforms.
-        It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
-        return
-
         import os
         if os.name == 'posix':
             node = uuid._ifconfig_getnode()
@@ -341,18 +331,18 @@
 
     def test_random_getnode(self):
         node = uuid._random_getnode()
-        self.assertTrue(0 <= node)
-        self.assertTrue(node < (1 <<48))
+        # Least significant bit of first octet must be set.
+        self.assertTrue(node & 0x010000000000)
+        self.assertTrue(node < (1 << 48))
 
     def test_unixdll_getnode(self):
         import sys
-        print("""    WARNING: uuid._unixdll_getnode is unreliable on many platforms.
-        It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
-        return
-
         import os
         if importable('ctypes') and os.name == 'posix':
-            self.check_node(uuid._unixdll_getnode(), 'unixdll')
+            try: # Issues 1481, 3581: _uuid_generate_time() might be None.
+                self.check_node(uuid._unixdll_getnode(), 'unixdll')
+            except TypeError:
+                pass
 
     def test_windll_getnode(self):
         import os
@@ -361,10 +351,6 @@
 
     def test_getnode(self):
         import sys
-        print("""    WARNING: uuid.getnode is unreliable on many platforms.
-        It is disabled until the code and/or test can be fixed properly.""", file=sys.__stdout__)
-        return
-
         node1 = uuid.getnode()
         self.check_node(node1, "getnode1")
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_warnings.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_warnings.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_warnings.py	Wed Apr 21 13:06:18 2010
@@ -694,7 +694,8 @@
         p = subprocess.Popen([sys.executable,
                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
                 stdout=subprocess.PIPE, env=newenv)
-        self.assertEqual(p.stdout.read(), b"['ignore::DeprecationWarning']")
+        self.assertEqual(p.communicate()[0], b"['ignore::DeprecationWarning']")
+        self.assertEqual(p.wait(), 0)
 
     def test_comma_separated_warnings(self):
         newenv = os.environ.copy()
@@ -703,8 +704,9 @@
         p = subprocess.Popen([sys.executable,
                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
                 stdout=subprocess.PIPE, env=newenv)
-        self.assertEqual(p.stdout.read(),
+        self.assertEqual(p.communicate()[0],
                 b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
+        self.assertEqual(p.wait(), 0)
 
     def test_envvar_and_command_line(self):
         newenv = os.environ.copy()
@@ -712,8 +714,22 @@
         p = subprocess.Popen([sys.executable, "-W" "ignore::UnicodeWarning",
                 "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
                 stdout=subprocess.PIPE, env=newenv)
-        self.assertEqual(p.stdout.read(),
+        self.assertEqual(p.communicate()[0],
                 b"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']")
+        self.assertEqual(p.wait(), 0)
+
+    @unittest.skipUnless(sys.getfilesystemencoding() != 'ascii',
+                         'requires non-ascii filesystemencoding')
+    def test_nonascii(self):
+        newenv = os.environ.copy()
+        newenv["PYTHONWARNINGS"] = "ignore:DeprecaciónWarning"
+        newenv["PYTHONIOENCODING"] = "utf-8"
+        p = subprocess.Popen([sys.executable,
+                "-c", "import sys; sys.stdout.write(str(sys.warnoptions))"],
+                stdout=subprocess.PIPE, env=newenv)
+        self.assertEqual(p.communicate()[0],
+                "['ignore:DeprecaciónWarning']".encode('utf-8'))
+        self.assertEqual(p.wait(), 0)
 
 class CEnvironmentVariableTests(EnvironmentVariableTests):
     module = c_warnings

Modified: python/branches/py3k-cdecimal/Lib/test/test_winsound.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_winsound.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_winsound.py	Wed Apr 21 13:06:18 2010
@@ -8,7 +8,20 @@
 import subprocess
 
 winsound = support.import_module('winsound')
+import winreg
 
+def has_sound(sound):
+    """Find out if a particular event is configured with a default sound"""
+    try:
+        key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER,
+                "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
+        value = winreg.EnumValue(key, 0)[1]
+        if value is not "":
+            return True
+        else:
+            return False
+    except WindowsError:
+        return False
 
 class BeepTest(unittest.TestCase):
     # As with PlaySoundTest, incorporate the _have_soundcard() check
@@ -84,6 +97,8 @@
             "none", winsound.SND_ASYNC | winsound.SND_MEMORY
         )
 
+    @unittest.skipUnless(has_sound("SystemAsterisk"),
+                         "No default SystemAsterisk")
     def test_alias_asterisk(self):
         if _have_soundcard():
             winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS)
@@ -94,6 +109,8 @@
                 'SystemAsterisk', winsound.SND_ALIAS
             )
 
+    @unittest.skipUnless(has_sound("SystemExclamation"),
+                         "No default SystemExclamation")
     def test_alias_exclamation(self):
         if _have_soundcard():
             winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS)
@@ -104,6 +121,7 @@
                 'SystemExclamation', winsound.SND_ALIAS
             )
 
+    @unittest.skipUnless(has_sound("SystemExit"), "No default SystemExit")
     def test_alias_exit(self):
         if _have_soundcard():
             winsound.PlaySound('SystemExit', winsound.SND_ALIAS)
@@ -114,6 +132,7 @@
                 'SystemExit', winsound.SND_ALIAS
             )
 
+    @unittest.skipUnless(has_sound("SystemHand"), "No default SystemHand")
     def test_alias_hand(self):
         if _have_soundcard():
             winsound.PlaySound('SystemHand', winsound.SND_ALIAS)
@@ -124,6 +143,8 @@
                 'SystemHand', winsound.SND_ALIAS
             )
 
+    @unittest.skipUnless(has_sound("SystemQuestion"),
+                         "No default SystemQuestion")
     def test_alias_question(self):
         if _have_soundcard():
             winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS)
@@ -194,11 +215,9 @@
                 pass
             winsound.PlaySound(None, winsound.SND_PURGE)
         else:
-            self.assertRaises(
-                RuntimeError,
-                winsound.PlaySound,
-                None, winsound.SND_PURGE
-            )
+            # Issue 8367: PlaySound(None, winsound.SND_PURGE)
+            # does not raise on systems without a sound card.
+            pass
 
 
 def _get_cscript_path():

Modified: python/branches/py3k-cdecimal/Lib/test/test_zipfile.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_zipfile.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_zipfile.py	Wed Apr 21 13:06:18 2010
@@ -6,6 +6,7 @@
 
 import io
 import os
+import imp
 import time
 import shutil
 import struct
@@ -587,7 +588,13 @@
         with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
             fn = __file__
             if fn.endswith('.pyc') or fn.endswith('.pyo'):
-                fn = fn[:-1]
+                path_split = fn.split(os.sep)
+                if os.altsep is not None:
+                    path_split.extend(fn.split(os.altsep))
+                if '__pycache__' in path_split:
+                    fn = imp.source_from_cache(fn)
+                else:
+                    fn = fn[:-1]
 
             zipfp.writepy(fn)
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_zipimport.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_zipimport.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_zipimport.py	Wed Apr 21 13:06:18 2010
@@ -48,17 +48,14 @@
 test_pyc = make_pyc(test_co, NOW)
 
 
-if __debug__:
-    pyc_ext = ".pyc"
-else:
-    pyc_ext = ".pyo"
-
-
 TESTMOD = "ziptestmodule"
 TESTPACK = "ziptestpackage"
 TESTPACK2 = "ziptestpackage2"
 TEMP_ZIP = os.path.abspath("junk95142.zip")
 
+pyc_file = imp.cache_from_source(TESTMOD + '.py')
+pyc_ext = ('.pyc' if __debug__ else '.pyo')
+
 
 class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
 
@@ -83,14 +80,11 @@
             stuff = kw.get("stuff", None)
             if stuff is not None:
                 # Prepend 'stuff' to the start of the zipfile
-                f = open(TEMP_ZIP, "rb")
-                data = f.read()
-                f.close()
-
-                f = open(TEMP_ZIP, "wb")
-                f.write(stuff)
-                f.write(data)
-                f.close()
+                with open(TEMP_ZIP, "rb") as f:
+                    data = f.read()
+                with open(TEMP_ZIP, "wb") as f:
+                    f.write(stuff)
+                    f.write(data)
 
             sys.path.insert(0, TEMP_ZIP)
 
@@ -180,8 +174,9 @@
 
     def testBadMTime(self):
         badtime_pyc = bytearray(test_pyc)
-        badtime_pyc[7] ^= 0x02  # flip the second bit -- not the first as that one
-                                # isn't stored in the .py's mtime in the zip archive.
+        # flip the second bit -- not the first as that one isn't stored in the
+        # .py's mtime in the zip archive.
+        badtime_pyc[7] ^= 0x02
         files = {TESTMOD + ".py": (NOW, test_src),
                  TESTMOD + pyc_ext: (NOW, badtime_pyc)}
         self.doTest(".py", files, TESTMOD)
@@ -232,7 +227,8 @@
             self.assertEquals(zi.get_source(TESTPACK), None)
             self.assertEquals(zi.get_source(mod_path), None)
             self.assertEquals(zi.get_filename(mod_path), mod.__file__)
-            # To pass in the module name instead of the path, we must use the right importer
+            # To pass in the module name instead of the path, we must use the
+            # right importer
             loader = mod.__loader__
             self.assertEquals(loader.get_source(mod_name), None)
             self.assertEquals(loader.get_filename(mod_name), mod.__file__)
@@ -266,8 +262,10 @@
             mod = zi.load_module(TESTPACK2)
             self.assertEquals(zi.get_filename(TESTPACK2), mod.__file__)
 
-            self.assertEquals(zi.is_package(TESTPACK2 + os.sep + '__init__'), False)
-            self.assertEquals(zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
+            self.assertEquals(
+                zi.is_package(TESTPACK2 + os.sep + '__init__'), False)
+            self.assertEquals(
+                zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
 
             mod_path = TESTPACK2 + os.sep + TESTMOD
             mod_name = module_path_to_dotted_name(mod_path)
@@ -276,7 +274,8 @@
             self.assertEquals(zi.get_source(TESTPACK2), None)
             self.assertEquals(zi.get_source(mod_path), None)
             self.assertEquals(zi.get_filename(mod_path), mod.__file__)
-            # To pass in the module name instead of the path, we must use the right importer
+            # To pass in the module name instead of the path, we must use the
+            # right importer
             loader = mod.__loader__
             self.assertEquals(loader.get_source(mod_name), None)
             self.assertEquals(loader.get_filename(mod_name), mod.__file__)

Modified: python/branches/py3k-cdecimal/Lib/threading.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/threading.py	(original)
+++ python/branches/py3k-cdecimal/Lib/threading.py	Wed Apr 21 13:06:18 2010
@@ -31,6 +31,7 @@
     _CRLock = _thread.RLock
 except AttributeError:
     _CRLock = None
+TIMEOUT_MAX = _thread.TIMEOUT_MAX
 del _thread
 
 
@@ -107,14 +108,14 @@
         return "<%s owner=%r count=%d>" % (
                 self.__class__.__name__, owner, self._count)
 
-    def acquire(self, blocking=True):
+    def acquire(self, blocking=True, timeout=-1):
         me = _get_ident()
         if self._owner == me:
             self._count = self._count + 1
             if __debug__:
                 self._note("%s.acquire(%s): recursive success", self, blocking)
             return 1
-        rc = self._block.acquire(blocking)
+        rc = self._block.acquire(blocking, timeout)
         if rc:
             self._owner = me
             self._count = 1
@@ -234,22 +235,10 @@
                 if __debug__:
                     self._note("%s.wait(): got it", self)
             else:
-                # Balancing act:  We can't afford a pure busy loop, so we
-                # have to sleep; but if we sleep the whole timeout time,
-                # we'll be unresponsive.  The scheme here sleeps very
-                # little at first, longer as time goes on, but never longer
-                # than 20 times per second (or the timeout time remaining).
-                endtime = _time() + timeout
-                delay = 0.0005 # 500 us -> initial delay of 1 ms
-                while True:
-                    gotit = waiter.acquire(0)
-                    if gotit:
-                        break
-                    remaining = endtime - _time()
-                    if remaining <= 0:
-                        break
-                    delay = min(delay * 2, remaining, .05)
-                    _sleep(delay)
+                if timeout > 0:
+                    gotit = waiter.acquire(True, timeout)
+                else:
+                    gotit = waiter.acquire(False)
                 if not gotit:
                     if __debug__:
                         self._note("%s.wait(%s): timed out", self, timeout)
@@ -301,8 +290,11 @@
         self._cond = Condition(Lock())
         self._value = value
 
-    def acquire(self, blocking=True):
+    def acquire(self, blocking=True, timeout=None):
+        if not blocking and timeout is not None:
+            raise ValueError("can't specify timeout for non-blocking acquire")
         rc = False
+        endtime = None
         self._cond.acquire()
         while self._value == 0:
             if not blocking:
@@ -310,7 +302,14 @@
             if __debug__:
                 self._note("%s.acquire(%s): blocked waiting, value=%s",
                            self, blocking, self._value)
-            self._cond.wait()
+            if timeout is not None:
+                if endtime is None:
+                    endtime = _time() + timeout
+                else:
+                    timeout = endtime - _time()
+                    if timeout <= 0:
+                        break
+            self._cond.wait(timeout)
         else:
             self._value = self._value - 1
             if __debug__:

Modified: python/branches/py3k-cdecimal/Lib/tkinter/test/test_ttk/test_widgets.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/tkinter/test/test_ttk/test_widgets.py	(original)
+++ python/branches/py3k-cdecimal/Lib/tkinter/test/test_ttk/test_widgets.py	Wed Apr 21 13:06:18 2010
@@ -704,15 +704,19 @@
         self.nb.select(0)
 
         support.simulate_mouse_click(self.nb, 5, 5)
+        self.nb.focus_force()
         self.nb.event_generate('<Control-Tab>')
         self.assertEqual(self.nb.select(), str(self.child2))
+        self.nb.focus_force()
         self.nb.event_generate('<Shift-Control-Tab>')
         self.assertEqual(self.nb.select(), str(self.child1))
+        self.nb.focus_force()
         self.nb.event_generate('<Shift-Control-Tab>')
         self.assertEqual(self.nb.select(), str(self.child2))
 
         self.nb.tab(self.child1, text='a', underline=0)
         self.nb.enable_traversal()
+        self.nb.focus_force()
         self.nb.event_generate('<Alt-a>')
         self.assertEqual(self.nb.select(), str(self.child1))
 
@@ -1112,9 +1116,9 @@
         self.assertRaises(tkinter.TclError, self.tv.tag_configure,
             'test', sky='blue')
         self.tv.tag_configure('test', foreground='blue')
-        self.assertEqual(self.tv.tag_configure('test', 'foreground'),
+        self.assertEqual(str(self.tv.tag_configure('test', 'foreground')),
             'blue')
-        self.assertEqual(self.tv.tag_configure('test', foreground=None),
+        self.assertEqual(str(self.tv.tag_configure('test', foreground=None)),
             'blue')
         self.assertTrue(isinstance(self.tv.tag_configure('test'), dict))
 

Modified: python/branches/py3k-cdecimal/Lib/unittest/case.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/case.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/case.py	Wed Apr 21 13:06:18 2010
@@ -502,10 +502,12 @@
                                                           safe_repr(second)))
             raise self.failureException(msg)
 
-    def assertAlmostEqual(self, first, second, *, places=7, msg=None):
+    def assertAlmostEqual(self, first, second, *, places=None, msg=None,
+                          delta=None):
         """Fail if the two objects are unequal as determined by their
            difference rounded to the given number of decimal places
-           (default 7) and comparing to zero.
+           (default 7) and comparing to zero, or by comparing that the
+           between the two objects is more than the given delta.
 
            Note that decimal places (from zero) are usually not the same
            as significant digits (measured from the most signficant digit).
@@ -514,31 +516,62 @@
            compare almost equal.
         """
         if first == second:
-            # shortcut for inf
+            # shortcut
             return
-        if round(abs(second-first), places) != 0:
+        if delta is not None and places is not None:
+            raise TypeError("specify delta or places not both")
+
+        if delta is not None:
+            if abs(first - second) <= delta:
+                return
+
+            standardMsg = '%s != %s within %s delta' % (safe_repr(first),
+                                                        safe_repr(second),
+                                                        safe_repr(delta))
+        else:
+            if places is None:
+                places = 7
+
+            if round(abs(second-first), places) == 0:
+                return
+
             standardMsg = '%s != %s within %r places' % (safe_repr(first),
                                                           safe_repr(second),
                                                           places)
-            msg = self._formatMessage(msg, standardMsg)
-            raise self.failureException(msg)
+        msg = self._formatMessage(msg, standardMsg)
+        raise self.failureException(msg)
 
-    def assertNotAlmostEqual(self, first, second, *, places=7, msg=None):
+    def assertNotAlmostEqual(self, first, second, *, places=None, msg=None,
+                             delta=None):
         """Fail if the two objects are equal as determined by their
            difference rounded to the given number of decimal places
-           (default 7) and comparing to zero.
+           (default 7) and comparing to zero, or by comparing that the
+           between the two objects is less than the given delta.
 
            Note that decimal places (from zero) are usually not the same
            as significant digits (measured from the most signficant digit).
 
            Objects that are equal automatically fail.
         """
-        if (first == second) or round(abs(second-first), places) == 0:
+        if delta is not None and places is not None:
+            raise TypeError("specify delta or places not both")
+        if delta is not None:
+            if not (first == second) and abs(first - second) > delta:
+                return
+            standardMsg = '%s == %s within %s delta' % (safe_repr(first),
+                                                        safe_repr(second),
+                                                        safe_repr(delta))
+        else:
+            if places is None:
+                places = 7
+            if not (first == second) and round(abs(second-first), places) != 0:
+                return
             standardMsg = '%s == %s within %r places' % (safe_repr(first),
-                                                          safe_repr(second),
-                                                          places)
-            msg = self._formatMessage(msg, standardMsg)
-            raise self.failureException(msg)
+                                                         safe_repr(second),
+                                                         places)
+
+        msg = self._formatMessage(msg, standardMsg)
+        raise self.failureException(msg)
 
     # Synonyms for assertion methods
 
@@ -967,6 +1000,18 @@
             msg = '%s: %r not found in %r' % (msg, expected_regexp.pattern, text)
             raise self.failureException(msg)
 
+    def assertNotRegexpMatches(self, text, unexpected_regexp, msg=None):
+        if isinstance(unexpected_regexp, (str, bytes)):
+            unexpected_regexp = re.compile(unexpected_regexp)
+        match = unexpected_regexp.search(text)
+        if match:
+            msg = msg or "Regexp matched"
+            msg = '%s: %r matches %r in %r' % (msg,
+                                               text[match.start():match.end()],
+                                               unexpected_regexp.pattern,
+                                               text)
+            raise self.failureException(msg)
+
 
 class FunctionTestCase(TestCase):
     """A test case that wraps a test function.

Modified: python/branches/py3k-cdecimal/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/loader.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/loader.py	Wed Apr 21 13:06:18 2010
@@ -166,27 +166,58 @@
         packages can continue discovery themselves. top_level_dir is stored so
         load_tests does not need to pass this argument in to loader.discover().
         """
+        set_implicit_top = False
         if top_level_dir is None and self._top_level_dir is not None:
             # make top_level_dir optional if called from load_tests in a package
             top_level_dir = self._top_level_dir
         elif top_level_dir is None:
+            set_implicit_top = True
             top_level_dir = start_dir
 
-        top_level_dir = os.path.abspath(os.path.normpath(top_level_dir))
-        start_dir = os.path.abspath(os.path.normpath(start_dir))
+        top_level_dir = os.path.abspath(top_level_dir)
 
         if not top_level_dir in sys.path:
             # all test modules must be importable from the top level directory
             sys.path.append(top_level_dir)
         self._top_level_dir = top_level_dir
 
-        if start_dir != top_level_dir and not os.path.isfile(os.path.join(start_dir, '__init__.py')):
-            # what about __init__.pyc or pyo (etc)
+        is_not_importable = False
+        if os.path.isdir(os.path.abspath(start_dir)):
+            start_dir = os.path.abspath(start_dir)
+            if start_dir != top_level_dir:
+                is_not_importable = not os.path.isfile(os.path.join(start_dir, '__init__.py'))
+        else:
+            # support for discovery from dotted module names
+            try:
+                __import__(start_dir)
+            except ImportError:
+                is_not_importable = True
+            else:
+                the_module = sys.modules[start_dir]
+                top_part = start_dir.split('.')[0]
+                start_dir = os.path.abspath(os.path.dirname((the_module.__file__)))
+                if set_implicit_top:
+                    self._top_level_dir = self._get_directory_containing_module(top_part)
+                    sys.path.remove(top_level_dir)
+
+        if is_not_importable:
             raise ImportError('Start directory is not importable: %r' % start_dir)
 
         tests = list(self._find_tests(start_dir, pattern))
         return self.suiteClass(tests)
 
+    def _get_directory_containing_module(self, module_name):
+        module = sys.modules[module_name]
+        full_path = os.path.abspath(module.__file__)
+
+        if os.path.basename(full_path).lower().startswith('__init__.py'):
+            return os.path.dirname(os.path.dirname(full_path))
+        else:
+            # here we have been given a module rather than a package - so
+            # all we can do is search the *same* directory the module is in
+            # should an exception be raised instead
+            return os.path.dirname(full_path)
+
     def _get_name_from_path(self, path):
         path = os.path.splitext(os.path.normpath(path))[0]
 

Modified: python/branches/py3k-cdecimal/Lib/unittest/main.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/main.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/main.py	Wed Apr 21 13:06:18 2010
@@ -9,9 +9,9 @@
 
 __unittest = True
 
-
-FAILFAST = "  -f, --failfast   Stop on first failure\n"
-CATCHBREAK = "  -c, --catch      Catch control-C and display results\n"
+FAILFAST     = "  -f, --failfast   Stop on first failure\n"
+CATCHBREAK   = "  -c, --catch      Catch control-C and display results\n"
+BUFFEROUTPUT = "  -b, --buffer     Buffer stdout and stderr during test runs\n"
 
 USAGE_AS_MAIN = """\
 Usage: %(progName)s [options] [tests]
@@ -20,7 +20,7 @@
   -h, --help       Show this message
   -v, --verbose    Verbose output
   -q, --quiet      Minimal output
-%(failfast)s%(catchbreak)s
+%(failfast)s%(catchbreak)s%(buffer)s
 Examples:
   %(progName)s test_module                       - run tests from test_module
   %(progName)s test_module.TestClass             - run tests from
@@ -34,7 +34,7 @@
 
 Options:
   -v, --verbose    Verbose output
-%(failfast)s%(catchbreak)s  -s directory     Directory to start discovery ('.' default)
+%(failfast)s%(catchbreak)s%(buffer)s  -s directory     Directory to start discovery ('.' default)
   -p pattern       Pattern to match test files ('test*.py' default)
   -t directory     Top level directory of project (default to
                    start directory)
@@ -50,7 +50,7 @@
   -h, --help       Show this message
   -v, --verbose    Verbose output
   -q, --quiet      Minimal output
-%(failfast)s%(catchbreak)s
+%(failfast)s%(catchbreak)s%(buffer)s
 Examples:
   %(progName)s                               - run default set of tests
   %(progName)s MyTestSuite                   - run suite 'MyTestSuite'
@@ -68,12 +68,12 @@
     USAGE = USAGE_FROM_MODULE
 
     # defaults for testing
-    failfast = catchbreak = None
+    failfast = catchbreak = buffer = None
 
     def __init__(self, module='__main__', defaultTest=None,
                  argv=None, testRunner=None,
                  testLoader=loader.defaultTestLoader, exit=True,
-                 verbosity=1, failfast=None, catchbreak=None):
+                 verbosity=1, failfast=None, catchbreak=None, buffer=None):
         if isinstance(module, str):
             self.module = __import__(module)
             for part in module.split('.')[1:]:
@@ -87,6 +87,7 @@
         self.failfast = failfast
         self.catchbreak = catchbreak
         self.verbosity = verbosity
+        self.buffer = buffer
         self.defaultTest = defaultTest
         self.testRunner = testRunner
         self.testLoader = testLoader
@@ -97,11 +98,14 @@
     def usageExit(self, msg=None):
         if msg:
             print(msg)
-        usage = {'progName': self.progName, 'catchbreak': '', 'failfast': ''}
+        usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '',
+                 'buffer': ''}
         if self.failfast != False:
             usage['failfast'] = FAILFAST
         if self.catchbreak != False:
             usage['catchbreak'] = CATCHBREAK
+        if self.buffer != False:
+            usage['buffer'] = BUFFEROUTPUT
         print(self.USAGE % usage)
         sys.exit(2)
 
@@ -111,9 +115,9 @@
             return
 
         import getopt
-        long_opts = ['help', 'verbose', 'quiet', 'failfast', 'catch']
+        long_opts = ['help', 'verbose', 'quiet', 'failfast', 'catch', 'buffer']
         try:
-            options, args = getopt.getopt(argv[1:], 'hHvqfc', long_opts)
+            options, args = getopt.getopt(argv[1:], 'hHvqfcb', long_opts)
             for opt, value in options:
                 if opt in ('-h','-H','--help'):
                     self.usageExit()
@@ -129,6 +133,10 @@
                     if self.catchbreak is None:
                         self.catchbreak = True
                     # Should this raise an exception if -c is not valid?
+                if opt in ('-b','--buffer'):
+                    if self.buffer is None:
+                        self.buffer = True
+                    # Should this raise an exception if -b is not valid?
             if len(args) == 0 and self.defaultTest is None:
                 # createTests will load tests from self.module
                 self.testNames = None
@@ -164,6 +172,10 @@
             parser.add_option('-c', '--catch', dest='catchbreak', default=False,
                               help='Catch ctrl-C and display results so far',
                               action='store_true')
+        if self.buffer != False:
+            parser.add_option('-b', '--buffer', dest='buffer', default=False,
+                              help='Buffer stdout and stderr during tests',
+                              action='store_true')
         parser.add_option('-s', '--start-directory', dest='start', default='.',
                           help="Directory to start discovery ('.' default)")
         parser.add_option('-p', '--pattern', dest='pattern', default='test*.py',
@@ -184,6 +196,8 @@
             self.failfast = options.failfast
         if self.catchbreak is None:
             self.catchbreak = options.catchbreak
+        if self.buffer is None:
+            self.buffer = options.buffer
 
         if options.verbose:
             self.verbosity = 2
@@ -203,9 +217,10 @@
         if isinstance(self.testRunner, type):
             try:
                 testRunner = self.testRunner(verbosity=self.verbosity,
-                                             failfast=self.failfast)
+                                             failfast=self.failfast,
+                                             buffer=self.buffer)
             except TypeError:
-                # didn't accept the verbosity or failfast arguments
+                # didn't accept the verbosity, buffer or failfast arguments
                 testRunner = self.testRunner()
         else:
             # it is assumed to be a TestRunner instance

Modified: python/branches/py3k-cdecimal/Lib/unittest/result.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/result.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/result.py	Wed Apr 21 13:06:18 2010
@@ -1,5 +1,8 @@
 """Test result object"""
 
+import os
+import io
+import sys
 import traceback
 
 from . import util
@@ -15,6 +18,10 @@
         return method(self, *args, **kw)
     return inner
 
+STDOUT_LINE = '\nStdout:\n%s'
+STDERR_LINE = '\nStderr:\n%s'
+
+
 class TestResult(object):
     """Holder for test result information.
 
@@ -37,6 +44,12 @@
         self.expectedFailures = []
         self.unexpectedSuccesses = []
         self.shouldStop = False
+        self.buffer = False
+        self._stdout_buffer = None
+        self._stderr_buffer = None
+        self._original_stdout = sys.stdout
+        self._original_stderr = sys.stderr
+        self._mirrorOutput = False
 
     def printErrors(self):
         "Called by TestRunner after test run"
@@ -44,6 +57,13 @@
     def startTest(self, test):
         "Called when the given test is about to be run"
         self.testsRun += 1
+        self._mirrorOutput = False
+        if self.buffer:
+            if self._stderr_buffer is None:
+                self._stderr_buffer = io.StringIO()
+                self._stdout_buffer = io.StringIO()
+            sys.stdout = self._stdout_buffer
+            sys.stderr = self._stderr_buffer
 
     def startTestRun(self):
         """Called once before any tests are executed.
@@ -53,6 +73,26 @@
 
     def stopTest(self, test):
         """Called when the given test has been run"""
+        if self.buffer:
+            if self._mirrorOutput:
+                output = sys.stdout.getvalue()
+                error = sys.stderr.getvalue()
+                if output:
+                    if not output.endswith('\n'):
+                        output += '\n'
+                    self._original_stdout.write(STDOUT_LINE % output)
+                if error:
+                    if not error.endswith('\n'):
+                        error += '\n'
+                    self._original_stderr.write(STDERR_LINE % error)
+
+            sys.stdout = self._original_stdout
+            sys.stderr = self._original_stderr
+            self._stdout_buffer.seek(0)
+            self._stdout_buffer.truncate()
+            self._stderr_buffer.seek(0)
+            self._stderr_buffer.truncate()
+        self._mirrorOutput = False
 
     def stopTestRun(self):
         """Called once after all tests are executed.
@@ -66,12 +106,14 @@
         returned by sys.exc_info().
         """
         self.errors.append((test, self._exc_info_to_string(err, test)))
+        self._mirrorOutput = True
 
     @failfast
     def addFailure(self, test, err):
         """Called when an error has occurred. 'err' is a tuple of values as
         returned by sys.exc_info()."""
         self.failures.append((test, self._exc_info_to_string(err, test)))
+        self._mirrorOutput = True
 
     def addSuccess(self, test):
         "Called when a test has completed successfully"
@@ -105,11 +147,29 @@
         # Skip test runner traceback levels
         while tb and self._is_relevant_tb_level(tb):
             tb = tb.tb_next
+
         if exctype is test.failureException:
             # Skip assert*() traceback levels
             length = self._count_relevant_tb_levels(tb)
-            return ''.join(traceback.format_exception(exctype, value, tb, length))
-        return ''.join(traceback.format_exception(exctype, value, tb))
+            msgLines = traceback.format_exception(exctype, value, tb, length)
+        else:
+            chain = exctype is not None
+            msgLines = traceback.format_exception(exctype, value, tb,
+                                                  chain=chain)
+
+        if self.buffer:
+            output = sys.stdout.getvalue()
+            error = sys.stderr.getvalue()
+            if output:
+                if not output.endswith('\n'):
+                    output += '\n'
+                msgLines.append(STDOUT_LINE % output)
+            if error:
+                if not error.endswith('\n'):
+                    error += '\n'
+                msgLines.append(STDERR_LINE % error)
+        return ''.join(msgLines)
+
 
     def _is_relevant_tb_level(self, tb):
         return '__unittest' in tb.tb_frame.f_globals

Modified: python/branches/py3k-cdecimal/Lib/unittest/runner.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/runner.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/runner.py	Wed Apr 21 13:06:18 2010
@@ -125,11 +125,12 @@
     resultclass = TextTestResult
 
     def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1,
-                 failfast=False, resultclass=None):
+                 failfast=False, buffer=False, resultclass=None):
         self.stream = _WritelnDecorator(stream)
         self.descriptions = descriptions
         self.verbosity = verbosity
         self.failfast = failfast
+        self.buffer = buffer
         if resultclass is not None:
             self.resultclass = resultclass
 
@@ -141,6 +142,7 @@
         result = self._makeResult()
         registerResult(result)
         result.failfast = self.failfast
+        result.buffer = self.buffer
         startTime = time.time()
         startTestRun = getattr(result, 'startTestRun', None)
         if startTestRun is not None:

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_assertions.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_assertions.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_assertions.py	Wed Apr 21 13:06:18 2010
@@ -1,3 +1,5 @@
+import datetime
+
 import unittest
 
 
@@ -25,6 +27,28 @@
         self.assertRaises(self.failureException, self.assertNotAlmostEqual,
                           float('inf'), float('inf'))
 
+    def test_AmostEqualWithDelta(self):
+        self.assertAlmostEqual(1.1, 1.0, delta=0.5)
+        self.assertAlmostEqual(1.0, 1.1, delta=0.5)
+        self.assertNotAlmostEqual(1.1, 1.0, delta=0.05)
+        self.assertNotAlmostEqual(1.0, 1.1, delta=0.05)
+
+        self.assertRaises(self.failureException, self.assertAlmostEqual,
+                          1.1, 1.0, delta=0.05)
+        self.assertRaises(self.failureException, self.assertNotAlmostEqual,
+                          1.1, 1.0, delta=0.5)
+
+        self.assertRaises(TypeError, self.assertAlmostEqual,
+                          1.1, 1.0, places=2, delta=2)
+        self.assertRaises(TypeError, self.assertNotAlmostEqual,
+                          1.1, 1.0, places=2, delta=2)
+
+        first = datetime.datetime.now()
+        second = first + datetime.timedelta(seconds=10)
+        self.assertAlmostEqual(first, second,
+                               delta=datetime.timedelta(seconds=20))
+        self.assertNotAlmostEqual(first, second,
+                                  delta=datetime.timedelta(seconds=5))
 
     def test_assertRaises(self):
         def _raise(e):
@@ -68,6 +92,16 @@
         else:
             self.fail("assertRaises() didn't let exception pass through")
 
+    def testAssertNotRegexpMatches(self):
+        self.assertNotRegexpMatches('Ala ma kota', r'r+')
+        try:
+            self.assertNotRegexpMatches('Ala ma kota', r'k.t', 'Message')
+        except self.failureException as e:
+            self.assertIn("'kot'", e.args[0])
+            self.assertIn('Message', e.args[0])
+        else:
+            self.fail('assertNotRegexpMatches should have failed.')
+
 
 class TestLongMessage(unittest.TestCase):
     """Test that the individual asserts honour longMessage.

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_break.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_break.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_break.py	Wed Apr 21 13:06:18 2010
@@ -1,6 +1,7 @@
 import gc
 import io
 import os
+import sys
 import signal
 import weakref
 
@@ -8,6 +9,7 @@
 
 
 @unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
+ at unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
 class TestBreak(unittest.TestCase):
 
     def setUp(self):
@@ -203,8 +205,9 @@
         p = Program(False)
         p.runTests()
 
-        self.assertEqual(FakeRunner.initArgs, [((), {'verbosity': verbosity,
-                                                'failfast': failfast})])
+        self.assertEqual(FakeRunner.initArgs, [((), {'buffer': None,
+                                                     'verbosity': verbosity,
+                                                     'failfast': failfast})])
         self.assertEqual(FakeRunner.runArgs, [test])
         self.assertEqual(p.result, result)
 
@@ -215,8 +218,9 @@
         p = Program(True)
         p.runTests()
 
-        self.assertEqual(FakeRunner.initArgs, [((), {'verbosity': verbosity,
-                                                'failfast': failfast})])
+        self.assertEqual(FakeRunner.initArgs, [((), {'buffer': None,
+                                                     'verbosity': verbosity,
+                                                     'failfast': failfast})])
         self.assertEqual(FakeRunner.runArgs, [test])
         self.assertEqual(p.result, result)
 

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_discovery.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_discovery.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_discovery.py	Wed Apr 21 13:06:18 2010
@@ -128,6 +128,7 @@
         loader = unittest.TestLoader()
 
         original_isfile = os.path.isfile
+        original_isdir = os.path.isdir
         def restore_isfile():
             os.path.isfile = original_isfile
 
@@ -147,6 +148,12 @@
         self.assertIn(full_path, sys.path)
 
         os.path.isfile = lambda path: True
+        os.path.isdir = lambda path: True
+
+        def restore_isdir():
+            os.path.isdir = original_isdir
+        self.addCleanup(restore_isdir)
+
         _find_tests_args = []
         def _find_tests(start_dir, pattern):
             _find_tests_args.append((start_dir, pattern))
@@ -156,8 +163,8 @@
 
         suite = loader.discover('/foo/bar/baz', 'pattern', '/foo/bar')
 
-        top_level_dir = os.path.abspath(os.path.normpath('/foo/bar'))
-        start_dir = os.path.abspath(os.path.normpath('/foo/bar/baz'))
+        top_level_dir = os.path.abspath('/foo/bar')
+        start_dir = os.path.abspath('/foo/bar/baz')
         self.assertEqual(suite, "['tests']")
         self.assertEqual(loader._top_level_dir, top_level_dir)
         self.assertEqual(_find_tests_args, [(start_dir, 'pattern')])

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_loader.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_loader.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_loader.py	Wed Apr 21 13:06:18 2010
@@ -524,12 +524,8 @@
         # We're going to try to load this module as a side-effect, so it
         # better not be loaded before we try.
         #
-        # Why pick audioop? Google shows it isn't used very often, so there's
-        # a good chance that it won't be imported when this test is run
-        module_name = 'audioop'
-
-        if module_name in sys.modules:
-            del sys.modules[module_name]
+        module_name = 'unittest.test.dummy'
+        sys.modules.pop(module_name, None)
 
         loader = unittest.TestLoader()
         try:
@@ -538,7 +534,7 @@
             self.assertIsInstance(suite, loader.suiteClass)
             self.assertEqual(list(suite), [])
 
-            # audioop should now be loaded, thanks to loadTestsFromName()
+            # module should now be loaded, thanks to loadTestsFromName()
             self.assertIn(module_name, sys.modules)
         finally:
             if module_name in sys.modules:
@@ -911,12 +907,8 @@
         # We're going to try to load this module as a side-effect, so it
         # better not be loaded before we try.
         #
-        # Why pick audioop? Google shows it isn't used very often, so there's
-        # a good chance that it won't be imported when this test is run
-        module_name = 'audioop'
-
-        if module_name in sys.modules:
-            del sys.modules[module_name]
+        module_name = 'unittest.test.dummy'
+        sys.modules.pop(module_name, None)
 
         loader = unittest.TestLoader()
         try:
@@ -925,7 +917,7 @@
             self.assertIsInstance(suite, loader.suiteClass)
             self.assertEqual(list(suite), [unittest.TestSuite()])
 
-            # audioop should now be loaded, thanks to loadTestsFromName()
+            # module should now be loaded, thanks to loadTestsFromName()
             self.assertIn(module_name, sys.modules)
         finally:
             if module_name in sys.modules:

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_result.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_result.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_result.py	Wed Apr 21 13:06:18 2010
@@ -1,6 +1,6 @@
 import io
 import sys
-import warnings
+import textwrap
 
 from test import support
 
@@ -25,6 +25,8 @@
         self.assertEqual(len(result.failures), 0)
         self.assertEqual(result.testsRun, 0)
         self.assertEqual(result.shouldStop, False)
+        self.assertIsNone(result._stdout_buffer)
+        self.assertIsNone(result._stderr_buffer)
 
     # "This method can be called to signal that the set of tests being
     # run should be aborted by setting the TestResult's shouldStop
@@ -302,6 +304,8 @@
     self.errors = []
     self.testsRun = 0
     self.shouldStop = False
+    self.buffer = False
+
 classDict['__init__'] = __init__
 OldResult = type('OldResult', (object,), classDict)
 
@@ -355,3 +359,129 @@
         # This will raise an exception if TextTestRunner can't handle old
         # test result objects
         runner.run(Test('testFoo'))
+
+
+class TestOutputBuffering(unittest.TestCase):
+
+    def setUp(self):
+        self._real_out = sys.stdout
+        self._real_err = sys.stderr
+
+    def tearDown(self):
+        sys.stdout = self._real_out
+        sys.stderr = self._real_err
+
+    def testBufferOutputOff(self):
+        real_out = self._real_out
+        real_err = self._real_err
+
+        result = unittest.TestResult()
+        self.assertFalse(result.buffer)
+
+        self.assertIs(real_out, sys.stdout)
+        self.assertIs(real_err, sys.stderr)
+
+        result.startTest(self)
+
+        self.assertIs(real_out, sys.stdout)
+        self.assertIs(real_err, sys.stderr)
+
+    def testBufferOutputStartTestAddSuccess(self):
+        real_out = self._real_out
+        real_err = self._real_err
+
+        result = unittest.TestResult()
+        self.assertFalse(result.buffer)
+
+        result.buffer = True
+
+        self.assertIs(real_out, sys.stdout)
+        self.assertIs(real_err, sys.stderr)
+
+        result.startTest(self)
+
+        self.assertIsNot(real_out, sys.stdout)
+        self.assertIsNot(real_err, sys.stderr)
+        self.assertIsInstance(sys.stdout, io.StringIO)
+        self.assertIsInstance(sys.stderr, io.StringIO)
+        self.assertIsNot(sys.stdout, sys.stderr)
+
+        out_stream = sys.stdout
+        err_stream = sys.stderr
+
+        result._original_stdout = io.StringIO()
+        result._original_stderr = io.StringIO()
+
+        print('foo')
+        print('bar', file=sys.stderr)
+
+        self.assertEqual(out_stream.getvalue(), 'foo\n')
+        self.assertEqual(err_stream.getvalue(), 'bar\n')
+
+        self.assertEqual(result._original_stdout.getvalue(), '')
+        self.assertEqual(result._original_stderr.getvalue(), '')
+
+        result.addSuccess(self)
+        result.stopTest(self)
+
+        self.assertIs(sys.stdout, result._original_stdout)
+        self.assertIs(sys.stderr, result._original_stderr)
+
+        self.assertEqual(result._original_stdout.getvalue(), '')
+        self.assertEqual(result._original_stderr.getvalue(), '')
+
+        self.assertEqual(out_stream.getvalue(), '')
+        self.assertEqual(err_stream.getvalue(), '')
+
+
+    def getStartedResult(self):
+        result = unittest.TestResult()
+        result.buffer = True
+        result.startTest(self)
+        return result
+
+    def testBufferOutputAddErrorOrFailure(self):
+        for message_attr, add_attr, include_error in [
+            ('errors', 'addError', True),
+            ('failures', 'addFailure', False),
+            ('errors', 'addError', True),
+            ('failures', 'addFailure', False)
+        ]:
+            result = self.getStartedResult()
+            buffered_out = sys.stdout
+            buffered_err = sys.stderr
+            result._original_stdout = io.StringIO()
+            result._original_stderr = io.StringIO()
+
+            print('foo', file=sys.stdout)
+            if include_error:
+                print('bar', file=sys.stderr)
+
+
+            addFunction = getattr(result, add_attr)
+            addFunction(self, (None, None, None))
+            result.stopTest(self)
+
+            result_list = getattr(result, message_attr)
+            self.assertEqual(len(result_list), 1)
+
+            test, message = result_list[0]
+            expectedOutMessage = textwrap.dedent("""
+                Stdout:
+                foo
+            """)
+            expectedErrMessage = ''
+            if include_error:
+                expectedErrMessage = textwrap.dedent("""
+                Stderr:
+                bar
+            """)
+            expectedFullMessage = 'NoneType\n%s%s' % (expectedOutMessage, expectedErrMessage)
+
+            self.assertIs(test, self)
+            self.assertEqual(result._original_stdout.getvalue(), expectedOutMessage)
+            self.assertEqual(result._original_stderr.getvalue(), expectedErrMessage)
+            self.assertMultiLineEqual(message, expectedFullMessage)
+
+if __name__ == '__main__':
+    unittest.main()

Modified: python/branches/py3k-cdecimal/Lib/urllib/parse.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/urllib/parse.py	(original)
+++ python/branches/py3k-cdecimal/Lib/urllib/parse.py	Wed Apr 21 13:06:18 2010
@@ -1,7 +1,29 @@
 """Parse (absolute and relative) URLs.
 
-See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
-UC Irvine, June 1995.
+urlparse module is based upon the following RFC specifications.
+
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
+and L.  Masinter, January 2005.
+
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
+and L.Masinter, December 1999.
+
+RFC2396:  "Uniform Resource Identifiers (URI)": Generic Syntax by T.
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.
+
+RFC2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zwinski, July 1998.
+
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
+1995.
+
+RFC1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
+McCahill, December 1994
+
+RFC 3986 is considered the current standard and any changes to urlparse module
+should conform to this.  urlparse module is not entirely compliant with this.
+The defacto scenarios of parsing are considered sometimes and for backward
+compatiblity purposes, older RFC uses of parsing are retained. The testcases in
+test_urlparse.py provides a good indicator of parsing behavior.
 """
 
 import sys
@@ -70,22 +92,24 @@
 
     @property
     def hostname(self):
-        netloc = self.netloc
-        if "@" in netloc:
-            netloc = netloc.rsplit("@", 1)[1]
-        if ":" in netloc:
-            netloc = netloc.split(":", 1)[0]
-        return netloc.lower() or None
+        netloc = self.netloc.split('@')[-1]
+        if '[' in netloc and ']' in netloc:
+            return netloc.split(']')[0][1:].lower()
+        elif ':' in netloc:
+            return netloc.split(':')[0].lower()
+        elif netloc == '':
+            return None
+        else:
+            return netloc.lower()
 
     @property
     def port(self):
-        netloc = self.netloc
-        if "@" in netloc:
-            netloc = netloc.rsplit("@", 1)[1]
-        if ":" in netloc:
-            port = netloc.split(":", 1)[1]
+        netloc = self.netloc.split('@')[-1].split(']')[-1]
+        if ':' in netloc:
+            port = netloc.split(':')[1]
             return int(port, 10)
-        return None
+        else:
+            return None
 
 from collections import namedtuple
 
@@ -157,6 +181,10 @@
             url = url[i+1:]
             if url[:2] == '//':
                 netloc, url = _splitnetloc(url, 2)
+                if '[' in netloc :
+                    if not ']' in netloc: raise ValueError("Invalid IPv6 URL")
+                if ']' in netloc:
+                    if not '[' in netloc: raise ValueError("Invalid IPv6 URL")
             if allow_fragments and '#' in url:
                 url, fragment = url.split('#', 1)
             if '?' in url:
@@ -171,6 +199,10 @@
             scheme, url = url[:i].lower(), url[i+1:]
     if url[:2] == '//':
         netloc, url = _splitnetloc(url, 2)
+        if '[' in netloc:
+            if not ']' in netloc: raise ValueError("Invalid IPv6 URL")
+        if ']' in netloc:
+            if not '[' in netloc: raise ValueError("Invalid IPv6 URL")
     if allow_fragments and scheme in uses_fragment and '#' in url:
         url, fragment = url.split('#', 1)
     if scheme in uses_query and '?' in url:

Modified: python/branches/py3k-cdecimal/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/urllib/request.py	(original)
+++ python/branches/py3k-cdecimal/Lib/urllib/request.py	Wed Apr 21 13:06:18 2010
@@ -2140,44 +2140,82 @@
 
 
 if sys.platform == 'darwin':
-    def getproxies_internetconfig():
-        """Return a dictionary of scheme -> proxy server URL mappings.
+    from _scproxy import _get_proxy_settings, _get_proxies
 
-        By convention the mac uses Internet Config to store
-        proxies.  An HTTP proxy, for instance, is stored under
-        the HttpProxy key.
+    def proxy_bypass_macosx_sysconf(host):
+        """
+        Return True iff this host shouldn't be accessed using a proxy
 
+        This function uses the MacOSX framework SystemConfiguration
+        to fetch the proxy information.
         """
-        try:
-            import ic
-        except ImportError:
-            return {}
+        import re
+        import socket
+        from fnmatch import fnmatch
+
+        hostonly, port = splitport(host)
+
+        def ip2num(ipAddr):
+            parts = ipAddr.split('.')
+            parts = map(int, parts)
+            if len(parts) != 4:
+                parts = (parts + [0, 0, 0, 0])[:4]
+            return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]
+
+        proxy_settings = _get_proxy_settings()
+
+        # Check for simple host names:
+        if '.' not in host:
+            if proxy_settings['exclude_simple']:
+                return True
+
+        hostIP = None
+
+        for value in proxy_settings.get('exceptions', ()):
+            # Items in the list are strings like these: *.local, 169.254/16
+            if not value: continue
+
+            m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value)
+            if m is not None:
+                if hostIP is None:
+                    try:
+                        hostIP = socket.gethostbyname(hostonly)
+                        hostIP = ip2num(hostIP)
+                    except socket.error:
+                        continue
+
+                base = ip2num(m.group(1))
+                mask = int(m.group(2)[1:])
+                mask = 32 - mask
+
+                if (hostIP >> mask) == (base >> mask):
+                    return True
+
+            elif fnmatch(host, value):
+                return True
+
+        return False
+
+
+    def getproxies_macosx_sysconf():
+        """Return a dictionary of scheme -> proxy server URL mappings.
+
+        This function uses the MacOSX framework SystemConfiguration
+        to fetch the proxy information.
+        """
+        return _get_proxies()
+
 
-        try:
-            config = ic.IC()
-        except ic.error:
-            return {}
-        proxies = {}
-        # HTTP:
-        if 'UseHTTPProxy' in config and config['UseHTTPProxy']:
-            try:
-                value = config['HTTPProxyHost']
-            except ic.error:
-                pass
-            else:
-                proxies['http'] = 'http://%s' % value
-        # FTP: XXX To be done.
-        # Gopher: XXX To be done.
-        return proxies
 
     def proxy_bypass(host):
         if getproxies_environment():
             return proxy_bypass_environment(host)
         else:
-            return 0
+            return proxy_bypass_macosx_sysconf(host)
 
     def getproxies():
-        return getproxies_environment() or getproxies_internetconfig()
+        return getproxies_environment() or getproxies_macosx_sysconf()
+
 
 elif os.name == 'nt':
     def getproxies_registry():

Modified: python/branches/py3k-cdecimal/Lib/xmlrpc/server.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/xmlrpc/server.py	(original)
+++ python/branches/py3k-cdecimal/Lib/xmlrpc/server.py	Wed Apr 21 13:06:18 2010
@@ -499,7 +499,9 @@
             if hasattr(self.server, '_send_traceback_header') and \
                     self.server._send_traceback_header:
                 self.send_header("X-exception", str(e))
-                self.send_header("X-traceback", traceback.format_exc())
+                trace = traceback.format_exc()
+                trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII')
+                self.send_header("X-traceback", trace)
 
             self.send_header("Content-length", "0")
             self.end_headers()

Modified: python/branches/py3k-cdecimal/Lib/zipfile.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/zipfile.py	(original)
+++ python/branches/py3k-cdecimal/Lib/zipfile.py	Wed Apr 21 13:06:18 2010
@@ -3,10 +3,17 @@
 
 XXX references to utf-8 need further investigation.
 """
-import struct, os, time, sys, shutil
-import binascii, io, stat
 import io
+import os
 import re
+import imp
+import sys
+import time
+import stat
+import shutil
+import struct
+import binascii
+
 
 try:
     import zlib # We may need its compression method
@@ -1303,22 +1310,42 @@
         file_py  = pathname + ".py"
         file_pyc = pathname + ".pyc"
         file_pyo = pathname + ".pyo"
-        if os.path.isfile(file_pyo) and \
-                            os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime:
-            fname = file_pyo    # Use .pyo file
-        elif not os.path.isfile(file_pyc) or \
-             os.stat(file_pyc).st_mtime < os.stat(file_py).st_mtime:
+        pycache_pyc = imp.cache_from_source(file_py, True)
+        pycache_pyo = imp.cache_from_source(file_py, False)
+        if (os.path.isfile(file_pyo) and
+            os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime):
+            # Use .pyo file.
+            arcname = fname = file_pyo
+        elif (os.path.isfile(file_pyc) and
+              os.stat(file_pyc).st_mtime >= os.stat(file_py).st_mtime):
+            # Use .pyc file.
+            arcname = fname = file_pyc
+        elif (os.path.isfile(pycache_pyc) and
+              os.stat(pycache_pyc).st_mtime >= os.stat(file_py).st_mtime):
+            # Use the __pycache__/*.pyc file, but write it to the legacy pyc
+            # file name in the archive.
+            fname = pycache_pyc
+            arcname = file_pyc
+        elif (os.path.isfile(pycache_pyo) and
+              os.stat(pycache_pyo).st_mtime >= os.stat(file_py).st_mtime):
+            # Use the __pycache__/*.pyo file, but write it to the legacy pyo
+            # file name in the archive.
+            fname = pycache_pyo
+            arcname = file_pyo
+        else:
+            # Compile py into PEP 3147 pyc file.
             import py_compile
             if self.debug:
                 print("Compiling", file_py)
             try:
-                py_compile.compile(file_py, file_pyc, None, True)
-            except py_compile.PyCompileError as err:
+                py_compile.compile(file_py, doraise=True)
+            except py_compile.PyCompileError as error:
                 print(err.msg)
-            fname = file_pyc
-        else:
-            fname = file_pyc
-        archivename = os.path.split(fname)[1]
+                fname = file_py
+            else:
+                fname = (pycache_pyc if __debug__ else pycache_pyo)
+                arcname = (file_pyc if __debug__ else file_pyo)
+        archivename = os.path.split(arcname)[1]
         if basename:
             archivename = "%s/%s" % (basename, archivename)
         return (fname, archivename)

Modified: python/branches/py3k-cdecimal/Mac/BuildScript/build-installer.py
==============================================================================
--- python/branches/py3k-cdecimal/Mac/BuildScript/build-installer.py	(original)
+++ python/branches/py3k-cdecimal/Mac/BuildScript/build-installer.py	Wed Apr 21 13:06:18 2010
@@ -377,6 +377,23 @@
 
     return data
 
+def getTclTkVersion(configfile, versionline):
+    """
+    search Tcl or Tk configuration file for version line
+    """
+    try:
+        f = open(configfile, "r")
+    except:
+        fatal("Framework configuration file not found: %s" % configfile)
+
+    for l in f:
+        if l.startswith(versionline):
+            f.close()
+            return l
+
+    fatal("Version variable %s not found in framework configuration file: %s"
+            % (versionline, configfile))
+
 def checkEnvironment():
     """
     Check that we're running on a supported system.
@@ -392,6 +409,41 @@
         fatal("Please install the latest version of Xcode and the %s SDK"%(
             os.path.basename(SDKPATH[:-4])))
 
+    # Because we only support dynamic load of only one major/minor version of
+    # Tcl/Tk, ensure:
+    # 1. there are no user-installed frameworks of Tcl/Tk with version
+    #       higher than the Apple-supplied system version
+    # 2. there is a user-installed framework in /Library/Frameworks with the
+    #       same version as the system version.  This allows users to choose
+    #       to install a newer patch level.
+
+    for framework in ['Tcl', 'Tk']:
+        fw = dict(lower=framework.lower(),
+                    upper=framework.upper(),
+                    cap=framework.capitalize())
+        fwpth = "Library/Frameworks/%(cap)s.framework/%(lower)sConfig.sh" % fw
+        sysfw = os.path.join('/System', fwpth)
+        libfw = os.path.join('/', fwpth)
+        usrfw = os.path.join(os.getenv('HOME'), fwpth)
+        version = "%(upper)s_VERSION" % fw
+        if getTclTkVersion(libfw, version) != getTclTkVersion(sysfw, version):
+            fatal("Version of %s must match %s" % (libfw, sysfw) )
+        if os.path.exists(usrfw):
+            fatal("Please rename %s to avoid possible dynamic load issues."
+                    % usrfw)
+
+    # Remove inherited environment variables which might influence build
+    environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
+                            'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
+    for ev in list(os.environ):
+        for prefix in environ_var_prefixes:
+            if ev.startswith(prefix) :
+                print "INFO: deleting environment variable %s=%s" % (
+                                                    ev, os.environ[ev])
+                del os.environ[ev]
+
+    os.environ['PATH'] = '/bin:/sbin:/usr/bin:/usr/sbin'
+    print "Setting default PATH: %s"%(os.environ['PATH'])
 
 
 def parseOptions(args=None):
@@ -1084,6 +1136,8 @@
         shutil.rmtree(WORKDIR)
     os.mkdir(WORKDIR)
 
+    os.environ['LC_ALL'] = 'C'
+
     # Then build third-party libraries such as sleepycat DB4.
     buildLibraries()
 

Modified: python/branches/py3k-cdecimal/Mac/BuildScript/scripts/postflight.framework
==============================================================================
--- python/branches/py3k-cdecimal/Mac/BuildScript/scripts/postflight.framework	(original)
+++ python/branches/py3k-cdecimal/Mac/BuildScript/scripts/postflight.framework	Wed Apr 21 13:06:18 2010
@@ -16,16 +16,6 @@
     -x badsyntax -x site-packages \
     "${FWK}/lib/python${PYVER}"
 
-"${FWK}/bin/python at PYVER@" -Wi \
-    "${FWK}/lib/python${PYVER}/compileall.py" \
-    -x badsyntax -x site-packages \
-    "${FWK}/Mac/Tools"
-
-"${FWK}/bin/python at PYVER@" -Wi -O \
-    "${FWK}/lib/python${PYVER}/compileall.py" \
-    -x badsyntax -x site-packages \
-    "${FWK}/Mac/Tools"
-
 chgrp -R admin "${FWK}"
 chmod -R g+w "${FWK}"
 

Modified: python/branches/py3k-cdecimal/Mac/Makefile.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/Makefile.in	(original)
+++ python/branches/py3k-cdecimal/Mac/Makefile.in	Wed Apr 21 13:06:18 2010
@@ -17,6 +17,9 @@
 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
 CC=@CC@
+MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
+export MACOSX_DEPLOYMENT_TARGET
+
 
 
 # These are normally glimpsed from the previous set

Modified: python/branches/py3k-cdecimal/Mac/PythonLauncher/Makefile.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/PythonLauncher/Makefile.in	(original)
+++ python/branches/py3k-cdecimal/Mac/PythonLauncher/Makefile.in	Wed Apr 21 13:06:18 2010
@@ -2,7 +2,7 @@
 LD=@CC@
 BASECFLAGS=@BASECFLAGS@
 OPT=@OPT@
-CFLAGS=$(BASECFLAGS) $(OPT)
+CFLAGS=@CFLAGS@ $(BASECFLAGS) $(OPT)
 LDFLAGS=@LDFLAGS@
 srcdir=         @srcdir@
 VERSION=	@VERSION@

Modified: python/branches/py3k-cdecimal/Mac/Tools/pythonw.c
==============================================================================
--- python/branches/py3k-cdecimal/Mac/Tools/pythonw.c	(original)
+++ python/branches/py3k-cdecimal/Mac/Tools/pythonw.c	Wed Apr 21 13:06:18 2010
@@ -78,7 +78,7 @@
 		end --;
 	}
 	end++;
-	if (end[1] == '.') {
+	if (*end == '.') {
 		end++;
 	}
 	strcpy(end, "Resources/Python.app/Contents/MacOS/" PYTHONFRAMEWORK);
@@ -161,7 +161,7 @@
 		setup_spawnattr(&spawnattr);		
 		posix_spawn(NULL, exec_path, NULL,
 			&spawnattr, argv, environ);
-		err(1, "posix_spawn: %s", argv[0]);
+		err(1, "posix_spawn: %s", exec_path);
 	}
 #endif
 	execve(exec_path, argv, environ);

Modified: python/branches/py3k-cdecimal/Makefile.pre.in
==============================================================================
--- python/branches/py3k-cdecimal/Makefile.pre.in	(original)
+++ python/branches/py3k-cdecimal/Makefile.pre.in	Wed Apr 21 13:06:18 2010
@@ -378,7 +378,7 @@
 
 # Default target
 all:		build_all
-build_all:	$(BUILDPYTHON) oldsharedmods sharedmods
+build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
 
 # Compile a binary with gcc profile guided optimization.
 profile-opt:
@@ -451,6 +451,17 @@
 libpython$(VERSION).sl: $(LIBRARY_OBJS)
 	$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
 
+# Copy up the gdb python hooks into a position where they can be automatically
+# loaded by gdb during Lib/test/test_gdb.py
+#
+# Distributors are likely to want to install this somewhere else e.g. relative
+# to the stripped DWARF data for the shared library.
+gdbhooks: $(BUILDPYTHON)-gdb.py
+
+SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
+$(BUILDPYTHON)-gdb.py: $(SRC_GDB_HOOKS)
+	$(INSTALL_DATA) $(SRC_GDB_HOOKS) $(BUILDPYTHON)-gdb.py
+
 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
 # minimal framework (not including the Lib directory and such) in the current
 # directory.
@@ -718,8 +729,8 @@
 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
 		$(TESTPYTHON) $(srcdir)/Lib/compileall.py
 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
-		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
+		-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
+		$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
 
 #  Run the unitests for both architectures in a Universal build on OSX
 #  Must be run on an Intel box.
@@ -729,9 +740,9 @@
 			exit 1 ;\
 		fi
 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
-		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
-		$(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) $(TESTOPTS) -uall
+		-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
+		$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
+		$(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) -uall $(TESTOPTS)
 
 
 # Like testall, but with a single pass only
@@ -740,7 +751,7 @@
 		- at if which pybuildbot.identify >/dev/null 2>&1; then \
 			pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
 		fi
-		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rwW
+		$(TESTPYTHON) $(TESTPROG) -uall -rwW $(TESTOPTS)
 
 QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
 		test_multibytecodec test_urllib2_localnet test_itertools \
@@ -1151,6 +1162,7 @@
 # files, which clobber removes as well
 pycremoval:
 	find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
+	find $(srcdir) -name '__pycache__' | xargs rmdir
 
 rmtestturds:
 	-rm -f *BAD *GOOD *SKIPPED
@@ -1188,6 +1200,7 @@
 	-rm -f core Makefile Makefile.pre config.status \
 		Modules/Setup Modules/Setup.local Modules/Setup.config \
 		Misc/python.pc
+	-rm -f python*-gdb.py
 	find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
 			   -o -name '[@,#]*' -o -name '*.old' \
 			   -o -name '*.orig' -o -name '*.rej' \
@@ -1251,5 +1264,6 @@
 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
 .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean 
 .PHONY: smelly funny patchcheck
+.PHONY: gdbhooks
 
 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY

Modified: python/branches/py3k-cdecimal/Misc/ACKS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/ACKS	(original)
+++ python/branches/py3k-cdecimal/Misc/ACKS	Wed Apr 21 13:06:18 2010
@@ -162,6 +162,7 @@
 Steve Cousins
 Alex Coventry
 Matthew Dixon Cowles
+Ryan Coyner
 Christopher A. Craig
 Laura Creighton
 Simon Cross
@@ -430,6 +431,7 @@
 Andrew Kuchling
 Vladimir Kushnir
 Cameron Laird
+Torsten Landschoff
 Tino Lange
 Andrew Langmead
 Detlef Lannert
@@ -484,7 +486,7 @@
 Don MacMillen
 Steve Majewski
 Grzegorz Makarewicz
-Dave Malcolm
+David Malcolm
 Ken Manheimer
 Vladimir Marangozov
 David Marek
@@ -670,6 +672,7 @@
 Rich Salz
 Kevin Samborn
 Ilya Sandler
+Mark Sapiro
 Ty Sarna
 Ben Sayer
 Michael Scharf
@@ -755,6 +758,7 @@
 Steven Taschuk
 Monty Taylor
 Amy Taylor
+Anatoly Techtonik
 Tobias Thelen
 James Thomas
 Robin Thomas

Modified: python/branches/py3k-cdecimal/Misc/NEWS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/NEWS	(original)
+++ python/branches/py3k-cdecimal/Misc/NEWS	Wed Apr 21 13:06:18 2010
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #8417: Raise an OverflowError when an integer larger than sys.maxsize is
+  passed to bytes or bytearray.
+
 - Issue #7301: Add environment variable $PYTHONWARNINGS.
 
 - Issue #8329: Don't return the same lists from select.select when no fds are
@@ -258,6 +261,9 @@
 
 - Code objects now support weak references.
 
+- Issue #7072: isspace(0xa0) is true on Mac OS X
+
+
 C-API
 -----
 
@@ -312,6 +318,70 @@
 Library
 -------
 
+- Issues #8279, #8330, #8437: Fix test_gdb failures, patch written by Dave Malcolm
+
+- Issue #6547: Added the ignore_dangling_symlinks option to shutil.copytree.
+
+- Issue #1540112: Now allowing the choice of a copy function in 
+  shutil.copytree.
+
+- Issue #4814: timeout parameter is now applied also for connections resulting
+  from PORT/EPRT commands.
+
+- Issue #8463: added missing reference to bztar in shutil's documentation.
+
+- Issue #7154: urllib.request can now detect the proxy settings on OSX 10.6
+  (as long as the user didn't specify 'automatic proxy configuration').
+
+- Issue #3817: ftplib.FTP.abort() method now considers 225 a valid response
+  code as stated in RFC-959 at chapter 5.4.
+
+- Issue #8394: _ctypes.dlopen() accepts bytes, bytearray and str with
+  surrogates.
+
+- Issue #850728: Add a *timeout* parameter to the `acquire()` method of
+  `threading.Semaphore` objects.  Original patch by Torsten Landschoff.
+
+- Issue #8322: Add a *ciphers* argument to SSL sockets, so as to change the
+  available cipher list.  Helps fix test_ssl with OpenSSL 1.0.0.
+
+- Issue #8393: subprocess accepts bytes, bytearray and str with surrogates for
+  the current working directory.
+
+- Issue #7606: XML-RPC traceback stored in X-traceback is now encoded to ASCII
+  using backslashreplace error handler
+
+- Issue #8412: os.system() now accepts bytes, bytearray and str with
+  surrogates.
+
+- Issue #2987: RFC2732 support for urlparse (IPv6 addresses). Patch by Tony
+  Locke and Hans Ulrich Niedermann.
+
+- Issue #5277: Fix quote counting when parsing RFC 2231 encoded parameters.
+
+- Issue #7316: the acquire() method of lock objects in the :mod:`threading`
+  module now takes an optional timeout argument in seconds.  Timeout support
+  relies on the system threading library, so as to avoid a semi-busy wait
+  loop.
+
+- Issue #8383: pickle and pickletools use surrogatepass error handler when
+  encoding unicode as utf8 to support lone surrogates and stay compatible with
+  Python 2.x and 3.0
+
+- Issue #7585: difflib context and unified diffs now place a tab between
+  filename and date, conforming to the 'standards' they were originally
+  designed to follow.  This improves compatibility with patch tools.
+
+- Issue #7472: Fixed typo in email.encoders module; messages using ISO-2022
+  character sets will now consistently use a Content-Transfer-Encoding of
+  7bit rather than sometimes being marked as 8bit.
+
+- Issue #8375: test_distutils now checks if the temporary directory are still
+  present before it cleans them.
+
+- Issue #8374: Update the internal alias table in the :mod:`locale` module
+  to cover recent locale changes and additions.
+
 - Issue #8321: Give access to OpenSSL version numbers from the `ssl` module,
   using the new attributes `ssl.OPENSSL_VERSION`, `ssl.OPENSSL_VERSION_INFO`
   and `ssl.OPENSSL_VERSION_NUMBER`.
@@ -896,6 +966,12 @@
 Extension Modules
 -----------------
 
+- Issue #2706: Allow division of a timedelta by another timedelta:
+  timedelta / timedelta, timedelta % timedelta, timedelta // timedelta
+  and divmod(timedelta, timedelta) are all supported.
+
+- Issue #8314: Fix unsigned long long bug in libffi on Sparc v8.
+
 - 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
@@ -1020,6 +1096,9 @@
 Tests
 -----
 
+- Issue #3864: Skip three test_signal tests on freebsd6 because they fail
+  if any thread was previously started, most likely due to a platform bug.
+
 - Issue #8193: Fix test_zlib failure with zlib 1.2.4.
 
 - Issue #8248: Add some tests for the bool type.  Patch by Gregory Nofi.

Modified: python/branches/py3k-cdecimal/Misc/developers.txt
==============================================================================
--- python/branches/py3k-cdecimal/Misc/developers.txt	(original)
+++ python/branches/py3k-cdecimal/Misc/developers.txt	Wed Apr 21 13:06:18 2010
@@ -20,7 +20,16 @@
 Permissions History
 -------------------
 
-- Brian Curtin was given commit access on March 24 by MvL.
+- Tim Golden was given commit access on April 21 2010 by MvL,
+  at suggestion of Michael Foord.
+
+- Giampaolo Rodolà was given commit access on April 17 2010 by
+  MvL, at suggestion of R. David Murray.
+
+- Jean-Paul Calderone was given commit access on April 6 2010 by
+  GFB, at suggestion of Michael Foord and others.
+
+- Brian Curtin was given commit access on March 24 2010 by MvL.
 
 - Florent Xicluna was given commit access on February 25 2010 by
   MvL, based on Antoine Pitrou's recommendation.

Modified: python/branches/py3k-cdecimal/Misc/maintainers.rst
==============================================================================
--- python/branches/py3k-cdecimal/Misc/maintainers.rst	(original)
+++ python/branches/py3k-cdecimal/Misc/maintainers.rst	Wed Apr 21 13:06:18 2010
@@ -99,7 +99,7 @@
 formatter
 fpectl
 fractions           mark.dickinson, rhettinger
-ftplib
+ftplib              giampaolo.rodola
 functools
 gc                  pitrou
 getopt
@@ -113,7 +113,7 @@
 hmac
 html
 http
-idlelib             kurt.kaiser
+idlelib             kbk
 imaplib
 imghdr
 imp
@@ -198,7 +198,7 @@
 symtable            benjamin.peterson
 sys
 sysconfig           tarek
-syslog
+syslog              jafo
 tabnanny            tim_one
 tarfile             lars.gustaebel
 telnetlib
@@ -289,7 +289,7 @@
 testing             michael.foord, pitrou
 threads
 tracker
-unicode             lemburg, ezio.melotti
+unicode             lemburg, ezio.melotti, haypo
 version control
 windows
 ==================  ===========

Modified: python/branches/py3k-cdecimal/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_ctypes/callproc.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_ctypes/callproc.c	Wed Apr 21 13:06:18 2010
@@ -1371,7 +1371,8 @@
 
 static PyObject *py_dl_open(PyObject *self, PyObject *args)
 {
-	char *name;
+	PyObject *name, *name2;
+	char *name_str;
 	void * handle;
 #ifdef RTLD_LOCAL	
 	int mode = RTLD_NOW | RTLD_LOCAL;
@@ -1379,10 +1380,22 @@
 	/* cygwin doesn't define RTLD_LOCAL */
 	int mode = RTLD_NOW;
 #endif
-	if (!PyArg_ParseTuple(args, "z|i:dlopen", &name, &mode))
+	if (!PyArg_ParseTuple(args, "O|i:dlopen", &name, &mode))
 		return NULL;
 	mode |= RTLD_NOW;
-	handle = ctypes_dlopen(name, mode);
+	if (name != Py_None) {
+		if (PyUnicode_FSConverter(name, &name2) == 0)
+			return NULL;
+		if (PyBytes_Check(name2))
+			name_str = PyBytes_AS_STRING(name2);
+		else
+			name_str = PyByteArray_AS_STRING(name2);
+	} else {
+		name_str = NULL;
+		name2 = NULL;
+	}
+	handle = ctypes_dlopen(name_str, mode);
+	Py_XDECREF(name2);
 	if (!handle) {
 		char *errmsg = ctypes_dlerror();
 		if (!errmsg)

Modified: python/branches/py3k-cdecimal/Modules/_ctypes/libffi/src/sparc/v8.S
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_ctypes/libffi/src/sparc/v8.S	(original)
+++ python/branches/py3k-cdecimal/Modules/_ctypes/libffi/src/sparc/v8.S	Wed Apr 21 13:06:18 2010
@@ -213,6 +213,10 @@
 	be,a	done1
 	 ldd	[%fp-8], %i0
 
+	cmp	%o0, FFI_TYPE_UINT64
+	be,a	done1
+	 ldd	[%fp-8], %i0
+
 	ld	[%fp-8], %i0
 done1:
 	jmp	%i7+8

Modified: python/branches/py3k-cdecimal/Modules/_pickle.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_pickle.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_pickle.c	Wed Apr 21 13:06:18 2010
@@ -1227,7 +1227,9 @@
     if (self->bin) {
         char pdata[5];
 
-        encoded = PyUnicode_AsUTF8String(obj);
+        encoded = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(obj),
+                                    PyUnicode_GET_SIZE(obj),
+                                    "surrogatepass");
         if (encoded == NULL)
             goto error;
 
@@ -3352,7 +3354,7 @@
     if (unpickler_read(self, &s, size) < 0)
         return -1;
 
-    str = PyUnicode_DecodeUTF8(s, size, NULL);
+    str = PyUnicode_DecodeUTF8(s, size, "surrogatepass");
     if (str == NULL)
         return -1;
 

Modified: python/branches/py3k-cdecimal/Modules/_posixsubprocess.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_posixsubprocess.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_posixsubprocess.c	Wed Apr 21 13:06:18 2010
@@ -177,6 +177,7 @@
     int p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite;
     int errpipe_read, errpipe_write, close_fds, restore_signals;
     int call_setsid;
+    PyObject *cwd_obj, *cwd_obj2;
     const char *cwd;
     pid_t pid;
     int need_to_reenable_gc = 0;
@@ -184,8 +185,9 @@
     Py_ssize_t arg_num;
 
     if (!PyArg_ParseTuple(
-            args, "OOOzOiiiiiiiiiiO:fork_exec",
-            &process_args, &executable_list, &py_close_fds, &cwd, &env_list,
+            args, "OOOOOiiiiiiiiiiO:fork_exec",
+            &process_args, &executable_list, &py_close_fds,
+            &cwd_obj, &env_list,
             &p2cread, &p2cwrite, &c2pread, &c2pwrite,
             &errread, &errwrite, &errpipe_read, &errpipe_write,
             &restore_signals, &call_setsid, &preexec_fn))
@@ -263,13 +265,25 @@
         preexec_fn_args_tuple = PyTuple_New(0);
         if (!preexec_fn_args_tuple)
             goto cleanup;
-	_PyImport_AcquireLock();
+        _PyImport_AcquireLock();
+    }
+
+    if (cwd_obj != Py_None) {
+        if (PyUnicode_FSConverter(cwd_obj, &cwd_obj2) == 0)
+            goto cleanup;
+        if (PyBytes_Check(cwd_obj2))
+            cwd = PyBytes_AS_STRING(cwd_obj2);
+        else
+            cwd = PyByteArray_AS_STRING(cwd_obj2);
+    } else {
+        cwd = NULL;
+        cwd_obj2 = NULL;
     }
 
     pid = fork();
     if (pid == 0) {
         /* Child process */
-        /* 
+        /*
          * Code from here to _exit() must only use async-signal-safe functions,
          * listed at `man 7 signal` or
          * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
@@ -291,6 +305,8 @@
         _exit(255);
         return NULL;  /* Dead code to avoid a potential compiler warning. */
     }
+    Py_XDECREF(cwd_obj2);
+
     if (pid == -1) {
         /* Capture the errno exception before errno can be clobbered. */
         PyErr_SetFromErrno(PyExc_OSError);

Modified: python/branches/py3k-cdecimal/Modules/_sre.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_sre.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_sre.c	Wed Apr 21 13:06:18 2010
@@ -3903,12 +3903,9 @@
     PyObject* d;
     PyObject* x;
 
-    /* Initialize object types */
-    if (PyType_Ready(&Pattern_Type) < 0)
-        return NULL;
-    if (PyType_Ready(&Match_Type) < 0)
-        return NULL;
-    if (PyType_Ready(&Scanner_Type) < 0)
+    /* Patch object types */
+    if (PyType_Ready(&Pattern_Type) || PyType_Ready(&Match_Type) ||
+        PyType_Ready(&Scanner_Type))
         return NULL;
 
     m = PyModule_Create(&sremodule);

Modified: python/branches/py3k-cdecimal/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_ssl.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_ssl.c	Wed Apr 21 13:06:18 2010
@@ -262,7 +262,7 @@
 	       enum py_ssl_server_or_client socket_type,
 	       enum py_ssl_cert_requirements certreq,
 	       enum py_ssl_version proto_version,
-	       char *cacerts_file)
+	       char *cacerts_file, char *ciphers)
 {
 	PySSLObject *self;
 	char *errstr = NULL;
@@ -310,6 +310,14 @@
 		goto fail;
 	}
 
+	if (ciphers != NULL) {
+		ret = SSL_CTX_set_cipher_list(self->ctx, ciphers);
+		if (ret == 0) {
+			errstr = ERRSTR("No cipher can be selected.");
+			goto fail;
+		}
+	}
+
 	if (certreq != PY_SSL_CERT_NONE) {
 		if (cacerts_file == NULL) {
 			errstr = ERRSTR("No root certificates specified for "
@@ -369,7 +377,9 @@
 	self->ssl = SSL_new(self->ctx); /* New ssl struct */
 	PySSL_END_ALLOW_THREADS
 	SSL_set_fd(self->ssl, Sock->sock_fd);	/* Set the socket for SSL */
+#ifdef SSL_MODE_AUTO_RETRY
 	SSL_set_mode(self->ssl, SSL_MODE_AUTO_RETRY);
+#endif
 
 	/* If the socket is in non-blocking mode or timeout mode, set the BIO
 	 * to non-blocking mode (blocking is the default)
@@ -406,14 +416,15 @@
 	char *key_file = NULL;
 	char *cert_file = NULL;
 	char *cacerts_file = NULL;
+	char *ciphers = NULL;
 
-	if (!PyArg_ParseTuple(args, "O!i|zziiz:sslwrap",
+	if (!PyArg_ParseTuple(args, "O!i|zziizz:sslwrap",
 			      PySocketModule.Sock_Type,
 			      &Sock,
 			      &server_side,
 			      &key_file, &cert_file,
 			      &verification_mode, &protocol,
-			      &cacerts_file))
+			      &cacerts_file, &ciphers))
 		return NULL;
 
 	/*
@@ -426,12 +437,13 @@
 
 	return (PyObject *) newPySSLObject(Sock, key_file, cert_file,
 					   server_side, verification_mode,
-					   protocol, cacerts_file);
+					   protocol, cacerts_file,
+					   ciphers);
 }
 
 PyDoc_STRVAR(ssl_doc,
 "sslwrap(socket, server_side, [keyfile, certfile, certs_mode, protocol,\n"
-"                              cacertsfile]) -> sslobject");
+"                              cacertsfile, ciphers]) -> sslobject");
 
 /* SSL object methods */
 

Modified: python/branches/py3k-cdecimal/Modules/_threadmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_threadmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_threadmodule.c	Wed Apr 21 13:06:18 2010
@@ -40,18 +40,47 @@
 }
 
 static PyObject *
-lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
+lock_PyThread_acquire_lock(lockobject *self, PyObject *args, PyObject *kwds)
 {
-	int i = 1;
+	char *kwlist[] = {"blocking", "timeout", NULL};
+	int blocking = 1;
+	double timeout = -1;
+	PY_TIMEOUT_T microseconds;
+	int r;
 
-	if (!PyArg_ParseTuple(args, "|i:acquire", &i))
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|id:acquire", kwlist,
+					 &blocking, &timeout))
 		return NULL;
 
+	if (!blocking && timeout != -1) {
+		PyErr_SetString(PyExc_ValueError, "can't specify a timeout "
+				"for a non-blocking call");
+		return NULL;
+	}
+	if (timeout < 0 && timeout != -1) {
+		PyErr_SetString(PyExc_ValueError, "timeout value must be "
+				"strictly positive");
+		return NULL;
+	}
+	if (!blocking)
+		microseconds = 0;
+	else if (timeout == -1)
+		microseconds = -1;
+	else {
+		timeout *= 1e6;
+		if (timeout >= (double) PY_TIMEOUT_MAX) {
+			PyErr_SetString(PyExc_OverflowError,
+					"timeout value is too large");
+			return NULL;
+		}
+		microseconds = (PY_TIMEOUT_T) timeout;
+	}
+	
 	Py_BEGIN_ALLOW_THREADS
-	i = PyThread_acquire_lock(self->lock_lock, i);
+	r = PyThread_acquire_lock_timed(self->lock_lock, microseconds);
 	Py_END_ALLOW_THREADS
 
-	return PyBool_FromLong((long)i);
+	return PyBool_FromLong(r);
 }
 
 PyDoc_STRVAR(acquire_doc,
@@ -106,9 +135,9 @@
 
 static PyMethodDef lock_methods[] = {
 	{"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, 
-	 METH_VARARGS, acquire_doc},
+	 METH_VARARGS | METH_KEYWORDS, acquire_doc},
 	{"acquire",      (PyCFunction)lock_PyThread_acquire_lock, 
-	 METH_VARARGS, acquire_doc},
+	 METH_VARARGS | METH_KEYWORDS, acquire_doc},
 	{"release_lock", (PyCFunction)lock_PyThread_release_lock, 
 	 METH_NOARGS, release_doc},
 	{"release",      (PyCFunction)lock_PyThread_release_lock, 
@@ -118,7 +147,7 @@
 	{"locked",       (PyCFunction)lock_locked_lock,  
 	 METH_NOARGS, locked_doc},
 	{"__enter__",    (PyCFunction)lock_PyThread_acquire_lock,
-	 METH_VARARGS, acquire_doc},
+	 METH_VARARGS | METH_KEYWORDS, acquire_doc},
 	{"__exit__",    (PyCFunction)lock_PyThread_release_lock,
 	 METH_VARARGS, release_doc},
 	{NULL,           NULL}		/* sentinel */
@@ -183,15 +212,41 @@
 static PyObject *
 rlock_acquire(rlockobject *self, PyObject *args, PyObject *kwds)
 {
-	char *kwlist[] = {"blocking", NULL};
+	char *kwlist[] = {"blocking", "timeout", NULL};
 	int blocking = 1;
+	double timeout = -1;
+	PY_TIMEOUT_T microseconds;
 	long tid;
 	int r = 1;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:acquire", kwlist,
-				         &blocking))
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|id:acquire", kwlist,
+					 &blocking, &timeout))
 		return NULL;
 
+	if (!blocking && timeout != -1) {
+		PyErr_SetString(PyExc_ValueError, "can't specify a timeout "
+				"for a non-blocking call");
+		return NULL;
+	}
+	if (timeout < 0 && timeout != -1) {
+		PyErr_SetString(PyExc_ValueError, "timeout value must be "
+				"strictly positive");
+		return NULL;
+	}
+	if (!blocking)
+		microseconds = 0;
+	else if (timeout == -1)
+		microseconds = -1;
+	else {
+		timeout *= 1e6;
+		if (timeout >= (double) PY_TIMEOUT_MAX) {
+			PyErr_SetString(PyExc_OverflowError,
+					"timeout value is too large");
+			return NULL;
+		}
+		microseconds = (PY_TIMEOUT_T) timeout;
+	}
+	
 	tid = PyThread_get_thread_ident();
 	if (self->rlock_count > 0 && tid == self->rlock_owner) {
 		unsigned long count = self->rlock_count + 1;
@@ -206,11 +261,11 @@
 
 	if (self->rlock_count > 0 ||
 	    !PyThread_acquire_lock(self->rlock_lock, 0)) {
-		if (!blocking) {
+		if (microseconds == 0) {
 			Py_RETURN_FALSE;
 		}
 		Py_BEGIN_ALLOW_THREADS
-		r = PyThread_acquire_lock(self->rlock_lock, blocking);
+		r = PyThread_acquire_lock_timed(self->rlock_lock, microseconds);
 		Py_END_ALLOW_THREADS
 	}
 	if (r) {
@@ -1005,7 +1060,7 @@
 PyMODINIT_FUNC
 PyInit__thread(void)
 {
-	PyObject *m, *d;
+	PyObject *m, *d, *timeout_max;
 	
 	/* Initialize types: */
 	if (PyType_Ready(&localtype) < 0)
@@ -1020,6 +1075,12 @@
 	if (m == NULL)
 		return NULL;
 
+	timeout_max = PyFloat_FromDouble(PY_TIMEOUT_MAX / 1000000);
+	if (!timeout_max)
+		return NULL;
+	if (PyModule_AddObject(m, "TIMEOUT_MAX", timeout_max) < 0)
+		return NULL;
+
 	/* Add a symbolic constant */
 	d = PyModule_GetDict(m);
 	ThreadError = PyErr_NewException("_thread.error", NULL, NULL);

Modified: python/branches/py3k-cdecimal/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/datetimemodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/datetimemodule.c	Wed Apr 21 13:06:18 2010
@@ -1666,6 +1666,52 @@
 }
 
 static PyObject *
+divide_timedelta_timedelta(PyDateTime_Delta *left, PyDateTime_Delta *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *result;
+
+	pyus_left = delta_to_microseconds(left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds(right);
+	if (pyus_right == NULL)	{
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	result = PyNumber_FloorDivide(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	return result;
+}
+
+static PyObject *
+truedivide_timedelta_timedelta(PyDateTime_Delta *left, PyDateTime_Delta *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *result;
+
+	pyus_left = delta_to_microseconds(left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds(right);
+	if (pyus_right == NULL)	{
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	result = PyNumber_TrueDivide(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	return result;
+}
+
+static PyObject *
 delta_add(PyObject *left, PyObject *right)
 {
 	PyObject *result = Py_NotImplemented;
@@ -1810,6 +1856,27 @@
 			result = divide_timedelta_int(
 					(PyDateTime_Delta *)left,
 					right);
+		else if (PyDelta_Check(right))
+			result = divide_timedelta_timedelta(
+					(PyDateTime_Delta *)left,
+					(PyDateTime_Delta *)right);
+	}
+
+	if (result == Py_NotImplemented)
+		Py_INCREF(result);
+	return result;
+}
+
+static PyObject *
+delta_truedivide(PyObject *left, PyObject *right)
+{
+	PyObject *result = Py_NotImplemented;
+
+	if (PyDelta_Check(left)) {
+		if (PyDelta_Check(right))
+			result = truedivide_timedelta_timedelta(
+					(PyDateTime_Delta *)left,
+					(PyDateTime_Delta *)right);
 	}
 
 	if (result == Py_NotImplemented)
@@ -1817,6 +1884,85 @@
 	return result;
 }
 
+static PyObject *
+delta_remainder(PyObject *left, PyObject *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *pyus_remainder;
+	PyObject *remainder;
+
+	if (!PyDelta_Check(left) || !PyDelta_Check(right)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+
+	pyus_left = delta_to_microseconds((PyDateTime_Delta *)left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds((PyDateTime_Delta *)right);
+	if (pyus_right == NULL) {
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	pyus_remainder = PyNumber_Remainder(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	if (pyus_remainder == NULL)
+		return NULL;
+
+	remainder = microseconds_to_delta(pyus_remainder);
+	Py_DECREF(pyus_remainder);
+	if (remainder == NULL)
+		return NULL;
+
+	return remainder;
+}
+
+static PyObject *
+delta_divmod(PyObject *left, PyObject *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *divmod;
+	PyObject *delta;
+	PyObject *result;
+
+	if (!PyDelta_Check(left) || !PyDelta_Check(right)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+
+	pyus_left = delta_to_microseconds((PyDateTime_Delta *)left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds((PyDateTime_Delta *)right);
+	if (pyus_right == NULL) {
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	divmod = PyNumber_Divmod(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	if (divmod == NULL)
+		return NULL;
+
+	assert(PyTuple_Size(divmod) == 2);
+	delta = microseconds_to_delta(PyTuple_GET_ITEM(divmod, 1));
+	if (delta == NULL) {
+		Py_DECREF(divmod);
+		return NULL;
+	}
+	result = PyTuple_Pack(2, PyTuple_GET_ITEM(divmod, 0), delta);
+	Py_DECREF(delta);
+	Py_DECREF(divmod);
+	return result;
+}
+
 /* Fold in the value of the tag ("seconds", "weeks", etc) component of a
  * timedelta constructor.  sofar is the # of microseconds accounted for
  * so far, and there are factor microseconds per current unit, the number
@@ -2108,8 +2254,8 @@
 	delta_add,				/* nb_add */
 	delta_subtract,				/* nb_subtract */
 	delta_multiply,				/* nb_multiply */
-	0,					/* nb_remainder */
-	0,					/* nb_divmod */
+	delta_remainder,			/* nb_remainder */
+	delta_divmod,				/* nb_divmod */
 	0,					/* nb_power */
 	(unaryfunc)delta_negative,		/* nb_negative */
 	(unaryfunc)delta_positive,		/* nb_positive */
@@ -2135,7 +2281,7 @@
 	0,					/*nb_inplace_xor*/
 	0,					/*nb_inplace_or*/
 	delta_divide,				/* nb_floor_divide */
-	0,					/* nb_true_divide */
+	delta_truedivide,			/* nb_true_divide */
 	0,					/* nb_inplace_floor_divide */
 	0,					/* nb_inplace_true_divide */
 };
@@ -4803,10 +4949,10 @@
 	Py_INCREF(&PyDateTime_TZInfoType);
 	PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType);
 
-    x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL);
-    if (x == NULL)
-        return NULL;
-    PyModule_AddObject(m, "datetime_CAPI", x);
+	x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL);
+	if (x == NULL)
+		return NULL;
+	PyModule_AddObject(m, "datetime_CAPI", x);
 
 	/* A 4-year cycle has an extra leap day over what we'd get from
 	 * pasting together 4 single years.

Modified: python/branches/py3k-cdecimal/Modules/main.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/main.c	(original)
+++ python/branches/py3k-cdecimal/Modules/main.c	Wed Apr 21 13:06:18 2010
@@ -266,6 +266,9 @@
 	wchar_t *module = NULL;
 	FILE *fp = stdin;
 	char *p;
+#ifdef MS_WINDOWS
+	wchar_t *wp;
+#endif
 	int skipfirstline = 0;
 	int stdin_is_interactive = 0;
 	int help = 0;
@@ -402,24 +405,48 @@
 	    (p = Py_GETENV("PYTHONNOUSERSITE")) && *p != '\0')
 		Py_NoUserSiteDirectory = 1;
 
+#ifdef MS_WINDOWS
+	if (!Py_IgnoreEnvironmentFlag && (wp = _wgetenv(L"PYTHONWARNINGS")) &&
+	    *wp != L'\0') {
+		wchar_t *buf, *warning;
+
+		buf = (wchar_t *)malloc((wcslen(wp) + 1) * sizeof(wchar_t));
+		if (buf == NULL)
+			Py_FatalError(
+			   "not enough memory to copy PYTHONWARNINGS");
+		wcscpy(buf, wp);
+		for (warning = wcstok(buf, L",");
+		     warning != NULL;
+		     warning = wcstok(NULL, L",")) {
+			PySys_AddWarnOption(warning);
+		}
+		free(buf);
+	}
+#else
 	if ((p = Py_GETENV("PYTHONWARNINGS")) && *p != '\0') {
-		char *buf;
+		char *buf, *oldloc;
 		wchar_t *warning;
-		size_t len;
 
-		for (buf = strtok(p, ",");
-		     buf != NULL;
-		     buf = strtok(NULL, ",")) {
-			len = strlen(buf);
-			warning = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
-			if (warning == NULL)
-				Py_FatalError(
-				   "not enough memory to copy PYTHONWARNINGS");
-			mbstowcs(warning, buf, len);
-			PySys_AddWarnOption(warning);
-			free(warning);
+		/* settle for strtok here as there's no one standard
+		   C89 wcstok */
+		buf = (char *)malloc(strlen(p) + 1);
+		if (buf == NULL)
+			Py_FatalError(
+			   "not enough memory to copy PYTHONWARNINGS");
+		strcpy(buf, p);
+		oldloc = strdup(setlocale(LC_ALL, NULL));
+		setlocale(LC_ALL, "");
+		for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) {
+			if ((warning = _Py_char2wchar(p)) != NULL) {
+				PySys_AddWarnOption(warning);
+				PyMem_Free(warning);
+			}
 		}
+		setlocale(LC_ALL, oldloc);
+		free(oldloc);
+		free(buf);
 	}
+#endif
 
 	if (command == NULL && module == NULL && _PyOS_optind < argc &&
 	    wcscmp(argv[_PyOS_optind], L"-") != 0)
@@ -679,6 +706,110 @@
 	*argv = orig_argv;
 }
 
+
+wchar_t*
+_Py_char2wchar(char* arg)
+{
+	wchar_t *res;
+#ifdef HAVE_BROKEN_MBSTOWCS
+	/* Some platforms have a broken implementation of
+	 * mbstowcs which does not count the characters that
+	 * would result from conversion.  Use an upper bound.
+	 */
+	size_t argsize = strlen(arg);
+#else
+	size_t argsize = mbstowcs(NULL, arg, 0);
+#endif
+	size_t count;
+	unsigned char *in;
+	wchar_t *out;
+#ifdef HAVE_MBRTOWC
+	mbstate_t mbs;
+#endif
+	if (argsize != (size_t)-1) {
+		res = (wchar_t *)PyMem_Malloc((argsize+1)*sizeof(wchar_t));
+		if (!res)
+			goto oom;
+		count = mbstowcs(res, arg, argsize+1);
+		if (count != (size_t)-1) {
+			wchar_t *tmp;
+			/* Only use the result if it contains no
+			   surrogate characters. */
+			for (tmp = res; *tmp != 0 &&
+				     (*tmp < 0xd800 || *tmp > 0xdfff); tmp++)
+				;
+			if (*tmp == 0)
+				return res;
+		}
+		PyMem_Free(res);
+	}
+	/* Conversion failed. Fall back to escaping with surrogateescape. */
+#ifdef HAVE_MBRTOWC
+	/* Try conversion with mbrtwoc (C99), and escape non-decodable bytes. */
+	
+	/* Overallocate; as multi-byte characters are in the argument, the
+	   actual output could use less memory. */
+	argsize = strlen(arg) + 1;
+	res = (wchar_t*)PyMem_Malloc(argsize*sizeof(wchar_t));
+	if (!res) goto oom;
+	in = (unsigned char*)arg;
+	out = res;
+	memset(&mbs, 0, sizeof mbs);
+	while (argsize) {
+		size_t converted = mbrtowc(out, (char*)in, argsize, &mbs);
+		if (converted == 0)
+			/* Reached end of string; null char stored. */
+			break;
+		if (converted == (size_t)-2) {
+			/* Incomplete character. This should never happen,
+			   since we provide everything that we have -
+			   unless there is a bug in the C library, or I 
+			   misunderstood how mbrtowc works. */
+			fprintf(stderr, "unexpected mbrtowc result -2\n");
+			return NULL;
+		}
+		if (converted == (size_t)-1) {
+			/* Conversion error. Escape as UTF-8b, and start over
+			   in the initial shift state. */
+			*out++ = 0xdc00 + *in++;
+			argsize--;
+			memset(&mbs, 0, sizeof mbs);
+			continue;
+		}
+		if (*out >= 0xd800 && *out <= 0xdfff) {
+			/* Surrogate character.  Escape the original
+			   byte sequence with surrogateescape. */
+			argsize -= converted;
+			while (converted--)
+				*out++ = 0xdc00 + *in++;
+			continue;
+		}
+		/* successfully converted some bytes */
+		in += converted;
+		argsize -= converted;
+		out++;
+	}
+#else
+	/* Cannot use C locale for escaping; manually escape as if charset
+	   is ASCII (i.e. escape all bytes > 128. This will still roundtrip
+	   correctly in the locale's charset, which must be an ASCII superset. */
+	res = PyMem_Malloc((strlen(arg)+1)*sizeof(wchar_t));
+	if (!res) goto oom;
+	in = (unsigned char*)arg;
+	out = res;
+	while(*in)
+		if(*in < 128)
+			*out++ = *in++;
+		else
+			*out++ = 0xdc00 + *in++;
+	*out = 0;
+#endif
+	return res;
+oom:
+	fprintf(stderr, "out of memory\n");
+	return NULL;
+}
+
 #ifdef __cplusplus
 }
 #endif

Modified: python/branches/py3k-cdecimal/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/posixmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/posixmodule.c	Wed Apr 21 13:06:18 2010
@@ -2688,18 +2688,23 @@
 	wchar_t *command;
 	if (!PyArg_ParseTuple(args, "u:system", &command))
 		return NULL;
+
+	Py_BEGIN_ALLOW_THREADS
+	sts = _wsystem(command);
+	Py_END_ALLOW_THREADS
 #else
+	PyObject *command_obj;
 	char *command;
-	if (!PyArg_ParseTuple(args, "s:system", &command))
+	if (!PyArg_ParseTuple(args, "O&:system",
+	                      PyUnicode_FSConverter, &command_obj))
 		return NULL;
-#endif
+
+	command = bytes2str(command_obj, 1);
 	Py_BEGIN_ALLOW_THREADS
-#ifdef MS_WINDOWS
-	sts = _wsystem(command);
-#else
 	sts = system(command);
-#endif
 	Py_END_ALLOW_THREADS
+	release_bytes(command_obj);
+#endif
 	return PyLong_FromLong(sts);
 }
 #endif
@@ -4171,6 +4176,53 @@
 }
 #endif
 
+#ifdef MS_WINDOWS
+PyDoc_STRVAR(win32_kill__doc__,
+"kill(pid, sig)\n\n\
+Kill a process with a signal.");
+
+static PyObject *
+win32_kill(PyObject *self, PyObject *args)
+{
+	PyObject *result, handle_obj;
+	DWORD pid, sig, err;
+	HANDLE handle;
+
+	if (!PyArg_ParseTuple(args, "kk:kill", &pid, &sig))
+		return NULL;
+
+	/* Console processes which share a common console can be sent CTRL+C or
+	   CTRL+BREAK events, provided they handle said events. */
+	if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) {
+		if (GenerateConsoleCtrlEvent(sig, pid) == 0) {
+			err = GetLastError();
+			PyErr_SetFromWindowsErr(err);
+		}
+		else
+			Py_RETURN_NONE;
+	}
+
+	/* If the signal is outside of what GenerateConsoleCtrlEvent can use,
+	   attempt to open and terminate the process. */
+	handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
+	if (handle == NULL) {
+		err = GetLastError();
+		return PyErr_SetFromWindowsErr(err);
+	}
+
+	if (TerminateProcess(handle, sig) == 0) {
+		err = GetLastError();
+		result = PyErr_SetFromWindowsErr(err);
+	} else {
+		Py_INCREF(Py_None);
+		result = Py_None;
+	}
+
+	CloseHandle(handle);
+	return result;
+}
+#endif /* MS_WINDOWS */
+
 #ifdef HAVE_PLOCK
 
 #ifdef HAVE_SYS_LOCK_H
@@ -5934,6 +5986,12 @@
 #ifdef _CS_ARCHITECTURE
     {"CS_ARCHITECTURE",	_CS_ARCHITECTURE},
 #endif
+#ifdef _CS_GNU_LIBC_VERSION
+    {"CS_GNU_LIBC_VERSION",	_CS_GNU_LIBC_VERSION},
+#endif
+#ifdef _CS_GNU_LIBPTHREAD_VERSION
+    {"CS_GNU_LIBPTHREAD_VERSION",	_CS_GNU_LIBPTHREAD_VERSION},
+#endif
 #ifdef _CS_HOSTNAME
     {"CS_HOSTNAME",	_CS_HOSTNAME},
 #endif
@@ -7200,6 +7258,7 @@
 #endif /* HAVE_PLOCK */
 #ifdef MS_WINDOWS
 	{"startfile",	win32_startfile, METH_VARARGS, win32_startfile__doc__},
+	{"kill",    win32_kill, METH_VARARGS, win32_kill__doc__},
 #endif
 #ifdef HAVE_SETUID
 	{"setuid",	posix_setuid, METH_VARARGS, posix_setuid__doc__},

Modified: python/branches/py3k-cdecimal/Modules/python.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/python.c	(original)
+++ python/branches/py3k-cdecimal/Modules/python.c	Wed Apr 21 13:06:18 2010
@@ -14,108 +14,6 @@
 	return Py_Main(argc, argv);
 }
 #else
-static wchar_t*
-char2wchar(char* arg)
-{
-	wchar_t *res;
-#ifdef HAVE_BROKEN_MBSTOWCS
-	/* Some platforms have a broken implementation of
-	 * mbstowcs which does not count the characters that
-	 * would result from conversion.  Use an upper bound.
-	 */
-	size_t argsize = strlen(arg);
-#else
-	size_t argsize = mbstowcs(NULL, arg, 0);
-#endif
-	size_t count;
-	unsigned char *in;
-	wchar_t *out;
-#ifdef HAVE_MBRTOWC
-	mbstate_t mbs;
-#endif
-	if (argsize != (size_t)-1) {
-		res = (wchar_t *)PyMem_Malloc((argsize+1)*sizeof(wchar_t));
-		if (!res)
-			goto oom;
-		count = mbstowcs(res, arg, argsize+1);
-		if (count != (size_t)-1) {
-			wchar_t *tmp;
-			/* Only use the result if it contains no
-			   surrogate characters. */
-			for (tmp = res; *tmp != 0 &&
-				     (*tmp < 0xd800 || *tmp > 0xdfff); tmp++)
-				;
-			if (*tmp == 0)
-				return res;
-		}
-		PyMem_Free(res);
-	}
-	/* Conversion failed. Fall back to escaping with surrogateescape. */
-#ifdef HAVE_MBRTOWC
-	/* Try conversion with mbrtwoc (C99), and escape non-decodable bytes. */
-	
-	/* Overallocate; as multi-byte characters are in the argument, the
-	   actual output could use less memory. */
-	argsize = strlen(arg) + 1;
-	res = PyMem_Malloc(argsize*sizeof(wchar_t));
-	if (!res) goto oom;
-	in = (unsigned char*)arg;
-	out = res;
-	memset(&mbs, 0, sizeof mbs);
-	while (argsize) {
-		size_t converted = mbrtowc(out, (char*)in, argsize, &mbs);
-		if (converted == 0)
-			/* Reached end of string; null char stored. */
-			break;
-		if (converted == (size_t)-2) {
-			/* Incomplete character. This should never happen,
-			   since we provide everything that we have -
-			   unless there is a bug in the C library, or I 
-			   misunderstood how mbrtowc works. */
-			fprintf(stderr, "unexpected mbrtowc result -2\n");
-			return NULL;
-		}
-		if (converted == (size_t)-1) {
-			/* Conversion error. Escape as UTF-8b, and start over
-			   in the initial shift state. */
-			*out++ = 0xdc00 + *in++;
-			argsize--;
-			memset(&mbs, 0, sizeof mbs);
-			continue;
-		}
-		if (*out >= 0xd800 && *out <= 0xdfff) {
-			/* Surrogate character.  Escape the original
-			   byte sequence with surrogateescape. */
-			argsize -= converted;
-			while (converted--)
-				*out++ = 0xdc00 + *in++;
-			continue;
-		}
-		/* successfully converted some bytes */
-		in += converted;
-		argsize -= converted;
-		out++;
-	}
-#else
-	/* Cannot use C locale for escaping; manually escape as if charset
-	   is ASCII (i.e. escape all bytes > 128. This will still roundtrip
-	   correctly in the locale's charset, which must be an ASCII superset. */
-	res = PyMem_Malloc((strlen(arg)+1)*sizeof(wchar_t));
-	if (!res) goto oom;
-	in = (unsigned char*)arg;
-	out = res;
-	while(*in)
-		if(*in < 128)
-			*out++ = *in++;
-		else
-			*out++ = 0xdc00 + *in++;
-	*out = 0;
-#endif
-	return res;
-oom:
-	fprintf(stderr, "out of memory\n");
-	return NULL;
-}
 
 int
 main(int argc, char **argv)
@@ -143,7 +41,7 @@
 	oldloc = strdup(setlocale(LC_ALL, NULL));
 	setlocale(LC_ALL, "");
 	for (i = 0; i < argc; i++) {
-		argv_copy2[i] = argv_copy[i] = char2wchar(argv[i]);
+		argv_copy2[i] = argv_copy[i] = _Py_char2wchar(argv[i]);
 		if (!argv_copy[i])
 			return 1;
 	}

Modified: python/branches/py3k-cdecimal/Modules/signalmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/signalmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/signalmodule.c	Wed Apr 21 13:06:18 2010
@@ -7,6 +7,7 @@
 #include "intrcheck.h"
 
 #ifdef MS_WINDOWS
+#include <Windows.h>
 #ifdef HAVE_PROCESS_H
 #include <process.h>
 #endif
@@ -805,6 +806,18 @@
     	PyDict_SetItemString(d, "ItimerError", ItimerError);
 #endif
 
+#ifdef CTRL_C_EVENT
+    x = PyLong_FromLong(CTRL_C_EVENT);
+    PyDict_SetItemString(d, "CTRL_C_EVENT", x);
+    Py_DECREF(x);
+#endif
+
+#ifdef CTRL_BREAK_EVENT
+    x = PyLong_FromLong(CTRL_BREAK_EVENT);
+    PyDict_SetItemString(d, "CTRL_BREAK_EVENT", x);
+    Py_DECREF(x);
+#endif
+
     if (PyErr_Occurred()) {
 	    Py_DECREF(m);
 	    m = NULL;

Modified: python/branches/py3k-cdecimal/Objects/bytearrayobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/bytearrayobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/bytearrayobject.c	Wed Apr 21 13:06:18 2010
@@ -753,14 +753,17 @@
     }
 
     /* Is it an int? */
-    count = PyNumber_AsSsize_t(arg, PyExc_ValueError);
-    if (count == -1 && PyErr_Occurred())
+    count = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
+    if (count == -1 && PyErr_Occurred()) {
+        if (PyErr_ExceptionMatches(PyExc_OverflowError))
+            return -1;
         PyErr_Clear();
+    }
+    else if (count < 0) {
+        PyErr_SetString(PyExc_ValueError, "negative count");
+        return -1;
+    }
     else {
-        if (count < 0) {
-            PyErr_SetString(PyExc_ValueError, "negative count");
-            return -1;
-        }
         if (count > 0) {
             if (PyByteArray_Resize((PyObject *)self, count))
                 return -1;

Modified: python/branches/py3k-cdecimal/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/bytesobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/bytesobject.c	Wed Apr 21 13:06:18 2010
@@ -2545,15 +2545,17 @@
 		return new;
 	}
 	/* Is it an integer? */
-	size = PyNumber_AsSsize_t(x, PyExc_ValueError);
+	size = PyNumber_AsSsize_t(x, PyExc_OverflowError);
 	if (size == -1 && PyErr_Occurred()) {
+		if (PyErr_ExceptionMatches(PyExc_OverflowError))
+			return NULL;
 		PyErr_Clear();		
 	}
+	else if (size < 0) {
+		PyErr_SetString(PyExc_ValueError, "negative count");
+		return NULL;
+	}
 	else {
-		if (size < 0) {
-			PyErr_SetString(PyExc_ValueError, "negative count");
-			return NULL;
-		}
 		new = PyBytes_FromStringAndSize(NULL, size);
 		if (new == NULL) {
 			return NULL;

Modified: python/branches/py3k-cdecimal/Objects/setobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/setobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/setobject.c	Wed Apr 21 13:06:18 2010
@@ -601,10 +601,8 @@
 
 	listrepr = PyObject_Repr(keys);
 	Py_DECREF(keys);
-	if (listrepr == NULL) {
-		Py_DECREF(keys);
+	if (listrepr == NULL)
 		goto done;
-	}
 	newsize = PyUnicode_GET_SIZE(listrepr);
 	result = PyUnicode_FromUnicode(NULL, newsize);
 	if (result) {
@@ -1980,6 +1978,8 @@
 
 	if (!PyAnySet_Check(self))
 		return -1;
+	if (PySet_Check(self) && !_PyArg_NoKeywords("set()", kwds))
+		return -1;
 	if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
 		return -1;
 	set_clear_internal(self);

Modified: python/branches/py3k-cdecimal/PC/_subprocess.c
==============================================================================
--- python/branches/py3k-cdecimal/PC/_subprocess.c	(original)
+++ python/branches/py3k-cdecimal/PC/_subprocess.c	Wed Apr 21 13:06:18 2010
@@ -599,5 +599,7 @@
 	defint(d, "INFINITE", INFINITE);
 	defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0);
 	defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE);
+	defint(d, "CREATE_NEW_PROCESS_GROUP", CREATE_NEW_PROCESS_GROUP);
+
 	return m;
 }

Modified: python/branches/py3k-cdecimal/Python/import.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/import.c	(original)
+++ python/branches/py3k-cdecimal/Python/import.c	Wed Apr 21 13:06:18 2010
@@ -43,6 +43,15 @@
    The current working scheme is to increment the previous value by
    10.
 
+   Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic
+   number also includes a new "magic tag", i.e. a human readable string used
+   to represent the magic number in __pycache__ directories.  When you change
+   the magic number, you must also set a new unique magic tag.  Generally this
+   can be named after the Python major version of the magic number bump, but
+   it can really be anything, as long as it's different than anything else
+   that's come before.  The tags are included in the following table, starting
+   with Python 3.2a0.
+
    Known values:
        Python 1.5:   20121
        Python 1.5.1: 20121
@@ -91,11 +100,18 @@
        Python 3.1a0: 3151 (optimize conditional branches:
 			   introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
        Python 3.2a0: 3160 (add SETUP_WITH)
+		     tag: cpython-32
 */
 
+/* If you change MAGIC, you must change TAG and you must insert the old value
+   into _PyMagicNumberTags below.
+*/
 #define MAGIC (3160 | ((long)'\r'<<16) | ((long)'\n'<<24))
-/* Magic word as global */
+#define TAG "cpython-32"
+#define CACHEDIR "__pycache__"
+/* Current magic word and string tag as globals. */
 static long pyc_magic = MAGIC;
+static const char *pyc_tag = TAG;
 
 /* See _PyImport_FixupExtension() below */
 static PyObject *extensions = NULL;
@@ -517,7 +533,7 @@
 }
 
 
-/* Helper for pythonrun.c -- return magic number */
+/* Helper for pythonrun.c -- return magic number and tag. */
 
 long
 PyImport_GetMagicNumber(void)
@@ -526,6 +542,12 @@
 }
 
 
+const char *
+PyImport_GetMagicTag(void)
+{
+	return pyc_tag;
+}
+
 /* Magic for extension modules (built-in as well as dynamically
    loaded).  To prevent initializing an extension module more than
    once, we keep a static dictionary 'extensions' keyed by module name
@@ -671,7 +693,10 @@
 			      "sys.modules failed");
 }
 
-static PyObject * get_sourcefile(const char *file);
+static PyObject * get_sourcefile(char *file);
+static char *make_source_pathname(char *pathname, char *buf);
+static char *make_compiled_pathname(char *pathname, char *buf, size_t buflen,
+				    int debug);
 
 /* Execute a code object in a module and return the module object
  * WITH INCREMENTED REFERENCE COUNT.  If an error occurs, name is
@@ -679,16 +704,28 @@
  * in sys.modules.  The caller may wish to restore the original
  * module object (if any) in this case; PyImport_ReloadModule is an
  * example.
+ *
+ * Note that PyImport_ExecCodeModuleWithPathnames() is the preferred, richer
+ * interface.  The other two exist primarily for backward compatibility.
  */
 PyObject *
 PyImport_ExecCodeModule(char *name, PyObject *co)
 {
-	return PyImport_ExecCodeModuleEx(name, co, (char *)NULL);
+	return PyImport_ExecCodeModuleWithPathnames(
+		name, co, (char *)NULL, (char *)NULL);
 }
 
 PyObject *
 PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
 {
+	return PyImport_ExecCodeModuleWithPathnames(
+		name, co, pathname, (char *)NULL);
+}
+
+PyObject *
+PyImport_ExecCodeModuleWithPathnames(char *name, PyObject *co, char *pathname,
+				     char *cpathname)
+{
 	PyObject *modules = PyImport_GetModuleDict();
 	PyObject *m, *d, *v;
 
@@ -718,6 +755,20 @@
 		PyErr_Clear(); /* Not important enough to report */
 	Py_DECREF(v);
 
+	/* Remember the pyc path name as the __cached__ attribute. */
+	if (cpathname == NULL) {
+		v = Py_None;
+		Py_INCREF(v);
+	}
+	else if ((v = PyUnicode_FromString(cpathname)) == NULL) {
+		PyErr_Clear(); /* Not important enough to report */
+		v = Py_None;
+		Py_INCREF(v);
+	}
+	if (PyDict_SetItemString(d, "__cached__", v) != 0)
+		PyErr_Clear(); /* Not important enough to report */
+	Py_DECREF(v);
+
 	v = PyEval_EvalCode((PyCodeObject *)co, d, d);
 	if (v == NULL)
 		goto error;
@@ -740,32 +791,189 @@
 }
 
 
+/* Like strrchr(string, '/') but searches for the rightmost of either SEP
+   or ALTSEP, if the latter is defined.
+*/
+static char *
+rightmost_sep(char *s)
+{
+	char *found, c;
+	for (found = NULL; (c = *s); s++) {
+		if (c == SEP
+#ifdef ALTSEP
+		    || c == ALTSEP
+#endif
+		    )
+		{
+			found = s;
+		}
+	}
+	return found;
+}
+
+
 /* Given a pathname for a Python source file, fill a buffer with the
    pathname for the corresponding compiled file.  Return the pathname
    for the compiled file, or NULL if there's no space in the buffer.
    Doesn't set an exception. */
 
 static char *
-make_compiled_pathname(char *pathname, char *buf, size_t buflen)
+make_compiled_pathname(char *pathname, char *buf, size_t buflen, int debug)
 {
+	/* foo.py -> __pycache__/foo.<tag>.pyc */
 	size_t len = strlen(pathname);
-	if (len+2 > buflen)
+	size_t i, save;
+	char *pos;
+	int sep = SEP;
+
+	/* Sanity check that the buffer has roughly enough space to hold what
+	   will eventually be the full path to the compiled file.  The 5 extra
+	   bytes include the slash afer __pycache__, the two extra dots, the
+	   extra trailing character ('c' or 'o') and null.  This isn't exact
+	   because the contents of the buffer can affect how many actual
+	   characters of the string get into the buffer.  We'll do a final
+	   sanity check before writing the extension to ensure we do not
+	   overflow the buffer.
+	*/
+	if (len + strlen(CACHEDIR) + strlen(pyc_tag) + 5 > buflen)
 		return NULL;
 
-#ifdef MS_WINDOWS
-	/* Treat .pyw as if it were .py.  The case of ".pyw" must match
-	   that used in _PyImport_StandardFiletab. */
-	if (len >= 4 && strcmp(&pathname[len-4], ".pyw") == 0)
-		--len;	/* pretend 'w' isn't there */
-#endif
-	memcpy(buf, pathname, len);
-	buf[len] = Py_OptimizeFlag ? 'o' : 'c';
-	buf[len+1] = '\0';
+	/* Find the last path separator and copy everything from the start of
+	   the source string up to and including the separator.
+	*/
+	if ((pos = rightmost_sep(pathname)) == NULL) {
+		i = 0;
+	}
+	else {
+		sep = *pos;
+		i = pos - pathname + 1;
+		strncpy(buf, pathname, i);
+	}
 
+	save = i;
+	buf[i++] = '\0';
+	/* Add __pycache__/ */
+	strcat(buf, CACHEDIR);
+	i += strlen(CACHEDIR) - 1;
+	buf[i++] = sep;
+	buf[i++] = '\0';
+	/* Add the base filename, but remove the .py or .pyw extension, since
+	   the tag name must go before the extension.
+	*/
+	strcat(buf, pathname + save);
+	if ((pos = strrchr(buf, '.')) != NULL)
+		*++pos = '\0';
+	strcat(buf, pyc_tag);
+	/* The length test above assumes that we're only adding one character
+	   to the end of what would normally be the extension.  What if there
+	   is no extension, or the string ends in '.' or '.p', and otherwise
+	   fills the buffer?  By appending 4 more characters onto the string
+	   here, we could overrun the buffer.
+
+	   As a simple example, let's say buflen=32 and the input string is
+	   'xxx.py'.  strlen() would be 6 and the test above would yield:
+
+	   (6 + 11 + 10 + 5 == 32) > 32
+
+	   which is false and so the name mangling would continue.  This would
+	   be fine because we'd end up with this string in buf:
+
+	   __pycache__/xxx.cpython-32.pyc\0
+
+	   strlen(of that) == 30 + the nul fits inside a 32 character buffer.
+	   We can even handle an input string of say 'xxxxx' above because
+	   that's (5 + 11 + 10 + 5 == 31) > 32 which is also false.  Name
+	   mangling that yields:
+
+	   __pycache__/xxxxxcpython-32.pyc\0
+
+	   which is 32 characters including the nul, and thus fits in the
+	   buffer. However, an input string of 'xxxxxx' would yield a result
+	   string of:
+
+	   __pycache__/xxxxxxcpython-32.pyc\0
+
+	   which is 33 characters long (including the nul), thus overflowing
+	   the buffer, even though the first test would fail, i.e.: the input
+	   string is also 6 characters long, so 32 > 32 is false.
+
+	   The reason the first test fails but we still overflow the buffer is
+	   that the test above only expects to add one extra character to be
+	   added to the extension, and here we're adding three (pyc).  We
+	   don't add the first dot, so that reclaims one of expected
+	   positions, leaving us overflowing by 1 byte (3 extra - 1 reclaimed
+	   dot - 1 expected extra == 1 overflowed).
+
+	   The best we can do is ensure that we still have enough room in the
+	   target buffer before we write the extension.  Because it's always
+	   only the extension that can cause the overflow, and never the other
+	   path bytes we've written, it's sufficient to just do one more test
+	   here.  Still, the assertion that follows can't hurt.
+	*/
+#if 0
+	printf("strlen(buf): %d; buflen: %d\n", (int)strlen(buf), (int)buflen);
+#endif
+	if (strlen(buf) + 5 > buflen)
+		return NULL;
+	strcat(buf, debug ? ".pyc" : ".pyo");
+	assert(strlen(buf) < buflen);
 	return buf;
 }
 
 
+/* Given a pathname to a Python byte compiled file, return the path to the
+   source file, if the path matches the PEP 3147 format.  This does not check
+   for any file existence, however, if the pyc file name does not match PEP
+   3147 style, NULL is returned.  buf must be at least as big as pathname;
+   the resulting path will always be shorter. */
+   
+static char *
+make_source_pathname(char *pathname, char *buf)
+{
+	/* __pycache__/foo.<tag>.pyc -> foo.py */
+	size_t i, j;
+	char *left, *right, *dot0, *dot1, sep;
+
+	/* Look back two slashes from the end.  In between these two slashes
+	   must be the string __pycache__ or this is not a PEP 3147 style
+	   path.  It's possible for there to be only one slash.
+	*/
+	if ((right = rightmost_sep(pathname)) == NULL)
+		return NULL;
+	sep = *right;
+	*right = '\0';
+	left = rightmost_sep(pathname);
+	*right = sep;
+	if (left == NULL)
+		left = pathname;
+	else
+		left++;
+	if (right-left != strlen(CACHEDIR) ||
+	    strncmp(left, CACHEDIR, right-left) != 0)
+		return NULL;
+
+	/* Now verify that the path component to the right of the last slash
+	   has two dots in it.
+	*/
+	if ((dot0 = strchr(right + 1, '.')) == NULL)
+		return NULL;
+	if ((dot1 = strchr(dot0 + 1, '.')) == NULL)
+		return NULL;
+	/* Too many dots? */
+	if (strchr(dot1 + 1, '.') != NULL)
+		return NULL;
+
+	/* This is a PEP 3147 path.  Start by copying everything from the
+	   start of pathname up to and including the leftmost slash.  Then
+	   copy the file's basename, removing the magic tag and adding a .py
+	   suffix.
+	*/
+	strncpy(buf, pathname, (i=left-pathname));
+	strncpy(buf+i, right+1, (j=dot0-right));
+	strcpy(buf+i+j, "py");
+	return buf;
+}
+
 /* Given a pathname for a Python source file, its time of last
    modification, and a pathname for a compiled file, check whether the
    compiled file represents the same version of the source.  If so,
@@ -846,7 +1054,8 @@
 	if (Py_VerboseFlag)
 		PySys_WriteStderr("import %s # precompiled from %s\n",
 			name, cpathname);
-	m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, cpathname);
+	m = PyImport_ExecCodeModuleWithPathnames(
+		name, (PyObject *)co, cpathname, cpathname);
 	Py_DECREF(co);
 
 	return m;
@@ -919,12 +1128,41 @@
 write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
 {
 	FILE *fp;
+	char *dirpath;
 	time_t mtime = srcstat->st_mtime;
 #ifdef MS_WINDOWS   /* since Windows uses different permissions  */
 	mode_t mode = srcstat->st_mode & ~S_IEXEC;
+	mode_t dirmode = srcstat->st_mode | S_IEXEC; /* XXX Is this correct
+							for Windows?
+							2010-04-07 BAW */
 #else
 	mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH;
-#endif
+	mode_t dirmode = (srcstat->st_mode |
+                          S_IXUSR | S_IXGRP | S_IXOTH |
+                          S_IWUSR | S_IWGRP | S_IWOTH);
+#endif
+	int saved;
+
+	/* Ensure that the __pycache__ directory exists. */
+	dirpath = rightmost_sep(cpathname);
+	if (dirpath == NULL) {
+		if (Py_VerboseFlag)
+			PySys_WriteStderr(
+				"# no %s path found %s\n",
+				CACHEDIR, cpathname);
+		return;
+	}
+	saved = *dirpath;
+	*dirpath = '\0';
+	/* XXX call os.mkdir() or maybe CreateDirectoryA() on Windows? */
+	if (mkdir(cpathname, dirmode) < 0 && errno != EEXIST) {
+		*dirpath = saved;
+		if (Py_VerboseFlag)
+			PySys_WriteStderr(
+				"# cannot create cache dir %s\n", cpathname);
+		return;
+	}
+	*dirpath = saved;
 
 	fp = open_exclusive(cpathname, mode);
 	if (fp == NULL) {
@@ -1032,8 +1270,8 @@
 		return NULL;
 	}
 #endif
-	cpathname = make_compiled_pathname(pathname, buf,
-					   (size_t)MAXPATHLEN + 1);
+	cpathname = make_compiled_pathname(
+		pathname, buf, (size_t)MAXPATHLEN + 1, !Py_OptimizeFlag);
 	if (cpathname != NULL &&
 	    (fpc = check_compiled_module(pathname, st.st_mtime, cpathname))) {
 		co = read_compiled_module(cpathname, fpc);
@@ -1060,7 +1298,8 @@
 				write_compiled_module(co, cpathname, &st);
 		}
 	}
-	m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname);
+	m = PyImport_ExecCodeModuleWithPathnames(
+		name, (PyObject *)co, pathname, cpathname);
 	Py_DECREF(co);
 
 	return m;
@@ -1070,7 +1309,7 @@
  * Returns the path to the py file if available, else the given path
  */
 static PyObject *
-get_sourcefile(const char *file)
+get_sourcefile(char *file)
 {
 	char py[MAXPATHLEN + 1];
 	Py_ssize_t len;
@@ -1087,8 +1326,15 @@
 		return PyUnicode_DecodeFSDefault(file);
 	}
 
-	strncpy(py, file, len-1);
-	py[len-1] = '\0';
+	/* Start by trying to turn PEP 3147 path into source path.  If that
+	 * fails, just chop off the trailing character, i.e. legacy pyc path
+	 * to py.
+	 */
+	if (make_source_pathname(file, py) == NULL) {
+		strncpy(py, file, len-1);
+		py[len-1] = '\0';
+	}
+
 	if (stat(py, &statbuf) == 0 &&
 		S_ISREG(statbuf.st_mode)) {
 		u = PyUnicode_DecodeFSDefault(py);
@@ -2813,16 +3059,28 @@
 */
 
 static PyObject *
-imp_get_magic(PyObject *self, PyObject *noargs)
+imp_make_magic(long magic)
 {
 	char buf[4];
 
-	buf[0] = (char) ((pyc_magic >>  0) & 0xff);
-	buf[1] = (char) ((pyc_magic >>  8) & 0xff);
-	buf[2] = (char) ((pyc_magic >> 16) & 0xff);
-	buf[3] = (char) ((pyc_magic >> 24) & 0xff);
+	buf[0] = (char) ((magic >>  0) & 0xff);
+	buf[1] = (char) ((magic >>  8) & 0xff);
+	buf[2] = (char) ((magic >> 16) & 0xff);
+	buf[3] = (char) ((magic >> 24) & 0xff);
 
 	return PyBytes_FromStringAndSize(buf, 4);
+};	
+
+static PyObject *
+imp_get_magic(PyObject *self, PyObject *noargs)
+{
+	return imp_make_magic(pyc_magic);
+}
+
+static PyObject *
+imp_get_tag(PyObject *self, PyObject *noargs)
+{
+	return PyUnicode_FromString(pyc_tag);
 }
 
 static PyObject *
@@ -3190,6 +3448,75 @@
 \n\
 Reload the module.  The module must have been successfully imported before.");
 
+static PyObject *
+imp_cache_from_source(PyObject *self, PyObject *args, PyObject *kws)
+{
+	static char *kwlist[] = {"path", "debug_override", NULL};
+
+	char buf[MAXPATHLEN+1];
+	char *pathname, *cpathname;
+	PyObject *debug_override = Py_None;
+	int debug = !Py_OptimizeFlag;
+
+	if (!PyArg_ParseTupleAndKeywords(
+		    args, kws, "es|O", kwlist,
+		    Py_FileSystemDefaultEncoding, &pathname, &debug_override))
+		return NULL;
+
+	if (debug_override != Py_None)
+		if ((debug = PyObject_IsTrue(debug_override)) < 0)
+			return NULL;
+
+	cpathname = make_compiled_pathname(pathname, buf, MAXPATHLEN+1, debug);
+	PyMem_Free(pathname);
+
+	if (cpathname == NULL) {
+		PyErr_Format(PyExc_SystemError, "path buffer too short");
+		return NULL;
+	}
+	return PyUnicode_FromString(buf);
+}
+
+PyDoc_STRVAR(doc_cache_from_source,
+"Given the path to a .py file, return the path to its .pyc/.pyo file.\n\
+\n\
+The .py file does not need to exist; this simply returns the path to the\n\
+.pyc/.pyo file calculated as if the .py file were imported.  The extension\n\
+will be .pyc unless __debug__ is not defined, then it will be .pyo.\n\
+\n\
+If debug_override is not None, then it must be a boolean and is taken as\n\
+the value of __debug__ instead.");
+
+static PyObject *
+imp_source_from_cache(PyObject *self, PyObject *args, PyObject *kws)
+{
+	static char *kwlist[] = {"path", NULL};
+
+	char *pathname;
+	char buf[MAXPATHLEN+1];
+
+	if (!PyArg_ParseTupleAndKeywords(
+		    args, kws, "es", kwlist,
+		    Py_FileSystemDefaultEncoding, &pathname))
+		return NULL;
+
+	if (make_source_pathname(pathname, buf) == NULL) {
+		PyErr_Format(PyExc_ValueError, "Not a PEP 3147 pyc path: %s",
+			     pathname);
+		PyMem_Free(pathname);
+		return NULL;
+	}
+	PyMem_Free(pathname);
+	return PyUnicode_FromString(buf);
+}
+
+PyDoc_STRVAR(doc_source_from_cache,
+"Given the path to a .pyc./.pyo file, return the path to its .py file.\n\
+\n\
+The .pyc/.pyo file does not need to exist; this simply returns the path to\n\
+the .py file calculated to correspond to the .pyc/.pyo file.  If path\n\
+does not conform to PEP 3147 format, ValueError will be raised.");
+
 /* Doc strings */
 
 PyDoc_STRVAR(doc_imp,
@@ -3212,6 +3539,10 @@
 "get_magic() -> string\n\
 Return the magic number for .pyc or .pyo files.");
 
+PyDoc_STRVAR(doc_get_tag,
+"get_tag() -> string\n\
+Return the magic tag for .pyc or .pyo files.");
+
 PyDoc_STRVAR(doc_get_suffixes,
 "get_suffixes() -> [(suffix, mode, type), ...]\n\
 Return a list of (suffix, mode, type) tuples describing the files\n\
@@ -3242,6 +3573,7 @@
 static PyMethodDef imp_methods[] = {
 	{"find_module",	 imp_find_module,  METH_VARARGS, doc_find_module},
 	{"get_magic",	 imp_get_magic,	   METH_NOARGS,  doc_get_magic},
+	{"get_tag",	 imp_get_tag,	   METH_NOARGS,  doc_get_tag},
 	{"get_suffixes", imp_get_suffixes, METH_NOARGS,  doc_get_suffixes},
 	{"load_module",	 imp_load_module,  METH_VARARGS, doc_load_module},
 	{"new_module",	 imp_new_module,   METH_VARARGS, doc_new_module},
@@ -3249,6 +3581,10 @@
 	{"acquire_lock", imp_acquire_lock, METH_NOARGS,  doc_acquire_lock},
 	{"release_lock", imp_release_lock, METH_NOARGS,  doc_release_lock},
 	{"reload",       imp_reload,       METH_O,       doc_reload},
+	{"cache_from_source", (PyCFunction)imp_cache_from_source,
+	 METH_VARARGS | METH_KEYWORDS, doc_cache_from_source},
+	{"source_from_cache", (PyCFunction)imp_source_from_cache,
+	 METH_VARARGS | METH_KEYWORDS, doc_source_from_cache},
 	/* The rest are obsolete */
 	{"get_frozen_object",	imp_get_frozen_object,	METH_VARARGS},
 	{"is_frozen_package",   imp_is_frozen_package,  METH_VARARGS},
@@ -3436,7 +3772,6 @@
   failure:
 	Py_XDECREF(m);
 	return NULL;
-
 }
 
 

Modified: python/branches/py3k-cdecimal/Python/pythonrun.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/pythonrun.c	(original)
+++ python/branches/py3k-cdecimal/Python/pythonrun.c	Wed Apr 21 13:06:18 2010
@@ -1155,6 +1155,8 @@
 			Py_DECREF(f);
 			return -1;
 		}
+		if (PyDict_SetItemString(d, "__cached__", Py_None) < 0)
+			return -1;
 		set_file_name = 1;
 		Py_DECREF(f);
 	}

Modified: python/branches/py3k-cdecimal/Python/thread_nt.h
==============================================================================
--- python/branches/py3k-cdecimal/Python/thread_nt.h	(original)
+++ python/branches/py3k-cdecimal/Python/thread_nt.h	Wed Apr 21 13:06:18 2010
@@ -34,13 +34,13 @@
 }
 
 DWORD
-EnterNonRecursiveMutex(PNRMUTEX mutex, BOOL wait)
+EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
 {
 	/* Assume that the thread waits successfully */
 	DWORD ret ;
 
 	/* InterlockedIncrement(&mutex->owned) == 0 means that no thread currently owns the mutex */
-	if (!wait)
+	if (milliseconds == 0)
 	{
 		if (InterlockedCompareExchange(&mutex->owned, 0, -1) != -1)
 			return WAIT_TIMEOUT ;
@@ -49,7 +49,7 @@
 	else
 		ret = InterlockedIncrement(&mutex->owned) ?
 			/* Some thread owns the mutex, let's wait... */
-			WaitForSingleObject(mutex->hevent, INFINITE) : WAIT_OBJECT_0 ;
+			WaitForSingleObject(mutex->hevent, milliseconds) : WAIT_OBJECT_0 ;
 
 	mutex->thread_id = GetCurrentThreadId() ; /* We own it */
 	return ret ;
@@ -239,18 +239,37 @@
  * if the lock has already been acquired by this thread!
  */
 int
-PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
+PyThread_acquire_lock_timed(PyThread_type_lock aLock, PY_TIMEOUT_T microseconds)
 {
 	int success ;
+	PY_TIMEOUT_T milliseconds;
+
+	if (microseconds >= 0) {
+		milliseconds = microseconds / 1000;
+		if (microseconds % 1000 > 0)
+			++milliseconds;
+		if ((DWORD) milliseconds != milliseconds)
+			Py_FatalError("Timeout too large for a DWORD, "
+				       "please check PY_TIMEOUT_MAX");
+	}
+	else
+		milliseconds = INFINITE;
 
-	dprintf(("%ld: PyThread_acquire_lock(%p, %d) called\n", PyThread_get_thread_ident(),aLock, waitflag));
+	dprintf(("%ld: PyThread_acquire_lock_timed(%p, %lld) called\n",
+		 PyThread_get_thread_ident(), aLock, microseconds));
 
-	success = aLock && EnterNonRecursiveMutex((PNRMUTEX) aLock, (waitflag ? INFINITE : 0)) == WAIT_OBJECT_0 ;
+	success = aLock && EnterNonRecursiveMutex((PNRMUTEX) aLock, (DWORD) milliseconds) == WAIT_OBJECT_0 ;
 
-	dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
+	dprintf(("%ld: PyThread_acquire_lock(%p, %lld) -> %d\n",
+		 PyThread_get_thread_ident(), aLock, microseconds, success));
 
 	return success;
 }
+int
+PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
+{
+	return PyThread_acquire_lock_timed(aLock, waitflag ? -1 : 0);
+}
 
 void
 PyThread_release_lock(PyThread_type_lock aLock)

Modified: python/branches/py3k-cdecimal/Python/thread_pthread.h
==============================================================================
--- python/branches/py3k-cdecimal/Python/thread_pthread.h	(original)
+++ python/branches/py3k-cdecimal/Python/thread_pthread.h	Wed Apr 21 13:06:18 2010
@@ -83,6 +83,26 @@
 #endif
 
 
+/* We assume all modern POSIX systems have gettimeofday() */
+#ifdef GETTIMEOFDAY_NO_TZ
+#define GETTIMEOFDAY(ptv) gettimeofday(ptv)
+#else
+#define GETTIMEOFDAY(ptv) gettimeofday(ptv, (struct timezone *)NULL)
+#endif
+
+#define MICROSECONDS_TO_TIMESPEC(microseconds, ts) \
+do { \
+	struct timeval tv; \
+	GETTIMEOFDAY(&tv); \
+	tv.tv_usec += microseconds % 1000000; \
+	tv.tv_sec += microseconds / 1000000; \
+	tv.tv_sec += tv.tv_usec / 1000000; \
+	tv.tv_usec %= 1000000; \
+	ts.tv_sec = tv.tv_sec; \
+	ts.tv_nsec = tv.tv_usec * 1000; \
+} while(0)
+
+
 /* A pthread mutex isn't sufficient to model the Python lock type
  * because, according to Draft 5 of the docs (P1003.4a/D5), both of the
  * following are undefined:
@@ -295,34 +315,53 @@
 	return (status == -1) ? errno : status;
 }
 
-int 
-PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
+int
+PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds)
 {
 	int success;
 	sem_t *thelock = (sem_t *)lock;
 	int status, error = 0;
+	struct timespec ts;
 
-	dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
+	dprintf(("PyThread_acquire_lock_timed(%p, %lld) called\n",
+		 lock, microseconds));
 
+	if (microseconds > 0)
+		MICROSECONDS_TO_TIMESPEC(microseconds, ts);
 	do {
-		if (waitflag)
-			status = fix_status(sem_wait(thelock));
-		else
+		if (microseconds > 0)
+			status = fix_status(sem_timedwait(thelock, &ts));
+		else if (microseconds == 0)
 			status = fix_status(sem_trywait(thelock));
+		else
+			status = fix_status(sem_wait(thelock));
 	} while (status == EINTR); /* Retry if interrupted by a signal */
 
-	if (waitflag) {
+	if (microseconds > 0) {
+		if (status != ETIMEDOUT)
+			CHECK_STATUS("sem_timedwait");
+	}
+	else if (microseconds == 0) {
+		if (status != EAGAIN)
+			CHECK_STATUS("sem_trywait");
+	}
+	else {
 		CHECK_STATUS("sem_wait");
-	} else if (status != EAGAIN) {
-		CHECK_STATUS("sem_trywait");
 	}
 	
 	success = (status == 0) ? 1 : 0;
 
-	dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
+	dprintf(("PyThread_acquire_lock_timed(%p, %lld) -> %d\n",
+		 lock, microseconds, success));
 	return success;
 }
 
+int 
+PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
+{
+	return PyThread_acquire_lock_timed(lock, waitflag ? -1 : 0);
+}
+
 void 
 PyThread_release_lock(PyThread_type_lock lock)
 {
@@ -390,40 +429,62 @@
 	free((void *)thelock);
 }
 
-int 
-PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
+int
+PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds)
 {
 	int success;
 	pthread_lock *thelock = (pthread_lock *)lock;
 	int status, error = 0;
 
-	dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
+	dprintf(("PyThread_acquire_lock_timed(%p, %lld) called\n",
+		 lock, microseconds));
 
 	status = pthread_mutex_lock( &thelock->mut );
 	CHECK_STATUS("pthread_mutex_lock[1]");
 	success = thelock->locked == 0;
 
-	if ( !success && waitflag ) {
+	if (!success && microseconds != 0) {
+		struct timespec ts;
+		if (microseconds > 0)
+			MICROSECONDS_TO_TIMESPEC(microseconds, ts);
 		/* continue trying until we get the lock */
 
 		/* mut must be locked by me -- part of the condition
 		 * protocol */
-		while ( thelock->locked ) {
-			status = pthread_cond_wait(&thelock->lock_released,
-						   &thelock->mut);
-			CHECK_STATUS("pthread_cond_wait");
+		while (thelock->locked) {
+			if (microseconds > 0) {
+				status = pthread_cond_timedwait(
+					&thelock->lock_released,
+					&thelock->mut, &ts);
+				if (status == ETIMEDOUT)
+					break;
+				CHECK_STATUS("pthread_cond_timed_wait");
+			}
+			else {
+				status = pthread_cond_wait(
+					&thelock->lock_released,
+					&thelock->mut);
+				CHECK_STATUS("pthread_cond_wait");
+			}
 		}
-		success = 1;
+		success = (status == 0);
 	}
 	if (success) thelock->locked = 1;
 	status = pthread_mutex_unlock( &thelock->mut );
 	CHECK_STATUS("pthread_mutex_unlock[1]");
 
 	if (error) success = 0;
-	dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
+	dprintf(("PyThread_acquire_lock_timed(%p, %lld) -> %d\n",
+		 lock, microseconds, success));
 	return success;
 }
 
+int 
+PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
+{
+	return PyThread_acquire_lock_timed(lock, waitflag ? -1 : 0);
+}
+
 void 
 PyThread_release_lock(PyThread_type_lock lock)
 {

Modified: python/branches/py3k-cdecimal/Tools/README
==============================================================================
--- python/branches/py3k-cdecimal/Tools/README	(original)
+++ python/branches/py3k-cdecimal/Tools/README	Wed Apr 21 13:06:18 2010
@@ -16,6 +16,9 @@
 
 freeze		Create a stand-alone executable from a Python program.
 
+gdb             Python code to be run inside gdb, to make it easier to
+                debug Python itself (by David Malcolm).
+
 i18n		Tools for internationalization. pygettext.py 
 		parses Python source code and generates .pot files,
 		and msgfmt.py generates a binary message catalog 

Modified: python/branches/py3k-cdecimal/Tools/i18n/makelocalealias.py
==============================================================================
--- python/branches/py3k-cdecimal/Tools/i18n/makelocalealias.py	(original)
+++ python/branches/py3k-cdecimal/Tools/i18n/makelocalealias.py	Wed Apr 21 13:06:18 2010
@@ -9,7 +9,7 @@
 import locale
 
 # Location of the alias file
-LOCALE_ALIAS = '/usr/lib/X11/locale/locale.alias'
+LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias'
 
 def parse(filename):
 

Modified: python/branches/py3k-cdecimal/configure
==============================================================================
--- python/branches/py3k-cdecimal/configure	(original)
+++ python/branches/py3k-cdecimal/configure	Wed Apr 21 13:06:18 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 79550 .
+# From configure.in Revision: 80191 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.2.
 #
@@ -3834,7 +3834,7 @@
   { echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6; }
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 
 
@@ -4693,6 +4693,22 @@
 	Darwin*)
 	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
 	    # used to be here, but non-Apple gcc doesn't accept them.
+            if test "${CC}" = gcc
+	    then
+		{ echo "$as_me:$LINENO: checking which compiler should be used" >&5
+echo $ECHO_N "checking which compiler should be used... $ECHO_C" >&6; }
+		case "${UNIVERSALSDK}" in
+		*/MacOSX10.4u.sdk)
+			# Build using 10.4 SDK, force usage of gcc when the
+			# compiler is gcc, otherwise the user will get very
+			# confusing error messages when building on OSX 10.6
+			CC=gcc-4.0
+			CPP=cpp-4.0
+			;;
+		esac
+		{ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+	    fi
 
 
 	    if test "${enable_universalsdk}"; then
@@ -4700,40 +4716,7 @@
 	        if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
 		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
 		   ARCH_RUN_32BIT=""
-		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
-
-                   # You have to use different flags on various versions of
-		   # OSX to extract PPC code from an universal binary, basically
-                   # '-arch ppc' on OSX 10.4 and '-arch ppc7400' on anything
-                   # newer.
-                   # Because '-arch pp7400' works on OSX 10.5 or higher this
-                   # test is only present in the '32-bit' branch, all other
-                   # branches require OSX 10.5 to compile.
-
-		   { echo "$as_me:$LINENO: checking lipo flag for extracting ppc code" >&5
-echo $ECHO_N "checking lipo flag for extracting ppc code... $ECHO_C" >&6; }
-		   FN="test.$$"
-		   cat >${FN}.c <<-EOF
-		        int main() { return 0; }
-EOF
-		   ${CC} ${CFLAGS} -arch ppc -arch i386 -o ${FN} ${FN}.c -isysroot ${UNIVERSALSDK}
-		   if test $? != 0 ; then
-			   rm ${FN} ${FN}.c
-			   { echo "$as_me:$LINENO: result: failed, assumee -extract ppc7400" >&5
-echo "${ECHO_T}failed, assumee -extract ppc7400" >&6; }
-		   else
-			   lipo "${FN}" -extract ppc7400 -output "${FN}.out" 2>/dev/null
-			   if test $? != 0 ; then
-			       LIPO_32BIT_FLAGS="-extract ppc -extract i386"
-			       { echo "$as_me:$LINENO: result: \"'-extract ppc'\"" >&5
-echo "${ECHO_T}\"'-extract ppc'\"" >&6; }
-			   else
-			       { echo "$as_me:$LINENO: result: \"'-extract ppc7400'\"" >&5
-echo "${ECHO_T}\"'-extract ppc7400'\"" >&6; }
-			   fi
-			   rm -f ${FN} ${FN}.c ${FN}.out
-		   fi
-
+		   LIPO_32BIT_FLAGS=""
 	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
 		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
 		   LIPO_32BIT_FLAGS=""
@@ -4762,10 +4745,12 @@
 		 fi
 
 
-		BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
-		tgt=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
-		if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
-			CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		if test "${UNIVERSALSDK}" != "/"
+		then
+			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
 		fi
 	    fi
 
@@ -5454,7 +5439,7 @@
 else
   ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -5475,7 +5460,7 @@
 else
   ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -6575,7 +6560,7 @@
 
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 { echo "$as_me:$LINENO: result: $was_it_defined" >&5
 echo "${ECHO_T}$was_it_defined" >&6; }
@@ -7105,7 +7090,7 @@
 else
   ac_cv_type_uid_t=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
@@ -15808,7 +15793,7 @@
 else
   unistd_defines_pthreads=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
     { echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5
 echo "${ECHO_T}$unistd_defines_pthreads" >&6; }
@@ -17106,7 +17091,7 @@
   $EGREP "yes" >/dev/null 2>&1; then
   ipv6type=$i
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		kame)
@@ -17129,7 +17114,7 @@
 				ipv6libdir=/usr/local/v6/lib
 				ipv6trylibc=yes
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		linux-glibc)
@@ -17150,7 +17135,7 @@
   ipv6type=$i;
 				ipv6trylibc=yes
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		linux-inet6)
@@ -17188,7 +17173,7 @@
 				ipv6lib=inet6;
 				ipv6libdir=/usr/local/v6/lib
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		v6d)
@@ -17211,7 +17196,7 @@
 				ipv6libdir=/usr/local/v6/lib;
 				BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		zeta)
@@ -17233,7 +17218,7 @@
 				ipv6lib=inet6;
 				ipv6libdir=/usr/local/v6/lib
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		esac
@@ -25748,7 +25733,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -25767,7 +25752,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -26037,7 +26022,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 

Modified: python/branches/py3k-cdecimal/configure.in
==============================================================================
--- python/branches/py3k-cdecimal/configure.in	(original)
+++ python/branches/py3k-cdecimal/configure.in	Wed Apr 21 13:06:18 2010
@@ -908,6 +908,20 @@
 	Darwin*)
 	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
 	    # used to be here, but non-Apple gcc doesn't accept them.
+            if test "${CC}" = gcc
+	    then
+		AC_MSG_CHECKING(which compiler should be used)
+		case "${UNIVERSALSDK}" in
+		*/MacOSX10.4u.sdk)
+			# Build using 10.4 SDK, force usage of gcc when the 
+			# compiler is gcc, otherwise the user will get very
+			# confusing error messages when building on OSX 10.6
+			CC=gcc-4.0
+			CPP=cpp-4.0
+			;;
+		esac
+		AC_MSG_RESULT($CC)
+	    fi
 
 
 	    if test "${enable_universalsdk}"; then
@@ -915,36 +929,7 @@
 	        if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
 		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
 		   ARCH_RUN_32BIT=""
-		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
-
-                   # You have to use different flags on various versions of
-		   # OSX to extract PPC code from an universal binary, basically
-                   # '-arch ppc' on OSX 10.4 and '-arch ppc7400' on anything                   
-                   # newer. 
-                   # Because '-arch pp7400' works on OSX 10.5 or higher this
-                   # test is only present in the '32-bit' branch, all other
-                   # branches require OSX 10.5 to compile.
-
-		   AC_MSG_CHECKING(lipo flag for extracting ppc code)
-		   FN="test.$$"
-		   cat >${FN}.c <<-EOF
-		        int main() { return 0; }
-EOF
-		   ${CC} ${CFLAGS} -arch ppc -arch i386 -o ${FN} ${FN}.c -isysroot ${UNIVERSALSDK}
-		   if test $? != 0 ; then
-			   rm ${FN} ${FN}.c
-			   AC_MSG_RESULT([failed, assumee -extract ppc7400])
-		   else
-			   lipo "${FN}" -extract ppc7400 -output "${FN}.out" 2>/dev/null
-			   if test $? != 0 ; then
-			       LIPO_32BIT_FLAGS="-extract ppc -extract i386"
-			       AC_MSG_RESULT("'-extract ppc'")
-			   else
-			       AC_MSG_RESULT("'-extract ppc7400'")
-			   fi
-			   rm -f ${FN} ${FN}.c ${FN}.out
-		   fi
-
+		   LIPO_32BIT_FLAGS=""
 	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
 		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
 		   LIPO_32BIT_FLAGS=""
@@ -971,10 +956,12 @@
 		 fi
 
 
-		BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
-		tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
-		if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
-			CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		if test "${UNIVERSALSDK}" != "/"
+		then
+			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
 		fi
 	    fi
 

Modified: python/branches/py3k-cdecimal/setup.py
==============================================================================
--- python/branches/py3k-cdecimal/setup.py	(original)
+++ python/branches/py3k-cdecimal/setup.py	Wed Apr 21 13:06:18 2010
@@ -1242,6 +1242,12 @@
                        Extension('_gestalt', ['_gestalt.c'],
                        extra_link_args=['-framework', 'Carbon'])
                        )
+            exts.append(
+                       Extension('_scproxy', ['_scproxy.c'],
+                       extra_link_args=[
+                           '-framework', 'SystemConfiguration',
+                           '-framework', 'CoreFoundation',
+                        ]))
 
         self.extensions.extend(exts)
 


More information about the Python-checkins mailing list