[Python-checkins] r87937 - in python/branches/py3k-cdecimal: Doc/ACKS.txt Doc/Makefile Doc/README.txt Doc/c-api/arg.rst Doc/glossary.rst Doc/howto/logging.rst Doc/howto/regex.rst Doc/library/argparse.rst Doc/library/ast.rst Doc/library/atexit.rst Doc/library/bisect.rst Doc/library/calendar.rst Doc/library/cmd.rst Doc/library/collections.rst Doc/library/contextlib.rst Doc/library/csv.rst Doc/library/datetime.rst Doc/library/decimal.rst Doc/library/dis.rst Doc/library/email.charset.rst Doc/library/email.generator.rst Doc/library/email.header.rst Doc/library/email.message.rst Doc/library/exceptions.rst Doc/library/filecmp.rst Doc/library/fileinput.rst Doc/library/fnmatch.rst Doc/library/functional.rst Doc/library/functools.rst Doc/library/glob.rst Doc/library/heapq.rst Doc/library/index.rst Doc/library/inspect.rst Doc/library/keyword.rst Doc/library/linecache.rst Doc/library/numeric.rst Doc/library/operator.rst Doc/library/optparse.rst Doc/library/pprint.rst Doc/library/pyexpat.rst Doc/library/queue.rst Doc/library/quopri.rst Doc/library/random.rst Doc/library/sched.rst Doc/library/shelve.rst Doc/library/shutil.rst Doc/library/socket.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/library/string.rst Doc/library/textwrap.rst Doc/library/threading.rst Doc/library/time.rst Doc/library/tokenize.rst Doc/library/trace.rst Doc/library/unittest.rst Doc/library/uu.rst Doc/library/wave.rst Doc/library/zlib.rst Doc/reference/compound_stmts.rst Doc/reference/executionmodel.rst Doc/tools/sphinxext/download.html Doc/tools/sphinxext/indexcontent.html Doc/whatsnew/3.2.rst Include/abstract.h Include/memoryobject.h Include/object.h Include/objimpl.h Include/typeslots.h Lib/_pyio.py Lib/ast.py Lib/bdb.py Lib/collections.py Lib/concurrent/futures/process.py Lib/contextlib.py Lib/datetime.py Lib/email/charset.py Lib/email/header.py Lib/email/message.py Lib/email/test/test_email.py Lib/encodings/aliases.py Lib/functools.py Lib/imaplib.py Lib/multiprocessing/connection.py Lib/pydoc.py Lib/socket.py Lib/subprocess.py Lib/test/datetimetester.py Lib/test/regrtest.py Lib/test/sha256.pem Lib/test/support.py Lib/test/test_array.py Lib/test/test_ast.py Lib/test/test_atexit.py Lib/test/test_bytes.py Lib/test/test_collections.py Lib/test/test_concurrent_futures.py Lib/test/test_functools.py Lib/test/test_httplib.py Lib/test/test_imaplib.py Lib/test/test_io.py Lib/test/test_os.py Lib/test/test_pyexpat.py Lib/test/test_site.py Lib/test/test_socket.py Lib/test/test_socketserver.py Lib/test/test_ssl.py Lib/test/test_subprocess.py Lib/test/test_sys.py Lib/test/test_threading.py Lib/test/test_threadsignals.py Lib/test/test_time.py Lib/test/test_timeout.py Lib/test/test_ttk_guionly.py Lib/test/test_unicode.py Lib/test/test_urllib2.py Lib/test/test_winreg.py Lib/test/test_with.py Lib/test/test_wsgiref.py Lib/test/test_xml_etree_c.py Lib/test/test_xmlrpc.py Lib/test/test_zipimport_support.py Lib/test/test_zlib.py Lib/threading.py Lib/tkinter/test/test_tkinter/test_loadtk.py Lib/unittest/case.py Lib/unittest/test/test_assertions.py Lib/unittest/test/test_case.py Lib/wsgiref/handlers.py Mac/IDLE/IDLE.app/Contents/Info.plist Mac/Makefile.in Mac/PythonLauncher/Info.plist.in Mac/Resources/app/Info.plist.in Mac/Resources/framework/Info.plist.in Misc/ACKS Misc/NEWS Misc/developers.txt Modules/_collectionsmodule.c Modules/_ctypes/_ctypes.c Modules/_datetimemodule.c Modules/_io/fileio.c Modules/_io/textio.c Modules/_posixsubprocess.c Modules/_testcapimodule.c Modules/atexitmodule.c Modules/audioop.c Modules/gcmodule.c Modules/main.c Modules/md5module.c Modules/posixmodule.c Modules/pyexpat.c Modules/selectmodule.c Modules/sha1module.c Modules/sha256module.c Modules/sha512module.c Modules/timemodule.c Modules/unicodedata.c Modules/zlibmodule.c Objects/codeobject.c Objects/fileobject.c Objects/listobject.c Objects/obmalloc.c Objects/typeobject.c Objects/typeslots.inc Objects/typeslots.py PC/python3.def Parser/tokenizer.c Python/ceval.c Python/getargs.c Python/pythonrun.c Python/sysmodule.c Tools/README Tools/unittestgui configure configure.in

stefan.krah python-checkins at python.org
Tue Jan 11 18:07:57 CET 2011


Author: stefan.krah
Date: Tue Jan 11 18:07:55 2011
New Revision: 87937

Log:
Merged revisions 87627-87628,87638-87639,87642,87646,87648,87651,87653-87657,87665-87667,87671-87673,87677-87689,87691,87695,87698,87703-87705,87710-87714,87716-87722,87728-87740,87744,87746-87750,87753-87762,87765-87769,87771-87784,87786-87792,87795-87797,87802,87805-87808,87810-87813,87820-87835,87838-87840,87843-87850,87853,87856,87858-87863,87865,87867-87871,87873,87876-87877,87890-87891,87895-87904,87906-87908,87910-87912,87914-87917,87919-87922,87924-87926 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87627 | georg.brandl | 2011-01-02 15:23:43 +0100 (Sun, 02 Jan 2011) | 1 line
  
  #1665333: add more docs for optparse.OptionGroup.
........
  r87628 | antoine.pitrou | 2011-01-02 17:16:09 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Relax test condition a lot
........
  r87638 | georg.brandl | 2011-01-02 20:07:51 +0100 (Sun, 02 Jan 2011) | 1 line
  
  Fix code indentation.
........
  r87639 | antoine.pitrou | 2011-01-02 20:34:03 +0100 (Sun, 02 Jan 2011) | 4 lines
  
  Issue #10475: Don't hardcode compilers for LDSHARED/LDCXXSHARED on NetBSD
  and DragonFly BSD.  Patch by Nicolas Joly.
........
  r87642 | victor.stinner | 2011-01-02 20:50:36 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Issue #10807: Remove base64, bz2, hex, quopri, rot13, uu and zlib codecs from
  the codec aliases. They are still accessible via codecs.lookup().
........
  r87646 | antoine.pitrou | 2011-01-02 21:45:21 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Fix bad quoting in r87639. Caught by Arfrever.
........
  r87648 | alexander.belopolsky | 2011-01-02 21:48:22 +0100 (Sun, 02 Jan 2011) | 1 line
  
  Issue #8013: Fixed time.asctime segfault when OS's asctime fails
........
  r87651 | gregory.p.smith | 2011-01-02 21:52:48 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  issue10802: fallback to pipe+fcntl when the pipe2 syscall fails with errno ENOSYS.
........
  r87653 | antoine.pitrou | 2011-01-02 23:06:53 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Clarify behaviour of close() and shutdown() on sockets.
........
  r87654 | antoine.pitrou | 2011-01-02 23:09:27 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Add a shutdown() call in the server example.
........
  r87655 | antoine.pitrou | 2011-01-02 23:12:22 +0100 (Sun, 02 Jan 2011) | 3 lines
  
  Some nits.
........
  r87656 | alexander.belopolsky | 2011-01-02 23:16:10 +0100 (Sun, 02 Jan 2011) | 1 line
  
  Issue #8013: Fixed test
........
  r87657 | georg.brandl | 2011-01-02 23:33:43 +0100 (Sun, 02 Jan 2011) | 5 lines
  
  #8013 follow-up:
  * In asctime and ctime, properly remove the newline if the year has more than four digits
  * Consistent error message for both functions
  * Fix the test comments and add a check for the removed newline
........
  r87665 | martin.v.loewis | 2011-01-03 01:07:01 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Issue #10798: Reject supporting concurrent.futures if the system has
  too few POSIX semaphores.
........
  r87666 | amaury.forgeotdarc | 2011-01-03 01:19:11 +0100 (Mon, 03 Jan 2011) | 4 lines
  
  #8278: In the Windows implementation of stat() and utime(),
  use time_t instead of int.  This gives support for dates after 2038,
  at least when compiled with VS2003 or later, where time_t is 64bit.
........
  r87667 | martin.v.loewis | 2011-01-03 01:19:59 +0100 (Mon, 03 Jan 2011) | 2 lines
  
  Skip hanging test.
........
  r87671 | raymond.hettinger | 2011-01-03 03:12:02 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Make C helper function more closely match the pure python version, and add tests.
........
  r87672 | raymond.hettinger | 2011-01-03 03:44:14 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Supply a reduce method for pickling.
........
  r87673 | brian.quinlan | 2011-01-03 03:56:39 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Removes the 'Call' class which is used to control execution order and is unreliable on Windows
........
  r87677 | senthil.kumaran | 2011-01-03 10:47:09 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  py3k implmentation of RSA algorithm,
........
  r87678 | senthil.kumaran | 2011-01-03 11:11:07 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Reverting the mistaken commit r87677. Checked in py3rsa.py by mistake.
........
  r87679 | michael.foord | 2011-01-03 13:55:11 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Issue 10786: unittest documentation update.
........
  r87680 | victor.stinner | 2011-01-03 15:30:39 +0100 (Mon, 03 Jan 2011) | 1 line
  
  test_sockserver: close servers when done
........
  r87681 | victor.stinner | 2011-01-03 15:30:41 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  test_timeout: move testRecvfromTimeout() to a UDP-specific test case
  
  Fix a ResourceWarning(unclosed socket).
........
  r87682 | victor.stinner | 2011-01-03 15:30:43 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  test_tkinter: use a context manager to close directly the pipe
  
  Patch written by Nadeem Vawda
........
  r87683 | victor.stinner | 2011-01-03 15:30:44 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  test_xmlrpc: close the transport when done
  
  Fix a ResourceWarning(unclosed socket). Patch written by Nadeem Vawda.
........
  r87684 | victor.stinner | 2011-01-03 15:30:46 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  test_socket: use context managers to close directly the socket
  
  Fix ResourceWarning(unclosed socket) warnings. Patch written by Nadeem Vawda.
........
  r87685 | michael.foord | 2011-01-03 16:39:49 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Issue 10502: addition of unittestgui to Tools/
........
  r87686 | victor.stinner | 2011-01-03 16:47:59 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Issue #10816: multiprocessing.SocketClient() closes the socket on error
  
  Use a context manager to close immediatly the socket on error.
........
  r87687 | victor.stinner | 2011-01-03 17:12:39 +0100 (Mon, 03 Jan 2011) | 1 line
  
  pydoc: close the DocServer when done
........
  r87688 | victor.stinner | 2011-01-03 17:36:00 +0100 (Mon, 03 Jan 2011) | 1 line
  
  test_subprocess: close pipes at the end of test_pipe_cloexec_real_tools()
........
  r87689 | michael.foord | 2011-01-03 18:00:11 +0100 (Mon, 03 Jan 2011) | 2 lines
  
  Enable unittest.TestCase to be instantiated without providing a method name.
  Changed unittestgui to show number of discovered tests in the status bar.
........
  r87691 | eric.araujo | 2011-01-03 18:51:11 +0100 (Mon, 03 Jan 2011) | 2 lines
  
  Fix test_site for systems without unsetenv.  Reported by Zsolt Cserna.
........
  r87695 | antoine.pitrou | 2011-01-03 19:23:55 +0100 (Mon, 03 Jan 2011) | 5 lines
  
  Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
  file descriptors (0, 1, 2) are closed in the parent process.  Initial
  patch by Ross Lagerwall.
........
  r87698 | antoine.pitrou | 2011-01-03 19:53:50 +0100 (Mon, 03 Jan 2011) | 4 lines
  
  Issue #7716: Under Solaris, don't assume existence of /usr/xpg4/bin/grep in
  the configure script but use $GREP instead.  Patch by Fabian Groffen.
........
  r87703 | michael.foord | 2011-01-03 20:13:02 +0100 (Mon, 03 Jan 2011) | 1 line
  
  Update description of Tools/unicode
........
  r87704 | antoine.pitrou | 2011-01-03 21:38:52 +0100 (Mon, 03 Jan 2011) | 5 lines
  
  Issue #6293: Have regrtest.py echo back sys.flags.  This is done by default
  in whole runs and enabled selectively using `--header` when running an
  explicit list of tests.  Original patch by Collin Winter.
........
  r87705 | antoine.pitrou | 2011-01-03 21:40:07 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Mention --randseed in option list
........
  r87710 | gregory.p.smith | 2011-01-03 22:06:12 +0100 (Mon, 03 Jan 2011) | 4 lines
  
  issue6643 - Two locks held within the threading module on each thread instance
  needed to be reinitialized after fork().  Adds tests to confirm that they are
  and that a potential deadlock and crasher bug are fixed (platform dependant).
........
  r87711 | gregory.p.smith | 2011-01-03 22:09:23 +0100 (Mon, 03 Jan 2011) | 2 lines
  
  news for 6643
........
  r87712 | antoine.pitrou | 2011-01-03 22:15:48 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Add a subprocess test of remapping standard file descriptors (issue #1187).
........
  r87713 | antoine.pitrou | 2011-01-03 23:12:43 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Temporary debug output for intermittent failures in test_subprocess
........
  r87714 | antoine.pitrou | 2011-01-03 23:24:52 +0100 (Mon, 03 Jan 2011) | 3 lines
  
  Add some more output
........
  r87716 | antoine.pitrou | 2011-01-04 00:42:01 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Un-complicate some code
........
  r87717 | victor.stinner | 2011-01-04 00:56:12 +0100 (Tue, 04 Jan 2011) | 1 line
  
  fix test_unittest: ignore DeprecationWarning on assertDictContainsSubset()
........
  r87718 | antoine.pitrou | 2011-01-04 01:00:31 +0100 (Tue, 04 Jan 2011) | 4 lines
  
  Issue #10333: Remove ancient GC API, which has been deprecated since
  Python 2.2.
........
  r87719 | victor.stinner | 2011-01-04 01:04:44 +0100 (Tue, 04 Jan 2011) | 1 line
  
  test_array: fix the DeprecationWarning('object.__init__() takes no parameters')
........
  r87720 | victor.stinner | 2011-01-04 01:04:46 +0100 (Tue, 04 Jan 2011) | 1 line
  
  test_httplib: fix a DeprecationWarning, assertEquals=>assertEqual
........
  r87721 | antoine.pitrou | 2011-01-04 01:24:03 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Issue #10267: Fix refleak in test_ttk_guionly.  Patch by Hirokazu Yamamoto.
........
  r87722 | victor.stinner | 2011-01-04 01:29:35 +0100 (Tue, 04 Jan 2011) | 2 lines
  
  Issue #9015, #9611: FileIO.readinto(), FileIO.write() and os.write() clamp the
  length to 2^31-1 on Windows.
........
  r87728 | victor.stinner | 2011-01-04 03:07:34 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
  doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
  (length bigger than 2^31-1).
........
  r87729 | victor.stinner | 2011-01-04 03:07:36 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Issue #8650: zlib.compress() and zlib.decompress() raise an OverflowError if
  the input buffer length doesn't fit into an unsigned int (length bigger than
  2^32-1 bytes).
........
  r87730 | victor.stinner | 2011-01-04 12:00:45 +0100 (Tue, 04 Jan 2011) | 2 lines
  
  Issue #10819: SocketIO.name property returns -1 when its closed, instead of
  raising a ValueError, to fix repr().
........
  r87731 | victor.stinner | 2011-01-04 12:16:48 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Issue #8992: Simplify addcleanup() API
  
  Don't need to handle unknown destructor anymore.
........
  r87732 | victor.stinner | 2011-01-04 12:16:49 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Issue #8992: convertsimple() doesn't need to fill msgbuf if an error occurred
  
  Return msgbug on error is enough.
........
  r87733 | victor.stinner | 2011-01-04 13:59:15 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Issue #9566: use Py_ssize_t instead of int
........
  r87734 | victor.stinner | 2011-01-04 14:15:39 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Issue #9015, #9611: stdprinter.write() clamps the length to 2^31-1 on Windows
........
  r87735 | vinay.sajip | 2011-01-04 14:58:49 +0100 (Tue, 04 Jan 2011) | 1 line
  
  logging HOWTO: fixed markup for numbered handler list.
........
  r87736 | alexander.belopolsky | 2011-01-04 17:34:30 +0100 (Tue, 04 Jan 2011) | 6 lines
  
  Issue #8013: time.asctime and time.ctime no longer call system asctime
  and ctime functions.  The year range for time.asctime is now 1900
  through maxint.  The range for time.ctime is the same as for
  time.localtime.  The string produced by these functions is longer than
  24 characters when year is greater than 9999.
........
  r87737 | alexander.belopolsky | 2011-01-04 18:08:04 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Issue #8013: Fix time.ctime test failure on 32-bit platforms.
........
  r87738 | alexander.belopolsky | 2011-01-04 18:15:52 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Whitespace cleanup
........
  r87739 | georg.brandl | 2011-01-04 18:27:13 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Fix exception catching.
........
  r87740 | gregory.p.smith | 2011-01-04 19:33:38 +0100 (Tue, 04 Jan 2011) | 6 lines
  
  Fix the new bug introduced in the r87710 fix for issue 6643.  DummyThread
  deletes its _block attribute, deal with that.  This prevents an uncaught
  exception in a thread during test_thread.
  
  This refactors a bit to better match what I did in the r87727 backport to 2.7.
........
  r87744 | antoine.pitrou | 2011-01-04 20:07:07 +0100 (Tue, 04 Jan 2011) | 4 lines
  
  In subprocess, wrap pipe fds before launching the child. Hopefully this
  will fix intermittent failures on some buildbots (issue #8458).
........
  r87746 | victor.stinner | 2011-01-04 22:58:10 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Issue #9566: explain why (int)len cannot underflow
........
  r87747 | victor.stinner | 2011-01-04 23:00:04 +0100 (Tue, 04 Jan 2011) | 1 line
  
  Issue #9566: PyUnicode_FromFormatV() doesn't support %zi, use %zd instead
........
  r87748 | antoine.pitrou | 2011-01-04 23:54:30 +0100 (Tue, 04 Jan 2011) | 3 lines
  
  Fix test_time under Windows
........
  r87749 | victor.stinner | 2011-01-05 01:19:28 +0100 (Wed, 05 Jan 2011) | 4 lines
  
  test_unicode: use ctypes to test PyUnicode_FromFormat()
  
  Instead of _testcapi.format_unicode() because it has a limited API: it requires
  exactly one argument of type unicode.
........
  r87750 | r.david.murray | 2011-01-05 02:39:32 +0100 (Wed, 05 Jan 2011) | 5 lines
  
  #10790: make append work when output codec is different from input codec
  
  There's still a bug here (the encode call shouldn't use the 'errors'
  paramter), but I'll fix that later.
........
  r87753 | victor.stinner | 2011-01-05 04:33:26 +0100 (Wed, 05 Jan 2011) | 4 lines
  
  Remove arbitrary string length limits
  
  PyUnicode_FromFormat() and PyErr_Format() allocates a buffer of the needed
  size, it is no more a fixed-buffer of 500 bytes.
........
  r87754 | victor.stinner | 2011-01-05 04:33:28 +0100 (Wed, 05 Jan 2011) | 1 line
  
  test_bytes: test PyBytes_FromFormat() using ctypes
........
  r87755 | victor.stinner | 2011-01-05 04:54:25 +0100 (Wed, 05 Jan 2011) | 1 line
  
  Issue #10756: atexit normalizes the exception before displaying it.
........
  r87756 | victor.stinner | 2011-01-05 04:54:26 +0100 (Wed, 05 Jan 2011) | 3 lines
  
  regrtest: close the new stdout and restore the original stdout at exit
  
  Fix a ResourceWarning(unclosed file).
........
  r87757 | victor.stinner | 2011-01-05 04:54:28 +0100 (Wed, 05 Jan 2011) | 4 lines
  
  test_threading: use Popen.communicate() instead of .wait()
  
  Popen.communicate() avoids deadlocks and close the pipes when done. This commit
  fixes a ResourceWarning(unclosed pipe).
........
  r87758 | victor.stinner | 2011-01-05 04:56:22 +0100 (Wed, 05 Jan 2011) | 1 line
  
  Issue #10756: add the author, Andreas Stührk
........
  r87759 | victor.stinner | 2011-01-05 04:58:54 +0100 (Wed, 05 Jan 2011) | 1 line
  
  test_time: assertEquals => assertEqual
........
  r87760 | georg.brandl | 2011-01-05 11:59:48 +0100 (Wed, 05 Jan 2011) | 1 line
  
  Fix duplicate end tag.
........
  r87761 | georg.brandl | 2011-01-05 12:00:25 +0100 (Wed, 05 Jan 2011) | 1 line
  
  #10130: Prepare for building epub-format docs.
........
  r87762 | antoine.pitrou | 2011-01-05 19:37:22 +0100 (Wed, 05 Jan 2011) | 3 lines
  
  Issue #5485: Add doc for expat.xmlparser.SetParamEntityParsing.
........
  r87765 | antoine.pitrou | 2011-01-05 19:44:14 +0100 (Wed, 05 Jan 2011) | 4 lines
  
  Issue #5485: Add tests for the UseForeignDTD method of expat parser objects.
  Patch by Jean-Paul Calderone and Sandro Tosi.
........
  r87766 | raymond.hettinger | 2011-01-05 21:08:25 +0100 (Wed, 05 Jan 2011) | 1 line
  
  Fix count of flag fields.  Being one short caused the 'quiet' option not to print.
........
  r87767 | raymond.hettinger | 2011-01-05 21:24:08 +0100 (Wed, 05 Jan 2011) | 1 line
  
  Update tests and whatsnew for the 'quiet' flag
........
  r87768 | antoine.pitrou | 2011-01-05 22:03:42 +0100 (Wed, 05 Jan 2011) | 4 lines
  
  Issue #7995: When calling accept() on a socket with a timeout, the returned
  socket is now always non-blocking, regardless of the operating system.
........
  r87769 | antoine.pitrou | 2011-01-05 22:17:36 +0100 (Wed, 05 Jan 2011) | 3 lines
  
  Overhaul the documentation about socket timeouts.
........
  r87771 | georg.brandl | 2011-01-05 22:47:47 +0100 (Wed, 05 Jan 2011) | 1 line
  
  On Py3k, -tt and -3 are no-op and unsupported respectively.
........
  r87772 | raymond.hettinger | 2011-01-05 23:27:49 +0100 (Wed, 05 Jan 2011) | 1 line
  
  RC1 updates to whatsnew
........
  r87773 | raymond.hettinger | 2011-01-05 23:41:23 +0100 (Wed, 05 Jan 2011) | 2 lines
  
  Remove mention of codes pending further discussion on transform()/untransform().
........
  r87774 | antoine.pitrou | 2011-01-05 23:43:26 +0100 (Wed, 05 Jan 2011) | 3 lines
  
  Fix mistake in NEWS
........
  r87775 | raymond.hettinger | 2011-01-06 00:00:00 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Add more porting notes.
........
  r87776 | alexander.belopolsky | 2011-01-06 00:00:47 +0100 (Thu, 06 Jan 2011) | 5 lines
  
  - time.accept2dyear = True is now equivalent to time.accept2dyear = 1
  - removed unnecessary struct_time to tuple conversion
  - added more unit tests
  (See issue #10827 for discussion.)
........
  r87777 | victor.stinner | 2011-01-06 00:01:37 +0100 (Thu, 06 Jan 2011) | 4 lines
  
  imaplib: IMAP4 constructor closes the socket on error
  
  Fix a ResourceWarning(unclosed socket) if an exception is raised in the
  constructor after the creation of the socket. Patch written by Nadeem Vawda.
........
  r87778 | victor.stinner | 2011-01-06 00:01:38 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  test_imaplib: reap_server() closes the server when done
  
  Fix a ResourceWarning(unclosed socket). Patch written by Nadeem Vawda.
........
  r87779 | victor.stinner | 2011-01-06 00:47:00 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  test_atexit: fix code saving/restoring stdout and stderr
  
  That's why I prefer a single instruction per line :-)
........
  r87780 | victor.stinner | 2011-01-06 01:49:38 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  Issue #10492: bdb.Bdb.run() only traces the execution of the code
  
  And not the compilation (if the input is a string).
........
  r87781 | raymond.hettinger | 2011-01-06 03:01:26 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Add PEP 3333 to whatsnew.
........
  r87782 | raymond.hettinger | 2011-01-06 03:08:30 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Nits
........
  r87783 | raymond.hettinger | 2011-01-06 06:34:17 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Issue 10825: Minor updates to the test suite.
........
  r87784 | antoine.pitrou | 2011-01-06 08:16:31 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  Issue #10840: make it explicit that "s*" and friends provide contiguous memory.
........
  r87786 | antoine.pitrou | 2011-01-06 10:05:22 +0100 (Thu, 06 Jan 2011) | 4 lines
  
  Issue #1677694: Refactor and improve test_timeout.  Original patch by
  Björn Lindqvist.
........
  r87787 | georg.brandl | 2011-01-06 10:15:45 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Remove doc for nonexisting parameter.
........
  r87788 | georg.brandl | 2011-01-06 10:23:19 +0100 (Thu, 06 Jan 2011) | 1 line
  
  itertools, operator and functools are not really "numeric" modules; move them into their own "functional" chapter.
........
  r87789 | georg.brandl | 2011-01-06 10:23:56 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Fix various issues (mostly Python 2 relics) found by Jacques Ducasse.
........
  r87790 | georg.brandl | 2011-01-06 10:25:27 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Add acks where acks are due.
........
  r87791 | georg.brandl | 2011-01-06 11:05:26 +0100 (Thu, 06 Jan 2011) | 1 line
  
  #10844: update copyright years in Mac plists.
........
  r87792 | antoine.pitrou | 2011-01-06 17:31:28 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  Elaborate about the GIL.
........
  r87795 | alexander.belopolsky | 2011-01-06 17:45:25 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Use PyOS_snprintf for better portability.
........
  r87796 | david.malcolm | 2011-01-06 18:01:36 +0100 (Thu, 06 Jan 2011) | 6 lines
  
  Issue #10655: Fix the build on PowerPC on Linux with GCC when building with
  timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
  support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
  only be present on OS X; the former is the correct one for Linux with GCC.
........
  r87797 | antoine.pitrou | 2011-01-06 18:17:04 +0100 (Thu, 06 Jan 2011) | 4 lines
  
  Issue #3839: wsgiref should not override a Content-Length header set by
  the application.  Initial patch by Clovis Fabricio.
........
  r87802 | antoine.pitrou | 2011-01-06 19:25:55 +0100 (Thu, 06 Jan 2011) | 6 lines
  
  Issue #7858: Raise an error properly when os.utime() fails under Windows
  on an existing file.
  
  (this does not seem to be easily testable)
........
  r87805 | martin.v.loewis | 2011-01-06 20:15:47 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Remove buffer API from stable ABI for now, see #10181.
........
  r87806 | martin.v.loewis | 2011-01-06 20:26:21 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Support comment lines and missing indices in typeslots.h.
........
  r87807 | georg.brandl | 2011-01-06 20:28:18 +0100 (Thu, 06 Jan 2011) | 1 line
  
  #10846: fix typo.
........
  r87808 | martin.v.loewis | 2011-01-06 20:28:31 +0100 (Thu, 06 Jan 2011) | 3 lines
  
  Drop bf_getbuffer/bf_releasebuffer from stable ABI,
  see #10181.
........
  r87810 | raymond.hettinger | 2011-01-06 21:55:29 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Typo.
........
  r87811 | alexander.belopolsky | 2011-01-06 22:57:06 +0100 (Thu, 06 Jan 2011) | 1 line
  
  Further simplify gettmarg()
........
  r87812 | brett.cannon | 2011-01-06 23:32:41 +0100 (Thu, 06 Jan 2011) | 2 lines
  
  Get --coverage to be an acceptable flag for test.regrtest again.
........
  r87813 | brett.cannon | 2011-01-07 00:08:16 +0100 (Fri, 07 Jan 2011) | 1 line
  
  Undo an accidental commit in r87812.
........
  r87820 | georg.brandl | 2011-01-07 19:28:45 +0100 (Fri, 07 Jan 2011) | 1 line
  
  #10856: document (Base)Exception.args better.
........
  r87821 | antoine.pitrou | 2011-01-07 19:33:07 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Put link to source at the end. There's nothing edificating in threading.py.
........
  r87822 | antoine.pitrou | 2011-01-07 19:42:21 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  atexit.py doesn't exist
........
  r87823 | antoine.pitrou | 2011-01-07 19:43:14 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Put those source links together
........
  r87824 | victor.stinner | 2011-01-07 19:47:22 +0100 (Fri, 07 Jan 2011) | 5 lines
  
  Issue #10841: set binary mode on files; the parser translates newlines
  
  On Windows, set the binary mode on stdin, stdout, stderr and all
  io.FileIO objects (to not translate newlines, \r\n <=> \n). The Python parser
  translates newlines (\r\n => \n).
........
  r87825 | victor.stinner | 2011-01-07 19:56:19 +0100 (Fri, 07 Jan 2011) | 1 line
  
  Issue #10841: don't translate newlines for pgen
........
  r87826 | antoine.pitrou | 2011-01-07 19:58:21 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Put those "seealso"s together
........
  r87827 | antoine.pitrou | 2011-01-07 20:01:48 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Group seealsos
........
  r87828 | antoine.pitrou | 2011-01-07 20:16:12 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Mention multiprocessing.Queue in the queue docs
........
  r87829 | alexander.belopolsky | 2011-01-07 20:59:19 +0100 (Fri, 07 Jan 2011) | 7 lines
  
  Issue #10827: Changed the rules for 2-digit years.  The time.asctime
  function will now format any year when time.accept2dyear is false and
  will accept years >= 1000 otherwise.  The year range accepted by
  time.mktime and time.strftime is still system dependent, but
  time.mktime will now accept full range supported by the OS. Conversion
  of 2-digit years to 4-digit is deprecated.
........
  r87830 | raymond.hettinger | 2011-01-07 21:33:09 +0100 (Fri, 07 Jan 2011) | 2 lines
  
  Combine the two seealso sections.
........
  r87831 | georg.brandl | 2011-01-07 21:58:25 +0100 (Fri, 07 Jan 2011) | 1 line
  
  Fix indent.
........
  r87832 | raymond.hettinger | 2011-01-07 22:04:30 +0100 (Fri, 07 Jan 2011) | 2 lines
  
  Update the digest of PEP 3333 based on comments for Phillip Eby.
........
  r87833 | raymond.hettinger | 2011-01-07 22:17:56 +0100 (Fri, 07 Jan 2011) | 1 line
  
  Revert r87823 which moved the source link to the wrong section.
........
  r87834 | antoine.pitrou | 2011-01-07 22:43:59 +0100 (Fri, 07 Jan 2011) | 5 lines
  
  Issue #8020: Avoid a crash where the small objects allocator would read
  non-Python managed memory while it is being modified by another thread.
  Patch by Matt Bandy.
........
  r87835 | antoine.pitrou | 2011-01-07 22:47:02 +0100 (Fri, 07 Jan 2011) | 3 lines
  
  Put NEWS entry in the right section.
........
  r87838 | raymond.hettinger | 2011-01-07 22:54:18 +0100 (Fri, 07 Jan 2011) | 1 line
  
  Revert r87821 which moved the source link to the wrong section (from the module intro covering the module to a section on thread imports).
........
  r87839 | r.david.murray | 2011-01-07 22:57:25 +0100 (Fri, 07 Jan 2011) | 9 lines
  
  Fix formatting of values with embedded newlines when rfc2047 encoding
  
  Before this patch if a value being encoded had an embedded newline,
  the line following the newline would have no leading whitespace,
  and the whitespace it did have was encoded into the word.  Now
  the existing whitespace gets turned into a blank, the way it does
  in other header reformatting, and the _continuation_ws gets added
  at the beginning of the encoded line.
........
  r87840 | r.david.murray | 2011-01-08 00:25:30 +0100 (Sat, 08 Jan 2011) | 6 lines
  
  #10686: recode non-ASCII headers to 'unknown-8bit' instead of ?s.
  
  This applies only when generating strings from non-RFC compliant binary
  input; it makes the existing recoding behavior more consistent (ie:
  now no data is lost when recoding).
........
  r87843 | alexander.belopolsky | 2011-01-08 01:13:34 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Issue #1777412: extended year range of strftime down to 1000.
........
  r87844 | alexander.belopolsky | 2011-01-08 02:23:02 +0100 (Sat, 08 Jan 2011) | 3 lines
  
  Fixed error handling branches.  Thanks
  Victor Stinner for pointing this out.
........
  r87845 | victor.stinner | 2011-01-08 02:56:31 +0100 (Sat, 08 Jan 2011) | 4 lines
  
  Issue #1777412: strftime() accepts year >= 1 instead of year >= 1900
  
   * With Visual Studio, year have to be in [1; 9999]
   * Add more tests on the year field
........
  r87846 | victor.stinner | 2011-01-08 03:00:24 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Issue #1777412: test large years value for strftime('%Y')
........
  r87847 | victor.stinner | 2011-01-08 03:46:33 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Issue #1777412: fix test_time for Mac OS X and OpenIndiana
........
  r87848 | victor.stinner | 2011-01-08 04:06:52 +0100 (Sat, 08 Jan 2011) | 3 lines
  
  Issue #1777412: Remove all limits on tm_year from time.strftime()
  
  The buildbots will tell us which platform does support or not negative years.
........
  r87849 | victor.stinner | 2011-01-08 04:16:05 +0100 (Sat, 08 Jan 2011) | 1 line
  
  test_ssl: test SHA256 using sha256.tbs-internet.com instead of sha2.hboeck.de
........
  r87850 | victor.stinner | 2011-01-08 04:35:36 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Issue #10864: limit year to [1; 9999] for strftime() on Solaris
........
  r87853 | raymond.hettinger | 2011-01-08 08:01:56 +0100 (Sat, 08 Jan 2011) | 4 lines
  
  Issue #10042: Fixed the total_ordering decorator to handle cross-type
  comparisons that could lead to infinite recursion.
........
  r87856 | raymond.hettinger | 2011-01-08 10:03:11 +0100 (Sat, 08 Jan 2011) | 2 lines
  
  Issue #10813: Small improvement to decimal money format recipe.
........
  r87858 | raymond.hettinger | 2011-01-08 10:35:38 +0100 (Sat, 08 Jan 2011) | 2 lines
  
  Issue 10533: Need example of using __missing__.
........
  r87859 | georg.brandl | 2011-01-08 10:45:43 +0100 (Sat, 08 Jan 2011) | 1 line
  
  #10855: document close() semantics of wave objects.
........
  r87860 | antoine.pitrou | 2011-01-08 10:55:31 +0100 (Sat, 08 Jan 2011) | 4 lines
  
  Issue #10859: Make `contextlib.GeneratorContextManager` officially
  private by renaming it to `_GeneratorContextManager`.
........
  r87861 | antoine.pitrou | 2011-01-08 11:23:29 +0100 (Sat, 08 Jan 2011) | 3 lines
  
  Fix test_ssl after r87849
........
  r87862 | raymond.hettinger | 2011-01-08 11:26:53 +0100 (Sat, 08 Jan 2011) | 3 lines
  
  Issue 9717:  Segregate and improve the documentation of "in-place" operators
  in the operator module.
........
  r87863 | antoine.pitrou | 2011-01-08 11:28:11 +0100 (Sat, 08 Jan 2011) | 3 lines
  
  Add EHOSTUNREACH ('No route to host') to the errnos trapped by transient_internet().
........
  r87865 | raymond.hettinger | 2011-01-08 11:32:31 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Markup fix
........
  r87867 | victor.stinner | 2011-01-08 17:31:24 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Issue #1777412: document the change in the NEWS file
........
  r87868 | victor.stinner | 2011-01-08 17:37:47 +0100 (Sat, 08 Jan 2011) | 1 line
  
  NEWS: merge #1777412 and #10827 entries
........
  r87869 | alexander.belopolsky | 2011-01-08 21:47:21 +0100 (Sat, 08 Jan 2011) | 1 line
  
  Fixed documentation to reflect recent changes for years < 1900.
........
  r87870 | georg.brandl | 2011-01-08 22:04:25 +0100 (Sat, 08 Jan 2011) | 1 line
  
  zlib only works with bytes objects.
........
  r87871 | raymond.hettinger | 2011-01-09 00:44:37 +0100 (Sun, 09 Jan 2011) | 2 lines
  
  Issue #10357: Clarify what it means to be a mapping.
........
  r87873 | r.david.murray | 2011-01-09 03:35:24 +0100 (Sun, 09 Jan 2011) | 12 lines
  
  #5871: protect against header injection attacks.
  
  This makes Header.encode throw a HeaderParseError if it winds up
  formatting a header such that a continuation line has no leading
  whitespace and looks like a header.  Since Header accepts values
  containing newlines and preserves them (and this is by design), without
  this fix any program that took user input (say, a subject in a web form)
  and passed it to the email package as a header was vulnerable to header
  injection attacks.  (As far as we know this has never been exploited.)
  
  Thanks to Jakub Wilk for reporting this vulnerability.
........
  r87876 | georg.brandl | 2011-01-09 08:38:51 +0100 (Sun, 09 Jan 2011) | 1 line
  
  #10869: do not visit root node twice in ast.increment_lineno().
........
  r87877 | georg.brandl | 2011-01-09 08:50:48 +0100 (Sun, 09 Jan 2011) | 1 line
  
  Add missing line.
........
  r87890 | georg.brandl | 2011-01-09 10:04:08 +0100 (Sun, 09 Jan 2011) | 1 line
  
  Wrap some long examples and signatures.
........
  r87891 | georg.brandl | 2011-01-09 10:31:01 +0100 (Sun, 09 Jan 2011) | 1 line
  
  #10871: "file" does not exist anymore in Python 3.  Also adapt the reprs of opened file objects.
........
  r87895 | lukasz.langa | 2011-01-09 19:18:53 +0100 (Sun, 09 Jan 2011) | 5 lines
  
  #10874: test_urllib2 shouldn't use `is` operator for comparing strings
  
  Patch by Adreas Stührk.
........
  r87896 | martin.v.loewis | 2011-01-09 19:28:07 +0100 (Sun, 09 Jan 2011) | 2 lines
  
  Add Ned Deily.
........
  r87897 | antoine.pitrou | 2011-01-09 21:38:15 +0100 (Sun, 09 Jan 2011) | 6 lines
  
  Issue #10872: The repr() of TextIOWrapper objects now includes the mode
  if available.
  
  (at Georg's request)
........
  r87898 | raymond.hettinger | 2011-01-10 04:26:08 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Move source links to consistent location and remove wordy, big yellow boxes.
........
  r87899 | raymond.hettinger | 2011-01-10 06:40:57 +0100 (Mon, 10 Jan 2011) | 2 lines
  
  Fix typos.
........
  r87900 | alexander.belopolsky | 2011-01-10 20:14:38 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Fixed a footnote reference
........
  r87901 | raymond.hettinger | 2011-01-10 20:54:11 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Separate source link from main text.
........
  r87902 | raymond.hettinger | 2011-01-10 22:16:07 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Missed two source links
........
  r87903 | raymond.hettinger | 2011-01-10 22:26:49 +0100 (Mon, 10 Jan 2011) | 2 lines
  
  Misspelling.
........
  r87904 | terry.reedy | 2011-01-10 22:27:49 +0100 (Mon, 10 Jan 2011) | 2 lines
  
  Issue #10875: Update Regular Expression HOWTO; patch by 'SilentGhost'.
........
  r87906 | alexander.belopolsky | 2011-01-10 22:55:34 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Added entries about removal of year 1900 limit.
........
  r87907 | alexander.belopolsky | 2011-01-10 22:58:52 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Removed time.ctime from the list of functions that take a time tuple argument
........
  r87908 | ned.deily | 2011-01-10 23:14:25 +0100 (Mon, 10 Jan 2011) | 4 lines
  
  #10820: Fix OS X framework installs to support version-specific
          scripts (implemented in #10679).
........
  r87910 | alexander.belopolsky | 2011-01-10 23:56:14 +0100 (Mon, 10 Jan 2011) | 1 line
  
  Issue #2568: Removed bogus rationale for supporting tm_sec=61.
........
  r87911 | victor.stinner | 2011-01-11 00:00:36 +0100 (Tue, 11 Jan 2011) | 5 lines
  
  Issue #9566: Fix pyparse.xmlparser.ParseFile()
  
  Fix readinst() if file.read(n) returns a bytes object longer than n:
  return -1 instead of the the buffer size to raise an exception.
  Simplify also the function code.
........
  r87912 | terry.reedy | 2011-01-11 00:13:21 +0100 (Tue, 11 Jan 2011) | 2 lines
  
  Issue #10875: Update Regular Expression HOWTO; last bit.
........
  r87914 | alexander.belopolsky | 2011-01-11 00:28:33 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Improved description of %Y directive.
........
  r87915 | alexander.belopolsky | 2011-01-11 00:31:51 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Improved  footnote for the %Y directive slightly.
........
  r87916 | raymond.hettinger | 2011-01-11 00:38:15 +0100 (Tue, 11 Jan 2011) | 2 lines
  
  Fix typos and markup.
........
  r87917 | victor.stinner | 2011-01-11 01:04:12 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Issue #9611: remove useless and dangerous explicit conversion to size_t
........
  r87919 | alexander.belopolsky | 2011-01-11 02:21:25 +0100 (Tue, 11 Jan 2011) | 4 lines
  
  Issue #1726687: time.mktime() will now correctly compute value one
  second before epoch.  Original patch by Peter Wang, reported by Martin
  Blais.
........
  r87920 | alexander.belopolsky | 2011-01-11 02:35:22 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Make mktime test more robust.
........
  r87921 | alexander.belopolsky | 2011-01-11 03:22:16 +0100 (Tue, 11 Jan 2011) | 1 line
  
  This should fix mktime test on Windows
........
  r87922 | nick.coghlan | 2011-01-11 03:42:15 +0100 (Tue, 11 Jan 2011) | 1 line
  
  developers.txt entry for Eli (at Brett's request)
........
  r87924 | raymond.hettinger | 2011-01-11 09:49:10 +0100 (Tue, 11 Jan 2011) | 2 lines
  
  Add a todo.
........
  r87925 | nick.coghlan | 2011-01-11 11:05:20 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Issue 10556: test_zipimport_support implicitly imports too many modules (including _ssl) to safely clobber sys.modules after each test
........
  r87926 | eric.smith | 2011-01-11 11:24:34 +0100 (Tue, 11 Jan 2011) | 1 line
  
  Typo.
........


Added:
   python/branches/py3k-cdecimal/Doc/library/functional.rst
      - copied unchanged from r87926, /python/branches/py3k/Doc/library/functional.rst
   python/branches/py3k-cdecimal/Tools/unittestgui/
      - copied from r87926, /python/branches/py3k/Tools/unittestgui/
Modified:
   python/branches/py3k-cdecimal/   (props changed)
   python/branches/py3k-cdecimal/Doc/ACKS.txt
   python/branches/py3k-cdecimal/Doc/Makefile
   python/branches/py3k-cdecimal/Doc/README.txt
   python/branches/py3k-cdecimal/Doc/c-api/arg.rst
   python/branches/py3k-cdecimal/Doc/glossary.rst
   python/branches/py3k-cdecimal/Doc/howto/logging.rst
   python/branches/py3k-cdecimal/Doc/howto/regex.rst
   python/branches/py3k-cdecimal/Doc/library/argparse.rst
   python/branches/py3k-cdecimal/Doc/library/ast.rst
   python/branches/py3k-cdecimal/Doc/library/atexit.rst
   python/branches/py3k-cdecimal/Doc/library/bisect.rst
   python/branches/py3k-cdecimal/Doc/library/calendar.rst
   python/branches/py3k-cdecimal/Doc/library/cmd.rst
   python/branches/py3k-cdecimal/Doc/library/collections.rst
   python/branches/py3k-cdecimal/Doc/library/contextlib.rst
   python/branches/py3k-cdecimal/Doc/library/csv.rst
   python/branches/py3k-cdecimal/Doc/library/datetime.rst
   python/branches/py3k-cdecimal/Doc/library/decimal.rst
   python/branches/py3k-cdecimal/Doc/library/dis.rst
   python/branches/py3k-cdecimal/Doc/library/email.charset.rst
   python/branches/py3k-cdecimal/Doc/library/email.generator.rst
   python/branches/py3k-cdecimal/Doc/library/email.header.rst
   python/branches/py3k-cdecimal/Doc/library/email.message.rst
   python/branches/py3k-cdecimal/Doc/library/exceptions.rst
   python/branches/py3k-cdecimal/Doc/library/filecmp.rst
   python/branches/py3k-cdecimal/Doc/library/fileinput.rst
   python/branches/py3k-cdecimal/Doc/library/fnmatch.rst
   python/branches/py3k-cdecimal/Doc/library/functools.rst
   python/branches/py3k-cdecimal/Doc/library/glob.rst
   python/branches/py3k-cdecimal/Doc/library/heapq.rst
   python/branches/py3k-cdecimal/Doc/library/index.rst
   python/branches/py3k-cdecimal/Doc/library/inspect.rst
   python/branches/py3k-cdecimal/Doc/library/keyword.rst
   python/branches/py3k-cdecimal/Doc/library/linecache.rst
   python/branches/py3k-cdecimal/Doc/library/numeric.rst
   python/branches/py3k-cdecimal/Doc/library/operator.rst
   python/branches/py3k-cdecimal/Doc/library/optparse.rst
   python/branches/py3k-cdecimal/Doc/library/pprint.rst
   python/branches/py3k-cdecimal/Doc/library/pyexpat.rst
   python/branches/py3k-cdecimal/Doc/library/queue.rst
   python/branches/py3k-cdecimal/Doc/library/quopri.rst
   python/branches/py3k-cdecimal/Doc/library/random.rst
   python/branches/py3k-cdecimal/Doc/library/sched.rst
   python/branches/py3k-cdecimal/Doc/library/shelve.rst
   python/branches/py3k-cdecimal/Doc/library/shutil.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/string.rst
   python/branches/py3k-cdecimal/Doc/library/textwrap.rst
   python/branches/py3k-cdecimal/Doc/library/threading.rst
   python/branches/py3k-cdecimal/Doc/library/time.rst
   python/branches/py3k-cdecimal/Doc/library/tokenize.rst
   python/branches/py3k-cdecimal/Doc/library/trace.rst
   python/branches/py3k-cdecimal/Doc/library/unittest.rst
   python/branches/py3k-cdecimal/Doc/library/uu.rst
   python/branches/py3k-cdecimal/Doc/library/wave.rst
   python/branches/py3k-cdecimal/Doc/library/zlib.rst
   python/branches/py3k-cdecimal/Doc/reference/compound_stmts.rst
   python/branches/py3k-cdecimal/Doc/reference/executionmodel.rst
   python/branches/py3k-cdecimal/Doc/tools/sphinxext/download.html
   python/branches/py3k-cdecimal/Doc/tools/sphinxext/indexcontent.html
   python/branches/py3k-cdecimal/Doc/whatsnew/3.2.rst
   python/branches/py3k-cdecimal/Include/abstract.h
   python/branches/py3k-cdecimal/Include/memoryobject.h
   python/branches/py3k-cdecimal/Include/object.h
   python/branches/py3k-cdecimal/Include/objimpl.h
   python/branches/py3k-cdecimal/Include/typeslots.h
   python/branches/py3k-cdecimal/Lib/_pyio.py
   python/branches/py3k-cdecimal/Lib/ast.py
   python/branches/py3k-cdecimal/Lib/bdb.py
   python/branches/py3k-cdecimal/Lib/collections.py
   python/branches/py3k-cdecimal/Lib/concurrent/futures/process.py
   python/branches/py3k-cdecimal/Lib/contextlib.py
   python/branches/py3k-cdecimal/Lib/datetime.py
   python/branches/py3k-cdecimal/Lib/email/charset.py
   python/branches/py3k-cdecimal/Lib/email/header.py
   python/branches/py3k-cdecimal/Lib/email/message.py
   python/branches/py3k-cdecimal/Lib/email/test/test_email.py
   python/branches/py3k-cdecimal/Lib/encodings/aliases.py
   python/branches/py3k-cdecimal/Lib/functools.py
   python/branches/py3k-cdecimal/Lib/imaplib.py
   python/branches/py3k-cdecimal/Lib/multiprocessing/connection.py
   python/branches/py3k-cdecimal/Lib/pydoc.py
   python/branches/py3k-cdecimal/Lib/socket.py
   python/branches/py3k-cdecimal/Lib/subprocess.py
   python/branches/py3k-cdecimal/Lib/test/datetimetester.py
   python/branches/py3k-cdecimal/Lib/test/regrtest.py
   python/branches/py3k-cdecimal/Lib/test/sha256.pem
   python/branches/py3k-cdecimal/Lib/test/support.py
   python/branches/py3k-cdecimal/Lib/test/test_array.py
   python/branches/py3k-cdecimal/Lib/test/test_ast.py
   python/branches/py3k-cdecimal/Lib/test/test_atexit.py
   python/branches/py3k-cdecimal/Lib/test/test_bytes.py
   python/branches/py3k-cdecimal/Lib/test/test_collections.py
   python/branches/py3k-cdecimal/Lib/test/test_concurrent_futures.py
   python/branches/py3k-cdecimal/Lib/test/test_functools.py
   python/branches/py3k-cdecimal/Lib/test/test_httplib.py
   python/branches/py3k-cdecimal/Lib/test/test_imaplib.py
   python/branches/py3k-cdecimal/Lib/test/test_io.py
   python/branches/py3k-cdecimal/Lib/test/test_os.py
   python/branches/py3k-cdecimal/Lib/test/test_pyexpat.py
   python/branches/py3k-cdecimal/Lib/test/test_site.py
   python/branches/py3k-cdecimal/Lib/test/test_socket.py
   python/branches/py3k-cdecimal/Lib/test/test_socketserver.py
   python/branches/py3k-cdecimal/Lib/test/test_ssl.py
   python/branches/py3k-cdecimal/Lib/test/test_subprocess.py
   python/branches/py3k-cdecimal/Lib/test/test_sys.py
   python/branches/py3k-cdecimal/Lib/test/test_threading.py
   python/branches/py3k-cdecimal/Lib/test/test_threadsignals.py
   python/branches/py3k-cdecimal/Lib/test/test_time.py
   python/branches/py3k-cdecimal/Lib/test/test_timeout.py
   python/branches/py3k-cdecimal/Lib/test/test_ttk_guionly.py
   python/branches/py3k-cdecimal/Lib/test/test_unicode.py
   python/branches/py3k-cdecimal/Lib/test/test_urllib2.py
   python/branches/py3k-cdecimal/Lib/test/test_winreg.py
   python/branches/py3k-cdecimal/Lib/test/test_with.py
   python/branches/py3k-cdecimal/Lib/test/test_wsgiref.py
   python/branches/py3k-cdecimal/Lib/test/test_xml_etree_c.py
   python/branches/py3k-cdecimal/Lib/test/test_xmlrpc.py
   python/branches/py3k-cdecimal/Lib/test/test_zipimport_support.py
   python/branches/py3k-cdecimal/Lib/test/test_zlib.py
   python/branches/py3k-cdecimal/Lib/threading.py
   python/branches/py3k-cdecimal/Lib/tkinter/test/test_tkinter/test_loadtk.py
   python/branches/py3k-cdecimal/Lib/unittest/case.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_assertions.py
   python/branches/py3k-cdecimal/Lib/unittest/test/test_case.py
   python/branches/py3k-cdecimal/Lib/wsgiref/handlers.py
   python/branches/py3k-cdecimal/Mac/IDLE/IDLE.app/Contents/Info.plist
   python/branches/py3k-cdecimal/Mac/Makefile.in
   python/branches/py3k-cdecimal/Mac/PythonLauncher/Info.plist.in
   python/branches/py3k-cdecimal/Mac/Resources/app/Info.plist.in
   python/branches/py3k-cdecimal/Mac/Resources/framework/Info.plist.in
   python/branches/py3k-cdecimal/Misc/ACKS
   python/branches/py3k-cdecimal/Misc/NEWS
   python/branches/py3k-cdecimal/Misc/developers.txt
   python/branches/py3k-cdecimal/Modules/_collectionsmodule.c
   python/branches/py3k-cdecimal/Modules/_ctypes/_ctypes.c
   python/branches/py3k-cdecimal/Modules/_datetimemodule.c
   python/branches/py3k-cdecimal/Modules/_io/fileio.c
   python/branches/py3k-cdecimal/Modules/_io/textio.c
   python/branches/py3k-cdecimal/Modules/_posixsubprocess.c
   python/branches/py3k-cdecimal/Modules/_testcapimodule.c
   python/branches/py3k-cdecimal/Modules/atexitmodule.c
   python/branches/py3k-cdecimal/Modules/audioop.c
   python/branches/py3k-cdecimal/Modules/gcmodule.c
   python/branches/py3k-cdecimal/Modules/main.c
   python/branches/py3k-cdecimal/Modules/md5module.c
   python/branches/py3k-cdecimal/Modules/posixmodule.c
   python/branches/py3k-cdecimal/Modules/pyexpat.c
   python/branches/py3k-cdecimal/Modules/selectmodule.c
   python/branches/py3k-cdecimal/Modules/sha1module.c
   python/branches/py3k-cdecimal/Modules/sha256module.c
   python/branches/py3k-cdecimal/Modules/sha512module.c
   python/branches/py3k-cdecimal/Modules/timemodule.c
   python/branches/py3k-cdecimal/Modules/unicodedata.c
   python/branches/py3k-cdecimal/Modules/zlibmodule.c
   python/branches/py3k-cdecimal/Objects/codeobject.c
   python/branches/py3k-cdecimal/Objects/fileobject.c
   python/branches/py3k-cdecimal/Objects/listobject.c
   python/branches/py3k-cdecimal/Objects/obmalloc.c
   python/branches/py3k-cdecimal/Objects/typeobject.c
   python/branches/py3k-cdecimal/Objects/typeslots.inc
   python/branches/py3k-cdecimal/Objects/typeslots.py
   python/branches/py3k-cdecimal/PC/python3.def
   python/branches/py3k-cdecimal/Parser/tokenizer.c
   python/branches/py3k-cdecimal/Python/ceval.c
   python/branches/py3k-cdecimal/Python/getargs.c
   python/branches/py3k-cdecimal/Python/pythonrun.c
   python/branches/py3k-cdecimal/Python/sysmodule.c
   python/branches/py3k-cdecimal/Tools/README
   python/branches/py3k-cdecimal/configure
   python/branches/py3k-cdecimal/configure.in

Modified: python/branches/py3k-cdecimal/Doc/ACKS.txt
==============================================================================
--- python/branches/py3k-cdecimal/Doc/ACKS.txt	(original)
+++ python/branches/py3k-cdecimal/Doc/ACKS.txt	Tue Jan 11 18:07:55 2011
@@ -47,6 +47,7 @@
    * L. Peter Deutsch
    * Robert Donohue
    * Fred L. Drake, Jr.
+   * Jacques Ducasse
    * Josip Dzolonga
    * Jeff Epler
    * Michael Ernst

Modified: python/branches/py3k-cdecimal/Doc/Makefile
==============================================================================
--- python/branches/py3k-cdecimal/Doc/Makefile	(original)
+++ python/branches/py3k-cdecimal/Doc/Makefile	Tue Jan 11 18:07:55 2011
@@ -26,6 +26,7 @@
 	@echo "  htmlhelp   to make HTML files and a HTML help project"
 	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
 	@echo "  text       to make plain text files"
+	@echo "  epub       to make EPUB files"
 	@echo "  changes    to make an overview over all changed/added/deprecated items"
 	@echo "  linkcheck  to check all external links for integrity"
 	@echo "  coverage   to check documentation coverage for library and C API"
@@ -81,6 +82,10 @@
 text: build
 	@echo "Build finished; the text files are in build/text."
 
+epub: BUILDER = epub
+epub: build
+	@echo "Build finished; the epub files are in build/epub."
+
 changes: BUILDER = changes
 changes: build
 	@echo "The overview file is in build/changes."
@@ -158,6 +163,17 @@
 	cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
 	cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
 
+	# archive the epub build
+	rm -rf build/epub
+	make epub
+	mkdir -p dist/python-$(DISTVERSION)-docs-epub
+	cp -pPR build/epub/*.epub dist/python-$(DISTVERSION)-docs-epub/
+	tar -C dist -cf dist/python-$(DISTVERSION)-docs-epub.tar python-$(DISTVERSION)-docs-epub
+	bzip2 -9 -k dist/python-$(DISTVERSION)-docs-epub.tar
+	(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-epub.zip python-$(DISTVERSION)-docs-epub)
+	rm -r dist/python-$(DISTVERSION)-docs-epub
+	rm dist/python-$(DISTVERSION)-docs-epub.tar
+
 check:
 	$(PYTHON) tools/rstlint.py -i tools
 

Modified: python/branches/py3k-cdecimal/Doc/README.txt
==============================================================================
--- python/branches/py3k-cdecimal/Doc/README.txt	(original)
+++ python/branches/py3k-cdecimal/Doc/README.txt	Tue Jan 11 18:07:55 2011
@@ -54,6 +54,9 @@
 
  * "text", which builds a plain text file for each source file.
 
+ * "epub", which builds an EPUB document, suitable to be viewed on e-book
+   readers.
+
  * "linkcheck", which checks all external references to see whether they are
    broken, redirected or malformed, and outputs this information to stdout as
    well as a plain-text (.txt) file.

Modified: python/branches/py3k-cdecimal/Doc/c-api/arg.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/c-api/arg.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/c-api/arg.rst	Tue Jan 11 18:07:55 2011
@@ -30,9 +30,10 @@
 Strings and buffers
 -------------------
 
-These formats do not expect you to provide raw storage for the returned string
-or bytes.  Also, you won't have to release any memory yourself, except with
-the ``es``, ``es#``, ``et`` and ``et#`` formats.
+These formats allow to access an object as a contiguous chunk of memory.
+You don't have to provide raw storage for the returned unicode or bytes
+area.  Also, you won't have to release any memory yourself, except with the
+``es``, ``es#``, ``et`` and ``et#`` formats.
 
 However, when a :c:type:`Py_buffer` structure gets filled, the underlying
 buffer is locked so that the caller can subsequently use the buffer even

Modified: python/branches/py3k-cdecimal/Doc/glossary.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/glossary.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/glossary.rst	Tue Jan 11 18:07:55 2011
@@ -102,9 +102,10 @@
       See :pep:`343`.
 
    CPython
-      The canonical implementation of the Python programming language.  The
-      term "CPython" is used in contexts when necessary to distinguish this
-      implementation from others such as Jython or IronPython.
+      The canonical implementation of the Python programming language, as
+      distributed on `python.org <http://python.org>`_.  The term "CPython"
+      is used when necessary to distinguish this implementation from others
+      such as Jython or IronPython.
 
    decorator
       A function returning another function, usually applied as a function
@@ -263,16 +264,25 @@
       See :term:`global interpreter lock`.
 
    global interpreter lock
-      The lock used by Python threads to assure that only one thread
-      executes in the :term:`CPython` :term:`virtual machine` at a time.
-      This simplifies the CPython implementation by assuring that no two
-      processes can access the same memory at the same time.  Locking the
-      entire interpreter makes it easier for the interpreter to be
-      multi-threaded, at the expense of much of the parallelism afforded by
-      multi-processor machines.  Efforts have been made in the past to
-      create a "free-threaded" interpreter (one which locks shared data at a
-      much finer granularity), but so far none have been successful because
-      performance suffered in the common single-processor case.
+      The mechanism used by the :term:`CPython` interpreter to assure that
+      only one thread executes Python :term:`bytecode` at a time.
+      This simplifies the CPython implementation by making the object model
+      (including critical built-in types such as :class:`dict`) implicitly
+      safe against concurrent access.  Locking the entire interpreter
+      makes it easier for the interpreter to be multi-threaded, at the
+      expense of much of the parallelism afforded by multi-processor
+      machines.
+
+      However, some extension modules, either standard or third-party,
+      are designed so as to release the GIL when doing computationally-intensive
+      tasks such as compression or hashing.  Also, the GIL is always released
+      when doing I/O.
+
+      Past efforts to create a "free-threaded" interpreter (one which locks
+      shared data at a much finer granularity) have not been successful
+      because performance suffered in the common single-processor case. It
+      is believed that overcoming this performance issue would make the
+      implementation much more complicated and therefore costlier to maintain.
 
    hashable
       An object is *hashable* if it has a hash value which never changes during
@@ -339,12 +349,12 @@
 
    iterator
       An object representing a stream of data.  Repeated calls to the iterator's
-      :meth:`__next__` (or passing it to the built-in function :func:`next`)
-      method return successive items in the stream.  When no more data are
-      available a :exc:`StopIteration` exception is raised instead.  At this
+      :meth:`__next__` method (or passing it to the built-in function
+      :func:`next`) return successive items in the stream.  When no more data
+      are available a :exc:`StopIteration` exception is raised instead.  At this
       point, the iterator object is exhausted and any further calls to its
-      :meth:`next` method just raise :exc:`StopIteration` again.  Iterators are
-      required to have an :meth:`__iter__` method that returns the iterator
+      :meth:`__next__` method just raise :exc:`StopIteration` again.  Iterators
+      are required to have an :meth:`__iter__` method that returns the iterator
       object itself so every iterator is also iterable and may be used in most
       places where other iterables are accepted.  One notable exception is code
       which attempts multiple iteration passes.  A container object (such as a
@@ -418,9 +428,11 @@
       :class:`importlib.abc.Loader` for an :term:`abstract base class`.
 
    mapping
-      A container object (such as :class:`dict`) which supports arbitrary key
-      lookups using the special method :meth:`__getitem__`.  Mappings also
-      support :meth:`__len__`, :meth:`__iter__`, and :meth:`__contains__`.
+      A container object that supports arbitrary key lookups and implements the
+      methods specified in the :class:`Mapping` or :class:`MutableMapping`
+      :ref:`abstract base classes <abstract-base-classes>`. Examples include
+      :class:`dict`, :class:`collections.defaultdict`,
+      :class:`collections.OrderedDict` and :class:`collections.Counter`.
 
    metaclass
       The class of a class.  Class definitions create a class name, a class

Modified: python/branches/py3k-cdecimal/Doc/howto/logging.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/howto/logging.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/howto/logging.rst	Tue Jan 11 18:07:55 2011
@@ -857,50 +857,46 @@
 
 #. :class:`FileHandler` instances send messages to disk files.
 
-.. currentmodule:: logging.handlers
-
-#. :class:`BaseRotatingHandler` is the base class for handlers that
+#. :class:`~handlers.BaseRotatingHandler` is the base class for handlers that
    rotate log files at a certain point. It is not meant to be  instantiated
-   directly. Instead, use :class:`RotatingFileHandler` or
-   :class:`TimedRotatingFileHandler`.
+   directly. Instead, use :class:`~handlers.RotatingFileHandler` or
+   :class:`~handlers.TimedRotatingFileHandler`.
 
-#. :class:`RotatingFileHandler` instances send messages to disk
+#. :class:`~handlers.RotatingFileHandler` instances send messages to disk
    files, with support for maximum log file sizes and log file rotation.
 
-#. :class:`TimedRotatingFileHandler` instances send messages to
+#. :class:`~handlers.TimedRotatingFileHandler` instances send messages to
    disk files, rotating the log file at certain timed intervals.
 
-#. :class:`SocketHandler` instances send messages to TCP/IP
+#. :class:`~handlers.SocketHandler` instances send messages to TCP/IP
    sockets.
 
-#. :class:`DatagramHandler` instances send messages to UDP
+#. :class:`~handlers.DatagramHandler` instances send messages to UDP
    sockets.
 
-#. :class:`SMTPHandler` instances send messages to a designated
+#. :class:`~handlers.SMTPHandler` instances send messages to a designated
    email address.
 
-#. :class:`SysLogHandler` instances send messages to a Unix
+#. :class:`~handlers.SysLogHandler` instances send messages to a Unix
    syslog daemon, possibly on a remote machine.
 
-#. :class:`NTEventLogHandler` instances send messages to a
+#. :class:`~handlers.NTEventLogHandler` instances send messages to a
    Windows NT/2000/XP event log.
 
-#. :class:`MemoryHandler` instances send messages to a buffer
+#. :class:`~handlers.MemoryHandler` instances send messages to a buffer
    in memory, which is flushed whenever specific criteria are met.
 
-#. :class:`HTTPHandler` instances send messages to an HTTP
+#. :class:`~handlers.HTTPHandler` instances send messages to an HTTP
    server using either ``GET`` or ``POST`` semantics.
 
-#. :class:`WatchedFileHandler` instances watch the file they are
+#. :class:`~handlers.WatchedFileHandler` instances watch the file they are
    logging to. If the file changes, it is closed and reopened using the file
    name. This handler is only useful on Unix-like systems; Windows does not
    support the underlying mechanism used.
 
-#. :class:`QueueHandler` instances send messages to a queue, such as
+#. :class:`~handlers.QueueHandler` instances send messages to a queue, such as
    those implemented in the :mod:`queue` or :mod:`multiprocessing` modules.
 
-.. currentmodule:: logging
-
 #. :class:`NullHandler` instances do nothing with error messages. They are used
    by library developers who want to use logging, but want to avoid the 'No
    handlers could be found for logger XXX' message which can be displayed if
@@ -911,7 +907,7 @@
    The :class:`NullHandler` class.
 
 .. versionadded:: 3.2
-   The :class:`~logging.handlers.QueueHandler` class.
+   The :class:`~handlers.QueueHandler` class.
 
 The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler`
 classes are defined in the core logging package. The other handlers are

Modified: python/branches/py3k-cdecimal/Doc/howto/regex.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/howto/regex.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/howto/regex.rst	Tue Jan 11 18:07:55 2011
@@ -5,7 +5,6 @@
 ****************************
 
 :Author: A.M. Kuchling <amk at amk.ca>
-:Release: 0.05
 
 .. TODO:
    Document lookbehind assertions
@@ -24,11 +23,6 @@
 Introduction
 ============
 
-The :mod:`re` module was added in Python 1.5, and provides Perl-style regular
-expression patterns.  Earlier versions of Python came with the :mod:`regex`
-module, which provided Emacs-style patterns.  The :mod:`regex` module was
-removed completely in Python 2.5.
-
 Regular expressions (called REs, or regexes, or regex patterns) are essentially
 a tiny, highly specialized programming language embedded inside Python and made
 available through the :mod:`re` module. Using this little language, you specify
@@ -113,7 +107,10 @@
 Some of the special sequences beginning with ``'\'`` represent predefined sets
 of characters that are often useful, such as the set of digits, the set of
 letters, or the set of anything that isn't whitespace.  The following predefined
-special sequences are available:
+special sequences are a subset of those available. The equivalent classes are
+for bytes patterns. For a complete list of sequences and expanded class
+definitions for Unicode string patterns, see the last part of
+:ref:`Regular Expression Syntax <re-syntax>`.
 
 ``\d``
    Matches any decimal digit; this is equivalent to the class ``[0-9]``.
@@ -264,7 +261,7 @@
    >>> import re
    >>> p = re.compile('ab*')
    >>> p
-   <_sre.SRE_Pattern object at 80b4150>
+   <_sre.SRE_Pattern object at 0x...>
 
 :func:`re.compile` also accepts an optional *flags* argument, used to enable
 various special features and syntax variations.  We'll go over the available
@@ -362,8 +359,8 @@
 and more.
 
 You can learn about this by interactively experimenting with the :mod:`re`
-module.  If you have Tkinter available, you may also want to look at
-:file:`Tools/scripts/redemo.py`, a demonstration program included with the
+module.  If you have :mod:`tkinter` available, you may also want to look at
+:file:`Tools/demo/redemo.py`, a demonstration program included with the
 Python distribution.  It allows you to enter REs and strings, and displays
 whether the RE matches or fails. :file:`redemo.py` can be quite useful when
 trying to debug a complicated RE.  Phil Schwartz's `Kodos
@@ -373,11 +370,10 @@
 This HOWTO uses the standard Python interpreter for its examples. First, run the
 Python interpreter, import the :mod:`re` module, and compile a RE::
 
-   Python 2.2.2 (#1, Feb 10 2003, 12:57:01)
    >>> import re
    >>> p = re.compile('[a-z]+')
    >>> p
-   <_sre.SRE_Pattern object at 80c3c28>
+   <_sre.SRE_Pattern object at 0x...>
 
 Now, you can try matching various strings against the RE ``[a-z]+``.  An empty
 string shouldn't match at all, since ``+`` means 'one or more repetitions'.
@@ -395,7 +391,7 @@
 
    >>> m = p.match('tempo')
    >>> m
-   <_sre.SRE_Match object at 80c4f68>
+   <_sre.SRE_Match object at 0x...>
 
 Now you can query the :class:`MatchObject` for information about the matching
 string.   :class:`MatchObject` instances also have several methods and
@@ -434,7 +430,7 @@
    >>> print(p.match('::: message'))
    None
    >>> m = p.search('::: message') ; print(m)
-   <re.MatchObject instance at 80c9650>
+   <_sre.SRE_Match object at 0x...>
    >>> m.group()
    'message'
    >>> m.span()
@@ -459,11 +455,11 @@
 
 :meth:`findall` has to create the entire list before it can be returned as the
 result.  The :meth:`finditer` method returns a sequence of :class:`MatchObject`
-instances as an :term:`iterator`. [#]_ ::
+instances as an :term:`iterator`::
 
    >>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
    >>> iterator
-   <callable-iterator object at 0x401833ac>
+   <callable_iterator object at 0x...>
    >>> for match in iterator:
    ...     print(match.span())
    ...
@@ -485,7 +481,7 @@
    >>> print(re.match(r'From\s+', 'Fromage amk'))
    None
    >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998')
-   <re.MatchObject instance at 80c5978>
+   <_sre.SRE_Match object at 0x...>
 
 Under the hood, these functions simply create a pattern object for you
 and call the appropriate method on it.  They also store the compiled object in a
@@ -687,7 +683,7 @@
    line, the RE to use is ``^From``. ::
 
       >>> print(re.search('^From', 'From Here to Eternity'))
-      <re.MatchObject instance at 80c1520>
+      <_sre.SRE_Match object at 0x...>
       >>> print(re.search('^From', 'Reciting From Memory'))
       None
 
@@ -699,11 +695,11 @@
    or any location followed by a newline character.     ::
 
       >>> print(re.search('}$', '{block}'))
-      <re.MatchObject instance at 80adfa8>
+      <_sre.SRE_Match object at 0x...>
       >>> print(re.search('}$', '{block} '))
       None
       >>> print(re.search('}$', '{block}\n'))
-      <re.MatchObject instance at 80adfa8>
+      <_sre.SRE_Match object at 0x...>
 
    To match a literal ``'$'``, use ``\$`` or enclose it inside a character class,
    as in  ``[$]``.
@@ -728,7 +724,7 @@
 
       >>> p = re.compile(r'\bclass\b')
       >>> print(p.search('no class at all'))
-      <re.MatchObject instance at 80c8f28>
+      <_sre.SRE_Match object at 0x...>
       >>> print(p.search('the declassified algorithm'))
       None
       >>> print(p.search('one subclass is'))
@@ -746,7 +742,7 @@
       >>> print(p.search('no class at all'))
       None
       >>> print(p.search('\b' + 'class' + '\b')  )
-      <re.MatchObject instance at 80c3ee0>
+      <_sre.SRE_Match object at 0x...>
 
    Second, inside a character class, where there's no use for this assertion,
    ``\b`` represents the backspace character, for compatibility with Python's
@@ -1316,8 +1312,8 @@
 be *very* complicated.  Use an HTML or XML parser module for such tasks.)
 
 
-Not Using re.VERBOSE
---------------------
+Using re.VERBOSE
+----------------
 
 By now you've probably noticed that regular expressions are a very compact
 notation, but they're not terribly readable.  REs of moderate complexity can
@@ -1366,8 +1362,3 @@
 now-removed :mod:`regex` module, which won't help you much.)  Consider checking
 it out from your library.
 
-
-.. rubric:: Footnotes
-
-.. [#] Introduced in Python 2.2.2.
-

Modified: python/branches/py3k-cdecimal/Doc/library/argparse.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/argparse.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/argparse.rst	Tue Jan 11 18:07:55 2011
@@ -120,7 +120,9 @@
 ArgumentParser objects
 ----------------------
 
-.. class:: ArgumentParser([description], [epilog], [prog], [usage], [add_help], [argument_default], [parents], [prefix_chars], [conflict_handler], [formatter_class])
+.. class:: ArgumentParser([description], [epilog], [prog], [usage], [add_help], \
+                          [argument_default], [parents], [prefix_chars], \
+                          [conflict_handler], [formatter_class])
 
    Create a new :class:`ArgumentParser` object.  Each parameter has its own more
    detailed description below, but in short they are:
@@ -563,7 +565,9 @@
 The add_argument() method
 -------------------------
 
-.. method:: ArgumentParser.add_argument(name or flags..., [action], [nargs], [const], [default], [type], [choices], [required], [help], [metavar], [dest])
+.. method:: ArgumentParser.add_argument(name or flags..., [action], [nargs], \
+                           [const], [default], [type], [choices], [required], \
+                           [help], [metavar], [dest])
 
    Define how a single command line argument should be parsed.  Each parameter
    has its own more detailed description below, but in short they are:
@@ -777,9 +781,11 @@
      >>> parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
      ...                     default=sys.stdout)
      >>> parser.parse_args(['input.txt', 'output.txt'])
-     Namespace(infile=<open file 'input.txt', mode 'r' at 0x...>, outfile=<open file 'output.txt', mode 'w' at 0x...>)
+     Namespace(infile=<_io.TextIOWrapper name='input.txt' encoding='UTF-8'>,
+               outfile=<_io.TextIOWrapper name='output.txt' encoding='UTF-8'>)
      >>> parser.parse_args([])
-     Namespace(infile=<open file '<stdin>', mode 'r' at 0x...>, outfile=<open file '<stdout>', mode 'w' at 0x...>)
+     Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
+               outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)
 
 * ``'*'``.  All command-line args present are gathered into a list.  Note that
   it generally doesn't make much sense to have more than one positional argument
@@ -875,26 +881,26 @@
 
 By default, ArgumentParser objects read command-line args in as simple strings.
 However, quite often the command-line string should instead be interpreted as
-another type, like a :class:`float`, :class:`int` or :class:`file`.  The
-``type`` keyword argument of :meth:`add_argument` allows any necessary
-type-checking and type-conversions to be performed.  Many common built-in types
-can be used directly as the value of the ``type`` argument::
+another type, like a :class:`float` or :class:`int`.  The ``type`` keyword
+argument of :meth:`add_argument` allows any necessary type-checking and
+type-conversions to be performed.  Common built-in types and functions can be
+used directly as the value of the ``type`` argument::
 
    >>> parser = argparse.ArgumentParser()
    >>> parser.add_argument('foo', type=int)
-   >>> parser.add_argument('bar', type=file)
+   >>> parser.add_argument('bar', type=open)
    >>> parser.parse_args('2 temp.txt'.split())
-   Namespace(bar=<open file 'temp.txt', mode 'r' at 0x...>, foo=2)
+   Namespace(bar=<_io.TextIOWrapper name='temp.txt' encoding='UTF-8'>, foo=2)
 
 To ease the use of various types of files, the argparse module provides the
 factory FileType which takes the ``mode=`` and ``bufsize=`` arguments of the
-``file`` object.  For example, ``FileType('w')`` can be used to create a
+:func:`open` function.  For example, ``FileType('w')`` can be used to create a
 writable file::
 
    >>> parser = argparse.ArgumentParser()
    >>> parser.add_argument('bar', type=argparse.FileType('w'))
    >>> parser.parse_args(['out.txt'])
-   Namespace(bar=<open file 'out.txt', mode 'w' at 0x...>)
+   Namespace(bar=<_io.TextIOWrapper name='out.txt' encoding='UTF-8'>)
 
 ``type=`` can take any callable that takes a single string argument and returns
 the type-converted value::
@@ -1506,7 +1512,7 @@
    >>> parser = argparse.ArgumentParser()
    >>> parser.add_argument('--output', type=argparse.FileType('wb', 0))
    >>> parser.parse_args(['--output', 'out'])
-   Namespace(output=<open file 'out', mode 'wb' at 0x...>)
+   Namespace(output=<_io.BufferedWriter name='out'>)
 
    FileType objects understand the pseudo-argument ``'-'`` and automatically
    convert this into ``sys.stdin`` for readable :class:`FileType` objects and
@@ -1515,7 +1521,7 @@
    >>> parser = argparse.ArgumentParser()
    >>> parser.add_argument('infile', type=argparse.FileType('r'))
    >>> parser.parse_args(['-'])
-   Namespace(infile=<open file '<stdin>', mode 'r' at 0x...>)
+   Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)
 
 
 Argument groups
@@ -1753,11 +1759,12 @@
 
 A partial upgrade path from optparse to argparse:
 
-* Replace all ``add_option()`` calls with :meth:`ArgumentParser.add_argument` calls.
+* Replace all ``add_option()`` calls with :meth:`ArgumentParser.add_argument`
+  calls.
 
 * Replace ``options, args = parser.parse_args()`` with ``args =
-  parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls for the
-  positional arguments.
+  parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument`
+  calls for the positional arguments.
 
 * Replace callback actions and the ``callback_*`` keyword arguments with
   ``type`` or ``action`` arguments.

Modified: python/branches/py3k-cdecimal/Doc/library/ast.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/ast.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/ast.rst	Tue Jan 11 18:07:55 2011
@@ -7,6 +7,9 @@
 .. sectionauthor:: Martin v. Löwis <martin at v.loewis.de>
 .. sectionauthor:: Georg Brandl <georg at python.org>
 
+**Source code:** :source:`Lib/ast.py`
+
+--------------
 
 The :mod:`ast` module helps Python applications to process trees of the Python
 abstract syntax grammar.  The abstract syntax itself might change with each
@@ -19,9 +22,6 @@
 classes all inherit from :class:`ast.AST`.  An abstract syntax tree can be
 compiled into a Python code object using the built-in :func:`compile` function.
 
-.. seealso::
-
-   Latest version of the :source:`ast module Python source code <Lib/ast.py>`
 
 Node classes
 ------------
@@ -173,9 +173,9 @@
 
 .. function:: walk(node)
 
-   Recursively yield all child nodes of *node*, in no specified order.  This is
-   useful if you only want to modify nodes in place and don't care about the
-   context.
+   Recursively yield all descendant nodes in the tree starting at *node*
+   (including *node* itself), in no specified order.  This is useful if you only
+   want to modify nodes in place and don't care about the context.
 
 
 .. class:: NodeVisitor()

Modified: python/branches/py3k-cdecimal/Doc/library/atexit.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/atexit.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/atexit.rst	Tue Jan 11 18:07:55 2011
@@ -11,11 +11,6 @@
 functions.  Functions thus registered are automatically executed upon normal
 interpreter termination.
 
-.. seealso::
-
-   Latest version of the :source:`atexit Python source code
-   <Lib/atexit.py>`
-
 Note: the functions registered via this module are not called when the program
 is killed by a signal not handled by Python, when a Python fatal internal error
 is detected, or when :func:`os._exit` is called.
@@ -103,3 +98,4 @@
 
 This obviously only works with functions that don't take arguments.
 
+

Modified: python/branches/py3k-cdecimal/Doc/library/bisect.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/bisect.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/bisect.rst	Tue Jan 11 18:07:55 2011
@@ -7,6 +7,10 @@
 .. sectionauthor:: Raymond Hettinger <python at rcn.com>
 .. example based on the PyModules FAQ entry by Aaron Watters <arw at pythonpros.com>
 
+**Source code:** :source:`Lib/bisect.py`
+
+--------------
+
 This module provides support for maintaining a list in sorted order without
 having to sort the list after each insertion.  For long lists of items with
 expensive comparison operations, this can be an improvement over the more common
@@ -14,11 +18,6 @@
 algorithm to do its work.  The source code may be most useful as a working
 example of the algorithm (the boundary conditions are already right!).
 
-.. seealso::
-
-   Latest version of the :source:`bisect module Python source code
-   <Lib/bisect.py>`
-
 The following functions are provided:
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/calendar.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/calendar.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/calendar.rst	Tue Jan 11 18:07:55 2011
@@ -6,6 +6,9 @@
               of the Unix cal program.
 .. sectionauthor:: Drew Csillag <drew_csillag at geocities.com>
 
+**Source code:** :source:`Lib/calendar.py`
+
+--------------
 
 This module allows you to output calendars like the Unix :program:`cal` program,
 and provides additional useful functions related to the calendar. By default,
@@ -21,10 +24,6 @@
 calendar in Dershowitz and Reingold's book "Calendrical Calculations", where
 it's the base calendar for all computations.
 
-.. seealso::
-
-   Latest version of the :source:`calendar module Python source code
-   <Lib/calendar.py>`
 
 .. class:: Calendar(firstweekday=0)
 
@@ -313,4 +312,3 @@
 
    Module :mod:`time`
       Low-level time related functions.
-

Modified: python/branches/py3k-cdecimal/Doc/library/cmd.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/cmd.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/cmd.rst	Tue Jan 11 18:07:55 2011
@@ -5,16 +5,15 @@
    :synopsis: Build line-oriented command interpreters.
 .. sectionauthor:: Eric S. Raymond <esr at snark.thyrsus.com>
 
+**Source code:** :source:`Lib/cmd.py`
+
+--------------
 
 The :class:`Cmd` class provides a simple framework for writing line-oriented
 command interpreters.  These are often useful for test harnesses, administrative
 tools, and prototypes that will later be wrapped in a more sophisticated
 interface.
 
-.. seealso::
-
-   Latest version of the :source:`cmd module Python source code <Lib/cmd.py>`
-
 .. class:: Cmd(completekey='tab', stdin=None, stdout=None)
 
    A :class:`Cmd` instance or subclass instance is a line-oriented interpreter

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	Tue Jan 11 18:07:55 2011
@@ -12,6 +12,10 @@
    import itertools
    __name__ = '<doctest>'
 
+**Source code:** :source:`Lib/collections.py`
+
+--------------
+
 This module implements specialized container datatypes providing alternatives to
 Python's general purpose built-in containers, :class:`dict`, :class:`list`,
 :class:`set`, and :class:`tuple`.
@@ -31,11 +35,6 @@
 :ref:`abstract-base-classes` that can be used to test whether a class provides a
 particular interface, for example, whether it is hashable or a mapping.
 
-.. seealso::
-
-   Latest version of the :source:`collections module Python source code
-   <Lib/collections.py>`
-
 
 :class:`Counter` objects
 ------------------------

Modified: python/branches/py3k-cdecimal/Doc/library/contextlib.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/contextlib.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/contextlib.rst	Tue Jan 11 18:07:55 2011
@@ -4,16 +4,14 @@
 .. module:: contextlib
    :synopsis: Utilities for with-statement contexts.
 
+**Source code:** :source:`Lib/contextlib.py`
+
+--------------
 
 This module provides utilities for common tasks involving the :keyword:`with`
 statement. For more information see also :ref:`typecontextmanager` and
 :ref:`context-managers`.
 
-.. seealso::
-
-   Latest version of the :source:`contextlib Python source code
-   <Lib/contextlib.py>`
-
 Functions provided:
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/csv.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/csv.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/csv.rst	Tue Jan 11 18:07:55 2011
@@ -50,7 +50,7 @@
 
    Return a reader object which will iterate over lines in the given *csvfile*.
    *csvfile* can be any object which supports the :term:`iterator` protocol and returns a
-   string each time its :meth:`!next` method is called --- :term:`file objects
+   string each time its :meth:`!__next__` method is called --- :term:`file objects
    <file object>` and list objects are both suitable.   If *csvfile* is a file object,
    it should be opened with ``newline=''``. [#]_  An optional
    *dialect* parameter can be given which is used to define a set of parameters

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	Tue Jan 11 18:07:55 2011
@@ -1661,9 +1661,6 @@
 implementation.  Note that the 1999 version of the C standard added additional
 format codes.
 
-The exact range of years for which :meth:`strftime` works also varies across
-platforms.  Regardless of platform, years before 1900 cannot be used.
-
 +-----------+--------------------------------+-------+
 | Directive | Meaning                        | Notes |
 +===========+================================+=======+
@@ -1706,7 +1703,7 @@
 |           | AM or PM.                      |       |
 +-----------+--------------------------------+-------+
 | ``%S``    | Second as a decimal number     | \(3)  |
-|           | [00,61].                       |       |
+|           | [00,59].                       |       |
 +-----------+--------------------------------+-------+
 | ``%U``    | Week number of the year        | \(4)  |
 |           | (Sunday as the first day of    |       |
@@ -1736,10 +1733,11 @@
 | ``%y``    | Year without century as a      |       |
 |           | decimal number [00,99].        |       |
 +-----------+--------------------------------+-------+
-| ``%Y``    | Year with century as a decimal |       |
-|           | number.                        |       |
+| ``%Y``    | Year with century as a decimal | \(5)  |
+|           | number [0001,9999] (strptime), |       |
+|           | [1000,9999] (strftime).        |       |
 +-----------+--------------------------------+-------+
-| ``%z``    | UTC offset in the form +HHMM   | \(5)  |
+| ``%z``    | UTC offset in the form +HHMM   | \(6)  |
 |           | or -HHMM (empty string if the  |       |
 |           | the object is naive).          |       |
 +-----------+--------------------------------+-------+
@@ -1763,18 +1761,26 @@
    the output hour field if the ``%I`` directive is used to parse the hour.
 
 (3)
-   The range really is ``0`` to ``61``; according to the Posix standard this
-   accounts for leap seconds and the (very rare) double leap seconds.
-   The :mod:`time` module may produce and does accept leap seconds since
-   it is based on the Posix standard, but the :mod:`datetime` module
-   does not accept leap seconds in :meth:`strptime` input nor will it
-   produce them in :func:`strftime` output.
+   Unlike :mod:`time` module, :mod:`datetime` module does not support
+   leap seconds.
 
 (4)
    When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used in
    calculations when the day of the week and the year are specified.
 
 (5)
+   For technical reasons, :meth:`strftime` method does not support
+   dates before year 1000: ``t.strftime(format)`` will raise a
+   :exc:`ValueError` when ``t.year < 1000`` even if ``format`` does
+   not contain ``%Y`` directive.  The :meth:`strptime` method can
+   parse years in the full [1, 9999] range, but years < 1000 must be
+   zero-filled to 4-digit width.
+
+   .. versionchanged:: 3.2
+      In previous versions, :meth:`strftime` method was restricted to
+      years >= 1900.
+
+(6)
    For example, if :meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``,
    ``%z`` is replaced with the string ``'-0330'``.
 

Modified: python/branches/py3k-cdecimal/Doc/library/decimal.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/decimal.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/decimal.rst	Tue Jan 11 18:07:55 2011
@@ -1657,7 +1657,8 @@
            build(trailneg)
        for i in range(places):
            build(next() if digits else '0')
-       build(dp)
+       if places:
+           build(dp)
        if not digits:
            build('0')
        i = 0

Modified: python/branches/py3k-cdecimal/Doc/library/dis.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/dis.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/dis.rst	Tue Jan 11 18:07:55 2011
@@ -4,19 +4,18 @@
 .. module:: dis
    :synopsis: Disassembler for Python bytecode.
 
+**Source code:** :source:`Lib/dis.py`
+
+--------------
 
 The :mod:`dis` module supports the analysis of CPython :term:`bytecode` by
 disassembling it. The CPython bytecode which this module takes as an
 input is defined in the file :file:`Include/opcode.h` and used by the compiler
 and the interpreter.
 
-.. seealso::
-
-   Latest version of the :source:`dis module Python source code <Lib/dis.py>`
-
 .. impl-detail::
 
-   Bytecode is an implementation detail of the CPython interpreter!  No
+   Bytecode is an implementation detail of the CPython interpreter.  No
    guarantees are made that bytecode will not be added, removed, or changed
    between versions of Python.  Use of this module should not be considered to
    work across Python VMs or Python releases.

Modified: python/branches/py3k-cdecimal/Doc/library/email.charset.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/email.charset.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/email.charset.rst	Tue Jan 11 18:07:55 2011
@@ -142,12 +142,6 @@
       it is *input_charset*.
 
 
-   .. method:: encoded_header_len()
-
-      Return the length of the encoded header string, properly calculating for
-      quoted-printable or base64 encoding.
-
-
    .. method:: header_encode(string)
 
       Header-encode the string *string*.
@@ -156,6 +150,16 @@
       *header_encoding* attribute.
 
 
+   .. method:: header_encode_lines(string, maxlengths)
+
+      Header-encode a *string* by converting it first to bytes.
+
+      This is similar to :meth:`header_encode` except that the string is fit
+      into maximum line lengths as given by the argument *maxlengths*, which
+      must be an iterator: each element returned from this iterator will provide
+      the next maximum line length.
+
+
    .. method:: body_encode(string)
 
       Body-encode the string *string*.

Modified: python/branches/py3k-cdecimal/Doc/library/email.generator.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/email.generator.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/email.generator.rst	Tue Jan 11 18:07:55 2011
@@ -79,8 +79,8 @@
 
       Messages parsed with a Bytes parser that have a
       :mailheader:`Content-Transfer-Encoding` of 8bit will be converted to a
-      use a 7bit Content-Transfer-Encoding.  Any other non-ASCII bytes in the
-      message structure will be converted to '?' characters.
+      use a 7bit Content-Transfer-Encoding.  Non-ASCII bytes in the headers
+      will be :rfc:`2047` encoded with a charset of `unknown-8bit`.
 
       .. versionchanged:: 3.2
          Added support for re-encoding 8bit message bodies, and the *linesep*

Modified: python/branches/py3k-cdecimal/Doc/library/email.header.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/email.header.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/email.header.rst	Tue Jan 11 18:07:55 2011
@@ -94,14 +94,15 @@
       decoded with that character set.
 
       If *s* is an instance of :class:`str`, then *charset* is a hint specifying
-      the character set of the characters in the string.  In this case, when
-      producing an :rfc:`2822`\ -compliant header using :rfc:`2047` rules, the
-      Unicode string will be encoded using the following charsets in order:
-      ``us-ascii``, the *charset* hint, ``utf-8``.  The first character set to
-      not provoke a :exc:`UnicodeError` is used.
+      the character set of the characters in the string.
 
-      Optional *errors* is passed through to any :func:`encode` or
-      :func:`ustr.encode` call, and defaults to "strict".
+      In either case, when producing an :rfc:`2822`\ -compliant header using
+      :rfc:`2047` rules, the string will be encoded using the output codec of
+      the charset.  If the string cannot be encoded using the output codec, a
+      UnicodeError will be raised.
+
+      Optional *errors* is passed as the errors argument to the decode call
+      if *s* is a byte string.
 
 
    .. method:: encode(splitchars=';, \\t', maxlinelen=None, linesep='\\n')
@@ -129,13 +130,15 @@
 
    .. method:: __str__()
 
-      A synonym for :meth:`Header.encode`.  Useful for ``str(aHeader)``.
-
+      Returns an approximation of the :class:`Header` as a string, using an
+      unlimited line length.  All pieces are converted to unicode using the
+      specified encoding and joined together appropriately.  Any pieces with a
+      charset of `unknown-8bit` are decoded as `ASCII` using the `replace`
+      error handler.
 
-   .. method:: __unicode__()
+      .. versionchanged:: 3.2
+         Added handling for the `unknown-8bit` charset.
 
-      A helper for :class:`str`'s :func:`encode` method.  Returns the header as
-      a Unicode string.
 
    .. method:: __eq__(other)
 

Modified: python/branches/py3k-cdecimal/Doc/library/email.message.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/email.message.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/email.message.rst	Tue Jan 11 18:07:55 2011
@@ -169,9 +169,10 @@
    Note that in all cases, any envelope header present in the message is not
    included in the mapping interface.
 
-   In a model generated from bytes, any header values that (in contravention
-   of the RFCs) contain non-ASCII bytes will have those bytes transformed
-   into '?' characters when the values are retrieved through this interface.
+   In a model generated from bytes, any header values that (in contravention of
+   the RFCs) contain non-ASCII bytes will, when retrieved through this
+   interface, be represented as :class:`~email.header.Header` objects with
+   a charset of `unknown-8bit`.
 
 
    .. method:: __len__()

Modified: python/branches/py3k-cdecimal/Doc/library/exceptions.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/exceptions.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/exceptions.rst	Tue Jan 11 18:07:55 2011
@@ -18,12 +18,10 @@
 
 The built-in exceptions listed below can be generated by the interpreter or
 built-in functions.  Except where mentioned, they have an "associated value"
-indicating the detailed cause of the error. This may be a string or a tuple
-containing several items of information (e.g., an error code and a string
-explaining the code).  The associated value is usually passed to the exception
-class's constructor.  If the exception class is derived from the standard root
-class :exc:`BaseException`, the associated value is present as the exception
-instance's :attr:`args` attribute.
+indicating the detailed cause of the error.  This may be a string or a tuple of
+several items of information (e.g., an error code and a string explaining the
+code).  The associated value is usually passed as arguments to the exception
+class's constructor.
 
 User code can raise built-in exceptions.  This can be used to test an exception
 handler or to report an error condition "just like" the situation in which the
@@ -38,16 +36,32 @@
 
 The following exceptions are used mostly as base classes for other exceptions.
 
-.. XXX document with_traceback()
-
 .. exception:: BaseException
 
    The base class for all built-in exceptions.  It is not meant to be directly
-   inherited by user-defined classes (for that use :exc:`Exception`).  If
+   inherited by user-defined classes (for that, use :exc:`Exception`).  If
    :func:`bytes` or :func:`str` is called on an instance of this class, the
-   representation of the argument(s) to the instance are returned or the empty
-   string when there were no arguments.  All arguments are  stored in :attr:`args`
-   as a tuple.
+   representation of the argument(s) to the instance are returned, or the empty
+   string when there were no arguments.
+
+   .. attribute:: args
+
+      The tuple of arguments given to the exception constructor.  Some built-in
+      exceptions (like :exc:`IOError`) expect a certain number of arguments and
+      assign a special meaning to the elements of this tuple, while others are
+      usually called only with a single string giving an error message.
+
+   .. method:: with_traceback(tb)
+
+      This method sets *tb* as the new traceback for the exception and returns
+      the exception object.  It is usually used in exception handling code like
+      this::
+
+         try:
+             ...
+         except SomeException:
+             tb = sys.exc_info()[2]
+             raise OtherException(...).with_traceback(tb)
 
 
 .. exception:: Exception

Modified: python/branches/py3k-cdecimal/Doc/library/filecmp.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/filecmp.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/filecmp.rst	Tue Jan 11 18:07:55 2011
@@ -5,16 +5,14 @@
    :synopsis: Compare files efficiently.
 .. sectionauthor:: Moshe Zadka <moshez at zadka.site.co.il>
 
+**Source code:** :source:`Lib/filecmp.py`
+
+--------------
 
 The :mod:`filecmp` module defines functions to compare files and directories,
 with various optional time/correctness trade-offs. For comparing files,
 see also the :mod:`difflib` module.
 
-.. seealso::
-
-   Latest version of the :source:`filecmp Python source code
-   <Lib/filecmp.py>`
-
 The :mod:`filecmp` module defines the following functions:
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/fileinput.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/fileinput.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/fileinput.rst	Tue Jan 11 18:07:55 2011
@@ -6,6 +6,9 @@
 .. moduleauthor:: Guido van Rossum <guido at python.org>
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
 
+**Source code:** :source:`Lib/fileinput.py`
+
+--------------
 
 This module implements a helper class and functions to quickly write a
 loop over standard input or a list of files. If you just want to read or
@@ -44,11 +47,6 @@
 returns an accordingly opened file-like object. Two useful hooks are already
 provided by this module.
 
-.. seealso::
-
-   Latest version of the :source:`fileinput Python source code
-   <Lib/fileinput.py>`
-
 The following function is the primary interface of this module:
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/fnmatch.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/fnmatch.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/fnmatch.rst	Tue Jan 11 18:07:55 2011
@@ -9,6 +9,10 @@
 
 .. index:: module: re
 
+**Source code:** :source:`Lib/fnmatch.py`
+
+--------------
+
 This module provides support for Unix shell-style wildcards, which are *not* the
 same as regular expressions (which are documented in the :mod:`re` module).  The
 special characters used in shell-style wildcards are:
@@ -33,10 +37,6 @@
 a period are not special for this module, and are matched by the ``*`` and ``?``
 patterns.
 
-.. seealso::
-
-   Latest version of the :source:`fnmatch Python source code
-   <Lib/fnmatch.py>`
 
 .. function:: fnmatch(filename, pattern)
 
@@ -92,4 +92,3 @@
 
    Module :mod:`glob`
       Unix shell-style path expansion.
-

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	Tue Jan 11 18:07:55 2011
@@ -8,16 +8,14 @@
 .. moduleauthor:: Nick Coghlan <ncoghlan at gmail.com>
 .. sectionauthor:: Peter Harris <scav at blueyonder.co.uk>
 
+**Source code:** :source:`Lib/functools.py`
+
+--------------
 
 The :mod:`functools` module is for higher-order functions: functions that act on
 or return other functions. In general, any callable object can be treated as a
 function for the purposes of this module.
 
-.. seealso::
-
-   Latest version of the :source:`functools Python source code
-   <Lib/functools.py>`
-
 The :mod:`functools` module defines the following functions:
 
 .. function:: cmp_to_key(func)

Modified: python/branches/py3k-cdecimal/Doc/library/glob.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/glob.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/glob.rst	Tue Jan 11 18:07:55 2011
@@ -7,6 +7,10 @@
 
 .. index:: single: filenames; pathname expansion
 
+**Source code:** :source:`Lib/glob.py`
+
+--------------
+
 The :mod:`glob` module finds all the pathnames matching a specified pattern
 according to the rules used by the Unix shell.  No tilde expansion is done, but
 ``*``, ``?``, and character ranges expressed with ``[]`` will be correctly
@@ -15,9 +19,6 @@
 subshell.  (For tilde and shell variable expansion, use
 :func:`os.path.expanduser` and :func:`os.path.expandvars`.)
 
-.. seealso::
-
-   Latest version of the :source:`glob module Python source code <Lib/glob.py>`
 
 .. function:: glob(pathname)
 

Modified: python/branches/py3k-cdecimal/Doc/library/heapq.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/heapq.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/heapq.rst	Tue Jan 11 18:07:55 2011
@@ -8,13 +8,12 @@
 .. sectionauthor:: François Pinard
 .. sectionauthor:: Raymond Hettinger
 
-This module provides an implementation of the heap queue algorithm, also known
-as the priority queue algorithm.
+**Source code:** :source:`Lib/heapq.py`
 
-.. seealso::
+--------------
 
-   Latest version of the :source:`heapq Python source code
-   <Lib/heapq.py>`
+This module provides an implementation of the heap queue algorithm, also known
+as the priority queue algorithm.
 
 Heaps are binary trees for which every parent node has a value less than or
 equal to any of its children.  This implementation uses arrays for which

Modified: python/branches/py3k-cdecimal/Doc/library/index.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/index.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/index.rst	Tue Jan 11 18:07:55 2011
@@ -49,6 +49,7 @@
    strings.rst
    datatypes.rst
    numeric.rst
+   functional.rst
    filesys.rst
    persistence.rst
    archiving.rst

Modified: python/branches/py3k-cdecimal/Doc/library/inspect.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/inspect.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/inspect.rst	Tue Jan 11 18:07:55 2011
@@ -176,17 +176,16 @@
 
 .. function:: getmoduleinfo(path)
 
-   Returns a :term:`named tuple` ``ModuleInfo(name, suffix, mode,
-   module_type)`` of values that describe how Python will interpret the file
-   identified by *path* if it is a module, or ``None`` if it would not be
-   identified as a module.  The return tuple is ``(name, suffix, mode, mtype)``,
-   where *name* is the name of the module without the name of any enclosing
-   package, *suffix* is the trailing part of the file name (which may not be a
-   dot-delimited extension), *mode* is the :func:`open` mode that would be used
-   (``'r'`` or ``'rb'``), and *mtype* is an integer giving the type of the
-   module.  *mtype* will have a value which can be compared to the constants
-   defined in the :mod:`imp` module; see the documentation for that module for
-   more information on module types.
+   Returns a :term:`named tuple` ``ModuleInfo(name, suffix, mode, module_type)``
+   of values that describe how Python will interpret the file identified by
+   *path* if it is a module, or ``None`` if it would not be identified as a
+   module.  In that tuple, *name* is the name of the module without the name of
+   any enclosing package, *suffix* is the trailing part of the file name (which
+   may not be a dot-delimited extension), *mode* is the :func:`open` mode that
+   would be used (``'r'`` or ``'rb'``), and *module_type* is an integer giving
+   the type of the module.  *module_type* will have a value which can be
+   compared to the constants defined in the :mod:`imp` module; see the
+   documentation for that module for more information on module types.
 
 
 .. function:: getmodulename(path)
@@ -391,12 +390,12 @@
 .. function:: getargspec(func)
 
    Get the names and default values of a Python function's arguments. A
-   :term:`named tuple` ``ArgSpec(args, varargs, keywords,
-   defaults)`` is returned. *args* is a list of
-   the argument names. *varargs* and *varkw* are the names of the ``*`` and
-   ``**`` arguments or ``None``. *defaults* is a tuple of default argument
-   values or None if there are no default arguments; if this tuple has *n*
-   elements, they correspond to the last *n* elements listed in *args*.
+   :term:`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is
+   returned. *args* is a list of the argument names. *varargs* and *keywords*
+   are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is a
+   tuple of default argument values or None if there are no default arguments;
+   if this tuple has *n* elements, they correspond to the last *n* elements
+   listed in *args*.
 
    .. deprecated:: 3.0
       Use :func:`getfullargspec` instead, which provides information about
@@ -425,8 +424,8 @@
 
    Get information about arguments passed into a particular frame.  A
    :term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is
-   returned. *args* is a list of the argument names.  *varargs* and *varkw* are
-   the names of the ``*`` and ``**`` arguments or ``None``.  *locals* is the
+   returned. *args* is a list of the argument names.  *varargs* and *keywords*
+   are the names of the ``*`` and ``**`` arguments or ``None``.  *locals* is the
    locals dictionary of the given frame.
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/keyword.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/keyword.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/keyword.rst	Tue Jan 11 18:07:55 2011
@@ -4,6 +4,9 @@
 .. module:: keyword
    :synopsis: Test whether a string is a keyword in Python.
 
+**Source code:** :source:`Lib/keyword.py`
+
+--------------
 
 This module allows a Python program to determine if a string is a keyword.
 
@@ -18,9 +21,3 @@
    Sequence containing all the keywords defined for the interpreter.  If any
    keywords are defined to only be active when particular :mod:`__future__`
    statements are in effect, these will be included as well.
-
-
-.. seealso::
-
-   Latest version of the :source:`keyword module Python source code
-   <Lib/keyword.py>`

Modified: python/branches/py3k-cdecimal/Doc/library/linecache.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/linecache.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/linecache.rst	Tue Jan 11 18:07:55 2011
@@ -5,17 +5,15 @@
    :synopsis: This module provides random access to individual lines from text files.
 .. sectionauthor:: Moshe Zadka <moshez at zadka.site.co.il>
 
+**Source code:** :source:`Lib/linecache.py`
+
+--------------
 
 The :mod:`linecache` module allows one to get any line from any file, while
 attempting to optimize internally, using a cache, the common case where many
 lines are read from a single file.  This is used by the :mod:`traceback` module
 to retrieve source lines for inclusion in  the formatted traceback.
 
-.. seealso::
-
-   Latest version of the :source:`linecache module Python source code
-   <Lib/linecache.py>`
-
 The :mod:`linecache` module defines the following functions:
 
 

Modified: python/branches/py3k-cdecimal/Doc/library/numeric.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/numeric.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/numeric.rst	Tue Jan 11 18:07:55 2011
@@ -24,6 +24,3 @@
    decimal.rst
    fractions.rst
    random.rst
-   itertools.rst
-   functools.rst
-   operator.rst

Modified: python/branches/py3k-cdecimal/Doc/library/operator.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/operator.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/operator.rst	Tue Jan 11 18:07:55 2011
@@ -19,8 +19,7 @@
 trailing ``__`` are also provided for convenience.
 
 The functions fall into categories that perform object comparisons, logical
-operations, mathematical operations, sequence operations, and abstract type
-tests.
+operations, mathematical operations and sequence operations.
 
 The object comparison functions are useful for all objects, and are named after
 the rich comparison operators they support:
@@ -226,91 +225,6 @@
 
    Set the value of *a* at index *b* to *c*.
 
-
-Many operations have an "in-place" version.  The following functions provide a
-more primitive access to in-place operators than the usual syntax does; for
-example, the :term:`statement` ``x += y`` is equivalent to
-``x = operator.iadd(x, y)``.  Another way to put it is to say that
-``z = operator.iadd(x, y)`` is equivalent to the compound statement
-``z = x; z += y``.
-
-.. function:: iadd(a, b)
-              __iadd__(a, b)
-
-   ``a = iadd(a, b)`` is equivalent to ``a += b``.
-
-
-.. function:: iand(a, b)
-              __iand__(a, b)
-
-   ``a = iand(a, b)`` is equivalent to ``a &= b``.
-
-
-.. function:: iconcat(a, b)
-              __iconcat__(a, b)
-
-   ``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences.
-
-
-.. function:: ifloordiv(a, b)
-              __ifloordiv__(a, b)
-
-   ``a = ifloordiv(a, b)`` is equivalent to ``a //= b``.
-
-
-.. function:: ilshift(a, b)
-              __ilshift__(a, b)
-
-   ``a = ilshift(a, b)`` is equivalent to ``a <<= b``.
-
-
-.. function:: imod(a, b)
-              __imod__(a, b)
-
-   ``a = imod(a, b)`` is equivalent to ``a %= b``.
-
-
-.. function:: imul(a, b)
-              __imul__(a, b)
-
-   ``a = imul(a, b)`` is equivalent to ``a *= b``.
-
-
-.. function:: ior(a, b)
-              __ior__(a, b)
-
-   ``a = ior(a, b)`` is equivalent to ``a |= b``.
-
-
-.. function:: ipow(a, b)
-              __ipow__(a, b)
-
-   ``a = ipow(a, b)`` is equivalent to ``a **= b``.
-
-
-.. function:: irshift(a, b)
-              __irshift__(a, b)
-
-   ``a = irshift(a, b)`` is equivalent to ``a >>= b``.
-
-
-.. function:: isub(a, b)
-              __isub__(a, b)
-
-   ``a = isub(a, b)`` is equivalent to ``a -= b``.
-
-
-.. function:: itruediv(a, b)
-              __itruediv__(a, b)
-
-   ``a = itruediv(a, b)`` is equivalent to ``a /= b``.
-
-
-.. function:: ixor(a, b)
-              __ixor__(a, b)
-
-   ``a = ixor(a, b)`` is equivalent to ``a ^= b``.
-
 Example: Build a dictionary that maps the ordinals from ``0`` to ``255`` to
 their character equivalents.
 
@@ -491,3 +405,112 @@
 | Ordering              | ``a > b``               | ``gt(a, b)``                          |
 +-----------------------+-------------------------+---------------------------------------+
 
+Inplace Operators
+=================
+
+Many operations have an "in-place" version.  Listed below are functions
+providing a more primitive access to in-place operators than the usual syntax
+does; for example, the :term:`statement` ``x += y`` is equivalent to
+``x = operator.iadd(x, y)``.  Another way to put it is to say that
+``z = operator.iadd(x, y)`` is equivalent to the compound statement
+``z = x; z += y``.
+
+In those examples, note that when an in-place method is called, the computation
+and assignment are performed in two separate steps.  The in-place functions
+listed below only do the first step, calling the in-place method.  The second
+step, assignment, is not handled.
+
+For immutable targets such as strings, numbers, and tuples, the updated
+value is computed, but not assigned back to the input variable:
+
+>>> a = 'hello'
+>>> iadd(a, ' world')
+'hello world'
+>>> a
+'hello'
+
+For mutable targets such as lists and dictionaries, the inplace method
+will perform the update, so no subsequent assignment is necessary:
+
+>>> s = ['h', 'e', 'l', 'l', 'o']
+>>> iadd(s, [' ', 'w', 'o', 'r', 'l', 'd'])
+['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
+>>> s
+['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
+
+.. function:: iadd(a, b)
+              __iadd__(a, b)
+
+   ``a = iadd(a, b)`` is equivalent to ``a += b``.
+
+
+.. function:: iand(a, b)
+              __iand__(a, b)
+
+   ``a = iand(a, b)`` is equivalent to ``a &= b``.
+
+
+.. function:: iconcat(a, b)
+              __iconcat__(a, b)
+
+   ``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences.
+
+
+.. function:: ifloordiv(a, b)
+              __ifloordiv__(a, b)
+
+   ``a = ifloordiv(a, b)`` is equivalent to ``a //= b``.
+
+
+.. function:: ilshift(a, b)
+              __ilshift__(a, b)
+
+   ``a = ilshift(a, b)`` is equivalent to ``a <<= b``.
+
+
+.. function:: imod(a, b)
+              __imod__(a, b)
+
+   ``a = imod(a, b)`` is equivalent to ``a %= b``.
+
+
+.. function:: imul(a, b)
+              __imul__(a, b)
+
+   ``a = imul(a, b)`` is equivalent to ``a *= b``.
+
+
+.. function:: ior(a, b)
+              __ior__(a, b)
+
+   ``a = ior(a, b)`` is equivalent to ``a |= b``.
+
+
+.. function:: ipow(a, b)
+              __ipow__(a, b)
+
+   ``a = ipow(a, b)`` is equivalent to ``a **= b``.
+
+
+.. function:: irshift(a, b)
+              __irshift__(a, b)
+
+   ``a = irshift(a, b)`` is equivalent to ``a >>= b``.
+
+
+.. function:: isub(a, b)
+              __isub__(a, b)
+
+   ``a = isub(a, b)`` is equivalent to ``a -= b``.
+
+
+.. function:: itruediv(a, b)
+              __itruediv__(a, b)
+
+   ``a = itruediv(a, b)`` is equivalent to ``a /= b``.
+
+
+.. function:: ixor(a, b)
+              __ixor__(a, b)
+
+   ``a = ixor(a, b)`` is equivalent to ``a ^= b``.

Modified: python/branches/py3k-cdecimal/Doc/library/optparse.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/optparse.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/optparse.rst	Tue Jan 11 18:07:55 2011
@@ -61,9 +61,9 @@
 
 .. code-block:: text
 
-   usage: <yourscript> [options]
+   Usage: <yourscript> [options]
 
-   options:
+   Options:
      -h, --help            show this help message and exit
      -f FILE, --file=FILE  write report to FILE
      -q, --quiet           don't print status messages to stdout
@@ -492,9 +492,9 @@
 
 .. code-block:: text
 
-   usage: <yourscript> [options] arg1 arg2
+   Usage: <yourscript> [options] arg1 arg2
 
-   options:
+   Options:
      -h, --help            show this help message and exit
      -v, --verbose         make lots of noise [default]
      -q, --quiet           be vewwy quiet (I'm hunting wabbits)
@@ -518,7 +518,7 @@
   is then printed before the detailed option help.
 
   If you don't supply a usage string, :mod:`optparse` uses a bland but sensible
-  default: ``"usage: %prog [options]"``, which is fine if your script doesn't
+  default: ``"Usage: %prog [options]"``, which is fine if your script doesn't
   take any positional arguments.
 
 * every option defines a help string, and doesn't worry about line-wrapping---
@@ -550,12 +550,33 @@
   default value.  If an option has no default value (or the default value is
   ``None``), ``%default`` expands to ``none``.
 
+Grouping Options
+++++++++++++++++
+
 When dealing with many options, it is convenient to group these options for
 better help output.  An :class:`OptionParser` can contain several option groups,
 each of which can contain several options.
 
-Continuing with the parser defined above, adding an :class:`OptionGroup` to a
-parser is easy::
+An option group is obtained using the class :class:`OptionGroup`:
+
+.. class:: OptionGroup(parser, title, description=None)
+
+   where
+
+   * parser is the :class:`OptionParser` instance the group will be insterted in
+     to
+   * title is the group title
+   * description, optional, is a long description of the group
+
+:class:`OptionGroup` inherits from :class:`OptionContainer` (like
+:class:`OptionParser`) and so the :meth:`add_option` method can be used to add
+an option to the group.
+
+Once all the options are declared, using the :class:`OptionParser` method
+:meth:`add_option_group` the group is added to the previously defined parser.
+
+Continuing with the parser defined in the previous section, adding an
+:class:`OptionGroup` to a parser is easy::
 
     group = OptionGroup(parser, "Dangerous Options",
                         "Caution: use these options at your own risk.  "
@@ -567,20 +588,73 @@
 
 .. code-block:: text
 
-    usage:  [options] arg1 arg2
+   Usage: <yourscript> [options] arg1 arg2
+
+   Options:
+     -h, --help            show this help message and exit
+     -v, --verbose         make lots of noise [default]
+     -q, --quiet           be vewwy quiet (I'm hunting wabbits)
+     -f FILE, --filename=FILE
+                           write output to FILE
+     -m MODE, --mode=MODE  interaction mode: novice, intermediate, or
+                           expert [default: intermediate]
+
+     Dangerous Options:
+       Caution: use these options at your own risk.  It is believed that some
+       of them bite.
+
+       -g                  Group option.
+
+A bit more complete example might invole using more than one group: still
+extendind the previous example::
+
+    group = OptionGroup(parser, "Dangerous Options",
+                        "Caution: use these options at your own risk.  "
+                        "It is believed that some of them bite.")
+    group.add_option("-g", action="store_true", help="Group option.")
+    parser.add_option_group(group)
+
+    group = OptionGroup(parser, "Debug Options")
+    group.add_option("-d", "--debug", action="store_true",
+                     help="Print debug information")
+    group.add_option("-s", "--sql", action="store_true",
+                     help="Print all SQL statements executed")
+    group.add_option("-e", action="store_true", help="Print every action done")
+    parser.add_option_group(group)
+
+that results in the following output:
+
+.. code-block:: text
+
+   Usage: <yourscript> [options] arg1 arg2
+
+   Options:
+     -h, --help            show this help message and exit
+     -v, --verbose         make lots of noise [default]
+     -q, --quiet           be vewwy quiet (I'm hunting wabbits)
+     -f FILE, --filename=FILE
+                           write output to FILE
+     -m MODE, --mode=MODE  interaction mode: novice, intermediate, or expert
+                           [default: intermediate]
+
+     Dangerous Options:
+       Caution: use these options at your own risk.  It is believed that some
+       of them bite.
+
+       -g                  Group option.
+
+     Debug Options:
+       -d, --debug         Print debug information
+       -s, --sql           Print all SQL statements executed
+       -e                  Print every action done
+
+Another interesting method, in particular when working programmatically with
+option groups is:
+
+.. method:: OptionParser.get_option_group(opt_str)
 
-    options:
-      -h, --help           show this help message and exit
-      -v, --verbose        make lots of noise [default]
-      -q, --quiet          be vewwy quiet (I'm hunting wabbits)
-      -fFILE, --file=FILE  write output to FILE
-      -mMODE, --mode=MODE  interaction mode: one of 'novice', 'intermediate'
-                           [default], 'expert'
-
-      Dangerous Options:
-      Caution: use of these options is at your own risk.  It is believed that
-      some of them bite.
-      -g                 Group option.
+   Return, if defined, the :class:`OptionGroup` that has the title or the long
+   description equals to *opt_str*
 
 .. _optparse-printing-version-string:
 
@@ -652,14 +726,14 @@
 that takes an integer::
 
    $ /usr/bin/foo -n 4x
-   usage: foo [options]
+   Usage: foo [options]
 
    foo: error: option -n: invalid integer value: '4x'
 
 Or, where the user fails to pass a value at all::
 
    $ /usr/bin/foo -n
-   usage: foo [options]
+   Usage: foo [options]
 
    foo: error: -n option requires an argument
 
@@ -1161,9 +1235,9 @@
 
   .. code-block:: text
 
-     usage: foo.py [options]
+     Usage: foo.py [options]
 
-     options:
+     Options:
        -h, --help        Show this help message and exit
        -v                Be moderately verbose
        --file=FILENAME   Input file to read data from
@@ -1358,7 +1432,7 @@
 option strings.  Now ``--dry-run`` is the only way for the user to activate
 that option.  If the user asks for help, the help message will reflect that::
 
-   options:
+   Options:
      --dry-run     do no harm
      [...]
      -n, --noisy   be noisy
@@ -1374,7 +1448,7 @@
 At this point, the original ``-n``/``--dry-run`` option is no longer
 accessible, so :mod:`optparse` removes it, leaving this help text::
 
-   options:
+   Options:
      [...]
      -n, --noisy   be noisy
      --dry-run     new dry-run option

Modified: python/branches/py3k-cdecimal/Doc/library/pprint.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/pprint.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/pprint.rst	Tue Jan 11 18:07:55 2011
@@ -6,6 +6,9 @@
 .. moduleauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
 
+**Source code:** :source:`Lib/pprint.py`
+
+--------------
 
 The :mod:`pprint` module provides a capability to "pretty-print" arbitrary
 Python data structures in a form which can be used as input to the interpreter.
@@ -21,11 +24,6 @@
 
 Dictionaries are sorted by key before the display is computed.
 
-.. seealso::
-
-   Latest version of the :source:`pprint module Python source code
-   <Lib/pprint.py>`
-
 The :mod:`pprint` module defines one class:
 
 .. First the implementation class:

Modified: python/branches/py3k-cdecimal/Doc/library/pyexpat.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/pyexpat.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/pyexpat.rst	Tue Jan 11 18:07:55 2011
@@ -153,6 +153,13 @@
    :attr:`ordered_attributes` and :attr:`specified_attributes` set to the values of
    this parser.
 
+.. method:: xmlparser.SetParamEntityParsing(flag)
+
+   Control parsing of parameter entities (including the external DTD subset).
+   Possible *flag* values are :const:`XML_PARAM_ENTITY_PARSING_NEVER`,
+   :const:`XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE` and
+   :const:`XML_PARAM_ENTITY_PARSING_ALWAYS`.  Return true if setting the flag
+   was successful.
 
 .. method:: xmlparser.UseForeignDTD([flag])
 

Modified: python/branches/py3k-cdecimal/Doc/library/queue.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/queue.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/queue.rst	Tue Jan 11 18:07:55 2011
@@ -4,6 +4,9 @@
 .. module:: queue
    :synopsis: A synchronized queue class.
 
+**Source code:** :source:`Lib/queue.py`
+
+--------------
 
 The :mod:`queue` module implements multi-producer, multi-consumer queues.
 It is especially useful in threaded programming when information must be
@@ -19,10 +22,6 @@
 the entries are kept sorted (using the :mod:`heapq` module) and the
 lowest valued entry is retrieved first.
 
-.. seealso::
-
-   Latest version of the :source:`queue module Python source code
-   <Lib/queue.py>`
 
 The :mod:`queue` module defines the following classes and exceptions:
 
@@ -64,12 +63,6 @@
    Exception raised when non-blocking :meth:`put` (or :meth:`put_nowait`) is called
    on a :class:`Queue` object which is full.
 
-.. seealso::
-
-   :class:`collections.deque` is an alternative implementation of unbounded
-   queues with fast atomic :func:`append` and :func:`popleft` operations that
-   do not require locking.
-
 
 .. _queueobjects:
 
@@ -180,3 +173,14 @@
 
    q.join()       # block until all tasks are done
 
+
+.. seealso::
+
+   Class :class:`multiprocessing.Queue`
+      A queue class for use in a multi-processing (rather than multi-threading)
+      context.
+
+   :class:`collections.deque` is an alternative implementation of unbounded
+   queues with fast atomic :func:`append` and :func:`popleft` operations that
+   do not require locking.
+

Modified: python/branches/py3k-cdecimal/Doc/library/quopri.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/quopri.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/quopri.rst	Tue Jan 11 18:07:55 2011
@@ -9,6 +9,10 @@
    pair: quoted-printable; encoding
    single: MIME; quoted-printable encoding
 
+**Source code:** :source:`Lib/quopri.py`
+
+--------------
+
 This module performs quoted-printable transport encoding and decoding, as
 defined in :rfc:`1521`: "MIME (Multipurpose Internet Mail Extensions) Part One:
 Mechanisms for Specifying and Describing the Format of Internet Message Bodies".
@@ -17,11 +21,6 @@
 :mod:`base64` module is more compact if there are many such characters, as when
 sending a graphics file.
 
-.. seealso::
-
-   Latest version of the :source:`quopri module Python source code
-   <Lib/quopri.py>`
-
 .. function:: decode(input, output, header=False)
 
    Decode the contents of the *input* file and write the resulting decoded binary
@@ -62,4 +61,3 @@
 
    Module :mod:`base64`
       Encode and decode MIME base64 data
-

Modified: python/branches/py3k-cdecimal/Doc/library/random.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/random.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/random.rst	Tue Jan 11 18:07:55 2011
@@ -4,15 +4,13 @@
 .. module:: random
    :synopsis: Generate pseudo-random numbers with various common distributions.
 
+**Source code:** :source:`Lib/random.py`
+
+--------------
 
 This module implements pseudo-random number generators for various
 distributions.
 
-.. seealso::
-
-   Latest version of the :source:`random module Python source code
-   <Lib/random.py>`
-
 For integers, there is uniform selection from a range. For sequences, there is
 uniform selection of a random element, a function to generate a random
 permutation of a list in-place, and a function for random sampling without
@@ -45,8 +43,8 @@
 uses the system function :func:`os.urandom` to generate random numbers
 from sources provided by the operating system.
 
-Bookkeeping functions:
 
+Bookkeeping functions:
 
 .. function:: seed([x], version=2)
 

Modified: python/branches/py3k-cdecimal/Doc/library/sched.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/sched.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/sched.rst	Tue Jan 11 18:07:55 2011
@@ -7,13 +7,12 @@
 
 .. index:: single: event scheduling
 
-The :mod:`sched` module defines a class which implements a general purpose event
-scheduler:
+**Source code:** :source:`Lib/sched.py`
 
-.. seealso::
+--------------
 
-   Latest version of the :source:`sched module Python source code
-   <Lib/sched.py>`
+The :mod:`sched` module defines a class which implements a general purpose event
+scheduler:
 
 .. class:: scheduler(timefunc, delayfunc)
 

Modified: python/branches/py3k-cdecimal/Doc/library/shelve.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/shelve.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/shelve.rst	Tue Jan 11 18:07:55 2011
@@ -7,16 +7,16 @@
 
 .. index:: module: pickle
 
+**Source code:** :source:`Lib/shelve.py`
+
+--------------
+
 A "shelf" is a persistent, dictionary-like object.  The difference with "dbm"
 databases is that the values (not the keys!) in a shelf can be essentially
 arbitrary Python objects --- anything that the :mod:`pickle` module can handle.
 This includes most class instances, recursive data types, and objects containing
 lots of shared  sub-objects.  The keys are ordinary strings.
 
-.. seealso::
-
-   Latest version of the :source:`shelve module Python source code
-   <Lib/shelve.py>`
 
 .. function:: open(filename, flag='c', protocol=None, writeback=False)
 

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	Tue Jan 11 18:07:55 2011
@@ -10,20 +10,19 @@
    single: file; copying
    single: copying files
 
+**Source code:** :source:`Lib/shutil.py`
+
+--------------
+
 The :mod:`shutil` module offers a number of high-level operations on files and
 collections of files.  In particular, functions are provided  which support file
 copying and removal. For operations on individual files, see also the
 :mod:`os` module.
 
-.. seealso::
-
-   Latest version of the :source:`shutil module Python source code
-   <Lib/shutil.py>`
-
 .. warning::
 
    Even the higher-level file copying functions (:func:`copy`, :func:`copy2`)
-   can't copy all file metadata.
+   cannot copy all file metadata.
 
    On POSIX platforms, this means that file owner and group are lost as well
    as ACLs.  On Mac OS, the resource fork and other metadata are not used.

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	Tue Jan 11 18:07:55 2011
@@ -25,6 +25,15 @@
 is implicit on send operations.
 
 
+.. seealso::
+
+   Module :mod:`socketserver`
+      Classes that simplify writing network servers.
+
+   Module :mod:`ssl`
+      A TLS/SSL wrapper for socket objects.
+
+
 Socket families
 ---------------
 
@@ -139,8 +148,8 @@
 .. exception:: timeout
 
    This exception is raised when a timeout occurs on a socket which has had
-   timeouts enabled via a prior call to :meth:`settimeout`.  The accompanying value
-   is a string whose value is currently always "timed out".
+   timeouts enabled via a prior call to :meth:`~socket.settimeout`.  The
+   accompanying value is a string whose value is currently always "timed out".
 
 
 .. data:: AF_UNIX
@@ -506,9 +515,10 @@
 
 .. function:: setdefaulttimeout(timeout)
 
-   Set the default timeout in floating seconds for new socket objects. A value of
-   ``None`` indicates that new socket objects have no timeout. When the socket
-   module is first imported, the default is ``None``.
+   Set the default timeout in floating seconds for new socket objects.  When
+   the socket module is first imported, the default is ``None``.  See
+   :meth:`~socket.settimeout` for possible values and their respective
+   meanings.
 
 
 .. data:: SocketType
@@ -517,12 +527,6 @@
    same as ``type(socket(...))``.
 
 
-.. seealso::
-
-   Module :mod:`socketserver`
-      Classes that simplify writing network servers.
-
-
 .. _socket-objects:
 
 Socket Objects
@@ -552,6 +556,12 @@
    remote end will receive no more data (after queued data is flushed). Sockets are
    automatically closed when they are garbage-collected.
 
+   .. note::
+      :meth:`close()` releases the resource associated with a connection but
+      does not necessarily close the connection immediately.  If you want
+      to close the connection in a timely fashion, call :meth:`shutdown()`
+      before :meth:`close()`.
+
 
 .. method:: socket.connect(address)
 
@@ -615,6 +625,13 @@
    to decode C structures encoded as byte strings).
 
 
+.. method:: socket.gettimeout()
+
+   Return the timeout in floating seconds associated with socket operations,
+   or ``None`` if no timeout is set.  This reflects the last call to
+   :meth:`setblocking` or :meth:`settimeout`.
+
+
 .. method:: socket.ioctl(control, option)
 
    :platform: Windows
@@ -644,8 +661,9 @@
    interpreted the same way as by the built-in :func:`open` function.
 
    Closing the file object won't close the socket unless there are no remaining
-   references to the socket.  The socket must be in blocking mode (it can not
-   have a timeout).
+   references to the socket.  The socket must be in blocking mode; it can have
+   a timeout, but the file object's internal buffer may end up in a inconsistent
+   state if a timeout occurs.
 
    .. note::
 
@@ -725,55 +743,26 @@
 
 .. method:: socket.setblocking(flag)
 
-   Set blocking or non-blocking mode of the socket: if *flag* is 0, the socket is
-   set to non-blocking, else to blocking mode.  Initially all sockets are in
-   blocking mode.  In non-blocking mode, if a :meth:`recv` call doesn't find any
-   data, or if a :meth:`send` call can't immediately dispose of the data, a
-   :exc:`error` exception is raised; in blocking mode, the calls block until they
-   can proceed. ``s.setblocking(0)`` is equivalent to ``s.settimeout(0.0)``;
-   ``s.setblocking(1)`` is equivalent to ``s.settimeout(None)``.
-
+   Set blocking or non-blocking mode of the socket: if *flag* is false, the
+   socket is set to non-blocking, else to blocking mode.
 
-.. method:: socket.settimeout(value)
-
-   Set a timeout on blocking socket operations.  The *value* argument can be a
-   nonnegative float expressing seconds, or ``None``. If a float is given,
-   subsequent socket operations will raise a :exc:`timeout` exception if the
-   timeout period *value* has elapsed before the operation has completed.  Setting
-   a timeout of ``None`` disables timeouts on socket operations.
-   ``s.settimeout(0.0)`` is equivalent to ``s.setblocking(0)``;
-   ``s.settimeout(None)`` is equivalent to ``s.setblocking(1)``.
+   This method is a shorthand for certain :meth:`~socket.settimeout` calls:
 
+   * ``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``
 
-.. method:: socket.gettimeout()
+   * ``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``
 
-   Return the timeout in floating seconds associated with socket operations, or
-   ``None`` if no timeout is set.  This reflects the last call to
-   :meth:`setblocking` or :meth:`settimeout`.
 
+.. method:: socket.settimeout(value)
 
-Some notes on socket blocking and timeouts: A socket object can be in one of
-three modes: blocking, non-blocking, or timeout.  Sockets are always created in
-blocking mode.  In blocking mode, operations block until complete or
-the system returns an error (such as connection timed out).  In
-non-blocking mode, operations fail (with an error that is unfortunately
-system-dependent) if they cannot be completed immediately.  In timeout mode,
-operations fail if they cannot be completed within the timeout specified for the
-socket or if the system returns an error.  The :meth:`~socket.setblocking`
-method is simply a shorthand for certain :meth:`~socket.settimeout` calls.
-
-Timeout mode internally sets the socket in non-blocking mode.  The blocking and
-timeout modes are shared between file descriptors and socket objects that refer
-to the same network endpoint.  A consequence of this is that file objects
-returned by the :meth:`~socket.makefile` method must only be used when the
-socket is in blocking mode; in timeout or non-blocking mode file operations
-that cannot be completed immediately will fail.
+   Set a timeout on blocking socket operations.  The *value* argument can be a
+   nonnegative floating point number expressing seconds, or ``None``.
+   If a non-zero value is given, subsequent socket operations will raise a
+   :exc:`timeout` exception if the timeout period *value* has elapsed before
+   the operation has completed.  If zero is given, the socket is put in
+   non-blocking mode. If ``None`` is given, the socket is put in blocking mode.
 
-Note that the :meth:`~socket.connect` operation is subject to the timeout
-setting, and in general it is recommended to call :meth:`~socket.settimeout`
-before calling :meth:`~socket.connect` or pass a timeout parameter to
-:meth:`create_connection`.  The system network stack may return a connection
-timeout error of its own regardless of any Python socket timeout setting.
+   For further information, please consult the :ref:`notes on socket timeouts <socket-timeouts>`.
 
 
 .. method:: socket.setsockopt(level, optname, value)
@@ -819,6 +808,61 @@
    The socket protocol.
 
 
+
+.. _socket-timeouts:
+
+Notes on socket timeouts
+------------------------
+
+A socket object can be in one of three modes: blocking, non-blocking, or
+timeout.  Sockets are by default always created in blocking mode, but this
+can be changed by calling :func:`setdefaulttimeout`.
+
+* In *blocking mode*, operations block until complete or the system returns
+  an error (such as connection timed out).
+
+* In *non-blocking mode*, operations fail (with an error that is unfortunately
+  system-dependent) if they cannot be completed immediately: functions from the
+  :mod:`select` can be used to know when and whether a socket is available for
+  reading or writing.
+
+* In *timeout mode*, operations fail if they cannot be completed within the
+  timeout specified for the socket (they raise a :exc:`timeout` exception)
+  or if the system returns an error.
+
+.. note::
+   At the operating system level, sockets in *timeout mode* are internally set
+   in non-blocking mode.  Also, the blocking and timeout modes are shared between
+   file descriptors and socket objects that refer to the same network endpoint.
+   This implementation detail can have visible consequences if e.g. you decide
+   to use the :meth:`~socket.fileno()` of a socket.
+
+Timeouts and the ``connect`` method
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The :meth:`~socket.connect` operation is also subject to the timeout
+setting, and in general it is recommended to call :meth:`~socket.settimeout`
+before calling :meth:`~socket.connect` or pass a timeout parameter to
+:meth:`create_connection`.  However, the system network stack may also
+return a connection timeout error of its own regardless of any Python socket
+timeout setting.
+
+Timeouts and the ``accept`` method
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by
+the :meth:`~socket.accept` method inherit that timeout.  Otherwise, the
+behaviour depends on settings of the listening socket:
+
+* if the listening socket is in *blocking mode* or in *timeout mode*,
+  the socket returned by :meth:`~socket.accept` is in *blocking mode*;
+
+* if the listening socket is in *non-blocking mode*, whether the socket
+  returned by :meth:`~socket.accept` is in blocking or non-blocking mode
+  is operating system-dependent.  If you want to ensure cross-platform
+  behaviour, it is recommended you manually override this setting.
+
+
 .. _socket-example:
 
 Example

Modified: python/branches/py3k-cdecimal/Doc/library/ssl.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/ssl.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/ssl.rst	Tue Jan 11 18:07:55 2011
@@ -1,8 +1,8 @@
-:mod:`ssl` --- SSL wrapper for socket objects
-=============================================
+:mod:`ssl` --- TLS/SSL wrapper for socket objects
+=================================================
 
 .. module:: ssl
-   :synopsis: SSL wrapper for socket objects
+   :synopsis: TLS/SSL wrapper for socket objects
 
 .. moduleauthor:: Bill Janssen <bill.janssen at gmail.com>
 .. sectionauthor::  Bill Janssen <bill.janssen at gmail.com>
@@ -768,11 +768,11 @@
 should use the following idiom::
 
    try:
-      import ssl
+       import ssl
    except ImportError:
-      pass
+       pass
    else:
-      [ do something that requires SSL support ]
+       ... # do something that requires SSL support
 
 Client-side operation
 ^^^^^^^^^^^^^^^^^^^^^
@@ -883,26 +883,27 @@
 method to create a server-side SSL socket for the connection::
 
    while True:
-      newsocket, fromaddr = bindsocket.accept()
-      connstream = context.wrap_socket(newsocket, server_side=True)
-      try:
-         deal_with_client(connstream)
-      finally:
-         connstream.close()
+       newsocket, fromaddr = bindsocket.accept()
+       connstream = context.wrap_socket(newsocket, server_side=True)
+       try:
+           deal_with_client(connstream)
+       finally:
+           connstream.shutdown(socket.SHUT_RDWR)
+           connstream.close()
 
 Then you'll read data from the ``connstream`` and do something with it till you
 are finished with the client (or the client is finished with you)::
 
    def deal_with_client(connstream):
-      data = connstream.recv(1024)
-      # empty data means the client is finished with us
-      while data:
-         if not do_something(connstream, data):
-            # we'll assume do_something returns False
-            # when we're finished with client
-            break
-         data = connstream.recv(1024)
-      # finished with client
+       data = connstream.recv(1024)
+       # empty data means the client is finished with us
+       while data:
+           if not do_something(connstream, data):
+               # we'll assume do_something returns False
+               # when we're finished with client
+               break
+           data = connstream.recv(1024)
+       # finished with client
 
 And go back to listening for new client connections (of course, a real server
 would probably handle each client connection in a separate thread, or put

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	Tue Jan 11 18:07:55 2011
@@ -2117,8 +2117,20 @@
       returned or raised by the ``__missing__(key)`` call if the key is not
       present. No other operations or methods invoke :meth:`__missing__`. If
       :meth:`__missing__` is not defined, :exc:`KeyError` is raised.
-      :meth:`__missing__` must be a method; it cannot be an instance variable. For
-      an example, see :class:`collections.defaultdict`.
+      :meth:`__missing__` must be a method; it cannot be an instance variable::
+
+          >>> class Counter(dict):
+          ...     def __missing__(self, key):
+          ...         return 0
+          >>> c = Counter()
+          >>> c['red']
+          0
+          >>> c['red'] += 1
+          >>> c['red']
+          1
+
+      See :class:`collections.Counter` for a complete implementation including
+      other methods helpful for accumulating and managing tallies.
 
    .. describe:: d[key] = value
 

Modified: python/branches/py3k-cdecimal/Doc/library/string.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/string.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/string.rst	Tue Jan 11 18:07:55 2011
@@ -5,21 +5,15 @@
    :synopsis: Common string operations.
 
 
-.. index:: module: re
+.. seealso::
 
-The :mod:`string` module contains a number of useful constants and classes
-for string formatting.  In addition, Python's built-in string classes
-support the sequence type methods described in the :ref:`typesseq`
-section, and also the string-specific methods described in the
-:ref:`string-methods` section.  To output formatted strings, see the
-:ref:`string-formatting` section.  Also, see the :mod:`re` module for
-string functions based on regular expressions.
+   :ref:`typesseq`
 
-.. seealso::
+   :ref:`string-methods`
 
-   Latest version of the :source:`string module Python source code
-   <Lib/string.py>`
+**Source code:** :source:`Lib/string.py`
 
+--------------
 
 String constants
 ----------------

Modified: python/branches/py3k-cdecimal/Doc/library/textwrap.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/textwrap.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/textwrap.rst	Tue Jan 11 18:07:55 2011
@@ -6,6 +6,9 @@
 .. moduleauthor:: Greg Ward <gward at python.net>
 .. sectionauthor:: Greg Ward <gward at python.net>
 
+**Source code:** :source:`Lib/textwrap.py`
+
+--------------
 
 The :mod:`textwrap` module provides two convenience functions, :func:`wrap` and
 :func:`fill`, as well as :class:`TextWrapper`, the class that does all the work,
@@ -13,11 +16,6 @@
 or two  text strings, the convenience functions should be good enough;
 otherwise,  you should use an instance of :class:`TextWrapper` for efficiency.
 
-.. seealso::
-
-   Latest version of the :source:`textwrap module Python source code
-   <Lib/textwrap.py>`
-
 .. function:: wrap(text, width=70, **kwargs)
 
    Wraps the single paragraph in *text* (a string) so every line is at most

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	Tue Jan 11 18:07:55 2011
@@ -4,6 +4,9 @@
 .. module:: threading
    :synopsis: Thread-based parallelism.
 
+**Source code:** :source:`Lib/threading.py`
+
+--------------
 
 This module constructs higher-level threading interfaces on top of the lower
 level :mod:`_thread` module.  See also the :mod:`queue` module.
@@ -17,10 +20,17 @@
    methods and functions in this module in the Python 2.x series are still
    supported by this module.
 
-.. seealso::
+.. impl-detail::
+
+   Due to the :term:`Global Interpreter Lock`, in CPython only one thread
+   can execute Python code at once (even though certain performance-oriented
+   libraries might overcome this limitation).
+   If you want your application to make better of use of the computational
+   resources of multi-core machines, you are advised to use
+   :mod:`multiprocessing` or :class:`concurrent.futures.ProcessPoolExecutor`.
+   However, threading is still an appropriate model if you want to run
+   multiple I/O-bound tasks simultaneously.
 
-   Latest version of the :source:`threading module Python source code
-   <Lib/threading.py>`
 
 This module defines the following functions and objects:
 
@@ -707,9 +717,9 @@
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Semaphores are often used to guard resources with limited capacity, for example,
-a database server.  In any situation where the size of the resource size is
-fixed, you should use a bounded semaphore.  Before spawning any worker threads,
-your main thread would initialize the semaphore::
+a database server.  In any situation where the size of the resource is fixed,
+you should use a bounded semaphore.  Before spawning any worker threads, your
+main thread would initialize the semaphore::
 
    maxconnections = 5
    ...

Modified: python/branches/py3k-cdecimal/Doc/library/time.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/time.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/time.rst	Tue Jan 11 18:07:55 2011
@@ -24,9 +24,9 @@
 
 .. index:: single: Year 2038
 
-* The functions in this module do not handle dates and times before the epoch or
+* The functions in this module may not handle dates and times before the epoch or
   far in the future.  The cut-off point in the future is determined by the C
-  library; for Unix, it is typically in 2038.
+  library; for 32-bit systems, it is typically in 2038.
 
 .. index::
    single: Year 2000
@@ -34,20 +34,31 @@
 
 .. _time-y2kissues:
 
-* **Year 2000 (Y2K) issues**:  Python depends on the platform's C library, which
+* **Year 2000 (Y2K) issues**: Python depends on the platform's C library, which
   generally doesn't have year 2000 issues, since all dates and times are
-  represented internally as seconds since the epoch.  Functions accepting a
-  :class:`struct_time` (see below) generally require a 4-digit year.  For backward
-  compatibility, 2-digit years are supported if the module variable
-  ``accept2dyear`` is a non-zero integer; this variable is initialized to ``1``
-  unless the environment variable :envvar:`PYTHONY2K` is set to a non-empty
-  string, in which case it is initialized to ``0``.  Thus, you can set
-  :envvar:`PYTHONY2K` to a non-empty string in the environment to require 4-digit
-  years for all year input.  When 2-digit years are accepted, they are converted
-  according to the POSIX or X/Open standard: values 69-99 are mapped to 1969-1999,
-  and values 0--68 are mapped to 2000--2068. Values 100--1899 are always illegal.
-  Note that this is new as of Python 1.5.2(a2); earlier versions, up to Python
-  1.5.1 and 1.5.2a1, would add 1900 to year values below 1900.
+  represented internally as seconds since the epoch.  Function :func:`strptime`
+  can parse 2-digit years when given ``%y`` format code.  When 2-digit years are
+  parsed, they are converted according to the POSIX and ISO C standards: values
+  69--99 are mapped to 1969--1999, and values 0--68 are mapped to 2000--2068.
+
+  For backward compatibility, years with less than 4 digits are treated
+  specially by :func:`asctime`, :func:`mktime`, and :func:`strftime` functions
+  that operate on a 9-tuple or :class:`struct_time` values. If year (the first
+  value in the 9-tuple) is specified with less than 4 digits, its interpretation
+  depends on the value of ``accept2dyear`` variable.
+
+  If ``accept2dyear`` is true (default), a backward compatibility behavior is
+  invoked as follows:
+
+    - for 2-digit year, century is guessed according to POSIX rules for
+      ``%y`` strptime format.  A deprecation warning is issued when century
+      information is guessed in this way.
+
+    - for 3-digit or negative year, a :exc:`ValueError` exception is raised.
+
+  If ``accept2dyear`` is false (set by the program or as a result of a
+  non-empty value assigned to ``PYTHONY2K`` environment variable) all year
+  values are interpreted as given.
 
 .. index::
    single: UTC
@@ -109,10 +120,19 @@
 
 .. data:: accept2dyear
 
-   Boolean value indicating whether two-digit year values will be accepted.  This
-   is true by default, but will be set to false if the environment variable
-   :envvar:`PYTHONY2K` has been set to a non-empty string.  It may also be modified
-   at run time.
+   Boolean value indicating whether two-digit year values will be
+   mapped to 1969--2068 range by :func:`asctime`, :func:`mktime`, and
+   :func:`strftime` functions.  This is true by default, but will be
+   set to false if the environment variable :envvar:`PYTHONY2K` has
+   been set to a non-empty string.  It may also be modified at run
+   time.
+
+   .. deprecated:: 3.2
+      Mapping of 2-digit year values by :func:`asctime`,
+      :func:`mktime`, and :func:`strftime` functions to 1969--2068
+      range is deprecated.  Programs that need to process 2-digit
+      years should use ``%y`` code available in :func:`strptime`
+      function or convert 2-digit year values to 4-digit themselves.
 
 
 .. data:: altzone
@@ -125,7 +145,7 @@
 .. function:: asctime([t])
 
    Convert a tuple or :class:`struct_time` representing a time as returned by
-   :func:`gmtime` or :func:`localtime` to a 24-character string of the following
+   :func:`gmtime` or :func:`localtime` to a string of the following
    form: ``'Sun Jun 20 23:21:05 1993'``.  If *t* is not provided, the current time
    as returned by :func:`localtime` is used. Locale information is not used by
    :func:`asctime`.
@@ -288,7 +308,7 @@
    | ``%y``    | Year without century as a decimal number       |       |
    |           | [00,99].                                       |       |
    +-----------+------------------------------------------------+-------+
-   | ``%Y``    | Year with century as a decimal number.         |       |
+   | ``%Y``    | Year with century as a decimal number.         | \(4)  |
    |           |                                                |       |
    +-----------+------------------------------------------------+-------+
    | ``%Z``    | Time zone name (no characters if no time zone  |       |
@@ -304,13 +324,20 @@
       the output hour field if the ``%I`` directive is used to parse the hour.
 
    (2)
-      The range really is ``0`` to ``61``; this accounts for leap seconds and the
-      (very rare) double leap seconds.
+      The range really is ``0`` to ``61``; value ``60`` is valid in
+      timestamps representing leap seconds and value ``61`` is supported
+      for historical reasons.
 
    (3)
       When used with the :func:`strptime` function, ``%U`` and ``%W`` are only used in
       calculations when the day of the week and the year are specified.
 
+   (4)
+      Produces different results depending on the value of
+      ``time.accept2dyear`` variable.  See :ref:`Year 2000 (Y2K)
+      issues <time-y2kissues>` for details.
+
+
    Here is an example, a format for dates compatible with that specified  in the
    :rfc:`2822` Internet email standard.  [#]_ ::
 
@@ -380,7 +407,7 @@
    +-------+-------------------+---------------------------------+
    | 4     | :attr:`tm_min`    | range [0, 59]                   |
    +-------+-------------------+---------------------------------+
-   | 5     | :attr:`tm_sec`    | range [0, 61]; see **(1)** in   |
+   | 5     | :attr:`tm_sec`    | range [0, 61]; see **(2)** in   |
    |       |                   | :func:`strftime` description    |
    +-------+-------------------+---------------------------------+
    | 6     | :attr:`tm_wday`   | range [0, 6], Monday is 0       |

Modified: python/branches/py3k-cdecimal/Doc/library/tokenize.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/tokenize.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/tokenize.rst	Tue Jan 11 18:07:55 2011
@@ -6,17 +6,15 @@
 .. moduleauthor:: Ka Ping Yee
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
 
+**Source code:** :source:`Lib/tokenize.py`
+
+--------------
 
 The :mod:`tokenize` module provides a lexical scanner for Python source code,
 implemented in Python.  The scanner in this module returns comments as tokens
 as well, making it useful for implementing "pretty-printers," including
 colorizers for on-screen displays.
 
-.. seealso::
-
-   Latest version of the :source:`tokenize module Python source code
-   <Lib/tokenize.py>`
-
 The primary entry point is a :term:`generator`:
 
 .. function:: tokenize(readline)

Modified: python/branches/py3k-cdecimal/Doc/library/trace.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/trace.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/trace.rst	Tue Jan 11 18:07:55 2011
@@ -4,17 +4,15 @@
 .. module:: trace
    :synopsis: Trace or track Python statement execution.
 
+**Source code:** :source:`Lib/trace.py`
+
+--------------
 
 The :mod:`trace` module allows you to trace program execution, generate
 annotated statement coverage listings, print caller/callee relationships and
 list functions executed during a program run.  It can be used in another program
 or from the command line.
 
-.. seealso::
-
-   Latest version of the :source:`trace module Python source code
-   <Lib/trace.py>`
-
 .. _trace-cli:
 
 Command-Line Usage

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	Tue Jan 11 18:07:55 2011
@@ -97,6 +97,13 @@
       A special-interest-group for discussion of testing, and testing tools,
       in Python.
 
+   The script :file:`Tools/unittestgui/unittestgui.py` in the Python source distribution is
+   a GUI tool for test discovery and execution.  This is intended largely for ease of use
+   for those new to unit testing.  For production environments it is recommended that
+   tests be driven by a continuous integration system such as `Hudson <http://hudson-ci.org/>`_
+   or `Buildbot <http://buildbot.net/trac>`_.
+
+
 .. _unittest-minimal-example:
 
 Basic example
@@ -714,6 +721,11 @@
    Here, we create two instances of :class:`WidgetTestCase`, each of which runs a
    single test.
 
+   .. versionchanged::
+      `TestCase` can be instantiated successfully without providing a method
+      name. This makes it easier to experiment with `TestCase` from the
+      interactive interpreter.
+
    *methodName* defaults to :meth:`runTest`.
 
    :class:`TestCase` instances provide three groups of methods: one group used
@@ -1870,9 +1882,10 @@
    instead of repeatedly creating new instances.
 
 
-.. class:: TextTestRunner(stream=sys.stderr, descriptions=True, verbosity=1, runnerclass=None, warnings=None)
+.. class:: TextTestRunner(stream=None, descriptions=True, verbosity=1, runnerclass=None, warnings=None)
 
-   A basic test runner implementation which prints results on standard error.  It
+   A basic test runner implementation that outputs results to a stream. If *stream*
+   is `None`, the default, `sys.stderr` is used as the output stream. This class
    has a few configurable parameters, but is essentially very simple.  Graphical
    applications which run test suites should provide alternate implementations.
 
@@ -1885,6 +1898,13 @@
    messages.  This behavior can be overridden using the :option:`-Wd` or
    :option:`-Wa` options and leaving *warnings* to ``None``.
 
+   .. versionchanged:: 3.2
+      Added the ``warnings`` argument.
+
+   .. versionchanged:: 3.2
+      The default stream is set to `sys.stderr` at instantiation time rather
+      than import time.
+
    .. method:: _makeResult()
 
       This method returns the instance of ``TestResult`` used by :meth:`run`.
@@ -1898,8 +1918,6 @@
 
         stream, descriptions, verbosity
 
-   .. versionchanged:: 3.2
-      Added the ``warnings`` argument.
 
 .. function:: main(module='__main__', defaultTest=None, argv=None, testRunner=None, \
                    testLoader=unittest.loader.defaultTestLoader, exit=True, verbosity=1, \

Modified: python/branches/py3k-cdecimal/Doc/library/uu.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/uu.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/uu.rst	Tue Jan 11 18:07:55 2011
@@ -5,6 +5,9 @@
    :synopsis: Encode and decode files in uuencode format.
 .. moduleauthor:: Lance Ellinghouse
 
+**Source code:** :source:`Lib/uu.py`
+
+--------------
 
 This module encodes and decodes files in uuencode format, allowing arbitrary
 binary data to be transferred over ASCII-only connections. Wherever a file
@@ -21,10 +24,6 @@
 
 This code was contributed by Lance Ellinghouse, and modified by Jack Jansen.
 
-.. seealso::
-
-   Latest version of the :source:`uu module Python source code <Lib/uu.py>`
-
 The :mod:`uu` module defines the following functions:
 
 
@@ -60,4 +59,3 @@
 
    Module :mod:`binascii`
       Support module containing ASCII-to-binary and binary-to-ASCII conversions.
-

Modified: python/branches/py3k-cdecimal/Doc/library/wave.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/wave.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/wave.rst	Tue Jan 11 18:07:55 2011
@@ -14,8 +14,8 @@
 
 .. function:: open(file, mode=None)
 
-   If *file* is a string, open the file by that name, other treat it as a seekable
-   file-like object. *mode* can be any of
+   If *file* is a string, open the file by that name, otherwise treat it as a
+   seekable file-like object.  *mode* can be any of
 
    ``'r'``, ``'rb'``
       Read only mode.
@@ -26,9 +26,14 @@
    Note that it does not allow read/write WAV files.
 
    A *mode* of ``'r'`` or ``'rb'`` returns a :class:`Wave_read` object, while a
-   *mode* of ``'w'`` or ``'wb'`` returns a :class:`Wave_write` object.  If *mode*
-   is omitted and a file-like  object is passed as *file*, ``file.mode`` is used as
-   the default value for *mode* (the ``'b'`` flag is still added if  necessary).
+   *mode* of ``'w'`` or ``'wb'`` returns a :class:`Wave_write` object.  If
+   *mode* is omitted and a file-like object is passed as *file*, ``file.mode``
+   is used as the default value for *mode* (the ``'b'`` flag is still added if
+   necessary).
+
+   If you pass in a file-like object, the wave object will not close it when its
+   :meth:`close` method is called; it is the caller's responsibility to close
+   the file object.
 
 
 .. function:: openfp(file, mode)
@@ -52,8 +57,8 @@
 
 .. method:: Wave_read.close()
 
-   Close the stream, and make the instance unusable. This is called automatically
-   on object collection.
+   Close the stream if it was opened by :mod:`wave`, and make the instance
+   unusable.  This is called automatically on object collection.
 
 
 .. method:: Wave_read.getnchannels()
@@ -139,8 +144,8 @@
 
 .. method:: Wave_write.close()
 
-   Make sure *nframes* is correct, and close the file. This method is called upon
-   deletion.
+   Make sure *nframes* is correct, and close the file if it was opened by
+   :mod:`wave`.  This method is called upon object collection.
 
 
 .. method:: Wave_write.setnchannels(n)
@@ -196,6 +201,7 @@
 
    Write audio frames and make sure *nframes* is correct.
 
+
 Note that it is invalid to set any parameters after calling :meth:`writeframes`
 or :meth:`writeframesraw`, and any attempt to do so will raise
 :exc:`wave.Error`.

Modified: python/branches/py3k-cdecimal/Doc/library/zlib.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/library/zlib.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/library/zlib.rst	Tue Jan 11 18:07:55 2011
@@ -51,9 +51,9 @@
    regardless of sign.
 
 
-.. function:: compress(string[, level])
+.. function:: compress(data[, level])
 
-   Compresses the data in *string*, returning a string contained compressed data.
+   Compresses the bytes in *data*, returning a bytes object containing compressed data.
    *level* is an integer from ``1`` to ``9`` controlling the level of compression;
    ``1`` is fastest and produces the least compression, ``9`` is slowest and
    produces the most.  The default value is ``6``.  Raises the :exc:`error`
@@ -92,9 +92,9 @@
    regardless of sign.
 
 
-.. function:: decompress(string[, wbits[, bufsize]])
+.. function:: decompress(data[, wbits[, bufsize]])
 
-   Decompresses the data in *string*, returning a string containing the
+   Decompresses the bytes in *data*, returning a bytes object containing the
    uncompressed data.  The *wbits* parameter controls the size of the window
    buffer, and is discussed further below.
    If *bufsize* is given, it is used as the initial size of the output
@@ -125,21 +125,21 @@
 Compression objects support the following methods:
 
 
-.. method:: Compress.compress(string)
+.. method:: Compress.compress(data)
 
-   Compress *string*, returning a string containing compressed data for at least
-   part of the data in *string*.  This data should be concatenated to the output
+   Compress *data*, returning a bytes object containing compressed data for at least
+   part of the data in *data*.  This data should be concatenated to the output
    produced by any preceding calls to the :meth:`compress` method.  Some input may
    be kept in internal buffers for later processing.
 
 
 .. method:: Compress.flush([mode])
 
-   All pending input is processed, and a string containing the remaining compressed
+   All pending input is processed, and a bytes object containing the remaining compressed
    output is returned.  *mode* can be selected from the constants
    :const:`Z_SYNC_FLUSH`,  :const:`Z_FULL_FLUSH`,  or  :const:`Z_FINISH`,
    defaulting to :const:`Z_FINISH`.  :const:`Z_SYNC_FLUSH` and
-   :const:`Z_FULL_FLUSH` allow compressing further strings of data, while
+   :const:`Z_FULL_FLUSH` allow compressing further bytestrings of data, while
    :const:`Z_FINISH` finishes the compressed stream and  prevents compressing any
    more data.  After calling :meth:`flush` with *mode* set to :const:`Z_FINISH`,
    the :meth:`compress` method cannot be called again; the only realistic action is
@@ -157,31 +157,31 @@
 
 .. attribute:: Decompress.unused_data
 
-   A string which contains any bytes past the end of the compressed data. That is,
+   A bytes object which contains any bytes past the end of the compressed data. That is,
    this remains ``""`` until the last byte that contains compression data is
-   available.  If the whole string turned out to contain compressed data, this is
-   ``""``, the empty string.
+   available.  If the whole bytestring turned out to contain compressed data, this is
+   ``b""``, an empty bytes object.
 
-   The only way to determine where a string of compressed data ends is by actually
+   The only way to determine where a bytestring of compressed data ends is by actually
    decompressing it.  This means that when compressed data is contained part of a
    larger file, you can only find the end of it by reading data and feeding it
-   followed by some non-empty string into a decompression object's
+   followed by some non-empty bytestring into a decompression object's
    :meth:`decompress` method until the :attr:`unused_data` attribute is no longer
-   the empty string.
+   empty.
 
 
 .. attribute:: Decompress.unconsumed_tail
 
-   A string that contains any data that was not consumed by the last
+   A bytes object that contains any data that was not consumed by the last
    :meth:`decompress` call because it exceeded the limit for the uncompressed data
    buffer.  This data has not yet been seen by the zlib machinery, so you must feed
    it (possibly with further data concatenated to it) back to a subsequent
    :meth:`decompress` method call in order to get correct output.
 
 
-.. method:: Decompress.decompress(string[, max_length])
+.. method:: Decompress.decompress(data[, max_length])
 
-   Decompress *string*, returning a string containing the uncompressed data
+   Decompress *data*, returning a bytes object containing the uncompressed data
    corresponding to at least part of the data in *string*.  This data should be
    concatenated to the output produced by any preceding calls to the
    :meth:`decompress` method.  Some of the input data may be preserved in internal
@@ -190,15 +190,15 @@
    If the optional parameter *max_length* is supplied then the return value will be
    no longer than *max_length*. This may mean that not all of the compressed input
    can be processed; and unconsumed data will be stored in the attribute
-   :attr:`unconsumed_tail`. This string must be passed to a subsequent call to
+   :attr:`unconsumed_tail`. This bytestring must be passed to a subsequent call to
    :meth:`decompress` if decompression is to continue.  If *max_length* is not
-   supplied then the whole input is decompressed, and :attr:`unconsumed_tail` is an
-   empty string.
+   supplied then the whole input is decompressed, and :attr:`unconsumed_tail` is
+   empty.
 
 
 .. method:: Decompress.flush([length])
 
-   All pending input is processed, and a string containing the remaining
+   All pending input is processed, and a bytes object containing the remaining
    uncompressed output is returned.  After calling :meth:`flush`, the
    :meth:`decompress` method cannot be called again; the only realistic action is
    to delete the object.

Modified: python/branches/py3k-cdecimal/Doc/reference/compound_stmts.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/reference/compound_stmts.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/reference/compound_stmts.rst	Tue Jan 11 18:07:55 2011
@@ -285,12 +285,11 @@
 
 Before an except clause's suite is executed, details about the exception are
 stored in the :mod:`sys` module and can be access via :func:`sys.exc_info`.
-:func:`sys.exc_info` returns a 3-tuple consisting of: ``exc_type``, the
-exception class; ``exc_value``, the exception instance; ``exc_traceback``, a
-traceback object (see section :ref:`types`) identifying the point in the program
-where the exception occurred. :func:`sys.exc_info` values are restored to their
-previous values (before the call) when returning from a function that handled an
-exception.
+:func:`sys.exc_info` returns a 3-tuple consisting of the exception class, the
+exception instance and a traceback object (see section :ref:`types`) identifying
+the point in the program where the exception occurred.  :func:`sys.exc_info`
+values are restored to their previous values (before the call) when returning
+from a function that handled an exception.
 
 .. index::
    keyword: else

Modified: python/branches/py3k-cdecimal/Doc/reference/executionmodel.rst
==============================================================================
--- python/branches/py3k-cdecimal/Doc/reference/executionmodel.rst	(original)
+++ python/branches/py3k-cdecimal/Doc/reference/executionmodel.rst	Tue Jan 11 18:07:55 2011
@@ -141,9 +141,9 @@
 The namespace for a module is automatically created the first time a module is
 imported.  The main module for a script is always called :mod:`__main__`.
 
-The global statement has the same scope as a name binding operation in the same
-block.  If the nearest enclosing scope for a free variable contains a global
-statement, the free variable is treated as a global.
+The :keyword:`global` statement has the same scope as a name binding operation
+in the same block.  If the nearest enclosing scope for a free variable contains
+a global statement, the free variable is treated as a global.
 
 A class definition is an executable statement that may use and define names.
 These references follow the normal rules for name resolution.  The namespace of

Modified: python/branches/py3k-cdecimal/Doc/tools/sphinxext/download.html
==============================================================================
--- python/branches/py3k-cdecimal/Doc/tools/sphinxext/download.html	(original)
+++ python/branches/py3k-cdecimal/Doc/tools/sphinxext/download.html	Tue Jan 11 18:07:55 2011
@@ -33,6 +33,10 @@
     <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.zip">Download</a> (ca. 2 MB)</td>
     <td><a href="{{ dlbase }}/python-{{ release }}-docs-text.tar.bz2">Download</a> (ca. 1.5 MB)</td>
   </tr>
+ <tr><td>EPUB</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-epub.zip">Download</a> (ca. 3.5 MB)</td>
+    <td><a href="{{ dlbase }}/python-{{ release }}-docs-epub.tar.bz2">Download</a> (ca. 3.5 MB)</td>
+  </tr>
 </table>
 
 

Modified: python/branches/py3k-cdecimal/Doc/tools/sphinxext/indexcontent.html
==============================================================================
--- python/branches/py3k-cdecimal/Doc/tools/sphinxext/indexcontent.html	(original)
+++ python/branches/py3k-cdecimal/Doc/tools/sphinxext/indexcontent.html	Tue Jan 11 18:07:55 2011
@@ -4,7 +4,7 @@
   <table class="contentstable" align="center"><tr>
     <td width="50%">
       <p class="biglink"><a class="biglink" href="{{ pathto("whatsnew/" + version) }}">What's new in Python {{ version }}?</a><br/>
-         <span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></span></p>
+         <span class="linkdescr">or <a href="{{ pathto("whatsnew/index") }}">all "What's new" documents</a> since 2.0</span></p>
       <p class="biglink"><a class="biglink" href="{{ pathto("tutorial/index") }}">Tutorial</a><br/>
          <span class="linkdescr">start here</span></p>
       <p class="biglink"><a class="biglink" href="{{ pathto("library/index") }}">Library Reference</a><br/>

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	Tue Jan 11 18:07:55 2011
@@ -205,8 +205,8 @@
     "root": {"level": "DEBUG", "handlers": ["console", "console_priority"]}}
 
 
-If that dictionary is stored in a file called :file:`conf.json`, it can loaded
-and called with code like this::
+If that dictionary is stored in a file called :file:`conf.json`, it can be
+loaded and called with code like this::
 
    >>> import logging.config
    >>> logging.config.dictConfig(json.load(open('conf.json', 'rb')))
@@ -281,7 +281,7 @@
 =====================================
 
 Python's scheme for caching bytecode in *.pyc* files did not work well in
-environments with multiple python interpreters.  If one interpreter encountered
+environments with multiple Python interpreters.  If one interpreter encountered
 a cached file created by another interpreter, it would recompile the source and
 overwrite the cached file, thus losing the benefits of caching.
 
@@ -362,6 +362,51 @@
    :pep:`3149` - ABI Version Tagged .so Files
       PEP written by Barry Warsaw.
 
+PEP 3333: Python Web Server Gateway Interface v1.0.1
+=====================================================
+
+This informational PEP clarifies how bytes/text issues are to be handled by the
+WGSI protocol.  The challenge is that string handling in Python 3 is most
+conveniently handled with the :class:`str` type even though the HTTP protocol
+is itself bytes oriented.
+
+The PEP differentiates so-called *native strings* that are used for
+request/response headers and metadata versus *byte strings* which are used for
+the bodies of requests and responses.
+
+The *native strings* are always of type :class:`str` but are restricted to code
+points between *u0000* through *u00FF* which are translatable to bytes using
+*Latin-1* encoding.  These strings are used for the keys and values in the
+environ dictionary and for response headers and statuses in the
+:func:`start_response` function.  They must follow :rfc:`2616` with respect to
+encoding. That is, they must either be *ISO-8859-1* characters or use
+:rfc:`2047` MIME encoding.
+
+For developers porting WSGI applications from Python 2, here are the salient
+points:
+
+* If the app already used strings for headers in Python 2, no change is needed.
+
+* If instead, the app encoded output headers or decoded input headers, then the
+  headers will need to be re-encoded to Latin-1.  For example, an output header
+  encoded in utf-8 was using ``h.encode('utf-8')`` now needs to convert from
+  bytes to native strings using ``h.encode('utf-8').decode('latin-1')``.
+
+* Values yielded by an application or sent using the :meth:`write` method
+  must be byte strings.  The :func:`start_response` function and environ
+  must use native strings.  The two cannot be mixed.
+
+For server implementers writing CGI-to-WSGI pathways or other CGI-style
+protocols, the users must to be able access the environment using native strings
+eventhough the underlying platform may have a different convention.  To bridge
+this gap, the :mod:`wsgiref` module has a new function,
+:func:`wsgiref.handlers.read_environ` for transcoding CGI variables from
+:attr:`os.environ` into native strings and returning a new dictionary.
+
+.. seealso::
+
+   :pep:`3333` - Python Web Server Gateway Interface v1.0.1
+      PEP written by Phillip Eby.
 
 Other Language Changes
 ======================
@@ -383,17 +428,24 @@
   (Suggested by Mark Dickinson and implemented by Eric Smith in :issue:`7094`.)
 
 * The interpreter can now be started with a quiet option, ``-q``, to suppress
-  the copyright and version information in an interactive mode.
-
-  (Contributed by Marcin Wojdyr in issue:`1772833`).
+  the copyright and version information from being displayed in the interactive
+  mode.  The option can be introspected using the :attr:`sys.flags` attribute::
 
-* The :func:`hasattr` function used to catch and suppress any Exception.  Now,
-  it only catches :exc:`AttributeError`.  Under the hood, :func:`hasattr` works
-  by calling :func:`getattr` and throwing away the results.  This is necessary
-  because dynamic attribute creation is possible using :meth:`__getattribute__`
-  or :meth:`__getattr__`.  If :func:`hasattr` were to just scan instance and class
-  dictionaries it would miss the dynamic methods and make it difficult to
-  implement proxy objects.
+    $ python -q
+    >>> sys.flags
+    sys.flags(debug=0, division_warning=0, inspect=0, interactive=0,
+    optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0,
+    ignore_environment=0, verbose=0, bytes_warning=0, quiet=1)
+
+  (Contributed by Marcin Wojdyr in :issue:`1772833`).
+
+* The :func:`hasattr` function works by calling :func:`getattr` and detecting
+  whether an exception is raised.  This technique allows it to detect methods
+  created dynamically by :meth:`__getattr__` or :meth:`__getattribute__` which
+  would otherwise be absent from the class dictionary.  Formerly, *hasattr*
+  would catch any exception, possibly masking genuine errors.  Now, *hasattr*
+  has been tightened to only catch :exc:`AttributeError` and let other
+  exceptions pass through.
 
   (Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)
 
@@ -421,7 +473,6 @@
 
   (Added by Antoine Pitrou; :issue:`9757`.)
 
-
 * Previously it was illegal to delete a name from the local namespace if it
   occurs as a free variable in a nested block::
 
@@ -447,9 +498,9 @@
   (See :issue:`4617`.)
 
 * The internal :c:type:`structsequence` tool now creates subclasses of tuple.
-  This means that C generated structures like those returned by :func:`os.stat`,
+  This means that C structures like those returned by :func:`os.stat`,
   :func:`time.gmtime`, and :func:`sys.version_info` now work like a
-  :term:`named tuple` and are more interoperable with functions and methods that
+  :term:`named tuple` and now work with functions and methods that
   expect a tuple as an argument.  The is a big step forward in making the C
   structures as flexible as their pure Python counterparts.
 
@@ -479,7 +530,7 @@
   produce various issues, especially under Windows.  Here is an example
   of enabling the warning from the command line::
 
-      $ ./python -q -Wdefault
+      $ python -q -Wdefault
       >>> f = open("foo", "wb")
       >>> del f
       __main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>
@@ -502,7 +553,7 @@
       >>> range(0, 100, 2)[0:5]
       range(0, 10, 2)
 
-  (Contributed by Daniel Stuzback in :issue:`9213` and by Alexander Belopolsky
+  (Contributed by Daniel Stutzbach in :issue:`9213` and by Alexander Belopolsky
   in :issue:`2690`.)
 
 * The :func:`callable` builtin function from Py2.x was resurrected.  It provides
@@ -535,14 +586,13 @@
 Throughout the standard library, there has been more careful attention to
 encodings and text versus bytes issues.  In particular, interactions with the
 operating system are now better able to pass non-ASCII data using the Windows
-mcbs encoding, locale aware encodings, or UTF-8.
+mcbs encoding, locale-aware encodings, or UTF-8.
 
 Another significant win is the addition of substantially better support for
 *SSL* connections and security certificates.
 
-In addition, more functions and classes now have a :term:`context manager` to
-support convenient and reliable resource clean-up using the
-:keyword:`with`-statement.
+In addition, more classes now implement a :term:`context manager` to support
+convenient and reliable resource clean-up using the :keyword:`with`-statement.
 
 email
 -----
@@ -568,6 +618,8 @@
   convert message bodies that have a :mailheader:`Content-Transfer-Encoding` of
   *8bit* to instead have a *7bit* :mailheader:`Content-Transfer-Encoding`.
 
+..  XXX: Headers with Un-encoded non-ASCII bytes will be :rfc:`2047`\ -encoded using the charset `unknown-8bit`.
+
 * A new class :class:`~email.generator.BytesGenerator` produces bytes as output,
   preserving any unchanged non-ASCII data that was present in the input used to
   build the model, including message bodies with a
@@ -602,7 +654,7 @@
 * :meth:`xml.etree.ElementTree.Element.iterfind` searches an element and
   subelements
 * :meth:`xml.etree.ElementTree.Element.itertext` creates a text iterator over
-  an element and its sub-elements
+  an element and its subelements
 * :meth:`xml.etree.ElementTree.TreeBuilder.end` closes the current element
 * :meth:`xml.etree.ElementTree.TreeBuilder.doctype` handles a doctype
   declaration
@@ -661,7 +713,7 @@
 
 * To help write classes with rich comparison methods, a new decorator
   :func:`functools.total_ordering` will use a existing equality and inequality
-  methods to fill-in the remaining methods.
+  methods to fill in the remaining methods.
 
   For example, supplying *__eq__* and *__lt__* will enable
   :func:`~functools.total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::
@@ -675,9 +727,10 @@
             return ((self.lastname.lower(), self.firstname.lower()) <
                     (other.lastname.lower(), other.firstname.lower()))
 
-  (Contributed by Raymond Hettinger.)
+  With the *total_ordering* decorator, the remaining comparison methods
+  are filled in automatically.
 
-.. XXX clarify what the example does
+  (Contributed by Raymond Hettinger.)
 
 * To aid in porting programs from Python 2, the :func:`~functools.cmp_to_key`
   function converts an old-style comparison function to
@@ -764,12 +817,14 @@
 
   (Contributed by Raymond Hettinger.)
 
+.. XXX threading.py and Barrier objects
+
 datetime
 --------
 
 * The :mod:`datetime` module has a new type :class:`~datetime.timezone` that
   implements the :class:`~datetime.tzinfo` interface by returning a fixed UTC
-  offset and timezone name. This makes it easier to create timezone aware
+  offset and timezone name. This makes it easier to create timezone-aware
   datetime objects:
 
   >>> datetime.now(timezone.utc)
@@ -780,12 +835,33 @@
 
 * Also, :class:`~datetime.timedelta` objects can now be multiplied by
   :class:`float` and divided by :class:`float` and :class:`int` objects.
+  And :class:`~datetime.timedelta` objects can now divide one another.
+
+  (Contributed by Alexander Belopolsky in :issue:`1289118`, :issue:`5094`,
+  :issue:`6641`, and :issue:`2706`.)
 
-.. XXX Describe added support for dividing a timedelta by another timedelta.
-       See revision 80290 and issue #2706.
+.. XXX
+
+   * The ``strftime()`` method of :class:`~datetime.date` and
+     :class:`~datetime.datetime` are no longer restricted to years >=
+     1900.  The new supported year range is [1000, 9999]. (Contributed
+     by Alexander Belopolsky and Victor Stinner in :issue:`1777412`)
+
+.. XXX Add a section on time module.
+
+   * The :func:`time.asctime` and :func:`time.ctime` functions no
+     longer call C library asctime. (Contributed by Alexander
+     Belopolsky in :issue:`8013`.)
+
+   * Changed the rules for using 2-digit years in time tuples. The
+     :func:`time.asctime` and
+     :func:`time.strftime` functions will now format any year when
+     ``time.accept2dyear`` is false and will accept years >= 1000
+     otherwise. :func:`time.mktime` and :func:`time.strftime` now
+     accepts full range supported by the OS.  Conversion of 2-digit
+     years to 4-digit is deprecated.  (Contributed by Alexander
+     Belopolsky and Victor Stinner in :issue:`10827`.)
 
-  (Contributed by Alexander Belopolsky in :issue:`1289118`, :issue:`5094` and
-  :issue:`6641`.)
 
 abc
 ---
@@ -804,7 +880,7 @@
 
 There is a new and slightly mind-blowing tool
 :class:`~contextlib.ContextDecorator` that is helpful for creating a
-:term:`context manager` that does double-duty as a function decorator.
+:term:`context manager` that does double duty as a function decorator.
 
 As a convenience, this new functionality is used by
 :func:`~contextlib.contextmanager` so that no extra effort is needed to support
@@ -814,7 +890,7 @@
 for pre-action and post-action wrappers.  Context managers wrap a group of
 statements using the :keyword:`with`-statement, and function decorators wrap a
 group of statements enclosed in a function.  So, occasionally there is a need to
-write a pre/post action wrapper that can be used in either role.
+write a pre-action or post-action wrapper that can be used in either role.
 
 For example, it is sometimes useful to wrap functions or groups of statements
 with a logger that can track the time of entry and time of exit.  Rather than
@@ -848,8 +924,8 @@
 the :keyword:`with`-statement, but there is no parallel for function decorators.
 
 In the above example, there is not a clean way for the *track_entry_and_exit*
-context manager does not have a way to return a logging instance for use in the
-body of enclosed statements.
+context manager to return a logging instance for use in the body of enclosed
+statements.
 
 (Contributed by Michael Foord in :issue:`9110`.)
 
@@ -923,7 +999,11 @@
 (Contributed by Tarek Ziadé and Giampaolo Rodolà in :issue:`4972`, and
 by Georg Brandl in :issue:`8046` and :issue:`1286`.)
 
-.. XXX mention os.popen and subprocess.Popen auto-closing of fds
+popen
+-----
+
+The :func:`os.popen` and :func:`subprocess.Popen` functions now support
+the :keyword:`with`-statement` for auto-closing of the file descriptors.
 
 gzip and zipfile
 ----------------
@@ -935,7 +1015,7 @@
 
 The :mod:`gzip` module also gains the :func:`~gzip.compress` and
 :func:`~gzip.decompress` functions for easier in-memory compression and
-decompression.  Keep in mind that text needs to be encoded in to :class:`bytes`
+decompression.  Keep in mind that text needs to be encoded as :class:`bytes`
 before compressing and decompressing:
 
 >>> s = 'Three shall be the number thou shalt count, '
@@ -1051,7 +1131,7 @@
 ----
 
 The :mod:`nntplib` module has a revamped implementation with better bytes and
-unicode semantics as well as more practical APIs.  These improvements break
+text semantics as well as more practical APIs.  These improvements break
 compatibility with the nntplib version in Python 3.1, which was partly
 dysfunctional in itself.
 
@@ -1070,25 +1150,40 @@
 unittest
 --------
 
-* The command-line call, ``python -m unittest`` can now accept file paths
+The unittest module has a number of improvements supporting test discovery for
+packages, easier experimentation at the interactive prompt, new testcase
+methods, improved diagnostic messages for test failures, and better method
+names.
+
+* The command-line call ``python -m unittest`` can now accept file paths
   instead of module names for running specific tests (:issue:`10620`).  The new
   test discovery can find tests within packages, locating any test importable
   from the top level directory.  The top level directory can be specified with
   the `-t` option, a pattern for matching files with ``-p``, and a directory to
   start discovery with ``-s``::
 
-    $ python -m unittest discover -s my_proj_dir -p '_test.py'
+    $ python -m unittest discover -s my_proj_dir -p _test.py
+
+  (Contributed by Michael Foord.)
+
+* Experimentation at the interactive prompt is now easier because the
+  :class:`unittest.case.TestCase` class can now be instantiated without
+  arguments:
+
+  >>> TestCase().assertEqual(pow(2, 3), 8)
 
   (Contributed by Michael Foord.)
 
 * The :mod:`unittest` module has two new methods,
   :meth:`~unittest.TestCase.assertWarns` and
-  :meth:`~unittest.TestCase.assertWarnsRegex` to check that a given warning type
+  :meth:`~unittest.TestCase.assertWarnsRegex` to verify that a given warning type
   is triggered by the code under test:
 
   >>> with self.assertWarns(DeprecationWarning):
   ...     legacy_function('XYZ')
 
+  (Contributed by Michael Foord and Ezio Melotti.)
+
   Another new method, :meth:`~unittest.TestCase.assertCountEqual` is used to
   compare two iterables to determine if their element counts are equal (whether
   the same elements are present with the same number of occurrences regardless
@@ -1097,23 +1192,28 @@
      def test_anagram(self):
          self.assertCountEqual('algorithm', 'logarithm')
 
-  A principal feature of the unittest module is an effort to produce meaningful
-  diagnostics when a test fails.  When possible the failure is recorded along
+  (Contributed by Raymond Hettinger.)
+
+* A principal feature of the unittest module is an effort to produce meaningful
+  diagnostics when a test fails.  When possible, the failure is recorded along
   with a diff of the output.  This is especially helpful for analyzing log files
   of failed test runs. However, since diffs can sometime be voluminous, there is
   a new :attr:`~unittest.TestCase.maxDiff` attribute which sets maximum length of
   diffs.
 
-  In addition the naming in the module has undergone a number of clean-ups.  For
-  example, :meth:`~unittest.TestCase.assertRegex` is the new name for
+* In addition, the method names in the module have undergone a number of clean-ups.
+
+  For example, :meth:`~unittest.TestCase.assertRegex` is the new name for
   :meth:`~unittest.TestCase.assertRegexpMatches` which was misnamed because the
   test uses :func:`re.search`, not :func:`re.match`.  Other methods using
-  regular expressions are now named using short form "Regex" in preference
-  to "Regexp" -- this matches the names used in other unittest implementations,
+  regular expressions are now named using short form "Regex" in preference to
+  "Regexp" -- this matches the names used in other unittest implementations,
   matches Python's old name for the :mod:`re` module, and it has unambiguous
   camel-casing.
 
-  To improve consistency, some of long-standing method aliases are being
+  (Contributed by Raymond Hettinger and implemented by Ezio Melotti.)
+
+* To improve consistency, some long-standing method aliases are being
   deprecated in favor of the preferred names:
 
    - replace :meth:`assert_` with :meth:`.assertTrue`
@@ -1128,6 +1228,13 @@
 
   (Contributed by Ezio Melotti; :issue:`9424`.)
 
+* The :meth:`~unittest.TestCase.assertDictContainsSubset` method was deprecated
+  because it was mis-implemented with the arguments in the wrong order.  This
+  created hard-to-debug optical illusions where tests like
+  ``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail.
+
+  (Contributed by Raymond Hettinger.)
+
 random
 ------
 
@@ -1169,7 +1276,7 @@
 cleanup of temporary directories:
 
 >>> with tempfile.TemporaryDirectory() as tmpdirname:
-...     print 'created temporary directory', tmpdirname
+...     print('created temporary dir:', tmpdirname)
 
 (Contributed by Neil Schemenauer and Nick Coghlan; :issue:`5178`.)
 
@@ -1199,7 +1306,7 @@
 sysconfig
 ---------
 
-The new :mod:`sysconfig` module makes it straight-forward to discover
+The new :mod:`sysconfig` module makes it straightforward to discover
 installation paths and configuration variables which vary across platforms and
 installations.
 
@@ -1208,8 +1315,8 @@
 
 * :func:`~sysconfig.get_platform` returning values like *linux-i586* or
   *macosx-10.6-ppc*.
-* :func:`~sysconfig.get_python_version` returns a Python version string in
-  the form, "3.2".
+* :func:`~sysconfig.get_python_version` returns a Python version string
+  such as "3.2".
 
 It also provides access to the paths and variables corresponding to one of
 seven named schemes used by :mod:`distutils`.  Those include *posix_prefix*,
@@ -1267,13 +1374,13 @@
 * A :file:`.pdbrc` script file can contain ``continue`` and ``next`` commands
   that continue debugging.
 * The :class:`Pdb` class constructor now accepts a *nosigint* argument.
-* new commands: ``l(list)``, ``ll(long list`` and ``source`` for
+* New commands: ``l(list)``, ``ll(long list)`` and ``source`` for
   listing source code.
-* new commands: ``display`` and ``undisplay`` for showing or hiding
+* New commands: ``display`` and ``undisplay`` for showing or hiding
   the value of an expression if it has changed.
-* new command: ``interact`` for starting an interactive interpreter containing
+* New command: ``interact`` for starting an interactive interpreter containing
   the global and local  names found in the current scope.
-* breakpoints can be cleared by breakpoint number
+* Breakpoints can be cleared by breakpoint number.
 
 (Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.)
 
@@ -1362,7 +1469,7 @@
             - bytes input support
             - non-UTF8 percent encoding of non-ASCII characters
           Issue 2987 for IPv6 (RFC2732) support in urlparse
-.. XXX: Any updates to the WSGI bytes versus text problem?
+
 
 Multi-threading
 ===============
@@ -1426,12 +1533,12 @@
   :meth:`list.sort` and :func:`sorted` now runs faster and uses less memory
   when called with a :term:`key function`.  Previously, every element of
   a list was wrapped with a temporary object that remembered the key value
-  associated with each element.  Now, an array of keys and values are
+  associated with each element.  Now, two arrays of keys and values are
   sorted in parallel.  This save the memory consumed by the sort wrappers,
   and it saves time lost during comparisons which were delegated by the
   sort wrappers.
 
-  (Patch by Daniel Stuzback in :issue:`9915`.)
+  (Patch by Daniel Stutzbach in :issue:`9915`.)
 
 * JSON decoding performance is improved and memory consumption is reduced
   whenever the same string is repeated for multiple keys.  Also, JSON encoding
@@ -1461,11 +1568,11 @@
   (:issue:`6713` by Gawain Bolton, Mark Dickinson, and Victor Stinner.)
 
 There were several other minor optimizations. Set differencing now runs faster
-when one operand is much larger than the other (Patch by Andress Bennetts in
+when one operand is much larger than the other (patch by Andress Bennetts in
 :issue:`8685`).  The :meth:`array.repeat` method has a faster implementation
 (:issue:`1569291` by Alexander Belopolsky). The :class:`BaseHTTPRequestHandler`
 has more efficient buffering (:issue:`3709` by Andrew Schaaf).  The
-multi-argument form of :func:`operator.attrgetter` now function runs slightly
+multi-argument form of :func:`operator.attrgetter` function now runs slightly
 faster (:issue:`10160` by Christos Georgiou).  And :class:`ConfigParser` loads
 multi-line arguments a bit faster (:issue:`7113` by Łukasz Langa).
 
@@ -1515,7 +1622,7 @@
 ``'mbcs'``), and the ``'surrogateescape'`` error handler on all operating
 systems.
 
-* Added the *cp720* Arabic DOS encoding (:issue:`1616979`).
+Also, support was added for *cp720* Arabic DOS encoding (:issue:`1616979`).
 
 
 Documentation
@@ -1528,10 +1635,10 @@
 accompanied by tables of cheatsheet-style summaries to provide an overview and
 memory jog without having to read all of the docs.
 
-In some cases, the pure python source code can be helpful adjunct to the docs,
-so now some modules feature quick links to the latest version of the source
-code.  For example, the :mod:`functools` module documentation has a quick link
-at the top labeled :source:`functools Python source code <Lib/functools.py>`.
+In some cases, the pure Python source code can be a helpful adjunct to the
+documentation, so now many modules now feature quick links to the latest version
+of the source code.  For example, the :mod:`functools` module documentation has
+a quick link at the top labeled: **Source code** :source:`Lib/functools.py`.
 
 The docs now contain more examples and recipes.  In particular, :mod:`re` module
 has an extensive section, :ref:`re-examples`.  Likewise, the :mod:`itertools`
@@ -1541,12 +1648,22 @@
 No functionality was changed.  This just provides an easier-to-read
 alternate implementation.  (Contributed by Alexander Belopolsky.)
 
+The unmaintained :file:`Demo` directory has been removed.  Some demos were
+integrated into the documentation, some were moved to the :file:`Tools/demo`
+directory, and others were removed altogether.  (Contributed by Georg Brandl.)
+
 
 IDLE
 ====
 
-* The format menu now has an option to clean-up source files by stripping
-  trailing whitespace (:issue:`5150`).
+* The format menu now has an option to clean source files by stripping
+  trailing whitespace.
+
+  (Contributed by Raymond Hettinger; :issue:`5150`.)
+
+* IDLE on Mac OS X now works with both Carbon AquaTk and Cocoa AquaTk.
+
+  (Contributed by Kevin Walzer, Ned Deily, and Ronald Oussoren; :issue:`6075`.)
 
 
 Build and C API Changes
@@ -1554,6 +1671,9 @@
 
 Changes to Python's build process and to the C API include:
 
+* The *idle*, *pydoc* and *2to3* scripts are now installed with a
+  version-specific suffix on ``make altinstall`` (:issue:`10679`).
+
 * The C functions that access the Unicode Database now accept and return
   characters from the full Unicode range, even on narrow unicode builds
   (Py_UNICODE_TOLOWER, Py_UNICODE_ISDECIMAL, and others).  A visible difference
@@ -1585,19 +1705,19 @@
   :issue:`9778`.)
 
 * A new macro :c:macro:`Py_VA_COPY` copies the state of the variable argument
-  list.  It is equivalent to C99 *va_copy* but available on all python platforms
+  list.  It is equivalent to C99 *va_copy* but available on all Python platforms
   (:issue:`2443`).
 
-* A new C API function :c:func:`PySys_SetArgvEx` allows an embedded
-  interpreter to set sys.argv without also modifying :attr:`sys.path`
+* A new C API function :c:func:`PySys_SetArgvEx` allows an embedded interpreter
+  to set :attr:`sys.argv` without also modifying :attr:`sys.path`
   (:issue:`5753`).
 
 * :c:macro:`PyEval_CallObject` is now only available in macro form.  The
   function declaration, which was kept for backwards compatibility reasons, is
-  now removed -- the macro was introduced in 1997  (:issue:`8276`).
+  now removed -- the macro was introduced in 1997 (:issue:`8276`).
 
 * The is a new function :c:func:`PyLong_AsLongLongAndOverflow` which
-  is analogous to :c:func:`PyLong_AsLongAndOverflow`.  The both serve to
+  is analogous to :c:func:`PyLong_AsLongAndOverflow`.  They both serve to
   convert Python :class:`int` into a native fixed-width type while providing
   detection of cases where the conversion won't fit (:issue:`7767`).
 
@@ -1614,7 +1734,7 @@
   gives improved memory leak detection when running under Valgrind, while taking
   advantage of pymalloc at other times (:issue:`2422`).
 
-* Removed the "O?" format from the *PyArg_Parse* functions.  The format is no
+* Removed the ``O?`` format from the *PyArg_Parse* functions.  The format is no
   longer used and it had never been documented (:issue:`8837`).
 
 There were a number of other small changes to the C-API.  See the
@@ -1664,7 +1784,7 @@
 * :class:`bytearray` objects can no longer be used as filenames; instead,
   they should be converted to :class:`bytes`.
 
-* PyArg_Parse*() functions:
+* ``PyArg_Parse*()`` functions:
 
   * "t#" format has been removed: use "s#" or "s*" instead
   * "w" and "w#" formats has been removed: use "w*" instead
@@ -1683,7 +1803,7 @@
   ``random.seed(s, version=1)``.
 
 * The previously deprecated :func:`string.maketrans` function has been removed
-  in favor of the static methods, :meth:`bytes.maketrans` and
+  in favor of the static methods :meth:`bytes.maketrans` and
   :meth:`bytearray.maketrans`.  This change solves the confusion around which
   types were supported by the :mod:`string` module.  Now, :class:`str`,
   :class:`bytes`, and :class:`bytearray` each have their own **maketrans** and
@@ -1706,6 +1826,20 @@
   (Contributed by Georg Brandl and Mattias Brändström;
   `appspot issue 53094 <http://codereview.appspot.com/53094>`_.)
 
-* :func:`struct.pack` no longer implicitly encodes unicode to UTF-8: use
-  explicit conversion instead and replace unicode literals by bytes literals.
+* :func:`struct.pack` now only allows bytes for the ``s`` string pack code.
+  Formerly, it would accept text arguments and implicitly encode them to bytes
+  using UTF-8.  This was problematic because it made assumptions about the
+  correct encoding and because a variable-length encoding can fail when writing
+  to fixed length segment of a structure.
+
+  Code such as ``struct.pack('<6sHHBBB', 'GIF87a', x, y)`` should be rewritten
+  with to use bytes instead of text, ``struct.pack('<6sHHBBB', b'GIF87a', x, y)``.
+
+  (Discovered by David Beazley and fixed by Victor Stinner; :issue:`10783`.)
+
+* The :class:`xml.etree.ElementTree` class now raises an
+  :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it
+  raised a :exc:`xml.parsers.expat.ExpatError`.
 
+* The new, longer :func:`str` value on floats may break doctests which rely on
+  the old output format.

Modified: python/branches/py3k-cdecimal/Include/abstract.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/abstract.h	(original)
+++ python/branches/py3k-cdecimal/Include/abstract.h	Tue Jan 11 18:07:55 2011
@@ -488,6 +488,7 @@
 
     /* new buffer API */
 
+#ifndef Py_LIMITED_API
 #define PyObject_CheckBuffer(obj) \
     (((obj)->ob_type->tp_as_buffer != NULL) &&  \
      ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL))
@@ -575,6 +576,7 @@
 
        /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
     */
+#endif /* Py_LIMITED_API */
 
      PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
                                             PyObject *format_spec);

Modified: python/branches/py3k-cdecimal/Include/memoryobject.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/memoryobject.h	(original)
+++ python/branches/py3k-cdecimal/Include/memoryobject.h	Tue Jan 11 18:07:55 2011
@@ -55,9 +55,11 @@
 
 PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
 
+#ifndef Py_LIMITED_API
 PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info);
     /* create new if bufptr is NULL 
         will be a new bytesobject in base */
+#endif
 
 
 /* The struct is declared here so that macros can work, but it shouldn't

Modified: python/branches/py3k-cdecimal/Include/object.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/object.h	(original)
+++ python/branches/py3k-cdecimal/Include/object.h	Tue Jan 11 18:07:55 2011
@@ -143,7 +143,7 @@
 typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
 typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *);
 
-
+#ifndef Py_LIMITED_API
 /* buffer interface */
 typedef struct bufferinfo {
     void *buf;
@@ -195,6 +195,7 @@
 #define PyBUF_WRITE 0x200
 
 /* End buffer interface */
+#endif /* Py_LIMITED_API */
 
 typedef int (*objobjproc)(PyObject *, PyObject *);
 typedef int (*visitproc)(PyObject *, void *);

Modified: python/branches/py3k-cdecimal/Include/objimpl.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/objimpl.h	(original)
+++ python/branches/py3k-cdecimal/Include/objimpl.h	Tue Jan 11 18:07:55 2011
@@ -242,9 +242,6 @@
 #define PyObject_GC_Resize(type, op, n) \
                 ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
 
-/* for source compatibility with 2.2 */
-#define _PyObject_GC_Del PyObject_GC_Del
-
 /* GC information is stored BEFORE the object structure. */
 #ifndef Py_LIMITED_API
 typedef union _gc_head {
@@ -328,15 +325,6 @@
         }                                                               \
     } while (0)
 
-/* This is here for the sake of backwards compatibility.  Extensions that
- * use the old GC API will still compile but the objects will not be
- * tracked by the GC. */
-#define PyGC_HEAD_SIZE 0
-#define PyObject_GC_Init(op)
-#define PyObject_GC_Fini(op)
-#define PyObject_AS_GC(op) (op)
-#define PyObject_FROM_GC(op) (op)
-
 
 /* Test if a type supports weak references */
 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)

Modified: python/branches/py3k-cdecimal/Include/typeslots.h
==============================================================================
--- python/branches/py3k-cdecimal/Include/typeslots.h	(original)
+++ python/branches/py3k-cdecimal/Include/typeslots.h	Tue Jan 11 18:07:55 2011
@@ -1,5 +1,7 @@
-#define Py_bf_getbuffer 1
-#define Py_bf_releasebuffer 2
+/* Do not renumber the file; these numbers are part of the stable ABI. */
+/* Disabled, see #10181 */
+#undef Py_bf_getbuffer
+#undef Py_bf_releasebuffer
 #define Py_mp_ass_subscript 3
 #define Py_mp_length 4
 #define Py_mp_subscript 5

Modified: python/branches/py3k-cdecimal/Lib/_pyio.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/_pyio.py	(original)
+++ python/branches/py3k-cdecimal/Lib/_pyio.py	Tue Jan 11 18:07:55 2011
@@ -1504,13 +1504,20 @@
     #   - "chars_..." for integer variables that count decoded characters
 
     def __repr__(self):
+        result = "<_pyio.TextIOWrapper"
         try:
             name = self.name
         except AttributeError:
-            return "<_pyio.TextIOWrapper encoding={0!r}>".format(self.encoding)
+            pass
+        else:
+            result += " name={0!r}".format(name)
+        try:
+            mode = self.mode
+        except AttributeError:
+            pass
         else:
-            return "<_pyio.TextIOWrapper name={0!r} encoding={1!r}>".format(
-                name, self.encoding)
+            result += " mode={0!r}".format(mode)
+        return result + " encoding={0!r}>".format(self.encoding)
 
     @property
     def encoding(self):

Modified: python/branches/py3k-cdecimal/Lib/ast.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/ast.py	(original)
+++ python/branches/py3k-cdecimal/Lib/ast.py	Tue Jan 11 18:07:55 2011
@@ -159,8 +159,6 @@
     Increment the line number of each node in the tree starting at *node* by *n*.
     This is useful to "move code" to a different location in a file.
     """
-    if 'lineno' in node._attributes:
-        node.lineno = getattr(node, 'lineno', 0) + n
     for child in walk(node):
         if 'lineno' in child._attributes:
             child.lineno = getattr(child, 'lineno', 0) + n
@@ -211,9 +209,9 @@
 
 def walk(node):
     """
-    Recursively yield all child nodes of *node*, in no specified order.  This is
-    useful if you only want to modify nodes in place and don't care about the
-    context.
+    Recursively yield all descendant nodes in the tree starting at *node*
+    (including *node* itself), in no specified order.  This is useful if you
+    only want to modify nodes in place and don't care about the context.
     """
     from collections import deque
     todo = deque([node])

Modified: python/branches/py3k-cdecimal/Lib/bdb.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/bdb.py	(original)
+++ python/branches/py3k-cdecimal/Lib/bdb.py	Tue Jan 11 18:07:55 2011
@@ -385,6 +385,8 @@
         if locals is None:
             locals = globals
         self.reset()
+        if isinstance(cmd, str):
+            cmd = compile(cmd, "<string>", "exec")
         sys.settrace(self.trace_dispatch)
         try:
             exec(cmd, globals, locals)

Modified: python/branches/py3k-cdecimal/Lib/collections.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/collections.py	(original)
+++ python/branches/py3k-cdecimal/Lib/collections.py	Tue Jan 11 18:07:55 2011
@@ -539,6 +539,9 @@
         'Like dict.copy() but returns a Counter instance instead of a dict.'
         return Counter(self)
 
+    def __reduce__(self):
+        return self.__class__, (dict(self),)
+
     def __delitem__(self, elem):
         'Like dict.__delitem__() but does not raise KeyError for missing values.'
         if elem in self:

Modified: python/branches/py3k-cdecimal/Lib/concurrent/futures/process.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/concurrent/futures/process.py	(original)
+++ python/branches/py3k-cdecimal/Lib/concurrent/futures/process.py	Tue Jan 11 18:07:55 2011
@@ -244,6 +244,31 @@
             else:
                 work_item.future.set_result(result_item.result)
 
+_system_limits_checked = False
+_system_limited = None
+def _check_system_limits():
+    global _system_limits_checked, _system_limited
+    if _system_limits_checked:
+        if _system_limited:
+            raise NotImplementedError(_system_limited)
+    _system_limits_checked = True
+    try:
+        import os
+        nsems_max = os.sysconf("SC_SEM_NSEMS_MAX")
+    except (AttributeError, ValueError):
+        # sysconf not available or setting not available
+        return
+    if nsems_max == -1:
+        # indetermine limit, assume that limit is determined
+        # by available memory only
+        return
+    if nsems_max >= 256:
+        # minimum number of semaphores available
+        # according to POSIX
+        return
+    _system_limited = "system provides too few semaphores (%d available, 256 necessary)" % nsems_max
+    raise NotImplementedError(_system_limited)
+
 class ProcessPoolExecutor(_base.Executor):
     def __init__(self, max_workers=None):
         """Initializes a new ProcessPoolExecutor instance.
@@ -253,6 +278,7 @@
                 execute the given calls. If None or not given then as many
                 worker processes will be created as the machine has processors.
         """
+        _check_system_limits()
         _remove_dead_thread_references()
 
         if max_workers is None:

Modified: python/branches/py3k-cdecimal/Lib/contextlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/contextlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/contextlib.py	Tue Jan 11 18:07:55 2011
@@ -17,7 +17,7 @@
         return inner
 
 
-class GeneratorContextManager(ContextDecorator):
+class _GeneratorContextManager(ContextDecorator):
     """Helper for @contextmanager decorator."""
 
     def __init__(self, gen):
@@ -92,7 +92,7 @@
     """
     @wraps(func)
     def helper(*args, **kwds):
-        return GeneratorContextManager(func(*args, **kwds))
+        return _GeneratorContextManager(func(*args, **kwds))
     return helper
 
 

Modified: python/branches/py3k-cdecimal/Lib/datetime.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/datetime.py	(original)
+++ python/branches/py3k-cdecimal/Lib/datetime.py	Tue Jan 11 18:07:55 2011
@@ -173,9 +173,9 @@
 # Correctly substitute for %z and %Z escapes in strftime formats.
 def _wrap_strftime(object, format, timetuple):
     year = timetuple[0]
-    if year < 1900:
-        raise ValueError("year=%d is before 1900; the datetime strftime() "
-                         "methods require year >= 1900" % year)
+    if year < 1000:
+        raise ValueError("year=%d is before 1000; the datetime strftime() "
+                         "methods require year >= 1000" % year)
     # Don't call utcoffset() or tzname() unless actually needed.
     freplace = None # the string to use for %f
     zreplace = None # the string to use for %z
@@ -1189,7 +1189,7 @@
         """Format using strftime().  The date part of the timestamp passed
         to underlying strftime should not be used.
         """
-        # The year must be >= 1900 else Python's strftime implementation
+        # The year must be >= 1000 else Python's strftime implementation
         # can raise a bogus exception.
         timetuple = (1900, 1, 1,
                      self._hour, self._minute, self._second,

Modified: python/branches/py3k-cdecimal/Lib/email/charset.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/email/charset.py	(original)
+++ python/branches/py3k-cdecimal/Lib/email/charset.py	Tue Jan 11 18:07:55 2011
@@ -28,6 +28,7 @@
 RFC2047_CHROME_LEN = 7
 
 DEFAULT_CHARSET = 'us-ascii'
+UNKNOWN8BIT = 'unknown-8bit'
 EMPTYSTRING = ''
 
 
@@ -153,6 +154,16 @@
 
 
 
+# Convenience function for encoding strings, taking into account
+# that they might be unknown-8bit (ie: have surrogate-escaped bytes)
+def _encode(string, codec):
+    if codec == UNKNOWN8BIT:
+        return string.encode('ascii', 'surrogateescape')
+    else:
+        return string.encode(codec)
+
+
+
 class Charset:
     """Map character sets to their email properties.
 
@@ -282,8 +293,7 @@
         :return: The encoded string, with RFC 2047 chrome.
         """
         codec = self.output_codec or 'us-ascii'
-        charset = self.get_output_charset()
-        header_bytes = string.encode(codec)
+        header_bytes = _encode(string, codec)
         # 7bit/8bit encodings return the string unchanged (modulo conversions)
         encoder_module = self._get_encoder(header_bytes)
         if encoder_module is None:
@@ -294,7 +304,7 @@
         """Header-encode a string by converting it first to bytes.
 
         This is similar to `header_encode()` except that the string is fit
-        into maximum line lengths as given by the arguments.
+        into maximum line lengths as given by the argument.
 
         :param string: A unicode string for the header.  It must be possible
             to encode this string to bytes using the character set's
@@ -305,13 +315,11 @@
             and should never be exhausted.  The maximum line lengths should
             not count the RFC 2047 chrome.  These line lengths are only a
             hint; the splitter does the best it can.
-        :param firstmaxlen: The maximum line length of the first line.  If
-            None (the default), then `maxlen` is used for the first line.
         :return: Lines of encoded strings, each with RFC 2047 chrome.
         """
         # See which encoding we should use.
         codec = self.output_codec or 'us-ascii'
-        header_bytes = string.encode(codec)
+        header_bytes = _encode(string, codec)
         encoder_module = self._get_encoder(header_bytes)
         encoder = partial(encoder_module.header_encode, charset=str(self))
         # Calculate the number of characters that the RFC 2047 chrome will
@@ -335,7 +343,7 @@
         for character in string:
             current_line.append(character)
             this_line = EMPTYSTRING.join(current_line)
-            length = encoder_module.header_length(this_line.encode(charset))
+            length = encoder_module.header_length(_encode(this_line, charset))
             if length > maxlen:
                 # This last character doesn't fit so pop it off.
                 current_line.pop()
@@ -345,12 +353,12 @@
                 else:
                     separator = (' ' if lines else '')
                     joined_line = EMPTYSTRING.join(current_line)
-                    header_bytes = joined_line.encode(codec)
+                    header_bytes = _encode(joined_line, codec)
                     lines.append(encoder(header_bytes))
                 current_line = [character]
                 maxlen = next(maxlengths) - extra
         joined_line = EMPTYSTRING.join(current_line)
-        header_bytes = joined_line.encode(codec)
+        header_bytes = _encode(joined_line, codec)
         lines.append(encoder(header_bytes))
         return lines
 

Modified: python/branches/py3k-cdecimal/Lib/email/header.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/email/header.py	(original)
+++ python/branches/py3k-cdecimal/Lib/email/header.py	Tue Jan 11 18:07:55 2011
@@ -17,7 +17,8 @@
 import email.base64mime
 
 from email.errors import HeaderParseError
-from email.charset import Charset
+from email import charset as _charset
+Charset = _charset.Charset
 
 NL = '\n'
 SPACE = ' '
@@ -46,6 +47,10 @@
 # For use with .match()
 fcre = re.compile(r'[\041-\176]+:$')
 
+# Find a header embeded in a putative header value.  Used to check for
+# header injection attack.
+_embeded_header = re.compile(r'\n[^ \t]+:')
+
 
 
 # Helpers
@@ -210,6 +215,9 @@
             # from a charset to None/us-ascii, or from None/us-ascii to a
             # charset.  Only do this for the second and subsequent chunks.
             nextcs = charset
+            if nextcs == _charset.UNKNOWN8BIT:
+                original_bytes = string.encode('ascii', 'surrogateescape')
+                string = original_bytes.decode('ascii', 'replace')
             if uchunks:
                 if lastcs not in (None, 'us-ascii'):
                     if nextcs in (None, 'us-ascii'):
@@ -245,32 +253,27 @@
         that byte string, and a UnicodeError will be raised if the string
         cannot be decoded with that charset.  If s is a Unicode string, then
         charset is a hint specifying the character set of the characters in
-        the string.  In this case, when producing an RFC 2822 compliant header
-        using RFC 2047 rules, the Unicode string will be encoded using the
-        following charsets in order: us-ascii, the charset hint, utf-8.  The
-        first character set not to provoke a UnicodeError is used.
+        the string.  In either case, when producing an RFC 2822 compliant
+        header using RFC 2047 rules, the string will be encoded using the
+        output codec of the charset.  If the string cannot be encoded to the
+        output codec, a UnicodeError will be raised.
 
-        Optional `errors' is passed as the third argument to any unicode() or
-        ustr.encode() call.
+        Optional `errors' is passed as the errors argument to the decode
+        call if s is a byte string.
         """
         if charset is None:
             charset = self._charset
         elif not isinstance(charset, Charset):
             charset = Charset(charset)
-        if isinstance(s, str):
-            # Convert the string from the input character set to the output
-            # character set and store the resulting bytes and the charset for
-            # composition later.
+        if not isinstance(s, str):
             input_charset = charset.input_codec or 'us-ascii'
-            input_bytes = s.encode(input_charset, errors)
-        else:
-            # We already have the bytes we will store internally.
-            input_bytes = s
+            s = s.decode(input_charset, errors)
         # Ensure that the bytes we're storing can be decoded to the output
         # character set, otherwise an early error is thrown.
         output_charset = charset.output_codec or 'us-ascii'
-        output_string = input_bytes.decode(output_charset, errors)
-        self._chunks.append((output_string, charset))
+        if output_charset != _charset.UNKNOWN8BIT:
+            s.encode(output_charset, errors)
+        self._chunks.append((s, charset))
 
     def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'):
         """Encode a message header into an RFC-compliant format.
@@ -311,12 +314,21 @@
                                     self._continuation_ws, splitchars)
         for string, charset in self._chunks:
             lines = string.splitlines()
-            for line in lines:
+            formatter.feed(lines[0], charset)
+            for line in lines[1:]:
+                formatter.newline()
+                if charset.header_encoding is not None:
+                    formatter.feed(self._continuation_ws, USASCII)
+                    line = ' ' + line.lstrip()
                 formatter.feed(line, charset)
-                if len(lines) > 1:
-                    formatter.newline()
+            if len(lines) > 1:
+                formatter.newline()
             formatter.add_transition()
-        return formatter._str(linesep)
+        value = formatter._str(linesep)
+        if _embeded_header.search(value):
+            raise HeaderParseError("header value appears to contain "
+                "an embedded header: {!r}".format(value))
+        return value
 
     def _normalize(self):
         # Step 1: Normalize the chunks so that all runs of identical charsets

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	Tue Jan 11 18:07:55 2011
@@ -16,7 +16,9 @@
 # Intrapackage imports
 from email import utils
 from email import errors
-from email.charset import Charset
+from email import header
+from email import charset as _charset
+Charset = _charset.Charset
 
 SEMISPACE = '; '
 
@@ -31,16 +33,15 @@
 
 
 # Helper functions
-def _sanitize_surrogates(value):
-    # If the value contains surrogates, re-decode and replace the original
-    # non-ascii bytes with '?'s.  Used to sanitize header values before letting
-    # them escape as strings.
+def _sanitize_header(name, value):
+    # If the header value contains surrogates, return a Header using
+    # the unknown-8bit charset to encode the bytes as encoded words.
     if not isinstance(value, str):
-        # Header object
+        # Assume it is already a header object
         return value
     if _has_surrogates(value):
-        original_bytes = value.encode('ascii', 'surrogateescape')
-        return original_bytes.decode('ascii', 'replace').replace('\ufffd', '?')
+        return header.Header(value, charset=_charset.UNKNOWN8BIT,
+                             header_name=name)
     else:
         return value
 
@@ -398,7 +399,7 @@
         Any fields deleted and re-inserted are always appended to the header
         list.
         """
-        return [_sanitize_surrogates(v) for k, v in self._headers]
+        return [_sanitize_header(k, v) for k, v in self._headers]
 
     def items(self):
         """Get all the message's header fields and values.
@@ -408,7 +409,7 @@
         Any fields deleted and re-inserted are always appended to the header
         list.
         """
-        return [(k, _sanitize_surrogates(v)) for k, v in self._headers]
+        return [(k, _sanitize_header(k, v)) for k, v in self._headers]
 
     def get(self, name, failobj=None):
         """Get a header value.
@@ -419,7 +420,7 @@
         name = name.lower()
         for k, v in self._headers:
             if k.lower() == name:
-                return _sanitize_surrogates(v)
+                return _sanitize_header(k, v)
         return failobj
 
     #
@@ -439,7 +440,7 @@
         name = name.lower()
         for k, v in self._headers:
             if k.lower() == name:
-                values.append(_sanitize_surrogates(v))
+                values.append(_sanitize_header(k, v))
         if not values:
             return failobj
         return values

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	Tue Jan 11 18:07:55 2011
@@ -561,6 +561,18 @@
             "attachment; filename*=utf-8''Fu%C3%9Fballer%20%5Bfilename%5D.ppt",
             msg['Content-Disposition'])
 
+    # Issue 5871: reject an attempt to embed a header inside a header value
+    # (header injection attack).
+    def test_embeded_header_via_Header_rejected(self):
+        msg = Message()
+        msg['Dummy'] = Header('dummy\nX-Injected-Header: test')
+        self.assertRaises(errors.HeaderParseError, msg.as_string)
+
+    def test_embeded_header_via_string_rejected(self):
+        msg = Message()
+        msg['Dummy'] = 'dummy\nX-Injected-Header: test'
+        self.assertRaises(errors.HeaderParseError, msg.as_string)
+
 
 # Test the email.encoders module
 class TestEncoders(unittest.TestCase):
@@ -968,6 +980,19 @@
 
 """)
 
+    def test_long_rfc2047_header_with_embedded_fws(self):
+        h = Header(textwrap.dedent("""\
+            We're going to pretend this header is in a non-ascii character set
+            \tto see if line wrapping with encoded words and embedded
+               folding white space works"""),
+                   charset='utf-8',
+                   header_name='Test')
+        self.assertEqual(h.encode()+'\n', textwrap.dedent("""\
+            =?utf-8?q?We=27re_going_to_pretend_this_header_is_in_a_non-ascii_chara?=
+             =?utf-8?q?cter_set?=
+             =?utf-8?q?_to_see_if_line_wrapping_with_encoded_words_and_embedded?=
+             =?utf-8?q?_folding_white_space_works?=""")+'\n')
+
 
 
 # Test mangling of "From " lines in the body of a message
@@ -2828,7 +2853,7 @@
                                      cte='8bit',
                                      bodyline='pöstal').encode('utf-8')
         msg = email.message_from_bytes(m)
-        self.assertEqual(msg.get_payload(), "p��stal\n")
+        self.assertEqual(msg.get_payload(), "p\uFFFD\uFFFDstal\n")
         self.assertEqual(msg.get_payload(decode=True),
                          "pöstal\n".encode('utf-8'))
 
@@ -2861,7 +2886,7 @@
                                      cte='quoted-printable',
                                      bodyline='p=C3=B6stál').encode('utf-8')
         msg = email.message_from_bytes(m)
-        self.assertEqual(msg.get_payload(), 'p=C3=B6st��l\n')
+        self.assertEqual(msg.get_payload(), 'p=C3=B6st\uFFFD\uFFFDl\n')
         self.assertEqual(msg.get_payload(decode=True),
                         'pöstál\n'.encode('utf-8'))
 
@@ -2886,52 +2911,65 @@
                          '<,.V<W1A; á \n'.encode('utf-8'))
 
 
-    headertest_msg = textwrap.dedent("""\
-        From: foo at bar.com
-        To: báz
-        Subject: Maintenant je vous présente mon collègue, le pouf célèbre
-        \tJean de Baddie
-        From: göst
-
-        Yes, they are flying.
-        """).encode('utf-8')
+    headertest_headers = (
+        ('From: foo at bar.com', ('From', 'foo at bar.com')),
+        ('To: báz', ('To', '=?unknown-8bit?q?b=C3=A1z?=')),
+        ('Subject: Maintenant je vous présente mon collègue, le pouf célèbre\n'
+            '\tJean de Baddie',
+            ('Subject', '=?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_'
+                'coll=C3=A8gue=2C_le_pouf_c=C3=A9l=C3=A8bre?=\n'
+                ' =?unknown-8bit?q?_Jean_de_Baddie?=')),
+        ('From: göst', ('From', '=?unknown-8bit?b?Z8O2c3Q=?=')),
+        )
+    headertest_msg = ('\n'.join([src for (src, _) in headertest_headers]) +
+        '\nYes, they are flying.\n').encode('utf-8')
 
     def test_get_8bit_header(self):
         msg = email.message_from_bytes(self.headertest_msg)
-        self.assertEqual(msg.get('to'), 'b??z')
-        self.assertEqual(msg['to'], 'b??z')
+        self.assertEqual(str(msg.get('to')), 'b\uFFFD\uFFFDz')
+        self.assertEqual(str(msg['to']), 'b\uFFFD\uFFFDz')
 
     def test_print_8bit_headers(self):
         msg = email.message_from_bytes(self.headertest_msg)
         self.assertEqual(str(msg),
-                         self.headertest_msg.decode(
-                            'ascii', 'replace').replace('�', '?'))
+                         textwrap.dedent("""\
+                            From: {}
+                            To: {}
+                            Subject: {}
+                            From: {}
+
+                            Yes, they are flying.
+                            """).format(*[expected[1] for (_, expected) in
+                                        self.headertest_headers]))
 
     def test_values_with_8bit_headers(self):
         msg = email.message_from_bytes(self.headertest_msg)
-        self.assertListEqual(msg.values(),
+        self.assertListEqual([str(x) for x in msg.values()],
                               ['foo at bar.com',
-                               'b??z',
-                               'Maintenant je vous pr??sente mon '
-                                   'coll??gue, le pouf c??l??bre\n'
+                               'b\uFFFD\uFFFDz',
+                               'Maintenant je vous pr\uFFFD\uFFFDsente mon '
+                                   'coll\uFFFD\uFFFDgue, le pouf '
+                                   'c\uFFFD\uFFFDl\uFFFD\uFFFDbre\n'
                                    '\tJean de Baddie',
-                               "g??st"])
+                               "g\uFFFD\uFFFDst"])
 
     def test_items_with_8bit_headers(self):
         msg = email.message_from_bytes(self.headertest_msg)
-        self.assertListEqual(msg.items(),
+        self.assertListEqual([(str(x), str(y)) for (x, y) in msg.items()],
                               [('From', 'foo at bar.com'),
-                               ('To', 'b??z'),
-                               ('Subject', 'Maintenant je vous pr??sente mon '
-                                              'coll??gue, le pouf c??l??bre\n'
-                                              '\tJean de Baddie'),
-                               ('From', 'g??st')])
+                               ('To', 'b\uFFFD\uFFFDz'),
+                               ('Subject', 'Maintenant je vous '
+                                  'pr\uFFFD\uFFFDsente '
+                                  'mon coll\uFFFD\uFFFDgue, le pouf '
+                                  'c\uFFFD\uFFFDl\uFFFD\uFFFDbre\n'
+                                  '\tJean de Baddie'),
+                               ('From', 'g\uFFFD\uFFFDst')])
 
     def test_get_all_with_8bit_headers(self):
         msg = email.message_from_bytes(self.headertest_msg)
-        self.assertListEqual(msg.get_all('from'),
+        self.assertListEqual([str(x) for x in msg.get_all('from')],
                               ['foo at bar.com',
-                               'g??st'])
+                               'g\uFFFD\uFFFDst'])
 
     non_latin_bin_msg = textwrap.dedent("""\
         From: foo at bar.com
@@ -2951,13 +2989,12 @@
         email.generator.BytesGenerator(out).flatten(msg)
         self.assertEqual(out.getvalue(), self.non_latin_bin_msg)
 
-    # XXX: ultimately the '?' should turn into CTE encoded bytes
-    # using 'unknown-8bit' charset.
-    non_latin_bin_msg_as7bit = textwrap.dedent("""\
+    non_latin_bin_msg_as7bit_wrapped = textwrap.dedent("""\
         From: foo at bar.com
-        To: b??z
-        Subject: Maintenant je vous pr??sente mon coll??gue, le pouf c??l??bre
-        \tJean de Baddie
+        To: =?unknown-8bit?q?b=C3=A1z?=
+        Subject: =?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_coll=C3=A8gue?=
+         =?unknown-8bit?q?=2C_le_pouf_c=C3=A9l=C3=A8bre?=
+         =?unknown-8bit?q?_Jean_de_Baddie?=
         Mime-Version: 1.0
         Content-Type: text/plain; charset="utf-8"
         Content-Transfer-Encoding: base64
@@ -2969,7 +3006,7 @@
         msg = email.message_from_bytes(self.non_latin_bin_msg)
         out = StringIO()
         email.generator.Generator(out).flatten(msg)
-        self.assertEqual(out.getvalue(), self.non_latin_bin_msg_as7bit)
+        self.assertEqual(out.getvalue(), self.non_latin_bin_msg_as7bit_wrapped)
 
     def test_bytes_generator_with_unix_from(self):
         # The unixfrom contains a current date, so we can't check it
@@ -2982,6 +3019,12 @@
         self.assertEqual(lines[0].split()[0], b'From')
         self.assertEqual(b'\n'.join(lines[1:]), self.non_latin_bin_msg)
 
+    non_latin_bin_msg_as7bit = non_latin_bin_msg_as7bit_wrapped.split('\n')
+    non_latin_bin_msg_as7bit[2:4] = [
+        'Subject: =?unknown-8bit?q?Maintenant_je_vous_pr=C3=A9sente_mon_'
+         'coll=C3=A8gue=2C_le_pouf_c=C3=A9l=C3=A8bre?=']
+    non_latin_bin_msg_as7bit = '\n'.join(non_latin_bin_msg_as7bit)
+
     def test_message_from_binary_file(self):
         fn = 'test.msg'
         self.addCleanup(unlink, fn)
@@ -3620,6 +3663,10 @@
         s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3I ?='
         raises(errors.HeaderParseError, decode_header, s)
 
+    def test_shift_jis_charset(self):
+        h = Header('文', charset='shift_jis')
+        self.assertEqual(h.encode(), '=?iso-2022-jp?b?GyRCSjgbKEI=?=')
+
 
 
 # Test RFC 2231 header parameters (en/de)coding

Modified: python/branches/py3k-cdecimal/Lib/encodings/aliases.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/encodings/aliases.py	(original)
+++ python/branches/py3k-cdecimal/Lib/encodings/aliases.py	Tue Jan 11 18:07:55 2011
@@ -33,9 +33,9 @@
     'us'                 : 'ascii',
     'us_ascii'           : 'ascii',
 
-    # base64_codec codec
-    'base64'             : 'base64_codec',
-    'base_64'            : 'base64_codec',
+    ## base64_codec codec
+    #'base64'             : 'base64_codec',
+    #'base_64'            : 'base64_codec',
 
     # big5 codec
     'big5_tw'            : 'big5',
@@ -45,8 +45,8 @@
     'big5_hkscs'         : 'big5hkscs',
     'hkscs'              : 'big5hkscs',
 
-    # bz2_codec codec
-    'bz2'                : 'bz2_codec',
+    ## bz2_codec codec
+    #'bz2'                : 'bz2_codec',
 
     # cp037 codec
     '037'                : 'cp037',
@@ -248,8 +248,8 @@
     'cp936'              : 'gbk',
     'ms936'              : 'gbk',
 
-    # hex_codec codec
-    'hex'                : 'hex_codec',
+    ## hex_codec codec
+    #'hex'                : 'hex_codec',
 
     # hp_roman8 codec
     'roman8'             : 'hp_roman8',
@@ -450,13 +450,13 @@
     'cp154'              : 'ptcp154',
     'cyrillic_asian'     : 'ptcp154',
 
-    # quopri_codec codec
-    'quopri'             : 'quopri_codec',
-    'quoted_printable'   : 'quopri_codec',
-    'quotedprintable'    : 'quopri_codec',
+    ## quopri_codec codec
+    #'quopri'             : 'quopri_codec',
+    #'quoted_printable'   : 'quopri_codec',
+    #'quotedprintable'    : 'quopri_codec',
 
-    # rot_13 codec
-    'rot13'              : 'rot_13',
+    ## rot_13 codec
+    #'rot13'              : 'rot_13',
 
     # shift_jis codec
     'csshiftjis'         : 'shift_jis',
@@ -518,12 +518,12 @@
     'utf8_ucs2'          : 'utf_8',
     'utf8_ucs4'          : 'utf_8',
 
-    # uu_codec codec
-    'uu'                 : 'uu_codec',
+    ## uu_codec codec
+    #'uu'                 : 'uu_codec',
 
-    # zlib_codec codec
-    'zip'                : 'zlib_codec',
-    'zlib'               : 'zlib_codec',
+    ## zlib_codec codec
+    #'zip'                : 'zlib_codec',
+    #'zlib'               : 'zlib_codec',
 
     # temporary mac CJK aliases, will be replaced by proper codecs in 3.1
     'x_mac_japanese'      : 'shift_jis',

Modified: python/branches/py3k-cdecimal/Lib/functools.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/functools.py	(original)
+++ python/branches/py3k-cdecimal/Lib/functools.py	Tue Jan 11 18:07:55 2011
@@ -68,17 +68,17 @@
 def total_ordering(cls):
     """Class decorator that fills in missing ordering methods"""
     convert = {
-        '__lt__': [('__gt__', lambda self, other: other < self),
-                   ('__le__', lambda self, other: not other < self),
+        '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
+                   ('__le__', lambda self, other: self < other or self == other),
                    ('__ge__', lambda self, other: not self < other)],
-        '__le__': [('__ge__', lambda self, other: other <= self),
-                   ('__lt__', lambda self, other: not other <= self),
+        '__le__': [('__ge__', lambda self, other: not self <= other or self == other),
+                   ('__lt__', lambda self, other: self <= other and not self == other),
                    ('__gt__', lambda self, other: not self <= other)],
-        '__gt__': [('__lt__', lambda self, other: other > self),
-                   ('__ge__', lambda self, other: not other > self),
+        '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
+                   ('__ge__', lambda self, other: self > other or self == other),
                    ('__le__', lambda self, other: not self > other)],
-        '__ge__': [('__le__', lambda self, other: other >= self),
-                   ('__gt__', lambda self, other: not other >= self),
+        '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
+                   ('__gt__', lambda self, other: self >= other and not self == other),
                    ('__lt__', lambda self, other: not self >= other)]
     }
     # Find user-defined comparisons (not those inherited from object).

Modified: python/branches/py3k-cdecimal/Lib/imaplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/imaplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/imaplib.py	Tue Jan 11 18:07:55 2011
@@ -169,6 +169,17 @@
 
         self.open(host, port)
 
+        try:
+            self._connect()
+        except Exception:
+            try:
+                self.shutdown()
+            except socket.error:
+                pass
+            raise
+
+
+    def _connect(self):
         # Create unique tag for this session,
         # and compile tagged response matcher.
 

Modified: python/branches/py3k-cdecimal/Lib/multiprocessing/connection.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/multiprocessing/connection.py	(original)
+++ python/branches/py3k-cdecimal/Lib/multiprocessing/connection.py	Tue Jan 11 18:07:55 2011
@@ -281,25 +281,24 @@
     Return a connection object connected to the socket given by `address`
     '''
     family = address_type(address)
-    s = socket.socket( getattr(socket, family) )
-    t = _init_timeout()
+    with socket.socket( getattr(socket, family) ) as s:
+        t = _init_timeout()
 
-    while 1:
-        try:
-            s.connect(address)
-        except socket.error as e:
-            if e.args[0] != errno.ECONNREFUSED or _check_timeout(t):
-                debug('failed to connect to address %s', address)
-                raise
-            time.sleep(0.01)
+        while 1:
+            try:
+                s.connect(address)
+            except socket.error as e:
+                if e.args[0] != errno.ECONNREFUSED or _check_timeout(t):
+                    debug('failed to connect to address %s', address)
+                    raise
+                time.sleep(0.01)
+            else:
+                break
         else:
-            break
-    else:
-        raise
+            raise
 
-    fd = duplicate(s.fileno())
+        fd = duplicate(s.fileno())
     conn = _multiprocessing.Connection(fd)
-    s.close()
     return conn
 
 #

Modified: python/branches/py3k-cdecimal/Lib/pydoc.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/pydoc.py	(original)
+++ python/branches/py3k-cdecimal/Lib/pydoc.py	Tue Jan 11 18:07:55 2011
@@ -2112,6 +2112,7 @@
             while not self.quit:
                 rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
                 if rd: self.handle_request()
+            self.server_close()
 
         def server_activate(self):
             self.base.server_activate(self)
@@ -2409,6 +2410,7 @@
                 rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
                 if rd:
                     self.handle_request()
+            self.server_close()
 
         def server_activate(self):
             self.base.server_activate(self)

Modified: python/branches/py3k-cdecimal/Lib/socket.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/socket.py	(original)
+++ python/branches/py3k-cdecimal/Lib/socket.py	Tue Jan 11 18:07:55 2011
@@ -130,7 +130,13 @@
         For IP sockets, the address info is a pair (hostaddr, port).
         """
         fd, addr = self._accept()
-        return socket(self.family, self.type, self.proto, fileno=fd), addr
+        sock = socket(self.family, self.type, self.proto, fileno=fd)
+        # Issue #7995: if no default timeout is set and the listening
+        # socket had a (non-zero) timeout, force the new socket in blocking
+        # mode to override platform-specific socket flags inheritance.
+        if getdefaulttimeout() is None and self.gettimeout():
+            sock.setblocking(True)
+        return sock, addr
 
     def makefile(self, mode="r", buffering=None, *,
                  encoding=None, errors=None, newline=None):
@@ -307,7 +313,10 @@
 
     @property
     def name(self):
-        return self.fileno()
+        if not self.closed:
+            return self.fileno()
+        else:
+            return -1
 
     @property
     def mode(self):

Modified: python/branches/py3k-cdecimal/Lib/subprocess.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/subprocess.py	(original)
+++ python/branches/py3k-cdecimal/Lib/subprocess.py	Tue Jan 11 18:07:55 2011
@@ -393,22 +393,22 @@
     # POSIX defines PIPE_BUF as >= 512.
     _PIPE_BUF = getattr(select, 'PIPE_BUF', 512)
 
+    _FD_CLOEXEC = getattr(fcntl, 'FD_CLOEXEC', 1)
+
+    def _set_cloexec(fd, cloexec):
+        old = fcntl.fcntl(fd, fcntl.F_GETFD)
+        if cloexec:
+            fcntl.fcntl(fd, fcntl.F_SETFD, old | _FD_CLOEXEC)
+        else:
+            fcntl.fcntl(fd, fcntl.F_SETFD, old & ~_FD_CLOEXEC)
+
     if _posixsubprocess:
         _create_pipe = _posixsubprocess.cloexec_pipe
     else:
         def _create_pipe():
-            try:
-                cloexec_flag = fcntl.FD_CLOEXEC
-            except AttributeError:
-                cloexec_flag = 1
-
             fds = os.pipe()
-
-            old = fcntl.fcntl(fds[0], fcntl.F_GETFD)
-            fcntl.fcntl(fds[0], fcntl.F_SETFD, old | cloexec_flag)
-            old = fcntl.fcntl(fds[1], fcntl.F_GETFD)
-            fcntl.fcntl(fds[1], fcntl.F_SETFD, old | cloexec_flag)
-
+            _set_cloexec(fds[0], True)
+            _set_cloexec(fds[1], True)
             return fds
 
 __all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "getstatusoutput",
@@ -699,13 +699,9 @@
          c2pread, c2pwrite,
          errread, errwrite) = self._get_handles(stdin, stdout, stderr)
 
-        self._execute_child(args, executable, preexec_fn, close_fds,
-                            pass_fds, cwd, env, universal_newlines,
-                            startupinfo, creationflags, shell,
-                            p2cread, p2cwrite,
-                            c2pread, c2pwrite,
-                            errread, errwrite,
-                            restore_signals, start_new_session)
+        # We wrap OS handles *before* launching the child, otherwise a
+        # quickly terminating child could make our fds unwrappable
+        # (see #8458).
 
         if mswindows:
             if p2cwrite != -1:
@@ -730,6 +726,24 @@
             if universal_newlines:
                 self.stderr = io.TextIOWrapper(self.stderr)
 
+        try:
+            self._execute_child(args, executable, preexec_fn, close_fds,
+                                pass_fds, cwd, env, universal_newlines,
+                                startupinfo, creationflags, shell,
+                                p2cread, p2cwrite,
+                                c2pread, c2pwrite,
+                                errread, errwrite,
+                                restore_signals, start_new_session)
+        except:
+            # Cleanup if the child failed starting
+            for f in filter(None, [self.stdin, self.stdout, self.stderr]):
+                try:
+                    f.close()
+                except EnvironmentError:
+                    # Ignore EBADF or other errors
+                    pass
+            raise
+
 
     def _translate_newlines(self, data, encoding):
         data = data.replace(b"\r\n", b"\n").replace(b"\r", b"\n")
@@ -1092,15 +1106,9 @@
                     errread, errwrite)
 
 
-        def _close_fds(self, but):
-            os.closerange(3, but)
-            os.closerange(but + 1, MAXFD)
-
-
-        def _close_all_but_a_sorted_few_fds(self, fds_to_keep):
-            # precondition: fds_to_keep must be sorted and unique
+        def _close_fds(self, fds_to_keep):
             start_fd = 3
-            for fd in fds_to_keep:
+            for fd in sorted(fds_to_keep):
                 if fd >= start_fd:
                     os.closerange(start_fd, fd)
                     start_fd = fd + 1
@@ -1194,33 +1202,31 @@
                                 os.close(errpipe_read)
 
                                 # Dup fds for child
-                                if p2cread != -1:
-                                    os.dup2(p2cread, 0)
-                                if c2pwrite != -1:
-                                    os.dup2(c2pwrite, 1)
-                                if errwrite != -1:
-                                    os.dup2(errwrite, 2)
+                                def _dup2(a, b):
+                                    # dup2() removes the CLOEXEC flag but
+                                    # we must do it ourselves if dup2()
+                                    # would be a no-op (issue #10806).
+                                    if a == b:
+                                        _set_cloexec(a, False)
+                                    elif a != -1:
+                                        os.dup2(a, b)
+                                _dup2(p2cread, 0)
+                                _dup2(c2pwrite, 1)
+                                _dup2(errwrite, 2)
 
                                 # Close pipe fds.  Make sure we don't close the
                                 # same fd more than once, or standard fds.
-                                if p2cread != -1 and p2cread not in (0,):
-                                    os.close(p2cread)
-                                if (c2pwrite != -1 and
-                                    c2pwrite not in (p2cread, 1)):
-                                    os.close(c2pwrite)
-                                if (errwrite != -1 and
-                                    errwrite not in (p2cread, c2pwrite, 2)):
-                                    os.close(errwrite)
+                                closed = set()
+                                for fd in [p2cread, c2pwrite, errwrite]:
+                                    if fd > 2 and fd not in closed:
+                                        os.close(fd)
+                                        closed.add(fd)
 
                                 # Close all other fds, if asked for
                                 if close_fds:
-                                    if pass_fds:
-                                        fds_to_keep = set(pass_fds)
-                                        fds_to_keep.add(errpipe_write)
-                                        self._close_all_but_a_sorted_few_fds(
-                                                sorted(fds_to_keep))
-                                    else:
-                                        self._close_fds(but=errpipe_write)
+                                    fds_to_keep = set(pass_fds)
+                                    fds_to_keep.add(errpipe_write)
+                                    self._close_fds(fds_to_keep)
 
 
                                 if cwd is not None:

Modified: python/branches/py3k-cdecimal/Lib/test/datetimetester.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/datetimetester.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/datetimetester.py	Tue Jan 11 18:07:55 2011
@@ -202,7 +202,7 @@
 
 
     def test_dst(self):
-        self.assertEqual(None, timezone.utc.dst(self.DT))
+        self.assertIsNone(timezone.utc.dst(self.DT))
 
         with self.assertRaises(TypeError): self.EST.dst('')
         with self.assertRaises(TypeError): self.EST.dst(5)
@@ -1284,10 +1284,10 @@
         self.assertTrue(self.theclass.max)
 
     def test_strftime_out_of_range(self):
-        # For nasty technical reasons, we can't handle years before 1900.
+        # For nasty technical reasons, we can't handle years before 1000.
         cls = self.theclass
-        self.assertEqual(cls(1900, 1, 1).strftime("%Y"), "1900")
-        for y in 1, 49, 51, 99, 100, 1000, 1899:
+        self.assertEqual(cls(1000, 1, 1).strftime("%Y"), "1000")
+        for y in 1, 49, 51, 99, 100, 999:
             self.assertRaises(ValueError, cls(y, 1, 1).strftime, "%Y")
 
     def test_replace(self):

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	Tue Jan 11 18:07:55 2011
@@ -3,7 +3,7 @@
 """
 Usage:
 
-python -m test.regrtest [options] [test_name1 [test_name2 ...]]
+python -m test [options] [test_name1 [test_name2 ...]]
 python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
 
 
@@ -14,7 +14,7 @@
 For more rigorous testing, it is useful to use the following
 command line:
 
-python -E -tt -Wd -3 -m test.regrtest [options] [test_name1 ...]
+python -E -Wd -m test [options] [test_name1 ...]
 
 
 Options:
@@ -29,10 +29,12 @@
 -d/--debug      -- print traceback for failed tests
 -q/--quiet      -- no output unless one or more tests fail
 -S/--slow       -- print the slowest 10 tests
+   --header     -- print header with interpreter info
 
 Selecting tests
 
 -r/--random     -- randomize test execution order (see below)
+   --randseed   -- pass a random seed to reproduce a previous random run
 -f/--fromfile   -- read names of tests to run from a file (see below)
 -x/--exclude    -- arguments are tests to *exclude*
 -s/--single     -- single step through a set of tests (see below)
@@ -228,7 +230,8 @@
          exclude=False, single=False, randomize=False, fromfile=None,
          findleaks=False, use_resources=None, trace=False, coverdir='coverage',
          runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
-         random_seed=None, use_mp=None, verbose3=False, forever=False):
+         random_seed=None, use_mp=None, verbose3=False, forever=False,
+         header=False):
     """Execute a test suite.
 
     This also parses command-line options and modifies its behavior
@@ -261,8 +264,8 @@
              'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks',
              'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
              'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
-             'multiprocess=', 'slaveargs=', 'forever', 'debug', 'start=',
-             'nowindows'])
+             'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug',
+             'start=', 'nowindows', 'header'])
     except getopt.error as msg:
         usage(msg)
 
@@ -371,6 +374,8 @@
             forever = True
         elif o in ('-j', '--multiprocess'):
             use_mp = int(a)
+        elif o == '--header':
+            header = True
         elif o == '--slaveargs':
             args, kwargs = json.loads(a)
             try:
@@ -447,12 +452,13 @@
         args = []
 
     # For a partial run, we do not need to clutter the output.
-    if verbose or not (quiet or single or tests or args):
+    if verbose or header or not (quiet or single or tests or args):
         # Print basic platform information
         print("==", platform.python_implementation(), *sys.version.split())
         print("==  ", platform.platform(aliased=True),
                       "%s-endian" % sys.byteorder)
         print("==  ", os.getcwd())
+        print("Testing with flags:", sys.flags)
 
     alltests = findtests(testdir, stdtests, nottests)
     selected = tests or args or alltests
@@ -737,10 +743,19 @@
     if os.name == "nt":
         # Replace sys.stdout breaks the stdout newlines on Windows: issue #8533
         return
+
+    import atexit
+
     stdout = sys.stdout
     sys.stdout = open(stdout.fileno(), 'w',
         encoding=stdout.encoding,
-        errors="backslashreplace")
+        errors="backslashreplace",
+        closefd=False)
+
+    def restore_stdout():
+        sys.stdout.close()
+        sys.stdout = stdout
+    atexit.register(restore_stdout)
 
 def runtest(test, verbose, quiet,
             huntrleaks=False, debug=False, use_resources=None):

Modified: python/branches/py3k-cdecimal/Lib/test/sha256.pem
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/sha256.pem	(original)
+++ python/branches/py3k-cdecimal/Lib/test/sha256.pem	Tue Jan 11 18:07:55 2011
@@ -1,33 +1,129 @@
+# Certificate chain for https://sha256.tbs-internet.com
+ 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com
+   i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
 -----BEGIN CERTIFICATE-----
-MIIFxzCCA6+gAwIBAgIJALnlnf5uzTkIMA0GCSqGSIb3DQEBCwUAMEsxCzAJBgNV
-BAYTAkRFMRcwFQYDVQQKEw5zY2hva29rZWtzLm9yZzEjMCEGCSqGSIb3DQEJARYU
-aGFubm9Ac2Nob2tva2Vrcy5vcmcwHhcNMTAwMTI3MDAyMTI1WhcNMjAwMTI1MDAy
-MTI1WjBLMQswCQYDVQQGEwJERTEXMBUGA1UEChMOc2Nob2tva2Vrcy5vcmcxIzAh
-BgkqhkiG9w0BCQEWFGhhbm5vQHNjaG9rb2tla3Mub3JnMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEApJ4ODPwEooMW35dQPlBqdvcfkEvjhcsA7jmJfFqN
-e/1T34zT44X9+KnMBSG2InacbD7eyFgjfaENFsZ87YkEBDIFZ/SHotLJZORQ8PUj
-YoxPG4mjKN+yL2WthNcYbRyJreTbbDroNMuw6tkTSxeSXyYFQrKMCUfErVbZa/d5
-RvfFVk+Au9dVUFhed/Stn5cv+a0ffvpyA7ygihm1kMFICbvPeI0846tmC2Ph7rM5
-pYQyNBDOVpULODTk5Wu6jiiJJygvJWCZ1FdpsdBs5aKWHWdRhX++quGuflTTjH5d
-qaIka4op9H7XksYphTDXmV+qHnva5jbPogwutDQcVsGBQcJaLmQqhsQK13bf4khE
-iWJvfBLfHn8OOpY25ZwwuigJIwifNCxQeeT1FrLmyuYNhz2phPpzx065kqSUSR+A
-Iw8DPE6e65UqMDKqZnID3dQeiQaFrHEV+Ibo0U/tD0YSBw5p33TMh0Es33IBWMac
-m7x4hIFWdhl8W522u6qOrTswY3s8vB7blNWqMc9n7oWH8ybFf7EgKeDVtEN9AyBE
-0WotXIEZWI+WvDbU1ACJXau9sQhYP/eerg7Zwr3iGUy4IQ5oUJibnjtcE+z8zmDN
-pE6YcMCLJyLjXiQ3iHG9mNXzw7wPnslTbEEEukrfSlHGgW8Dm+VrNyW0JUM1bntx
-vbMCAwEAAaOBrTCBqjAdBgNVHQ4EFgQUCedv7pDTuXtCxm4HTw9hUtrTvsowewYD
-VR0jBHQwcoAUCedv7pDTuXtCxm4HTw9hUtrTvsqhT6RNMEsxCzAJBgNVBAYTAkRF
-MRcwFQYDVQQKEw5zY2hva29rZWtzLm9yZzEjMCEGCSqGSIb3DQEJARYUaGFubm9A
-c2Nob2tva2Vrcy5vcmeCCQC55Z3+bs05CDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3
-DQEBCwUAA4ICAQBHKAxA7WA/MEFjet03K8ouzEOr6Jrk2fZOuRhoDZ+9gr4FtaJB
-P3Hh5D00kuSOvDnwsvCohxeNd1KTMAwVmVoH+NZkHERn3UXniUENlp18koI1ehlr
-CZbXbzzE9Te9BelliSFA63q0cq0yJN1x9GyabU34XkAouCAmOqfSpKNZWZHGBHPF
-bbYnZrHEMcsye6vKeTOcg1GqUHGrQM2WK0QaOwnCQv2RblI9VN+SeRoUJ44qTXdW
-TwIYStsIPesacNcAQTStnHgKqIPx4zCwdx5xo8zONbXJfocqwyFqiAofvb9dN1nW
-g1noVBcXB+oRBZW5CjFw87U88itq39i9+BWl835DWLBW2pVmx1QTLGv0RNgs/xVx
-mWnjH4nNHvrjn6pRmqHZTk/SS0Hkl2qtDsynVxIl8EiMTfWSU3DBTuD2J/RSzuOE
-eKtAbaoXkXE31jCl4FEZLITIZd8UkXacb9rN304tAK92L76JOAV+xOZxFRipmvx4
-+A9qQXgLhtP4VaDajb44V/kCKPSA0Vm3apehke9Wl8dDtagfos1e6MxSu3EVLXRF
-SP2U777V77pdMSd0f/7cerKn5FjrxW1v1FaP1oIGniMk4qQNTgA/jvvhjybsPlVA
-jsfnhWGbh1voJa0RQcMiRMsxpw2P1KNOEu37W2eq/vFghVztZJQUmb5iNw==
+MIIGXTCCBUWgAwIBAgIRAMmag+ygSAdxZsbyzYjhuW0wDQYJKoZIhvcNAQELBQAw
+gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+Q0EgU0dDMB4XDTEwMDIxODAwMDAwMFoXDTEyMDIxOTIzNTk1OVowgcsxCzAJBgNV
+BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV
+BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM
+VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS
+c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0
+LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbuM8VT7f0nntwu
+N3F7v9KIBlhKNAxqCrziOXU5iqUt8HrQB3DtHbdmII+CpVUlwlmepsx6G+srEZ9a
+MIGAy0nxi5aLb7watkyIdPjJTMvTUBQ/+RPWzt5JtYbbY9BlJ+yci0dctP74f4NU
+ISLtlrEjUbf2gTohLrcE01TfmOF6PDEbB5PKDi38cB3NzKfizWfrOaJW6Q1C1qOJ
+y4/4jkUREX1UFUIxzx7v62VfjXSGlcjGpBX1fvtABQOSLeE0a6gciDZs1REqroFf
+5eXtqYphpTa14Z83ITXMfgg5Nze1VtMnzI9Qx4blYBw4dgQVEuIsYr7FDBOITDzc
+VEVXZx0CAwEAAaOCAj8wggI7MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf
+2YIfMB0GA1UdDgQWBBSJKI/AYVI9RQNY0QPIqc8ej2QivTAOBgNVHQ8BAf8EBAMC
+BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG
+CisGAQQBgjcKAwMGCWCGSAGG+EIEATBMBgNVHSAERTBDMEEGCysGAQQBgOU3AgQB
+MDIwMAYIKwYBBQUHAgEWJGh0dHBzOi8vd3d3LnRicy1pbnRlcm5ldC5jb20vQ0Ev
+Q1BTNDBtBgNVHR8EZjBkMDKgMKAuhixodHRwOi8vY3JsLnRicy1pbnRlcm5ldC5j
+b20vVEJTWDUwOUNBU0dDLmNybDAuoCygKoYoaHR0cDovL2NybC50YnMteDUwOS5j
+b20vVEJTWDUwOUNBU0dDLmNybDCBpgYIKwYBBQUHAQEEgZkwgZYwOAYIKwYBBQUH
+MAKGLGh0dHA6Ly9jcnQudGJzLWludGVybmV0LmNvbS9UQlNYNTA5Q0FTR0MuY3J0
+MDQGCCsGAQUFBzAChihodHRwOi8vY3J0LnRicy14NTA5LmNvbS9UQlNYNTA5Q0FT
+R0MuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC50YnMteDUwOS5jb20wPwYD
+VR0RBDgwNoIXc2hhMjU2LnRicy1pbnRlcm5ldC5jb22CG3d3dy5zaGEyNTYudGJz
+LWludGVybmV0LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAA5NL0D4QSqhErhlkdPmz
+XtiMvdGL+ZehM4coTRIpasM/Agt36Rc0NzCvnQwKE+wkngg1Gy2qe7Q0E/ziqBtB
+fZYzdVgu1zdiL4kTaf+wFKYAFGsFbyeEmXysy+CMwaNoF2vpSjCU1UD56bEnTX/W
+fxVZYxtBQUpnu2wOsm8cDZuZRv9XrYgAhGj9Tt6F0aVHSDGn59uwShG1+BVF/uju
+SCyPTTjL1oc7YElJUzR/x4mQJYvtQI8gDIDAGEOs7v3R/gKa5EMfbUQUI4C84UbI
+Yz09Jdnws/MkC/Hm1BZEqk89u7Hvfv+oHqEb0XaUo0TDfsxE0M1sMdnLb91QNQBm
+UQ==
+-----END CERTIFICATE-----
+ 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
+   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+-----BEGIN CERTIFICATE-----
+MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv
+MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
+ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
+eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow
+gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6
+rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0
+9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ
+ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk
+owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G
+Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk
+9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf
+2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ
+MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3
+AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk
+ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k
+by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw
+cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV
+VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B
+ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN
+AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232
+euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY
+1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98
+RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz
+8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV
+v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E=
+-----END CERTIFICATE-----
+ 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+-----BEGIN CERTIFICATE-----
+MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB
+kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT
+AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0
+ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
+IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05
+4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6
+2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh
+alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv
+u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW
+xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p
+XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd
+tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB
+BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX
+BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov
+L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN
+AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO
+rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd
+FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM
++bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI
+3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb
++M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g=
+-----END CERTIFICATE-----
+ 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+-----BEGIN CERTIFICATE-----
+MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB
+kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG
+EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD
+VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu
+dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN
+BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6
+E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ
+D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK
+4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq
+lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW
+bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB
+o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT
+MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js
+LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr
+BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB
+AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
+Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj
+j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH
+KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv
+2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3
+mfnGV/TJVTl4uix5yaaIK/QI
 -----END CERTIFICATE-----

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	Tue Jan 11 18:07:55 2011
@@ -800,6 +800,7 @@
     default_errnos = [
         ('ECONNREFUSED', 111),
         ('ECONNRESET', 104),
+        ('EHOSTUNREACH', 113),
         ('ENETUNREACH', 101),
         ('ETIMEDOUT', 110),
     ]
@@ -1198,6 +1199,12 @@
                  if k.startswith('encodings.')]
     sys.modules.clear()
     sys.modules.update(encodings)
+    # XXX: This kind of problem can affect more than just encodings. In particular
+    # extension modules (such as _ssl) don't cope with reloading properly.
+    # Really, test modules should be cleaning out the test specific modules they
+    # know they added (ala test_runpy) rather than relying on this function (as
+    # test_importhooks and test_pkg do currently).
+    # Implicitly imported *real* modules should be left alone (see issue 10556).
     sys.modules.update(oldmodules)
 
 #=======================================================================

Modified: python/branches/py3k-cdecimal/Lib/test/test_array.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_array.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_array.py	Tue Jan 11 18:07:55 2011
@@ -22,7 +22,7 @@
 
 class ArraySubclassWithKwargs(array.array):
     def __init__(self, typecode, newarg=None):
-        array.array.__init__(self, typecode)
+        array.array.__init__(self)
 
 tests = [] # list to accumulate all tests
 typecodes = "ubBhHiIlLfd"

Modified: python/branches/py3k-cdecimal/Lib/test/test_ast.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_ast.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_ast.py	Tue Jan 11 18:07:55 2011
@@ -264,6 +264,14 @@
             'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, '
             'col_offset=0))'
         )
+        # issue10869: do not increment lineno of root twice
+        src = ast.parse('1 + 1', mode='eval')
+        self.assertEqual(ast.increment_lineno(src.body, n=3), src.body)
+        self.assertEqual(ast.dump(src, include_attributes=True),
+            'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), '
+            'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, '
+            'col_offset=0))'
+        )
 
     def test_iter_fields(self):
         node = ast.parse('foo()', mode='eval')

Modified: python/branches/py3k-cdecimal/Lib/test/test_atexit.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_atexit.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_atexit.py	Tue Jan 11 18:07:55 2011
@@ -25,8 +25,9 @@
 
 class TestCase(unittest.TestCase):
     def setUp(self):
+        self.save_stdout = sys.stdout
+        self.save_stderr = sys.stderr
         self.stream = io.StringIO()
-        self.save_stdout, self.save_stderr = sys.stderr, sys.stdout
         sys.stdout = sys.stderr = self.stream
         atexit._clear()
 
@@ -65,6 +66,14 @@
 
         self.assertRaises(TypeError, atexit._run_exitfuncs)
 
+    def test_raise_unnormalized(self):
+        # Issue #10756: Make sure that an unnormalized exception is
+        # handled properly
+        atexit.register(lambda: 1 / 0)
+
+        self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
+        self.assertIn("ZeroDivisionError", self.stream.getvalue())
+
     def test_stress(self):
         a = [0]
         def inc():

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	Tue Jan 11 18:07:55 2011
@@ -497,6 +497,27 @@
                 return None
         self.assertRaises(TypeError, bytes, A())
 
+    # Test PyBytes_FromFormat()
+    def test_from_format(self):
+        test.support.import_module('ctypes')
+        from ctypes import pythonapi, py_object, c_int, c_char_p
+        PyBytes_FromFormat = pythonapi.PyBytes_FromFormat
+        PyBytes_FromFormat.restype = py_object
+
+        self.assertEqual(PyBytes_FromFormat(b'format'),
+                         b'format')
+
+        self.assertEqual(PyBytes_FromFormat(b'%'), b'%')
+        self.assertEqual(PyBytes_FromFormat(b'%%'), b'%')
+        self.assertEqual(PyBytes_FromFormat(b'%%s'), b'%s')
+        self.assertEqual(PyBytes_FromFormat(b'[%%]'), b'[%]')
+        self.assertEqual(PyBytes_FromFormat(b'%%%c', c_int(ord('_'))), b'%_')
+
+        self.assertEqual(PyBytes_FromFormat(b'c:%c', c_int(255)),
+                         b'c:\xff')
+        self.assertEqual(PyBytes_FromFormat(b's:%s', c_char_p(b'cstr')),
+                         b's:cstr')
+
 
 class ByteArrayTest(BaseBytesTest):
     type2test = bytearray

Modified: python/branches/py3k-cdecimal/Lib/test/test_collections.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_collections.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_collections.py	Tue Jan 11 18:07:55 2011
@@ -3,7 +3,7 @@
 import unittest, doctest, operator
 import inspect
 from test import support
-from collections import namedtuple, Counter, OrderedDict
+from collections import namedtuple, Counter, OrderedDict, _count_elements
 from test import mapping_tests
 import pickle, copy
 from random import randrange, shuffle
@@ -775,6 +775,19 @@
         c.subtract('aaaabbcce')
         self.assertEqual(c, Counter(a=-1, b=0, c=-1, d=1, e=-1))
 
+    def test_helper_function(self):
+        # two paths, one for real dicts and one for other mappings
+        elems = list('abracadabra')
+
+        d = dict()
+        _count_elements(d, elems)
+        self.assertEqual(d, {'a': 5, 'r': 2, 'b': 2, 'c': 1, 'd': 1})
+
+        m = OrderedDict()
+        _count_elements(m, elems)
+        self.assertEqual(m,
+             OrderedDict([('a', 5), ('b', 2), ('r', 2), ('c', 1), ('d', 1)]))
+
 class TestOrderedDict(unittest.TestCase):
 
     def test_init(self):

Modified: python/branches/py3k-cdecimal/Lib/test/test_concurrent_futures.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_concurrent_futures.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_concurrent_futures.py	Tue Jan 11 18:07:55 2011
@@ -9,24 +9,16 @@
 # without thread support.
 test.support.import_module('threading')
 
-import io
-import logging
-import multiprocessing
-import sys
 import threading
 import time
 import unittest
 
-if sys.platform.startswith('win'):
-    import ctypes
-    import ctypes.wintypes
-
 from concurrent import futures
 from concurrent.futures._base import (
-    PENDING, RUNNING, CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED, Future,
-    LOGGER, wait)
+    PENDING, RUNNING, CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED, Future)
 import concurrent.futures.process
 
+
 def create_future(state=PENDING, exception=None, result=None):
     f = Future()
     f._state = state
@@ -34,6 +26,7 @@
     f._result = result
     return f
 
+
 PENDING_FUTURE = create_future(state=PENDING)
 RUNNING_FUTURE = create_future(state=RUNNING)
 CANCELLED_FUTURE = create_future(state=CANCELLED)
@@ -41,110 +34,48 @@
 EXCEPTION_FUTURE = create_future(state=FINISHED, exception=IOError())
 SUCCESSFUL_FUTURE = create_future(state=FINISHED, result=42)
 
+
 def mul(x, y):
     return x * y
 
-class Call(object):
-    """A call that can be submitted to a future.Executor for testing.
 
-    The call signals when it is called and waits for an event before finishing.
-    """
-    CALL_LOCKS = {}
-    def _create_event(self):
-        if sys.platform.startswith('win'):
-            class SECURITY_ATTRIBUTES(ctypes.Structure):
-                _fields_ = [("nLength", ctypes.wintypes.DWORD),
-                            ("lpSecurityDescriptor", ctypes.wintypes.LPVOID),
-                            ("bInheritHandle", ctypes.wintypes.BOOL)]
-
-            s = SECURITY_ATTRIBUTES()
-            s.nLength = ctypes.sizeof(s)
-            s.lpSecurityDescriptor = None
-            s.bInheritHandle = True
-
-            handle = ctypes.windll.kernel32.CreateEventA(ctypes.pointer(s),
-                                                         True,
-                                                         False,
-                                                         None)
-            assert handle is not None
-            return handle
-        else:
-            event = multiprocessing.Event()
-            self.CALL_LOCKS[id(event)] = event
-            return id(event)
-
-    def _wait_on_event(self, handle):
-        if sys.platform.startswith('win'):
-            # WaitForSingleObject returns 0 if handle is signaled.
-            r = ctypes.windll.kernel32.WaitForSingleObject(handle, 60 * 1000)
-            if r != 0:
-                message = (
-                    'WaitForSingleObject({}, ...) failed with {}, '
-                    'GetLastError() = {}'.format(
-                            handle, r, ctypes.GetLastError()))
-                logging.critical(message)
-                assert False, message
-        else:
-            self.CALL_LOCKS[handle].wait()
+def sleep_and_raise(t):
+    time.sleep(t)
+    raise Exception('this is an exception')
 
-    def _signal_event(self, handle):
-        if sys.platform.startswith('win'):
-            r = ctypes.windll.kernel32.SetEvent(handle)  # Returns 0 on failure.
-            if r == 0:
-                message = (
-                    'SetEvent({}) failed with {}, GetLastError() = {}'.format(
-                            handle, r, ctypes.GetLastError()))
-                logging.critical(message)
-                assert False, message
-        else:
-            self.CALL_LOCKS[handle].set()
 
-    def __init__(self, manual_finish=False, result=42):
-        self._called_event = self._create_event()
-        self._can_finish = self._create_event()
+class ExecutorMixin:
+    worker_count = 5
+    def _prime_executor(self):
+        # Make sure that the executor is ready to do work before running the
+        # tests. This should reduce the probability of timeouts in the tests.
+        futures = [self.executor.submit(time.sleep, 0.1)
+                   for _ in range(self.worker_count)]
 
-        self._result = result
+        for f in futures:
+            f.result()
 
-        if not manual_finish:
-            self._signal_event(self._can_finish)
 
-    def wait_on_called(self):
-        self._wait_on_event(self._called_event)
+class ThreadPoolMixin(ExecutorMixin):
+    def setUp(self):
+        self.executor = futures.ThreadPoolExecutor(max_workers=5)
+        self._prime_executor()
 
-    def set_can(self):
-        self._signal_event(self._can_finish)
+    def tearDown(self):
+        self.executor.shutdown(wait=True)
 
-    def __call__(self):
-        self._signal_event(self._called_event)
-        self._wait_on_event(self._can_finish)
 
-        return self._result
+class ProcessPoolMixin(ExecutorMixin):
+    def setUp(self):
+        try:
+            self.executor = futures.ProcessPoolExecutor(max_workers=5)
+        except NotImplementedError as e:
+            self.skipTest(str(e))
+        self._prime_executor()
 
-    def close(self):
-        self.set_can()
-        if sys.platform.startswith('win'):
-            ctypes.windll.kernel32.CloseHandle(self._called_event)
-            ctypes.windll.kernel32.CloseHandle(self._can_finish)
-            self._called_event = None
-            self._can_finish = None
-        else:
-            del self.CALL_LOCKS[self._called_event]
-            del self.CALL_LOCKS[self._can_finish]
+    def tearDown(self):
+        self.executor.shutdown(wait=True)
 
-class ExceptionCall(Call):
-    def __call__(self):
-        self._signal_event(self._called_event)
-        self._wait_on_event(self._can_finish)
-        raise ZeroDivisionError()
-
-class MapCall(Call):
-    def __init__(self, result=42):
-        super().__init__(manual_finish=True, result=result)
-
-    def __call__(self, manual_finish):
-        if manual_finish:
-            super().__call__()
-        return self._result
 
 class ExecutorShutdownTest(unittest.TestCase):
     def test_run_after_shutdown(self):
@@ -154,37 +85,14 @@
                           pow, 2, 5)
 
 
-    def _start_some_futures(self):
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        call3 = Call(manual_finish=True)
-
-        try:
-            self.executor.submit(call1)
-            self.executor.submit(call2)
-            self.executor.submit(call3)
-
-            call1.wait_on_called()
-            call2.wait_on_called()
-            call3.wait_on_called()
-
-            call1.set_can()
-            call2.set_can()
-            call3.set_can()
-        finally:
-            call1.close()
-            call2.close()
-            call3.close()
-
-class ThreadPoolShutdownTest(ExecutorShutdownTest):
-    def setUp(self):
-        self.executor = futures.ThreadPoolExecutor(max_workers=5)
-
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest):
+    def _prime_executor(self):
+        pass
 
     def test_threads_terminate(self):
-        self._start_some_futures()
+        self.executor.submit(mul, 21, 2)
+        self.executor.submit(mul, 6, 7)
+        self.executor.submit(mul, 3, 14)
         self.assertEqual(len(self.executor._threads), 3)
         self.executor.shutdown()
         for t in self.executor._threads:
@@ -208,15 +116,15 @@
         for t in threads:
             t.join()
 
-class ProcessPoolShutdownTest(ExecutorShutdownTest):
-    def setUp(self):
-        self.executor = futures.ProcessPoolExecutor(max_workers=5)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ProcessPoolShutdownTest(ProcessPoolMixin, ExecutorShutdownTest):
+    def _prime_executor(self):
+        pass
 
     def test_processes_terminate(self):
-        self._start_some_futures()
+        self.executor.submit(mul, 21, 2)
+        self.executor.submit(mul, 6, 7)
+        self.executor.submit(mul, 3, 14)
         self.assertEqual(len(self.executor._processes), 5)
         processes = self.executor._processes
         self.executor.shutdown()
@@ -226,11 +134,11 @@
 
     def test_context_manager_shutdown(self):
         with futures.ProcessPoolExecutor(max_workers=5) as e:
-            executor = e
+            processes = e._processes
             self.assertEqual(list(e.map(abs, range(-5, 5))),
                              [5, 4, 3, 2, 1, 0, 1, 2, 3, 4])
 
-        for p in self.executor._processes:
+        for p in processes:
             p.join()
 
     def test_del_shutdown(self):
@@ -246,302 +154,157 @@
 
 class WaitTests(unittest.TestCase):
     def test_first_completed(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
-
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
-
-            t = threading.Thread(target=wait_test)
-            t.start()
-            done, not_done = futures.wait(
-                    [CANCELLED_FUTURE, future1, future2],
-                     return_when=futures.FIRST_COMPLETED)
-
-            self.assertEqual(set([future1]), done)
-            self.assertEqual(set([CANCELLED_FUTURE, future2]), not_done)
-        finally:
-            call1.close()
-            call2.close()
+        future1 = self.executor.submit(mul, 21, 2)
+        future2 = self.executor.submit(time.sleep, 5)
 
-    def test_first_completed_one_already_completed(self):
-        call1 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
+        done, not_done = futures.wait(
+                [CANCELLED_FUTURE, future1, future2],
+                 return_when=futures.FIRST_COMPLETED)
+
+        self.assertEqual(set([future1]), done)
+        self.assertEqual(set([CANCELLED_FUTURE, future2]), not_done)
+
+    def test_first_completed_some_already_completed(self):
+        future1 = self.executor.submit(time.sleep, 2)
+
+        finished, pending = futures.wait(
+                 [CANCELLED_AND_NOTIFIED_FUTURE, SUCCESSFUL_FUTURE, future1],
+                 return_when=futures.FIRST_COMPLETED)
 
-            finished, pending = futures.wait(
-                     [SUCCESSFUL_FUTURE, future1],
-                     return_when=futures.FIRST_COMPLETED)
-
-            self.assertEqual(set([SUCCESSFUL_FUTURE]), finished)
-            self.assertEqual(set([future1]), pending)
-        finally:
-            call1.close()
+        self.assertEqual(
+                set([CANCELLED_AND_NOTIFIED_FUTURE, SUCCESSFUL_FUTURE]),
+                finished)
+        self.assertEqual(set([future1]), pending)
 
     def test_first_exception(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
-            call2.set_can()
-
-        call1 = Call(manual_finish=True)
-        call2 = ExceptionCall(manual_finish=True)
-        call3 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
-            future3 = self.executor.submit(call3)
-
-            t = threading.Thread(target=wait_test)
-            t.start()
-            finished, pending = futures.wait(
-                    [future1, future2, future3],
-                    return_when=futures.FIRST_EXCEPTION)
-
-            self.assertEqual(set([future1, future2]), finished)
-            self.assertEqual(set([future3]), pending)
-        finally:
-            call1.close()
-            call2.close()
-            call3.close()
+        future1 = self.executor.submit(mul, 2, 21)
+        future2 = self.executor.submit(sleep_and_raise, 5)
+        future3 = self.executor.submit(time.sleep, 10)
+
+        finished, pending = futures.wait(
+                [future1, future2, future3],
+                return_when=futures.FIRST_EXCEPTION)
 
-    def test_first_exception_some_already_complete(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
+        self.assertEqual(set([future1, future2]), finished)
+        self.assertEqual(set([future3]), pending)
 
-        call1 = ExceptionCall(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
+    def test_first_exception_some_already_complete(self):
+        future1 = self.executor.submit(divmod, 21, 0)
+        future2 = self.executor.submit(time.sleep, 5)
 
-            t = threading.Thread(target=wait_test)
-            t.start()
-            finished, pending = futures.wait(
-                    [SUCCESSFUL_FUTURE,
-                     CANCELLED_FUTURE,
-                     CANCELLED_AND_NOTIFIED_FUTURE,
-                     future1, future2],
-                    return_when=futures.FIRST_EXCEPTION)
-
-            self.assertEqual(set([SUCCESSFUL_FUTURE,
-                                  CANCELLED_AND_NOTIFIED_FUTURE,
-                                  future1]), finished)
-            self.assertEqual(set([CANCELLED_FUTURE, future2]), pending)
-
-
-        finally:
-            call1.close()
-            call2.close()
+        finished, pending = futures.wait(
+                [SUCCESSFUL_FUTURE,
+                 CANCELLED_FUTURE,
+                 CANCELLED_AND_NOTIFIED_FUTURE,
+                 future1, future2],
+                return_when=futures.FIRST_EXCEPTION)
+
+        self.assertEqual(set([SUCCESSFUL_FUTURE,
+                              CANCELLED_AND_NOTIFIED_FUTURE,
+                              future1]), finished)
+        self.assertEqual(set([CANCELLED_FUTURE, future2]), pending)
 
     def test_first_exception_one_already_failed(self):
-        call1 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
+        future1 = self.executor.submit(time.sleep, 2)
 
-            finished, pending = futures.wait(
-                     [EXCEPTION_FUTURE, future1],
-                     return_when=futures.FIRST_EXCEPTION)
-
-            self.assertEqual(set([EXCEPTION_FUTURE]), finished)
-            self.assertEqual(set([future1]), pending)
-        finally:
-            call1.close()
+        finished, pending = futures.wait(
+                 [EXCEPTION_FUTURE, future1],
+                 return_when=futures.FIRST_EXCEPTION)
 
-    def test_all_completed(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
-            call2.set_can()
+        self.assertEqual(set([EXCEPTION_FUTURE]), finished)
+        self.assertEqual(set([future1]), pending)
 
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
+    def test_all_completed(self):
+        future1 = self.executor.submit(divmod, 2, 0)
+        future2 = self.executor.submit(mul, 2, 21)
 
-            t = threading.Thread(target=wait_test)
-            t.start()
-            finished, pending = futures.wait(
-                    [future1, future2],
-                    return_when=futures.ALL_COMPLETED)
-
-            self.assertEqual(set([future1, future2]), finished)
-            self.assertEqual(set(), pending)
-        finally:
-            call1.close()
-            call2.close()
-
-    def test_all_completed_some_already_completed(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-
-            future4.cancel()
-            call1.set_can()
-            call2.set_can()
-            call3.set_can()
-
-        self.assertLessEqual(
-                futures.process.EXTRA_QUEUED_CALLS,
-                1,
-               'this test assumes that future4 will be cancelled before it is '
-               'queued to run - which might not be the case if '
-               'ProcessPoolExecutor is too aggresive in scheduling futures')
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        call3 = Call(manual_finish=True)
-        call4 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
-            future3 = self.executor.submit(call3)
-            future4 = self.executor.submit(call4)
-
-            t = threading.Thread(target=wait_test)
-            t.start()
-            finished, pending = futures.wait(
-                    [SUCCESSFUL_FUTURE,
-                     CANCELLED_AND_NOTIFIED_FUTURE,
-                     future1, future2, future3, future4],
-                    return_when=futures.ALL_COMPLETED)
-
-            self.assertEqual(set([SUCCESSFUL_FUTURE,
-                                  CANCELLED_AND_NOTIFIED_FUTURE,
-                                  future1, future2, future3, future4]),
-                             finished)
-            self.assertEqual(set(), pending)
-        finally:
-            call1.close()
-            call2.close()
-            call3.close()
-            call4.close()
+        finished, pending = futures.wait(
+                [SUCCESSFUL_FUTURE,
+                 CANCELLED_AND_NOTIFIED_FUTURE,
+                 EXCEPTION_FUTURE,
+                 future1,
+                 future2],
+                return_when=futures.ALL_COMPLETED)
+
+        self.assertEqual(set([SUCCESSFUL_FUTURE,
+                              CANCELLED_AND_NOTIFIED_FUTURE,
+                              EXCEPTION_FUTURE,
+                              future1,
+                              future2]), finished)
+        self.assertEqual(set(), pending)
 
     def test_timeout(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
-
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
-
-            t = threading.Thread(target=wait_test)
-            t.start()
-            finished, pending = futures.wait(
-                    [CANCELLED_AND_NOTIFIED_FUTURE,
-                     EXCEPTION_FUTURE,
-                     SUCCESSFUL_FUTURE,
-                     future1, future2],
-                    timeout=5,
-                    return_when=futures.ALL_COMPLETED)
-
-            self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
-                                  EXCEPTION_FUTURE,
-                                  SUCCESSFUL_FUTURE,
-                                  future1]), finished)
-            self.assertEqual(set([future2]), pending)
+        future1 = self.executor.submit(mul, 6, 7)
+        future2 = self.executor.submit(time.sleep, 10)
 
+        finished, pending = futures.wait(
+                [CANCELLED_AND_NOTIFIED_FUTURE,
+                 EXCEPTION_FUTURE,
+                 SUCCESSFUL_FUTURE,
+                 future1, future2],
+                timeout=5,
+                return_when=futures.ALL_COMPLETED)
+
+        self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
+                              EXCEPTION_FUTURE,
+                              SUCCESSFUL_FUTURE,
+                              future1]), finished)
+        self.assertEqual(set([future2]), pending)
 
-        finally:
-            call1.close()
-            call2.close()
 
+class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests):
+    pass
 
-class ThreadPoolWaitTests(WaitTests):
-    def setUp(self):
-        self.executor = futures.ThreadPoolExecutor(max_workers=1)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
-
-class ProcessPoolWaitTests(WaitTests):
-    def setUp(self):
-        self.executor = futures.ProcessPoolExecutor(max_workers=1)
+class ProcessPoolWaitTests(ProcessPoolMixin, WaitTests):
+    pass
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
 
 class AsCompletedTests(unittest.TestCase):
     # TODO(brian at sweetapp.com): Should have a test with a non-zero timeout.
     def test_no_timeout(self):
-        def wait_test():
-            while not future1._waiters:
-                pass
-            call1.set_can()
-            call2.set_can()
+        future1 = self.executor.submit(mul, 2, 21)
+        future2 = self.executor.submit(mul, 7, 6)
 
-        call1 = Call(manual_finish=True)
-        call2 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            future2 = self.executor.submit(call2)
+        completed = set(futures.as_completed(
+                [CANCELLED_AND_NOTIFIED_FUTURE,
+                 EXCEPTION_FUTURE,
+                 SUCCESSFUL_FUTURE,
+                 future1, future2]))
+        self.assertEqual(set(
+                [CANCELLED_AND_NOTIFIED_FUTURE,
+                 EXCEPTION_FUTURE,
+                 SUCCESSFUL_FUTURE,
+                 future1, future2]),
+                completed)
 
-            t = threading.Thread(target=wait_test)
-            t.start()
-            completed = set(futures.as_completed(
-                    [CANCELLED_AND_NOTIFIED_FUTURE,
-                     EXCEPTION_FUTURE,
-                     SUCCESSFUL_FUTURE,
-                     future1, future2]))
-            self.assertEqual(set(
+    def test_zero_timeout(self):
+        future1 = self.executor.submit(time.sleep, 2)
+        completed_futures = set()
+        try:
+            for future in futures.as_completed(
                     [CANCELLED_AND_NOTIFIED_FUTURE,
                      EXCEPTION_FUTURE,
                      SUCCESSFUL_FUTURE,
-                     future1, future2]),
-                    completed)
-        finally:
-            call1.close()
-            call2.close()
+                     future1],
+                    timeout=0):
+                completed_futures.add(future)
+        except futures.TimeoutError:
+            pass
 
-    def test_zero_timeout(self):
-        call1 = Call(manual_finish=True)
-        try:
-            future1 = self.executor.submit(call1)
-            completed_futures = set()
-            try:
-                for future in futures.as_completed(
-                        [CANCELLED_AND_NOTIFIED_FUTURE,
-                         EXCEPTION_FUTURE,
-                         SUCCESSFUL_FUTURE,
-                         future1],
-                        timeout=0):
-                    completed_futures.add(future)
-            except futures.TimeoutError:
-                pass
-
-            self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
-                                  EXCEPTION_FUTURE,
-                                  SUCCESSFUL_FUTURE]),
-                             completed_futures)
-        finally:
-            call1.close()
+        self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
+                              EXCEPTION_FUTURE,
+                              SUCCESSFUL_FUTURE]),
+                         completed_futures)
 
-class ThreadPoolAsCompletedTests(AsCompletedTests):
-    def setUp(self):
-        self.executor = futures.ThreadPoolExecutor(max_workers=1)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests):
+    pass
 
-class ProcessPoolAsCompletedTests(AsCompletedTests):
-    def setUp(self):
-        self.executor = futures.ProcessPoolExecutor(max_workers=1)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ProcessPoolAsCompletedTests(ProcessPoolMixin, AsCompletedTests):
+    pass
+
 
 class ExecutorTest(unittest.TestCase):
     # Executor.shutdown() and context manager usage is tested by
@@ -567,35 +330,26 @@
 
     def test_map_timeout(self):
         results = []
-        timeout_call = MapCall()
         try:
-            try:
-                for i in self.executor.map(timeout_call,
-                                           [False, False, True],
-                                           timeout=5):
-                    results.append(i)
-            except futures.TimeoutError:
-                pass
-            else:
-                self.fail('expected TimeoutError')
-        finally:
-            timeout_call.close()
+            for i in self.executor.map(time.sleep,
+                                       [0, 0, 10],
+                                       timeout=5):
+                results.append(i)
+        except futures.TimeoutError:
+            pass
+        else:
+            self.fail('expected TimeoutError')
 
-        self.assertEqual([42, 42], results)
+        self.assertEqual([None, None], results)
 
-class ThreadPoolExecutorTest(ExecutorTest):
-    def setUp(self):
-        self.executor = futures.ThreadPoolExecutor(max_workers=1)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest):
+    pass
 
-class ProcessPoolExecutorTest(ExecutorTest):
-    def setUp(self):
-        self.executor = futures.ProcessPoolExecutor(max_workers=1)
 
-    def tearDown(self):
-        self.executor.shutdown(wait=True)
+class ProcessPoolExecutorTest(ProcessPoolMixin, ExecutorTest):
+    pass
+
 
 class FutureTests(unittest.TestCase):
     def test_done_callback_with_result(self):

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	Tue Jan 11 18:07:55 2011
@@ -457,6 +457,8 @@
                 self.value = value
             def __lt__(self, other):
                 return self.value < other.value
+            def __eq__(self, other):
+                return self.value == other.value
         self.assertTrue(A(1) < A(2))
         self.assertTrue(A(2) > A(1))
         self.assertTrue(A(1) <= A(2))
@@ -471,6 +473,8 @@
                 self.value = value
             def __le__(self, other):
                 return self.value <= other.value
+            def __eq__(self, other):
+                return self.value == other.value
         self.assertTrue(A(1) < A(2))
         self.assertTrue(A(2) > A(1))
         self.assertTrue(A(1) <= A(2))
@@ -485,6 +489,8 @@
                 self.value = value
             def __gt__(self, other):
                 return self.value > other.value
+            def __eq__(self, other):
+                return self.value == other.value
         self.assertTrue(A(1) < A(2))
         self.assertTrue(A(2) > A(1))
         self.assertTrue(A(1) <= A(2))
@@ -499,6 +505,8 @@
                 self.value = value
             def __ge__(self, other):
                 return self.value >= other.value
+            def __eq__(self, other):
+                return self.value == other.value
         self.assertTrue(A(1) < A(2))
         self.assertTrue(A(2) > A(1))
         self.assertTrue(A(1) <= A(2))
@@ -524,6 +532,22 @@
             class A:
                 pass
 
+    def test_bug_10042(self):
+        @functools.total_ordering
+        class TestTO:
+            def __init__(self, value):
+                self.value = value
+            def __eq__(self, other):
+                if isinstance(other, TestTO):
+                    return self.value == other.value
+                return False
+            def __lt__(self, other):
+                if isinstance(other, TestTO):
+                    return self.value < other.value
+                raise TypeError
+        with self.assertRaises(TypeError):
+            TestTO(8) <= ()
+
 class TestLRU(unittest.TestCase):
 
     def test_lru(self):

Modified: python/branches/py3k-cdecimal/Lib/test/test_httplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_httplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_httplib.py	Tue Jan 11 18:07:55 2011
@@ -244,7 +244,7 @@
         sock = FakeSocket("")
         conn.sock = sock
         conn.request('GET', '/foo', body(), {'Content-Length': '11'})
-        self.assertEquals(sock.data, expected)
+        self.assertEqual(sock.data, expected)
 
     def test_chunked(self):
         chunked_start = (
@@ -560,7 +560,7 @@
         self.conn.request("PUT", "/url", "body")
         message, f = self.get_headers_and_fp()
         self.assertEqual("text/plain", message.get_content_type())
-        self.assertEqual(None, message.get_charset())
+        self.assertIsNone(message.get_charset())
         self.assertEqual("4", message.get("content-length"))
         self.assertEqual(b'body', f.read())
 
@@ -568,7 +568,7 @@
         self.conn.request("PUT", "/url", "body\xc1")
         message, f = self.get_headers_and_fp()
         self.assertEqual("text/plain", message.get_content_type())
-        self.assertEqual(None, message.get_charset())
+        self.assertIsNone(message.get_charset())
         self.assertEqual("5", message.get("content-length"))
         self.assertEqual(b'body\xc1', f.read())
 
@@ -576,7 +576,7 @@
         self.conn.request("PUT", "/url", b"body\xc1")
         message, f = self.get_headers_and_fp()
         self.assertEqual("text/plain", message.get_content_type())
-        self.assertEqual(None, message.get_charset())
+        self.assertIsNone(message.get_charset())
         self.assertEqual("5", message.get("content-length"))
         self.assertEqual(b'body\xc1', f.read())
 
@@ -587,7 +587,7 @@
             self.conn.request("PUT", "/url", f)
             message, f = self.get_headers_and_fp()
             self.assertEqual("text/plain", message.get_content_type())
-            self.assertEqual(None, message.get_charset())
+            self.assertIsNone(message.get_charset())
             self.assertEqual("4", message.get("content-length"))
             self.assertEqual(b'body', f.read())
 
@@ -598,7 +598,7 @@
             self.conn.request("PUT", "/url", f)
             message, f = self.get_headers_and_fp()
             self.assertEqual("text/plain", message.get_content_type())
-            self.assertEqual(None, message.get_charset())
+            self.assertIsNone(message.get_charset())
             self.assertEqual("5", message.get("content-length"))
             self.assertEqual(b'body\xc1', f.read())
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_imaplib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_imaplib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_imaplib.py	Tue Jan 11 18:07:55 2011
@@ -135,6 +135,7 @@
     def reap_server(self, server, thread):
         if verbose: print("waiting for server")
         server.shutdown()
+        server.server_close()
         thread.join()
         if verbose: print("done")
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_io.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_io.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_io.py	Tue Jan 11 18:07:55 2011
@@ -1717,9 +1717,12 @@
         raw.name = "dummy"
         self.assertEqual(repr(t),
                          "<%s.TextIOWrapper name='dummy' encoding='utf-8'>" % modname)
+        t.mode = "r"
+        self.assertEqual(repr(t),
+                         "<%s.TextIOWrapper name='dummy' mode='r' encoding='utf-8'>" % modname)
         raw.name = b"dummy"
         self.assertEqual(repr(t),
-                         "<%s.TextIOWrapper name=b'dummy' encoding='utf-8'>" % modname)
+                         "<%s.TextIOWrapper name=b'dummy' mode='r' encoding='utf-8'>" % modname)
 
     def test_line_buffering(self):
         r = self.BytesIO()

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	Tue Jan 11 18:07:55 2011
@@ -365,6 +365,11 @@
                 os.utime(self.fname, (t1, t1))
                 self.assertEqual(os.stat(self.fname).st_mtime, t1)
 
+            def test_large_time(self):
+                t1 = 5000000000 # some day in 2128
+                os.utime(self.fname, (t1, t1))
+                self.assertEqual(os.stat(self.fname).st_mtime, t1)
+
         def test_1686475(self):
             # Verify that an open file can be stat'ed
             try:

Modified: python/branches/py3k-cdecimal/Lib/test/test_pyexpat.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_pyexpat.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_pyexpat.py	Tue Jan 11 18:07:55 2011
@@ -155,6 +155,14 @@
         'ElementDeclHandler', 'AttlistDeclHandler', 'SkippedEntityHandler',
         ]
 
+    def _hookup_callbacks(self, parser, handler):
+        """
+        Set each of the callbacks defined on handler and named in
+        self.handler_names on the given parser.
+        """
+        for name in self.handler_names:
+            setattr(parser, name, getattr(handler, name))
+
     def _verify_parse_output(self, operations):
         expected_operations = [
             ('XML declaration', ('1.0', 'iso-8859-1', 0)),
@@ -196,8 +204,7 @@
         # Try the parse again, this time producing Unicode output
         out = self.Outputter()
         parser = expat.ParserCreate(namespace_separator='!')
-        for name in self.handler_names:
-            setattr(parser, name, getattr(out, name))
+        self._hookup_callbacks(parser, out)
 
         parser.Parse(data, 1)
 
@@ -210,8 +217,7 @@
         # Try parsing a file
         out = self.Outputter()
         parser = expat.ParserCreate(namespace_separator='!')
-        for name in self.handler_names:
-            setattr(parser, name, getattr(out, name))
+        self._hookup_callbacks(parser, out)
         file = BytesIO(data)
 
         parser.ParseFile(file)
@@ -613,6 +619,48 @@
                              errors.codes[errors.XML_ERROR_UNCLOSED_TOKEN])
 
 
+class ForeignDTDTests(unittest.TestCase):
+    """
+    Tests for the UseForeignDTD method of expat parser objects.
+    """
+    def test_use_foreign_dtd(self):
+        """
+        If UseForeignDTD is passed True and a document without an external
+        entity reference is parsed, ExternalEntityRefHandler is first called
+        with None for the public and system ids.
+        """
+        handler_call_args = []
+        def resolve_entity(context, base, system_id, public_id):
+            handler_call_args.append((public_id, system_id))
+            return 1
+
+        parser = expat.ParserCreate()
+        parser.UseForeignDTD(True)
+        parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
+        parser.ExternalEntityRefHandler = resolve_entity
+        parser.Parse("<?xml version='1.0'?><element/>")
+        self.assertEqual(handler_call_args, [(None, None)])
+
+    def test_ignore_use_foreign_dtd(self):
+        """
+        If UseForeignDTD is passed True and a document with an external
+        entity reference is parsed, ExternalEntityRefHandler is called with
+        the public and system ids from the document.
+        """
+        handler_call_args = []
+        def resolve_entity(context, base, system_id, public_id):
+            handler_call_args.append((public_id, system_id))
+            return 1
+
+        parser = expat.ParserCreate()
+        parser.UseForeignDTD(True)
+        parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
+        parser.ExternalEntityRefHandler = resolve_entity
+        parser.Parse(
+            "<?xml version='1.0'?><!DOCTYPE foo PUBLIC 'bar' 'baz'><element/>")
+        self.assertEqual(handler_call_args, [("bar", "baz")])
+
+
 def test_main():
     run_unittest(SetAttributeTest,
                  ParseTest,
@@ -624,7 +672,8 @@
                  sf1296433Test,
                  ChardataBufferTest,
                  MalformedInputTest,
-                 ErrorMessageTest)
+                 ErrorMessageTest,
+                 ForeignDTDTests)
 
 if __name__ == "__main__":
     test_main()

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	Tue Jan 11 18:07:55 2011
@@ -161,12 +161,16 @@
         usersite = site.USER_SITE
         self.assertIn(usersite, sys.path)
 
+        env = os.environ.copy()
         rc = subprocess.call([sys.executable, '-c',
-            'import sys; sys.exit(%r in sys.path)' % usersite])
+            'import sys; sys.exit(%r in sys.path)' % usersite],
+            env=env)
         self.assertEqual(rc, 1)
 
+        env = os.environ.copy()
         rc = subprocess.call([sys.executable, '-s', '-c',
-            'import sys; sys.exit(%r in sys.path)' % usersite])
+            'import sys; sys.exit(%r in sys.path)' % usersite],
+            env=env)
         self.assertEqual(rc, 0)
 
         env = os.environ.copy()

Modified: python/branches/py3k-cdecimal/Lib/test/test_socket.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_socket.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_socket.py	Tue Jan 11 18:07:55 2011
@@ -738,6 +738,12 @@
             f = None
             support.gc_collect()
 
+    def test_name_closed_socketio(self):
+        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
+            fp = sock.makefile("rb")
+            fp.close()
+            self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
+
 
 @unittest.skipUnless(thread, 'Threading required for this test.')
 class BasicTCPTest(SocketConnectedTest):
@@ -976,6 +982,23 @@
         def _testInitNonBlocking(self):
             pass
 
+    def testInheritFlags(self):
+        # Issue #7995: when calling accept() on a listening socket with a
+        # timeout, the resulting socket should not be non-blocking.
+        self.serv.settimeout(10)
+        try:
+            conn, addr = self.serv.accept()
+            message = conn.recv(len(MSG))
+        finally:
+            conn.close()
+            self.serv.settimeout(None)
+
+    def _testInheritFlags(self):
+        time.sleep(0.1)
+        self.cli.connect((HOST, self.port))
+        time.sleep(0.5)
+        self.cli.send(MSG)
+
     def testAccept(self):
         # Testing non-blocking accept
         self.serv.setblocking(0)
@@ -1678,25 +1701,25 @@
 
     def testLinuxAbstractNamespace(self):
         address = b"\x00python-test-hello\x00\xff"
-        s1 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-        s1.bind(address)
-        s1.listen(1)
-        s2 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-        s2.connect(s1.getsockname())
-        s1.accept()
-        self.assertEqual(s1.getsockname(), address)
-        self.assertEqual(s2.getpeername(), address)
+        with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s1:
+            s1.bind(address)
+            s1.listen(1)
+            with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s2:
+                s2.connect(s1.getsockname())
+                with s1.accept()[0] as s3:
+                    self.assertEqual(s1.getsockname(), address)
+                    self.assertEqual(s2.getpeername(), address)
 
     def testMaxName(self):
         address = b"\x00" + b"h" * (self.UNIX_PATH_MAX - 1)
-        s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-        s.bind(address)
-        self.assertEqual(s.getsockname(), address)
+        with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
+            s.bind(address)
+            self.assertEqual(s.getsockname(), address)
 
     def testNameOverflow(self):
         address = "\x00" + "h" * self.UNIX_PATH_MAX
-        s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-        self.assertRaises(socket.error, s.bind, address)
+        with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
+            self.assertRaises(socket.error, s.bind, address)
 
 
 @unittest.skipUnless(thread, 'Threading required for this test.')
@@ -1898,10 +1921,10 @@
         if v < (2, 6, 28):
             self.skipTest("Linux kernel 2.6.28 or higher required, not %s"
                           % ".".join(map(str, v)))
-        s = socket.socket(socket.AF_INET,
-                          socket.SOCK_STREAM | socket.SOCK_CLOEXEC)
-        self.assertTrue(s.type & socket.SOCK_CLOEXEC)
-        self.assertTrue(fcntl.fcntl(s, fcntl.F_GETFD) & fcntl.FD_CLOEXEC)
+        with socket.socket(socket.AF_INET,
+                           socket.SOCK_STREAM | socket.SOCK_CLOEXEC) as s:
+            self.assertTrue(s.type & socket.SOCK_CLOEXEC)
+            self.assertTrue(fcntl.fcntl(s, fcntl.F_GETFD) & fcntl.FD_CLOEXEC)
 
 
 @unittest.skipUnless(hasattr(socket, "SOCK_NONBLOCK"),
@@ -1922,29 +1945,33 @@
                           % ".".join(map(str, v)))
         # a lot of it seems silly and redundant, but I wanted to test that
         # changing back and forth worked ok
-        s = socket.socket(socket.AF_INET,
-                          socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
-        self.checkNonblock(s)
-        s.setblocking(1)
-        self.checkNonblock(s, False)
-        s.setblocking(0)
-        self.checkNonblock(s)
-        s.settimeout(None)
-        self.checkNonblock(s, False)
-        s.settimeout(2.0)
-        self.checkNonblock(s, timeout=2.0)
-        s.setblocking(1)
-        self.checkNonblock(s, False)
+        with socket.socket(socket.AF_INET,
+                           socket.SOCK_STREAM | socket.SOCK_NONBLOCK) as s:
+            self.checkNonblock(s)
+            s.setblocking(1)
+            self.checkNonblock(s, False)
+            s.setblocking(0)
+            self.checkNonblock(s)
+            s.settimeout(None)
+            self.checkNonblock(s, False)
+            s.settimeout(2.0)
+            self.checkNonblock(s, timeout=2.0)
+            s.setblocking(1)
+            self.checkNonblock(s, False)
         # defaulttimeout
         t = socket.getdefaulttimeout()
         socket.setdefaulttimeout(0.0)
-        self.checkNonblock(socket.socket())
+        with socket.socket() as s:
+            self.checkNonblock(s)
         socket.setdefaulttimeout(None)
-        self.checkNonblock(socket.socket(), False)
+        with socket.socket() as s:
+            self.checkNonblock(s, False)
         socket.setdefaulttimeout(2.0)
-        self.checkNonblock(socket.socket(), timeout=2.0)
+        with socket.socket() as s:
+            self.checkNonblock(s, timeout=2.0)
         socket.setdefaulttimeout(None)
-        self.checkNonblock(socket.socket(), False)
+        with socket.socket() as s:
+            self.checkNonblock(s, False)
         socket.setdefaulttimeout(t)
 
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_socketserver.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_socketserver.py	Tue Jan 11 18:07:55 2011
@@ -151,6 +151,7 @@
         if verbose: print("waiting for server")
         server.shutdown()
         t.join()
+        server.server_close()
         if verbose: print("done")
 
     def stream_examine(self, proto, addr):
@@ -270,6 +271,7 @@
             s.shutdown()
         for t, s in threads:
             t.join()
+            s.server_close()
 
 
 def test_main():

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	Tue Jan 11 18:07:55 2011
@@ -599,10 +599,10 @@
         # SHA256 was added in OpenSSL 0.9.8
         if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15):
             self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION)
-        # NOTE: https://sha256.tbs-internet.com is another possible test host
-        remote = ("sha2.hboeck.de", 443)
+        # https://sha2.hboeck.de/ was used until 2011-01-08 (no route to host)
+        remote = ("sha256.tbs-internet.com", 443)
         sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem")
-        with support.transient_internet("sha2.hboeck.de"):
+        with support.transient_internet("sha256.tbs-internet.com"):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
                                 cert_reqs=ssl.CERT_REQUIRED,
                                 ca_certs=sha256_cert,)

Modified: python/branches/py3k-cdecimal/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_subprocess.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_subprocess.py	Tue Jan 11 18:07:55 2011
@@ -903,6 +903,106 @@
         self.assertStderrEqual(stderr, b'')
         self.assertEqual(p.wait(), -signal.SIGTERM)
 
+    def check_close_std_fds(self, fds):
+        # Issue #9905: test that subprocess pipes still work properly with
+        # some standard fds closed
+        stdin = 0
+        newfds = []
+        for a in fds:
+            b = os.dup(a)
+            newfds.append(b)
+            if a == 0:
+                stdin = b
+        try:
+            for fd in fds:
+                os.close(fd)
+            out, err = subprocess.Popen([sys.executable, "-c",
+                              'import sys;'
+                              'sys.stdout.write("apple");'
+                              'sys.stdout.flush();'
+                              'sys.stderr.write("orange")'],
+                       stdin=stdin,
+                       stdout=subprocess.PIPE,
+                       stderr=subprocess.PIPE).communicate()
+            err = support.strip_python_stderr(err)
+            self.assertEqual((out, err), (b'apple', b'orange'))
+        finally:
+            for b, a in zip(newfds, fds):
+                os.dup2(b, a)
+            for b in newfds:
+                os.close(b)
+
+    def test_close_fd_0(self):
+        self.check_close_std_fds([0])
+
+    def test_close_fd_1(self):
+        self.check_close_std_fds([1])
+
+    def test_close_fd_2(self):
+        self.check_close_std_fds([2])
+
+    def test_close_fds_0_1(self):
+        self.check_close_std_fds([0, 1])
+
+    def test_close_fds_0_2(self):
+        self.check_close_std_fds([0, 2])
+
+    def test_close_fds_1_2(self):
+        self.check_close_std_fds([1, 2])
+
+    def test_close_fds_0_1_2(self):
+        # Issue #10806: test that subprocess pipes still work properly with
+        # all standard fds closed.
+        self.check_close_std_fds([0, 1, 2])
+
+    def test_remapping_std_fds(self):
+        # open up some temporary files
+        temps = [mkstemp() for i in range(3)]
+        try:
+            temp_fds = [fd for fd, fname in temps]
+
+            # unlink the files -- we won't need to reopen them
+            for fd, fname in temps:
+                os.unlink(fname)
+
+            # write some data to what will become stdin, and rewind
+            os.write(temp_fds[1], b"STDIN")
+            os.lseek(temp_fds[1], 0, 0)
+
+            # move the standard file descriptors out of the way
+            saved_fds = [os.dup(fd) for fd in range(3)]
+            try:
+                # duplicate the file objects over the standard fd's
+                for fd, temp_fd in enumerate(temp_fds):
+                    os.dup2(temp_fd, fd)
+
+                # now use those files in the "wrong" order, so that subprocess
+                # has to rearrange them in the child
+                p = subprocess.Popen([sys.executable, "-c",
+                    'import sys; got = sys.stdin.read();'
+                    'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
+                    stdin=temp_fds[1],
+                    stdout=temp_fds[2],
+                    stderr=temp_fds[0])
+                p.wait()
+            finally:
+                # restore the original fd's underneath sys.stdin, etc.
+                for std, saved in enumerate(saved_fds):
+                    os.dup2(saved, std)
+                    os.close(saved)
+
+            for fd in temp_fds:
+                os.lseek(fd, 0, 0)
+
+            out = os.read(temp_fds[2], 1024)
+            err = support.strip_python_stderr(os.read(temp_fds[0], 1024))
+            self.assertEqual(out, b"got STDIN")
+            self.assertEqual(err, b"err")
+
+        finally:
+            for fd in temp_fds:
+                os.close(fd)
+
     def test_surrogates_error_message(self):
         def prepare():
             raise ValueError("surrogate:\uDCff")
@@ -1022,6 +1122,9 @@
         self.assertTrue(readfiles, "The child hung")
         self.assertEqual(p2.stdout.read(), data)
 
+        p1.stdout.close()
+        p2.stdout.close()
+
     def test_close_fds(self):
         fd_status = support.findfile("fd_status.py", subdir="subprocessdata")
 
@@ -1053,6 +1156,9 @@
 
         open_fds = set()
 
+        if support.verbose:
+            print(" -- maxfd =", subprocess.MAXFD)
+
         for x in range(5):
             fds = os.pipe()
             self.addCleanup(os.close, fds[0])
@@ -1067,6 +1173,10 @@
 
             remaining_fds = set(map(int, output.split(b',')))
             to_be_closed = open_fds - {fd}
+            # Temporary debug output for intermittent failures
+            if support.verbose:
+                print(" -- fds that should have been closed:", to_be_closed)
+                print(" -- fds that remained open:", remaining_fds)
 
             self.assertIn(fd, remaining_fds, "fd to be passed not passed")
             self.assertFalse(remaining_fds & to_be_closed,

Modified: python/branches/py3k-cdecimal/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_sys.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_sys.py	Tue Jan 11 18:07:55 2011
@@ -501,7 +501,7 @@
         attrs = ("debug", "division_warning",
                  "inspect", "interactive", "optimize", "dont_write_bytecode",
                  "no_user_site", "no_site", "ignore_environment", "verbose",
-                 "bytes_warning")
+                 "bytes_warning", "quiet")
         for attr in attrs:
             self.assertTrue(hasattr(sys.flags, attr), attr)
             self.assertEqual(type(getattr(sys.flags, attr)), int, attr)

Modified: python/branches/py3k-cdecimal/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_threading.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_threading.py	Tue Jan 11 18:07:55 2011
@@ -11,6 +11,7 @@
 import unittest
 import weakref
 import os
+import subprocess
 
 from test import lock_tests
 
@@ -272,7 +273,6 @@
         except ImportError:
             raise unittest.SkipTest("cannot import ctypes")
 
-        import subprocess
         rc = subprocess.call([sys.executable, "-c", """if 1:
             import ctypes, sys, time, _thread
 
@@ -303,7 +303,6 @@
     def test_finalize_with_trace(self):
         # Issue1733757
         # Avoid a deadlock when sys.settrace steps into threading._shutdown
-        import subprocess
         p = subprocess.Popen([sys.executable, "-c", """if 1:
             import sys, threading
 
@@ -338,7 +337,6 @@
     def test_join_nondaemon_on_shutdown(self):
         # Issue 1722344
         # Raising SystemExit skipped threading._shutdown
-        import subprocess
         p = subprocess.Popen([sys.executable, "-c", """if 1:
                 import threading
                 from time import sleep
@@ -398,7 +396,7 @@
         weak_cyclic_object = weakref.ref(cyclic_object)
         cyclic_object.thread.join()
         del cyclic_object
-        self.assertEqual(None, weak_cyclic_object(),
+        self.assertIsNone(weak_cyclic_object(),
                          msg=('%d references still around' %
                               sys.getrefcount(weak_cyclic_object())))
 
@@ -406,7 +404,7 @@
         weak_raising_cyclic_object = weakref.ref(raising_cyclic_object)
         raising_cyclic_object.thread.join()
         del raising_cyclic_object
-        self.assertEqual(None, weak_raising_cyclic_object(),
+        self.assertIsNone(weak_raising_cyclic_object(),
                          msg=('%d references still around' %
                               sys.getrefcount(weak_raising_cyclic_object())))
 
@@ -445,7 +443,6 @@
                 sys.stdout.flush()
         \n""" + script
 
-        import subprocess
         p = subprocess.Popen([sys.executable, "-c", script], stdout=subprocess.PIPE)
         rc = p.wait()
         data = p.stdout.read().decode().replace('\r', '')
@@ -512,6 +509,152 @@
             """
         self._run_and_join(script)
 
+    def assertScriptHasOutput(self, script, expected_output):
+        p = subprocess.Popen([sys.executable, "-c", script],
+                             stdout=subprocess.PIPE)
+        stdout, stderr = p.communicate()
+        data = stdout.decode().replace('\r', '')
+        self.assertEqual(p.returncode, 0, "Unexpected error")
+        self.assertEqual(data, expected_output)
+
+    @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()")
+    def test_4_joining_across_fork_in_worker_thread(self):
+        # There used to be a possible deadlock when forking from a child
+        # thread.  See http://bugs.python.org/issue6643.
+
+        # Skip platforms with known problems forking from a worker thread.
+        # See http://bugs.python.org/issue3863.
+        if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'):
+            raise unittest.SkipTest('due to known OS bugs on ' + sys.platform)
+
+        # The script takes the following steps:
+        # - The main thread in the parent process starts a new thread and then
+        #   tries to join it.
+        # - The join operation acquires the Lock inside the thread's _block
+        #   Condition.  (See threading.py:Thread.join().)
+        # - We stub out the acquire method on the condition to force it to wait
+        #   until the child thread forks.  (See LOCK ACQUIRED HERE)
+        # - The child thread forks.  (See LOCK HELD and WORKER THREAD FORKS
+        #   HERE)
+        # - The main thread of the parent process enters Condition.wait(),
+        #   which releases the lock on the child thread.
+        # - The child process returns.  Without the necessary fix, when the
+        #   main thread of the child process (which used to be the child thread
+        #   in the parent process) attempts to exit, it will try to acquire the
+        #   lock in the Thread._block Condition object and hang, because the
+        #   lock was held across the fork.
+
+        script = """if 1:
+            import os, time, threading
+
+            finish_join = False
+            start_fork = False
+
+            def worker():
+                # Wait until this thread's lock is acquired before forking to
+                # create the deadlock.
+                global finish_join
+                while not start_fork:
+                    time.sleep(0.01)
+                # LOCK HELD: Main thread holds lock across this call.
+                childpid = os.fork()
+                finish_join = True
+                if childpid != 0:
+                    # Parent process just waits for child.
+                    os.waitpid(childpid, 0)
+                # Child process should just return.
+
+            w = threading.Thread(target=worker)
+
+            # Stub out the private condition variable's lock acquire method.
+            # This acquires the lock and then waits until the child has forked
+            # before returning, which will release the lock soon after.  If
+            # someone else tries to fix this test case by acquiring this lock
+            # before forking instead of reseting it, the test case will
+            # deadlock when it shouldn't.
+            condition = w._block
+            orig_acquire = condition.acquire
+            call_count_lock = threading.Lock()
+            call_count = 0
+            def my_acquire():
+                global call_count
+                global start_fork
+                orig_acquire()  # LOCK ACQUIRED HERE
+                start_fork = True
+                if call_count == 0:
+                    while not finish_join:
+                        time.sleep(0.01)  # WORKER THREAD FORKS HERE
+                with call_count_lock:
+                    call_count += 1
+            condition.acquire = my_acquire
+
+            w.start()
+            w.join()
+            print('end of main')
+            """
+        self.assertScriptHasOutput(script, "end of main\n")
+
+    @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()")
+    def test_5_clear_waiter_locks_to_avoid_crash(self):
+        # Check that a spawned thread that forks doesn't segfault on certain
+        # platforms, namely OS X.  This used to happen if there was a waiter
+        # lock in the thread's condition variable's waiters list.  Even though
+        # we know the lock will be held across the fork, it is not safe to
+        # release locks held across forks on all platforms, so releasing the
+        # waiter lock caused a segfault on OS X.  Furthermore, since locks on
+        # OS X are (as of this writing) implemented with a mutex + condition
+        # variable instead of a semaphore, while we know that the Python-level
+        # lock will be acquired, we can't know if the internal mutex will be
+        # acquired at the time of the fork.
+
+        # Skip platforms with known problems forking from a worker thread.
+        # See http://bugs.python.org/issue3863.
+        if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'):
+            raise unittest.SkipTest('due to known OS bugs on ' + sys.platform)
+        script = """if True:
+            import os, time, threading
+
+            start_fork = False
+
+            def worker():
+                # Wait until the main thread has attempted to join this thread
+                # before continuing.
+                while not start_fork:
+                    time.sleep(0.01)
+                childpid = os.fork()
+                if childpid != 0:
+                    # Parent process just waits for child.
+                    (cpid, rc) = os.waitpid(childpid, 0)
+                    assert cpid == childpid
+                    assert rc == 0
+                    print('end of worker thread')
+                else:
+                    # Child process should just return.
+                    pass
+
+            w = threading.Thread(target=worker)
+
+            # Stub out the private condition variable's _release_save method.
+            # This releases the condition's lock and flips the global that
+            # causes the worker to fork.  At this point, the problematic waiter
+            # lock has been acquired once by the waiter and has been put onto
+            # the waiters list.
+            condition = w._block
+            orig_release_save = condition._release_save
+            def my_release_save():
+                global start_fork
+                orig_release_save()
+                # Waiter lock held here, condition lock released.
+                start_fork = True
+            condition._release_save = my_release_save
+
+            w.start()
+            w.join()
+            print('end of main thread')
+            """
+        output = "end of worker thread\nend of main thread\n"
+        self.assertScriptHasOutput(script, output)
+
 
 class ThreadingExceptionTests(BaseTestCase):
     # A RuntimeError should be raised if Thread.start() is called

Modified: python/branches/py3k-cdecimal/Lib/test/test_threadsignals.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_threadsignals.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_threadsignals.py	Tue Jan 11 18:07:55 2011
@@ -176,8 +176,9 @@
             self.assertLess(self.end - self.start, 2.0)
             self.assertGreater(self.end - self.start, 0.3)
             # If the signal is received several times before PyErr_CheckSignals()
-            # is called, the handler will get called less than 40 times.
-            self.assertGreater(self.sigs_recvd, 20)
+            # is called, the handler will get called less than 40 times. Just
+            # check it's been called at least once.
+            self.assertGreater(self.sigs_recvd, 0)
         finally:
             signal.signal(signal.SIGUSR1, old_handler)
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_time.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_time.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_time.py	Tue Jan 11 18:07:55 2011
@@ -2,6 +2,8 @@
 import time
 import unittest
 import locale
+import sysconfig
+import warnings
 
 class TimeTestCase(unittest.TestCase):
 
@@ -18,10 +20,10 @@
         time.clock()
 
     def test_conversions(self):
-        self.assertTrue(time.ctime(self.t)
-                     == time.asctime(time.localtime(self.t)))
-        self.assertTrue(int(time.mktime(time.localtime(self.t)))
-                     == int(self.t))
+        self.assertEqual(time.ctime(self.t),
+                         time.asctime(time.localtime(self.t)))
+        self.assertEqual(int(time.mktime(time.localtime(self.t))),
+                         int(self.t))
 
     def test_sleep(self):
         time.sleep(1.2)
@@ -41,14 +43,8 @@
         # Make sure that strftime() checks the bounds of the various parts
         #of the time tuple (0 is valid for *all* values).
 
-        # Check year [1900, max(int)]
-        self.assertRaises(ValueError, func,
-                            (1899, 1, 1, 0, 0, 0, 0, 1, -1))
-        if time.accept2dyear:
-            self.assertRaises(ValueError, func,
-                                (-1, 1, 1, 0, 0, 0, 0, 1, -1))
-            self.assertRaises(ValueError, func,
-                                (100, 1, 1, 0, 0, 0, 0, 1, -1))
+        # The year field is tested by other test cases above
+
         # Check month [1, 12] + zero support
         self.assertRaises(ValueError, func,
                             (1900, -1, 1, 0, 0, 0, 0, 1, -1))
@@ -96,7 +92,8 @@
         # No test for daylight savings since strftime() does not change output
         # based on its value.
         expected = "2000 01 01 00 00 00 1 001"
-        result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9)
+        with support.check_warnings():
+            result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9)
         self.assertEqual(expected, result)
 
     def test_strptime(self):
@@ -121,11 +118,35 @@
 
     def test_asctime(self):
         time.asctime(time.gmtime(self.t))
+
+        # Max year is only limited by the size of C int.
+        sizeof_int = sysconfig.get_config_var('SIZEOF_INT') or 4
+        bigyear = (1 << 8 * sizeof_int - 1) - 1
+        asc = time.asctime((bigyear, 6, 1) + (0,)*6)
+        self.assertEqual(asc[-len(str(bigyear)):], str(bigyear))
+        self.assertRaises(OverflowError, time.asctime, (bigyear + 1,) + (0,)*8)
         self.assertRaises(TypeError, time.asctime, 0)
+        self.assertRaises(TypeError, time.asctime, ())
+        self.assertRaises(TypeError, time.asctime, (0,) * 10)
 
     def test_asctime_bounding_check(self):
         self._bounds_checking(time.asctime)
 
+    def test_ctime(self):
+        t = time.mktime((1973, 9, 16, 1, 3, 52, 0, 0, -1))
+        self.assertEqual(time.ctime(t), 'Sun Sep 16 01:03:52 1973')
+        t = time.mktime((2000, 1, 1, 0, 0, 0, 0, 0, -1))
+        self.assertEqual(time.ctime(t), 'Sat Jan  1 00:00:00 2000')
+        for year in [-100, 100, 1000, 2000, 10000]:
+            try:
+                testval = time.mktime((year, 1, 10) + (0,)*6)
+            except (ValueError, OverflowError):
+                # If mktime fails, ctime will fail too.  This may happen
+                # on some platforms.
+                pass
+            else:
+                self.assertEqual(time.ctime(testval)[20:], str(year))
+
     @unittest.skipIf(not hasattr(time, "tzset"),
         "time module has no attribute tzset")
     def test_tzset(self):
@@ -215,14 +236,14 @@
         gt1 = time.gmtime(None)
         t0 = time.mktime(gt0)
         t1 = time.mktime(gt1)
-        self.assertTrue(0 <= (t1-t0) < 0.2)
+        self.assertAlmostEqual(t1, t0, delta=0.2)
 
     def test_localtime_without_arg(self):
         lt0 = time.localtime()
         lt1 = time.localtime(None)
         t0 = time.mktime(lt0)
         t1 = time.mktime(lt1)
-        self.assertTrue(0 <= (t1-t0) < 0.2)
+        self.assertAlmostEqual(t1, t0, delta=0.2)
 
 class TestLocale(unittest.TestCase):
     def setUp(self):
@@ -240,8 +261,142 @@
         # This should not cause an exception
         time.strftime("%B", (2009,2,1,0,0,0,0,0,0))
 
+
+class _BaseYearTest(unittest.TestCase):
+    accept2dyear = None
+
+    def setUp(self):
+        self.saved_accept2dyear = time.accept2dyear
+        time.accept2dyear = self.accept2dyear
+
+    def tearDown(self):
+        time.accept2dyear = self.saved_accept2dyear
+
+    def yearstr(self, y):
+        raise NotImplementedError()
+
+class _TestAsctimeYear:
+    def yearstr(self, y):
+        return time.asctime((y,) + (0,) * 8).split()[-1]
+
+    def test_large_year(self):
+        # Check that it doesn't crash for year > 9999
+        self.assertEqual(self.yearstr(12345), '12345')
+        self.assertEqual(self.yearstr(123456789), '123456789')
+
+class _TestStrftimeYear:
+    def yearstr(self, y):
+        return time.strftime('%Y', (y,) + (0,) * 8).split()[-1]
+
+    def test_large_year(self):
+        # Check that it doesn't crash for year > 9999
+        try:
+            text = self.yearstr(12345)
+        except ValueError:
+            # strftime() is limited to [1; 9999] with Visual Studio
+            return
+        # Issue #10864: OpenIndiana is limited to 4 digits,
+        # but Python doesn't raise a ValueError
+        #self.assertEqual(text, '12345')
+        #self.assertEqual(self.yearstr(123456789), '123456789')
+        self.assertIn(text, ('2345', '12345'))
+        self.assertIn(self.yearstr(123456789), ('123456789', '6789'))
+
+class _Test2dYear(_BaseYearTest):
+    accept2dyear = 1
+
+    def test_year(self):
+        with support.check_warnings():
+            self.assertEqual(self.yearstr(0), '2000')
+            self.assertEqual(self.yearstr(69), '1969')
+            self.assertEqual(self.yearstr(68), '2068')
+            self.assertEqual(self.yearstr(99), '1999')
+
+    def test_invalid(self):
+        self.assertRaises(ValueError, self.yearstr, -1)
+        self.assertRaises(ValueError, self.yearstr, 100)
+        self.assertRaises(ValueError, self.yearstr, 999)
+
+class _Test4dYear(_BaseYearTest):
+    accept2dyear = 0
+
+    def test_year(self):
+        self.assertIn(self.yearstr(1),     ('1', '0001'))
+        self.assertIn(self.yearstr(68),   ('68', '0068'))
+        self.assertIn(self.yearstr(69),   ('69', '0069'))
+        self.assertIn(self.yearstr(99),   ('99', '0099'))
+        self.assertIn(self.yearstr(999), ('999', '0999'))
+        self.assertEqual(self.yearstr(9999), '9999')
+
+    def test_negative(self):
+        try:
+            text = self.yearstr(-1)
+        except ValueError:
+            # strftime() is limited to [1; 9999] with Visual Studio
+            return
+        self.assertIn(text, ('-1', '-001'))
+
+        self.assertEqual(self.yearstr(-1234), '-1234')
+        self.assertEqual(self.yearstr(-123456), '-123456')
+
+
+    def test_mktime(self):
+        # Issue #1726687
+        for t in (-2, -1, 0, 1):
+            try:
+                tt = time.localtime(t)
+            except (OverflowError, ValueError):
+                pass
+            else:
+                self.assertEqual(time.mktime(tt), t)
+        # It may not be possible to reliably make mktime return error
+        # on all platfom.  This will make sure that no other exception
+        # than OverflowError is raised for an extreme value.
+        try:
+            time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))
+        except OverflowError:
+            pass
+
+class TestAsctimeAccept2dYear(_TestAsctimeYear, _Test2dYear):
+    pass
+
+class TestStrftimeAccept2dYear(_TestStrftimeYear, _Test2dYear):
+    pass
+
+class TestAsctime4dyear(_TestAsctimeYear, _Test4dYear):
+    pass
+
+class TestStrftime4dyear(_TestStrftimeYear, _Test4dYear):
+    pass
+
+class Test2dyearBool(_TestAsctimeYear, _Test2dYear):
+    accept2dyear = True
+
+class Test4dyearBool(_TestAsctimeYear, _Test4dYear):
+    accept2dyear = False
+
+class TestAccept2YearBad(_TestAsctimeYear, _BaseYearTest):
+    class X:
+        def __bool__(self):
+            raise RuntimeError('boo')
+    accept2dyear = X()
+    def test_2dyear(self):
+        pass
+    def test_invalid(self):
+        self.assertRaises(RuntimeError, self.yearstr, 200)
+
+
 def test_main():
-    support.run_unittest(TimeTestCase, TestLocale)
+    support.run_unittest(
+        TimeTestCase,
+        TestLocale,
+        TestAsctimeAccept2dYear,
+        TestStrftimeAccept2dYear,
+        TestAsctime4dyear,
+        TestStrftime4dyear,
+        Test2dyearBool,
+        Test4dyearBool,
+        TestAccept2YearBad)
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-cdecimal/Lib/test/test_timeout.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_timeout.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_timeout.py	Tue Jan 11 18:07:55 2011
@@ -7,6 +7,7 @@
 skip_expected = not support.is_resource_enabled('network')
 
 import time
+import errno
 import socket
 
 
@@ -88,8 +89,6 @@
 
 
 class TimeoutTestCase(unittest.TestCase):
-    """Test case for socket.socket() timeout functions"""
-
     # There are a number of tests here trying to make sure that an operation
     # doesn't take too much longer than expected.  But competing machine
     # activity makes it inevitable that such tests will fail at times.
@@ -98,10 +97,42 @@
     # solution.
     fuzz = 2.0
 
+    localhost = '127.0.0.1'
+
+    def setUp(self):
+        raise NotImplementedError()
+
+    tearDown = setUp
+
+    def _sock_operation(self, count, timeout, method, *args):
+        """
+        Test the specified socket method.
+
+        The method is run at most `count` times and must raise a socket.timeout
+        within `timeout` + self.fuzz seconds.
+        """
+        self.sock.settimeout(timeout)
+        method = getattr(self.sock, method)
+        for i in range(count):
+            t1 = time.time()
+            try:
+                method(*args)
+            except socket.timeout as e:
+                delta = time.time() - t1
+                break
+        else:
+            self.fail('socket.timeout was not raised')
+        # These checks should account for timing unprecision
+        self.assertLess(delta, timeout + self.fuzz)
+        self.assertGreater(delta, timeout - 1.0)
+
+
+class TCPTimeoutTestCase(TimeoutTestCase):
+    """TCP test case for socket.socket() timeout functions"""
+
     def setUp(self):
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         self.addr_remote = ('www.python.org.', 80)
-        self.localhost = '127.0.0.1'
 
     def tearDown(self):
         self.sock.close()
@@ -113,90 +144,73 @@
         # with the connect time.  This avoids failing the assertion that
         # the timeout occurred fast enough.
         addr = ('10.0.0.0', 12345)
-
-        # Test connect() timeout
-        _timeout = 0.001
-        self.sock.settimeout(_timeout)
-
-        _t1 = time.time()
-        self.assertRaises(socket.error, self.sock.connect, addr)
-        _t2 = time.time()
-
-        _delta = abs(_t1 - _t2)
-        self.assertTrue(_delta < _timeout + self.fuzz,
-                     "timeout (%g) is more than %g seconds more than expected (%g)"
-                     %(_delta, self.fuzz, _timeout))
+        with support.transient_internet(addr[0]):
+            self._sock_operation(1, 0.001, 'connect', addr)
 
     def testRecvTimeout(self):
         # Test recv() timeout
-        _timeout = 0.02
-
         with support.transient_internet(self.addr_remote[0]):
             self.sock.connect(self.addr_remote)
-            self.sock.settimeout(_timeout)
-
-            _t1 = time.time()
-            self.assertRaises(socket.timeout, self.sock.recv, 1024)
-            _t2 = time.time()
-
-            _delta = abs(_t1 - _t2)
-            self.assertTrue(_delta < _timeout + self.fuzz,
-                         "timeout (%g) is %g seconds more than expected (%g)"
-                         %(_delta, self.fuzz, _timeout))
+            self._sock_operation(1, 1.5, 'recv', 1024)
 
     def testAcceptTimeout(self):
         # Test accept() timeout
-        _timeout = 2
-        self.sock.settimeout(_timeout)
-        # Prevent "Address already in use" socket exceptions
         support.bind_port(self.sock, self.localhost)
         self.sock.listen(5)
-
-        _t1 = time.time()
-        self.assertRaises(socket.error, self.sock.accept)
-        _t2 = time.time()
-
-        _delta = abs(_t1 - _t2)
-        self.assertTrue(_delta < _timeout + self.fuzz,
-                     "timeout (%g) is %g seconds more than expected (%g)"
-                     %(_delta, self.fuzz, _timeout))
-
-    def testRecvfromTimeout(self):
-        # Test recvfrom() timeout
-        _timeout = 2
-        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-        self.sock.settimeout(_timeout)
-        # Prevent "Address already in use" socket exceptions
-        support.bind_port(self.sock, self.localhost)
-
-        _t1 = time.time()
-        self.assertRaises(socket.error, self.sock.recvfrom, 8192)
-        _t2 = time.time()
-
-        _delta = abs(_t1 - _t2)
-        self.assertTrue(_delta < _timeout + self.fuzz,
-                     "timeout (%g) is %g seconds more than expected (%g)"
-                     %(_delta, self.fuzz, _timeout))
+        self._sock_operation(1, 1.5, 'accept')
 
     def testSend(self):
         # Test send() timeout
-        # couldn't figure out how to test it
-        pass
+        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
+            support.bind_port(serv, self.localhost)
+            serv.listen(5)
+            self.sock.connect(serv.getsockname())
+            # Send a lot of data in order to bypass buffering in the TCP stack.
+            self._sock_operation(100, 1.5, 'send', b"X" * 200000)
 
     def testSendto(self):
         # Test sendto() timeout
-        # couldn't figure out how to test it
-        pass
+        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
+            support.bind_port(serv, self.localhost)
+            serv.listen(5)
+            self.sock.connect(serv.getsockname())
+            # The address argument is ignored since we already connected.
+            self._sock_operation(100, 1.5, 'sendto', b"X" * 200000,
+                                 serv.getsockname())
 
     def testSendall(self):
         # Test sendall() timeout
-        # couldn't figure out how to test it
-        pass
+        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as serv:
+            support.bind_port(serv, self.localhost)
+            serv.listen(5)
+            self.sock.connect(serv.getsockname())
+            # Send a lot of data in order to bypass buffering in the TCP stack.
+            self._sock_operation(100, 1.5, 'sendall', b"X" * 200000)
+
+
+class UDPTimeoutTestCase(TimeoutTestCase):
+    """UDP test case for socket.socket() timeout functions"""
+
+    def setUp(self):
+        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+
+    def tearDown(self):
+        self.sock.close()
+
+    def testRecvfromTimeout(self):
+        # Test recvfrom() timeout
+        # Prevent "Address already in use" socket exceptions
+        support.bind_port(self.sock, self.localhost)
+        self._sock_operation(1, 1.5, 'recvfrom', 1024)
 
 
 def test_main():
     support.requires('network')
-    support.run_unittest(CreationTestCase, TimeoutTestCase)
+    support.run_unittest(
+        CreationTestCase,
+        TCPTimeoutTestCase,
+        UDPTimeoutTestCase,
+    )
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-cdecimal/Lib/test/test_ttk_guionly.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_ttk_guionly.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_ttk_guionly.py	Tue Jan 11 18:07:55 2011
@@ -8,6 +8,7 @@
 from _tkinter import TclError
 from tkinter import ttk
 from tkinter.test import runtktests
+from tkinter.test.support import get_tk_root
 
 try:
     ttk.Button()
@@ -22,8 +23,11 @@
         elif 'gui' not in support.use_resources:
             support.use_resources.append('gui')
 
-    support.run_unittest(
-            *runtktests.get_tests(text=False, packages=['test_ttk']))
+    try:
+        support.run_unittest(
+                *runtktests.get_tests(text=False, packages=['test_ttk']))
+    finally:
+        get_tk_root().destroy()
 
 if __name__ == '__main__':
     test_main(enable_gui=True)

Modified: python/branches/py3k-cdecimal/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_unicode.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_unicode.py	Tue Jan 11 18:07:55 2011
@@ -1423,22 +1423,36 @@
         self.assertEqual("%s" % s, '__str__ overridden')
         self.assertEqual("{}".format(s), '__str__ overridden')
 
+    # Test PyUnicode_FromFormat()
     def test_from_format(self):
-        from _testcapi import format_unicode
+        support.import_module('ctypes')
+        from ctypes import pythonapi, py_object
+        if sys.maxunicode == 65535:
+            name = "PyUnicodeUCS2_FromFormat"
+        else:
+            name = "PyUnicodeUCS4_FromFormat"
+        _PyUnicode_FromFormat = getattr(pythonapi, name)
+        _PyUnicode_FromFormat.restype = py_object
+
+        def PyUnicode_FromFormat(format, *args):
+            cargs = tuple(
+                py_object(arg) if isinstance(arg, str) else arg
+                for arg in args)
+            return _PyUnicode_FromFormat(format, *cargs)
 
         # ascii format, non-ascii argument
-        text = format_unicode(b'ascii\x7f=%U', 'unicode\xe9')
+        text = PyUnicode_FromFormat(b'ascii\x7f=%U', 'unicode\xe9')
         self.assertEqual(text, 'ascii\x7f=unicode\xe9')
 
-        # non-ascii format, ascii argument: ensure that PyUnicode_FromFormat()
-        # raises an error for a non-ascii format string.
+        # non-ascii format, ascii argument: ensure that PyUnicode_FromFormatV()
+        # raises an error
         self.assertRaisesRegex(ValueError,
             '^PyUnicode_FromFormatV\(\) expects an ASCII-encoded format '
             'string, got a non-ASCII byte: 0xe9$',
-            format_unicode, b'unicode\xe9=%s', 'ascii')
+            PyUnicode_FromFormat, b'unicode\xe9=%s', 'ascii')
 
         # other tests
-        text = format_unicode(b'%%A:%A', 'abc\xe9\uabcd\U0010ffff')
+        text = PyUnicode_FromFormat(b'%%A:%A', 'abc\xe9\uabcd\U0010ffff')
         self.assertEqual(text, r"%A:'abc\xe9\uabcd\U0010ffff'")
 
     # Test PyUnicode_AsWideChar()

Modified: python/branches/py3k-cdecimal/Lib/test/test_urllib2.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_urllib2.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_urllib2.py	Tue Jan 11 18:07:55 2011
@@ -758,7 +758,7 @@
             else:
                 self.assertIs(o.req, req)
                 self.assertEqual(req.type, "ftp")
-            self.assertEqual(req.type is "ftp", ftp)
+            self.assertEqual(req.type == "ftp", ftp)
 
     def test_http(self):
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_winreg.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_winreg.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_winreg.py	Tue Jan 11 18:07:55 2011
@@ -341,8 +341,8 @@
         with OpenKey(HKEY_LOCAL_MACHINE, "Software") as key:
             # HKLM\Software is redirected but not reflected in all OSes
             self.assertTrue(QueryReflectionKey(key))
-            self.assertEqual(None, EnableReflectionKey(key))
-            self.assertEqual(None, DisableReflectionKey(key))
+            self.assertIsNone(EnableReflectionKey(key))
+            self.assertIsNone(DisableReflectionKey(key))
             self.assertTrue(QueryReflectionKey(key))
 
     @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection")

Modified: python/branches/py3k-cdecimal/Lib/test/test_with.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_with.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_with.py	Tue Jan 11 18:07:55 2011
@@ -9,26 +9,26 @@
 import sys
 import unittest
 from collections import deque
-from contextlib import GeneratorContextManager, contextmanager
+from contextlib import _GeneratorContextManager, contextmanager
 from test.support import run_unittest
 
 
-class MockContextManager(GeneratorContextManager):
+class MockContextManager(_GeneratorContextManager):
     def __init__(self, gen):
-        GeneratorContextManager.__init__(self, gen)
+        _GeneratorContextManager.__init__(self, gen)
         self.enter_called = False
         self.exit_called = False
         self.exit_args = None
 
     def __enter__(self):
         self.enter_called = True
-        return GeneratorContextManager.__enter__(self)
+        return _GeneratorContextManager.__enter__(self)
 
     def __exit__(self, type, value, traceback):
         self.exit_called = True
         self.exit_args = (type, value, traceback)
-        return GeneratorContextManager.__exit__(self, type,
-                                                value, traceback)
+        return _GeneratorContextManager.__exit__(self, type,
+                                                 value, traceback)
 
 
 def mock_contextmanager(func):

Modified: python/branches/py3k-cdecimal/Lib/test/test_wsgiref.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_wsgiref.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_wsgiref.py	Tue Jan 11 18:07:55 2011
@@ -520,6 +520,11 @@
             s('200 OK',[])
             return ['\u0442\u0435\u0441\u0442'.encode("utf-8")]
 
+        def trivial_app4(e,s):
+            # Simulate a response to a HEAD request
+            s('200 OK',[('Content-Length', '12345')])
+            return []
+
         h = TestHandler()
         h.run(trivial_app1)
         self.assertEqual(h.stdout.getvalue(),
@@ -543,10 +548,12 @@
             b'\r\n'
             b'\xd1\x82\xd0\xb5\xd1\x81\xd1\x82')
 
-
-
-
-
+        h = TestHandler()
+        h.run(trivial_app4)
+        self.assertEqual(h.stdout.getvalue(),
+            b'Status: 200 OK\r\n'
+            b'Content-Length: 12345\r\n'
+            b'\r\n')
 
     def testBasicErrorOutput(self):
 

Modified: python/branches/py3k-cdecimal/Lib/test/test_xml_etree_c.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_xml_etree_c.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_xml_etree_c.py	Tue Jan 11 18:07:55 2011
@@ -1,6 +1,8 @@
 # xml.etree test for cElementTree
 
 from test import support
+from test.support import precisionbigmemtest, _2G
+import unittest
 
 cET = support.import_module('xml.etree.cElementTree')
 
@@ -31,12 +33,28 @@
     """
 
 
+class MiscTests(unittest.TestCase):
+    # Issue #8651.
+    @support.precisionbigmemtest(size=support._2G + 100, memuse=1)
+    def test_length_overflow(self, size):
+        if size < support._2G + 100:
+            self.skipTest("not enough free memory, need at least 2 GB")
+        data = b'x' * size
+        parser = cET.XMLParser()
+        try:
+            self.assertRaises(OverflowError, parser.feed, data)
+        finally:
+            data = None
+
+
 def test_main():
     from test import test_xml_etree, test_xml_etree_c
 
     # Run the tests specific to the C implementation
     support.run_doctest(test_xml_etree_c, verbosity=True)
 
+    support.run_unittest(MiscTests)
+
     # Assign the C implementation before running the doctests
     # Patch the __name__, to prevent confusion with the pure Python test
     pyET = test_xml_etree.ET

Modified: python/branches/py3k-cdecimal/Lib/test/test_xmlrpc.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_xmlrpc.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_xmlrpc.py	Tue Jan 11 18:07:55 2011
@@ -629,6 +629,7 @@
         self.assertEqual(p.pow(6,8), 6**8)
         self.assertEqual(p.pow(6,8), 6**8)
         self.assertEqual(p.pow(6,8), 6**8)
+        p("close")()
 
         #they should have all been handled by a single request handler
         self.assertEqual(len(self.RequestHandler.myRequests), 1)
@@ -637,6 +638,7 @@
         #due to thread scheduling)
         self.assertGreaterEqual(len(self.RequestHandler.myRequests[-1]), 2)
 
+
 #test special attribute access on the serverproxy, through the __call__
 #function.
 class KeepaliveServerTestCase2(BaseKeepaliveServerTestCase):
@@ -653,6 +655,7 @@
         self.assertEqual(p.pow(6,8), 6**8)
         self.assertEqual(p.pow(6,8), 6**8)
         self.assertEqual(p.pow(6,8), 6**8)
+        p("close")()
 
         #they should have all been two request handlers, each having logged at least
         #two complete requests
@@ -660,12 +663,14 @@
         self.assertGreaterEqual(len(self.RequestHandler.myRequests[-1]), 2)
         self.assertGreaterEqual(len(self.RequestHandler.myRequests[-2]), 2)
 
+
     def test_transport(self):
         p = xmlrpclib.ServerProxy(URL)
         #do some requests with close.
         self.assertEqual(p.pow(6,8), 6**8)
         p("transport").close() #same as above, really.
         self.assertEqual(p.pow(6,8), 6**8)
+        p("close")()
         self.assertEqual(len(self.RequestHandler.myRequests), 2)
 
 #A test case that verifies that gzip encoding works in both directions
@@ -709,6 +714,7 @@
         self.assertEqual(p.pow(6,8), 6**8)
         b = self.RequestHandler.content_length
         self.assertTrue(a>b)
+        p("close")()
 
     def test_bad_gzip_request(self):
         t = self.Transport()
@@ -719,6 +725,7 @@
                                     re.compile(r"\b400\b"))
         with cm:
             p.pow(6, 8)
+        p("close")()
 
     def test_gsip_response(self):
         t = self.Transport()
@@ -729,6 +736,7 @@
         a = t.response_length
         self.requestHandler.encode_threshold = 0 #always encode
         self.assertEqual(p.pow(6,8), 6**8)
+        p("close")()
         b = t.response_length
         self.requestHandler.encode_threshold = old
         self.assertTrue(a>b)

Modified: python/branches/py3k-cdecimal/Lib/test/test_zipimport_support.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_zipimport_support.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_zipimport_support.py	Tue Jan 11 18:07:55 2011
@@ -13,6 +13,7 @@
 import inspect
 import linecache
 import pdb
+import unittest
 from test.script_helper import (spawn_python, kill_python, assert_python_ok,
                                 temp_dir, make_script, make_zip_script)
 
@@ -29,7 +30,6 @@
 
 # Retrieve some helpers from other test cases
 from test import test_doctest, sample_doctest
-from test.test_importhooks import ImportHooksBaseTestCase
 
 
 def _run_object_doctest(obj, module):
@@ -59,17 +59,28 @@
 
 
 
-class ZipSupportTests(ImportHooksBaseTestCase):
-    # We use the ImportHooksBaseTestCase to restore
+class ZipSupportTests(unittest.TestCase):
+    # This used to use the ImportHooksBaseTestCase to restore
     # the state of the import related information
-    # in the sys module after each test
+    # in the sys module after each test. However, that restores
+    # *too much* information and breaks for the invocation of
+    # of test_doctest. So we do our own thing and leave
+    # sys.modules alone.
     # We also clear the linecache and zipimport cache
     # just to avoid any bogus errors due to name reuse in the tests
     def setUp(self):
         linecache.clearcache()
         zipimport._zip_directory_cache.clear()
-        ImportHooksBaseTestCase.setUp(self)
-
+        self.path = sys.path[:]
+        self.meta_path = sys.meta_path[:]
+        self.path_hooks = sys.path_hooks[:]
+        sys.path_importer_cache.clear()
+
+    def tearDown(self):
+        sys.path[:] = self.path
+        sys.meta_path[:] = self.meta_path
+        sys.path_hooks[:] = self.path_hooks
+        sys.path_importer_cache.clear()
 
     def test_inspect_getsource_issue4223(self):
         test_src = "def foo(): pass\n"

Modified: python/branches/py3k-cdecimal/Lib/test/test_zlib.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/test_zlib.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/test_zlib.py	Tue Jan 11 18:07:55 2011
@@ -2,7 +2,7 @@
 from test import support
 import binascii
 import random
-from test.support import precisionbigmemtest, _1G
+from test.support import precisionbigmemtest, _1G, _4G
 
 zlib = support.import_module('zlib')
 
@@ -158,6 +158,16 @@
     def test_big_decompress_buffer(self, size):
         self.check_big_decompress_buffer(size, zlib.decompress)
 
+    @precisionbigmemtest(size=_4G + 100, memuse=1)
+    def test_length_overflow(self, size):
+        if size < _4G + 100:
+            self.skipTest("not enough free memory, need at least 4 GB")
+        data = b'x' * size
+        try:
+            self.assertRaises(OverflowError, zlib.compress, data, 1)
+        finally:
+            data = None
+
 
 class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
     # Test compression object

Modified: python/branches/py3k-cdecimal/Lib/threading.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/threading.py	(original)
+++ python/branches/py3k-cdecimal/Lib/threading.py	Tue Jan 11 18:07:55 2011
@@ -395,6 +395,10 @@
         self._cond = Condition(Lock())
         self._flag = False
 
+    def _reset_internal_locks(self):
+        # private!  called by Thread._reset_internal_locks by _after_fork()
+        self._cond.__init__()
+
     def is_set(self):
         return self._flag
 
@@ -642,6 +646,13 @@
         # sys.exc_info since it can be changed between instances
         self._stderr = _sys.stderr
 
+    def _reset_internal_locks(self):
+        # private!  Called by _after_fork() to reset our internal locks as
+        # they may be in an invalid state leading to a deadlock or crash.
+        if hasattr(self, '_block'):  # DummyThread deletes _block
+            self._block.__init__()
+        self._started._reset_internal_locks()
+
     def _set_daemon(self):
         # Overridden in _MainThread and _DummyThread
         return current_thread().daemon
@@ -984,12 +995,11 @@
     def __init__(self):
         Thread.__init__(self, name=_newname("Dummy-%d"))
 
-        # Thread.__block consumes an OS-level locking primitive, which
+        # Thread._block consumes an OS-level locking primitive, which
         # can never be used by a _DummyThread.  Since a _DummyThread
         # instance is immortal, that's bad, so release this resource.
         del self._block
 
-
         self._started.set()
         self._set_ident()
         with _active_limbo_lock:
@@ -1064,6 +1074,9 @@
                 # its new value since it can have changed.
                 ident = _get_ident()
                 thread._ident = ident
+                # Any condition variables hanging off of the active thread may
+                # be in an invalid state, so we reinitialize them.
+                thread._reset_internal_locks()
                 new_active[ident] = thread
             else:
                 # All the others are already stopped.

Modified: python/branches/py3k-cdecimal/Lib/tkinter/test/test_tkinter/test_loadtk.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/tkinter/test/test_tkinter/test_loadtk.py	(original)
+++ python/branches/py3k-cdecimal/Lib/tkinter/test/test_tkinter/test_loadtk.py	Tue Jan 11 18:07:55 2011
@@ -31,7 +31,8 @@
                 # doesn't actually carry through to the process level
                 # because they don't support unsetenv
                 # If that's the case, abort.
-                display = os.popen('echo $DISPLAY').read().strip()
+                with os.popen('echo $DISPLAY') as pipe:
+                    display = pipe.read().strip()
                 if display:
                     return
 

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	Tue Jan 11 18:07:55 2011
@@ -274,12 +274,17 @@
         """
         self._testMethodName = methodName
         self._outcomeForDoCleanups = None
+        self._testMethodDoc = 'No test'
         try:
             testMethod = getattr(self, methodName)
         except AttributeError:
-            raise ValueError("no such test method in %s: %s" %
-                  (self.__class__, methodName))
-        self._testMethodDoc = testMethod.__doc__
+            if methodName != 'runTest':
+                # we allow instantiation with no explicit method name
+                # but not an *incorrect* or missing method name
+                raise ValueError("no such test method in %s: %s" %
+                      (self.__class__, methodName))
+        else:
+            self._testMethodDoc = testMethod.__doc__
         self._cleanups = []
 
         # Map types to custom assertEqual functions that will compare

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	Tue Jan 11 18:07:55 2011
@@ -1,5 +1,5 @@
 import datetime
-
+import warnings
 import unittest
 
 
@@ -224,10 +224,13 @@
                              "\+ \{'key': 'value'\} : oops$"])
 
     def testAssertDictContainsSubset(self):
-        self.assertMessages('assertDictContainsSubset', ({'key': 'value'}, {}),
-                            ["^Missing: 'key'$", "^oops$",
-                             "^Missing: 'key'$",
-                             "^Missing: 'key' : oops$"])
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+
+            self.assertMessages('assertDictContainsSubset', ({'key': 'value'}, {}),
+                                ["^Missing: 'key'$", "^oops$",
+                                 "^Missing: 'key'$",
+                                 "^Missing: 'key' : oops$"])
 
     def testAssertMultiLineEqual(self):
         self.assertMessages('assertMultiLineEqual', ("", "foo"),

Modified: python/branches/py3k-cdecimal/Lib/unittest/test/test_case.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/unittest/test/test_case.py	(original)
+++ python/branches/py3k-cdecimal/Lib/unittest/test/test_case.py	Tue Jan 11 18:07:55 2011
@@ -77,6 +77,16 @@
 
         self.assertEqual(Test().id()[-13:], '.Test.runTest')
 
+        # test that TestCase can be instantiated with no args
+        # primarily for use at the interactive interpreter
+        test = unittest.TestCase()
+        test.assertEqual(3, 3)
+        with test.assertRaises(test.failureException):
+            test.assertEqual(3, 2)
+
+        with self.assertRaises(AttributeError):
+            test.run()
+
     # "class TestCase([methodName])"
     # ...
     # "Each instance of TestCase will run a single test method: the
@@ -479,31 +489,34 @@
                           animals)
 
     def testAssertDictContainsSubset(self):
-        self.assertDictContainsSubset({}, {})
-        self.assertDictContainsSubset({}, {'a': 1})
-        self.assertDictContainsSubset({'a': 1}, {'a': 1})
-        self.assertDictContainsSubset({'a': 1}, {'a': 1, 'b': 2})
-        self.assertDictContainsSubset({'a': 1, 'b': 2}, {'a': 1, 'b': 2})
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
 
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({1: "one"}, {})
+            self.assertDictContainsSubset({}, {})
+            self.assertDictContainsSubset({}, {'a': 1})
+            self.assertDictContainsSubset({'a': 1}, {'a': 1})
+            self.assertDictContainsSubset({'a': 1}, {'a': 1, 'b': 2})
+            self.assertDictContainsSubset({'a': 1, 'b': 2}, {'a': 1, 'b': 2})
 
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 2}, {'a': 1})
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({1: "one"}, {})
 
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'c': 1}, {'a': 1})
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({'a': 2}, {'a': 1})
 
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({'c': 1}, {'a': 1})
 
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
 
-        one = ''.join(chr(i) for i in range(255))
-        # this used to cause a UnicodeDecodeError constructing the failure msg
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'foo': one}, {'foo': '\uFFFD'})
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
+
+            one = ''.join(chr(i) for i in range(255))
+            # this used to cause a UnicodeDecodeError constructing the failure msg
+            with self.assertRaises(self.failureException):
+                self.assertDictContainsSubset({'foo': one}, {'foo': '\uFFFD'})
 
     def testAssertEqual(self):
         equal_pairs = [

Modified: python/branches/py3k-cdecimal/Lib/wsgiref/handlers.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/wsgiref/handlers.py	(original)
+++ python/branches/py3k-cdecimal/Lib/wsgiref/handlers.py	Tue Jan 11 18:07:55 2011
@@ -302,7 +302,9 @@
     def finish_content(self):
         """Ensure headers and content have both been sent"""
         if not self.headers_sent:
-            self.headers['Content-Length'] = "0"
+            # Only zero Content-Length if not set by the application (so
+            # that HEAD requests can be satisfied properly, see #3839)
+            self.headers.setdefault('Content-Length', "0")
             self.send_headers()
         else:
             pass # XXX check if content-length was too short?

Modified: python/branches/py3k-cdecimal/Mac/IDLE/IDLE.app/Contents/Info.plist
==============================================================================
--- python/branches/py3k-cdecimal/Mac/IDLE/IDLE.app/Contents/Info.plist	(original)
+++ python/branches/py3k-cdecimal/Mac/IDLE/IDLE.app/Contents/Info.plist	Tue Jan 11 18:07:55 2011
@@ -36,7 +36,7 @@
 	<key>CFBundleExecutable</key>
 	<string>IDLE</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%version%, © 2001-2008 Python Software Foundation</string>
+	<string>%version%, © 2001-2011 Python Software Foundation</string>
 	<key>CFBundleIconFile</key>
 	<string>IDLE.icns</string>
 	<key>CFBundleIdentifier</key>

Modified: python/branches/py3k-cdecimal/Mac/Makefile.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/Makefile.in	(original)
+++ python/branches/py3k-cdecimal/Mac/Makefile.in	Tue Jan 11 18:07:55 2011
@@ -47,8 +47,7 @@
 compileall=$(srcdir)/../Lib/compileall.py
 
 installapps: install_Python install_pythonw install_PythonLauncher install_IDLE \
-	checkapplepython install_versionedtools
-
+	checkapplepython
 
 install_pythonw: pythonw
 	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
@@ -92,27 +91,6 @@
 		ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
 	done
 
-# By default most tools are installed without a version in their basename, to
-# make it easier to install (and use) several python versions side-by-side move
-# the tools to a version-specific name and add the non-versioned name as an
-# alias.
-install_versionedtools:
-	for fn in idle pydoc ;\
-	do \
-		if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}3" ]; then \
-			continue ;\
-		fi ;\
-		mv "$(DESTDIR)$(prefix)/bin/$${fn}3" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)"  ;\
-		ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}3" ;\
-	done
-	mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)"
-	ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3"
-	if [ ! -h "$(DESTDIR)$(prefix)/bin/python3-config" ]; then \
-		mv "$(DESTDIR)$(prefix)/bin/python3-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
-		ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python3-config" ; \
-	fi
-
-
 pythonw: $(srcdir)/Tools/pythonw.c Makefile
 	$(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
 

Modified: python/branches/py3k-cdecimal/Mac/PythonLauncher/Info.plist.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/PythonLauncher/Info.plist.in	(original)
+++ python/branches/py3k-cdecimal/Mac/PythonLauncher/Info.plist.in	Tue Jan 11 18:07:55 2011
@@ -40,7 +40,7 @@
 	<key>CFBundleExecutable</key>
 	<string>PythonLauncher</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%VERSION%, © 2001-2008 Python Software Foundation</string>
+	<string>%VERSION%, © 2001-2011 Python Software Foundation</string>
 	<key>CFBundleIconFile</key>
 	<string>PythonLauncher.icns</string>
 	<key>CFBundleIdentifier</key>

Modified: python/branches/py3k-cdecimal/Mac/Resources/app/Info.plist.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/Resources/app/Info.plist.in	(original)
+++ python/branches/py3k-cdecimal/Mac/Resources/app/Info.plist.in	Tue Jan 11 18:07:55 2011
@@ -20,7 +20,7 @@
 	<key>CFBundleExecutable</key>
 	<string>Python</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%version%, (c) 2004-2010 Python Software Foundation.</string>
+	<string>%version%, (c) 2004-2011 Python Software Foundation.</string>
 	<key>CFBundleHelpBookFolder</key>
 	<array>
 		<string>Documentation</string>
@@ -37,7 +37,7 @@
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleLongVersionString</key>
-	<string>%version%, (c) 2004-2010 Python Software Foundation.</string>
+	<string>%version%, (c) 2004-2011 Python Software Foundation.</string>
 	<key>CFBundleName</key>
 	<string>Python</string>
 	<key>CFBundlePackageType</key>
@@ -55,6 +55,6 @@
 	<key>NSAppleScriptEnabled</key>
 	<true/>
 	<key>NSHumanReadableCopyright</key>
-	<string>(c) 2004 Python Software Foundation.</string>
+	<string>(c) 2011 Python Software Foundation.</string>
 </dict>
 </plist>

Modified: python/branches/py3k-cdecimal/Mac/Resources/framework/Info.plist.in
==============================================================================
--- python/branches/py3k-cdecimal/Mac/Resources/framework/Info.plist.in	(original)
+++ python/branches/py3k-cdecimal/Mac/Resources/framework/Info.plist.in	Tue Jan 11 18:07:55 2011
@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>%VERSION%, (c) 2004-2008 Python Software Foundation.</string>
+	<string>%VERSION%, (c) 2004-2011 Python Software Foundation.</string>
 	<key>CFBundleLongVersionString</key>
-	<string>%VERSION%, (c) 2004-2008 Python Software Foundation.</string>
+	<string>%VERSION%, (c) 2004-2011 Python Software Foundation.</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>

Modified: python/branches/py3k-cdecimal/Misc/ACKS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/ACKS	(original)
+++ python/branches/py3k-cdecimal/Misc/ACKS	Tue Jan 11 18:07:55 2011
@@ -46,6 +46,7 @@
 Greg Ball
 Luigi Ballabio
 Jeff Balogh
+Matt Bandy
 Michael J. Barber
 Chris Barker
 Nick Barnes
@@ -261,6 +262,7 @@
 David Everly
 Greg Ewing
 Martijn Faassen
+Clovis Fabricio
 Andreas Faerber
 Bill Fancher
 Troy J. Farrell
@@ -321,6 +323,7 @@
 Hans de Graaff
 Eddy De Greef
 Duncan Grisby
+Fabian Groffen
 Eric Groo
 Dag Gruneau
 Michael Guravage
@@ -422,6 +425,7 @@
 Gregory K. Johnson
 Simon Johnston
 Thomas Jollans
+Nicolas Joly
 Evan Jones
 Jeremy Jones
 Richard Jones
@@ -696,6 +700,7 @@
 Steven Reiz
 Roeland Rengelink
 Tim Rice
+Francesco Ricciardi
 Jan Pieter Riegel
 Armin Rigo
 Nicholas Riley
@@ -809,6 +814,7 @@
 Ken Stox
 Dan Stromberg
 Daniel Stutzbach
+Andreas Stührk
 Pal Subbiah
 Nathan Sullivan
 Mark Summerfield
@@ -865,6 +871,7 @@
 Atul Varma
 Dmitry Vasiliev
 Alexandre Vassalotti
+Nadeem Vawda
 Frank Vercruesse
 Mike Verdone
 Jaap Vermeulen
@@ -898,6 +905,7 @@
 Rickard Westman
 Jeff Wheeler
 Christopher White
+David White
 Mats Wichmann
 Truida Wiedijk
 Felix Wiemann

Modified: python/branches/py3k-cdecimal/Misc/NEWS
==============================================================================
--- python/branches/py3k-cdecimal/Misc/NEWS	(original)
+++ python/branches/py3k-cdecimal/Misc/NEWS	Tue Jan 11 18:07:55 2011
@@ -8,6 +8,26 @@
 Core and Builtins
 -----------------
 
+- Issue #8020: Avoid a crash where the small objects allocator would read
+  non-Python managed memory while it is being modified by another thread.
+  Patch by Matt Bandy.
+
+- Issue #10841: On Windows, set the binary mode on stdin, stdout, stderr and
+  all io.FileIO objects (to not translate newlines, \r\n <=> \n). The Python
+  parser translates newlines (\r\n => \n).
+
+- Remove buffer API from stable ABI for now, see #10181.
+
+- Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
+  doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
+  (length bigger than 2^31-1 bytes).
+
+- Issue #9015, #9611: FileIO.readinto(), FileIO.write(), os.write() and
+  stdprinter.write() clamp the length to 2^31-1 on Windows.
+
+- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime()
+  can now handle dates after 2038.
+
 - Issue #10780: PyErr_SetFromWindowsErrWithFilename() and
   PyErr_SetExcFromWindowsErrWithFilename() decode the filename from the
   filesystem encoding instead of UTF-8.
@@ -20,6 +40,84 @@
 Library
 -------
 
+- Issue #10875: Update Regular Expression HOWTO; patch by 'SilentGhost'.
+
+- Issue #10872: The repr() of TextIOWrapper objects now includes the mode
+  if available.
+
+- Issue #10869: Fixed bug where ast.increment_lineno modified the root
+  node twice.
+
+- Issue #5871: email.header.Header.encode now raises an error if any
+  continuation line in the formatted value has no leading white space
+  and looks like a header.  Since Generator uses Header to format all
+  headers, this check is made for all headers in any serialized message
+  at serialization time.  This provides protection against header
+  injection attacks.
+
+- Issue #10859: Make ``contextlib.GeneratorContextManager`` officially
+  private by renaming it to ``_GeneratorContextManager``.
+
+- Issue #10042: Fixed the total_ordering decorator to handle cross-type
+  comparisons that could lead to infinite recursion.
+
+- Issue #10686: the email package now :rfc:`2047`\ -encodes headers with
+  non-ASCII bytes (parsed by a Bytes Parser) when doing conversion to
+  7bit-clean presentation, instead of replacing them with ?s.
+
+- email.header.Header was incorrectly encoding folding white space when
+  rfc2047-encoding header values with embedded newlines, leaving them
+  without folding whitespace.  It now uses the continuation_ws, as it
+  does for continuation lines that it creates itself.
+
+- Issue #1777412, #10827: Changed the rules for 2-digit years. The
+  time.asctime(), time.ctime() and time.strftime() functions will now format
+  any year when ``time.accept2dyear`` is False and will accept years >= 1000
+  otherwise. ``time.mktime`` and ``time.strftime`` now accept full range
+  supported by the OS. With Visual Studio or on Solaris, the year is limited to
+  the range [1; 9999]. Conversion of 2-digit years to 4-digit is deprecated.
+
+- Issue #7858: Raise an error properly when os.utime() fails under Windows
+  on an existing file.
+
+- Issue #3839: wsgiref should not override a Content-Length header set by
+  the application.  Initial patch by Clovis Fabricio.
+
+- Issue #10492: bdb.Bdb.run() only traces the execution of the code, not the
+  compilation (if the input is a string).
+
+- Issue #7995: When calling accept() on a socket with a timeout, the returned
+  socket is now always blocking, regardless of the operating system.
+
+- Issue #10756: atexit normalizes the exception before displaying it. Patch by
+  Andreas Stührk.
+
+- Issue #10790: email.header.Header.append's charset logic now works correctly
+  for charsets whose output codec is different from its input codec.
+
+- Issue #10819: SocketIO.name property returns -1 when its closed, instead of
+  raising a ValueError, to fix repr().
+
+- Issue #8650: zlib.compress() and zlib.decompress() raise an OverflowError if
+  the input buffer length doesn't fit into an unsigned int (length bigger than
+  2^32-1 bytes).
+
+- Issue #6643: Reinitialize locks held within the threading module after fork
+  to avoid a potential rare deadlock or crash on some platforms.
+
+- Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
+  file descriptors (0, 1, 2) are closed in the parent process.  Initial
+  patch by Ross Lagerwall.
+
+- `unittest.TestCase` can be instantiated without a method name; for simpler
+  exploration from the interactive interpreter.
+
+- Issue #10798: Reject supporting concurrent.futures if the system has too
+  few POSIX semaphores.
+
+- Issue #10807: Remove base64, bz2, hex, quopri, rot13, uu and zlib codecs from
+  the codec aliases. They are still accessible via codecs.lookup().
+
 - Issue #10801: In zipfile, support different encodings for the header and
   the filenames.
 
@@ -82,12 +180,32 @@
 
 - Deprecated assertDictContainsSubset() in the unittest module.
 
+C-API
+-----
+
+- Issue #10333: Remove ancient GC API, which has been deprecated since
+  Python 2.2.
+
 Build
 -----
 
+- Issue #10820: Fix OS X framework installs to support version-specific
+  scripts (#10679).
+
+- Issue #7716: Under Solaris, don't assume existence of /usr/xpg4/bin/grep in
+  the configure script but use $GREP instead.  Patch by Fabian Groffen.
+
+- Issue #10475: Don't hardcode compilers for LDSHARED/LDCXXSHARED on NetBSD
+  and DragonFly BSD.  Patch by Nicolas Joly.
+
 - Issue #10679: The "idle", "pydoc" and "2to3" scripts are now installed with
   a version-specific suffix on "make altinstall".
 
+- Issue #10655: Fix the build on PowerPC on Linux with GCC when building with
+  timestamp profiling (--with-tsc): the preprocessor test for the PowerPC
+  support now looks for "__powerpc__" as well as "__ppc__": the latter seems to
+  only be present on OS X; the former is the correct one for Linux with GCC.
+
 Tools/Demos
 -----------
 
@@ -95,6 +213,25 @@
   demos have been removed, others integrated in documentation or a new
   Tools/demo subdirectory.
 
+- Issue #10502: Addition of the unittestgui tool. Originally by Steve Purcell.
+  Updated for test discovery by Mark Roddy and Python 3 compatibility by
+  Brian Curtin.
+
+Tests
+-----
+
+- Make the --coverage flag work for test.regrtest.
+
+- Issue #1677694: Refactor and improve test_timeout.  Original patch by
+  Björn Lindqvist.
+
+- Issue #5485: Add tests for the UseForeignDTD method of expat parser objects.
+  Patch by Jean-Paul Calderone and Sandro Tosi.
+
+- Issue #6293: Have regrtest.py echo back sys.flags.  This is done by default
+  in whole runs and enabled selectively using ``--header`` when running an
+  explicit list of tests.  Original patch by Collin Winter.
+
 
 What's New in Python 3.2 Beta 2?
 ================================
@@ -1366,6 +1503,12 @@
 Extension Modules
 -----------------
 
+- Issue #8013: time.asctime and time.ctime no longer call system
+  asctime and ctime functions.  The year range for time.asctime is now
+  1900 through maxint.  The range for time.ctime is the same as for
+  time.localtime.  The string produced by these functions is longer
+  than 24 characters when year is greater than 9999.
+
 - Issue #6608: time.asctime is now checking struct tm fields its input
   before passing it to the system asctime.  Patch by MunSic Jeong.
 

Modified: python/branches/py3k-cdecimal/Misc/developers.txt
==============================================================================
--- python/branches/py3k-cdecimal/Misc/developers.txt	(original)
+++ python/branches/py3k-cdecimal/Misc/developers.txt	Tue Jan 11 18:07:55 2011
@@ -23,6 +23,12 @@
 Permissions History
 -------------------
 
+- Eli Bendersky was given commit access on Jan 11 2011 by BAC,
+  on recommendation by Terry Reedy and Nick Coghlan.
+
+- Ned Deily was given commit access on Jan 9 2011 by MvL,
+  on recommendation by Antoine Pitrou.
+
 - David Malcolm was given commit access on Oct 27 2010 by GFB,
   at recommendation by Antoine Pitrou and Raymond Hettinger.
 

Modified: python/branches/py3k-cdecimal/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_collectionsmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_collectionsmodule.c	Tue Jan 11 18:07:55 2011
@@ -1536,41 +1536,68 @@
     if (!PyArg_UnpackTuple(args, "_count_elements", 2, 2, &mapping, &iterable))
         return NULL;
 
-    if (!PyDict_Check(mapping)) {
-        PyErr_SetString(PyExc_TypeError,
-            "Expected mapping argument to be a dictionary");
-        return NULL;
-    }
-
     it = PyObject_GetIter(iterable);
     if (it == NULL)
         return NULL;
+
     one = PyLong_FromLong(1);
     if (one == NULL) {
         Py_DECREF(it);
         return NULL;
     }
-    while (1) {
-        key = PyIter_Next(it);
-        if (key == NULL) {
-            if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration))
-                PyErr_Clear();
-            break;
+
+    if (PyDict_CheckExact(mapping)) {
+        while (1) {
+            key = PyIter_Next(it);
+            if (key == NULL) {
+                if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration))
+                    PyErr_Clear();
+                else
+                    break;
+            }
+            oldval = PyDict_GetItem(mapping, key);
+            if (oldval == NULL) {
+                if (PyDict_SetItem(mapping, key, one) == -1)
+                    break;
+            } else {
+                newval = PyNumber_Add(oldval, one);
+                if (newval == NULL)
+                    break;
+                if (PyDict_SetItem(mapping, key, newval) == -1)
+                    break;
+                Py_CLEAR(newval);
+            }
+            Py_DECREF(key);
         }
-        oldval = PyDict_GetItem(mapping, key);
-        if (oldval == NULL) {
-            if (PyDict_SetItem(mapping, key, one) == -1)
-                break;
-        } else {
-            newval = PyNumber_Add(oldval, one);
-            if (newval == NULL)
-                break;
-            if (PyDict_SetItem(mapping, key, newval) == -1)
+    } else {
+        while (1) {
+            key = PyIter_Next(it);
+            if (key == NULL) {
+                if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration))
+                    PyErr_Clear();
+                else
+                    break;
+            }
+            oldval = PyObject_GetItem(mapping, key);
+            if (oldval == NULL) {
+                if (!PyErr_Occurred() || !PyErr_ExceptionMatches(PyExc_KeyError))
+                    break;
+                PyErr_Clear();
+                Py_INCREF(one);
+                newval = one;
+            } else {
+                newval = PyNumber_Add(oldval, one);
+                Py_DECREF(oldval);
+                if (newval == NULL)
+                    break;
+            }
+            if (PyObject_SetItem(mapping, key, newval) == -1)
                 break;
             Py_CLEAR(newval);
+            Py_DECREF(key);
         }
-        Py_DECREF(key);
     }
+
     Py_DECREF(it);
     Py_XDECREF(key);
     Py_XDECREF(newval);

Modified: python/branches/py3k-cdecimal/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_ctypes/_ctypes.c	Tue Jan 11 18:07:55 2011
@@ -3925,14 +3925,14 @@
 
   Returns -1 on error, or the index of next argument on success.
  */
-static int
+static Py_ssize_t
 _init_pos_args(PyObject *self, PyTypeObject *type,
                PyObject *args, PyObject *kwds,
-               int index)
+               Py_ssize_t index)
 {
     StgDictObject *dict;
     PyObject *fields;
-    int i;
+    Py_ssize_t i;
 
     if (PyType_stgdict((PyObject *)type->tp_base)) {
         index = _init_pos_args(self, type->tp_base,

Modified: python/branches/py3k-cdecimal/Modules/_datetimemodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_datetimemodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_datetimemodule.c	Tue Jan 11 18:07:55 2011
@@ -1166,10 +1166,10 @@
     if (!pin)
         return NULL;
 
-    /* Give up if the year is before 1900.
+    /* Give up if the year is before 1000.
      * Python strftime() plays games with the year, and different
      * games depending on whether envar PYTHON2K is set.  This makes
-     * years before 1900 a nightmare, even if the platform strftime
+     * years before 1000 a nightmare, even if the platform strftime
      * supports them (and not all do).
      * We could get a lot farther here by avoiding Python's strftime
      * wrapper and calling the C strftime() directly, but that isn't
@@ -1182,10 +1182,10 @@
         assert(PyLong_Check(pyyear));
         year = PyLong_AsLong(pyyear);
         Py_DECREF(pyyear);
-        if (year < 1900) {
+        if (year < 1000) {
             PyErr_Format(PyExc_ValueError, "year=%ld is before "
-                         "1900; the datetime strftime() "
-                         "methods require year >= 1900",
+                         "1000; the datetime strftime() "
+                         "methods require year >= 1000",
                          year);
             return NULL;
         }
@@ -3663,7 +3663,7 @@
 
     /* Python's strftime does insane things with the year part of the
      * timetuple.  The year is forced to (the otherwise nonsensical)
-     * 1900 to worm around that.
+     * 1900 to work around that.
      */
     tuple = Py_BuildValue("iiiiiiiii",
                           1900, 1, 1, /* year, month, day */

Modified: python/branches/py3k-cdecimal/Modules/_io/fileio.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_io/fileio.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_io/fileio.c	Tue Jan 11 18:07:55 2011
@@ -388,6 +388,11 @@
             goto error;
     }
 
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+    /* don't translate newlines (\r\n <=> \n) */
+    _setmode(self->fd, O_BINARY);
+#endif
+
     if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
         goto error;
 
@@ -506,7 +511,7 @@
 fileio_readinto(fileio *self, PyObject *args)
 {
     Py_buffer pbuf;
-    Py_ssize_t n;
+    Py_ssize_t n, len;
 
     if (self->fd < 0)
         return err_closed();
@@ -517,9 +522,16 @@
         return NULL;
 
     if (_PyVerify_fd(self->fd)) {
+        len = pbuf.len;
         Py_BEGIN_ALLOW_THREADS
         errno = 0;
-        n = read(self->fd, pbuf.buf, pbuf.len);
+#if defined(MS_WIN64) || defined(MS_WINDOWS)
+        if (len > INT_MAX)
+            len = INT_MAX;
+        n = read(self->fd, pbuf.buf, (int)len);
+#else
+        n = read(self->fd, pbuf.buf, len);
+#endif
         Py_END_ALLOW_THREADS
     } else
         n = -1;
@@ -685,7 +697,7 @@
 fileio_write(fileio *self, PyObject *args)
 {
     Py_buffer pbuf;
-    Py_ssize_t n;
+    Py_ssize_t n, len;
 
     if (self->fd < 0)
         return err_closed();
@@ -698,7 +710,14 @@
     if (_PyVerify_fd(self->fd)) {
         Py_BEGIN_ALLOW_THREADS
         errno = 0;
-        n = write(self->fd, pbuf.buf, pbuf.len);
+        len = pbuf.len;
+#if defined(MS_WIN64) || defined(MS_WINDOWS)
+        if (len > INT_MAX)
+            len = INT_MAX;
+        n = write(self->fd, pbuf.buf, (int)len);
+#else
+        n = write(self->fd, pbuf.buf, len);
+#endif
         Py_END_ALLOW_THREADS
     } else
         n = -1;

Modified: python/branches/py3k-cdecimal/Modules/_io/textio.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_io/textio.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_io/textio.c	Tue Jan 11 18:07:55 2011
@@ -2323,25 +2323,52 @@
 static PyObject *
 textiowrapper_repr(textio *self)
 {
-    PyObject *nameobj, *res;
+    PyObject *nameobj, *modeobj, *res, *s;
 
     CHECK_INITIALIZED(self);
 
+    res = PyUnicode_FromString("<_io.TextIOWrapper");
+    if (res == NULL)
+        return NULL;
     nameobj = PyObject_GetAttrString((PyObject *) self, "name");
     if (nameobj == NULL) {
         if (PyErr_ExceptionMatches(PyExc_AttributeError))
             PyErr_Clear();
         else
-            return NULL;
-        res = PyUnicode_FromFormat("<_io.TextIOWrapper encoding=%R>",
-                                   self->encoding);
+            goto error;
     }
     else {
-        res = PyUnicode_FromFormat("<_io.TextIOWrapper name=%R encoding=%R>",
-                                   nameobj, self->encoding);
+        s = PyUnicode_FromFormat(" name=%R", nameobj);
         Py_DECREF(nameobj);
+        if (s == NULL)
+            goto error;
+        PyUnicode_AppendAndDel(&res, s);
+        if (res == NULL)
+            return NULL;
     }
-    return res;
+    modeobj = PyObject_GetAttrString((PyObject *) self, "mode");
+    if (modeobj == NULL) {
+        if (PyErr_ExceptionMatches(PyExc_AttributeError))
+            PyErr_Clear();
+        else
+            goto error;
+    }
+    else {
+        s = PyUnicode_FromFormat(" mode=%R", modeobj);
+        Py_DECREF(modeobj);
+        if (s == NULL)
+            goto error;
+        PyUnicode_AppendAndDel(&res, s);
+        if (res == NULL)
+            return NULL;
+    }
+    s = PyUnicode_FromFormat("%U encoding=%R>",
+                             res, self->encoding);
+    Py_DECREF(res);
+    return s;
+error:
+    Py_XDECREF(res);
+    return NULL;
 }
 
 

Modified: python/branches/py3k-cdecimal/Modules/_posixsubprocess.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_posixsubprocess.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_posixsubprocess.c	Tue Jan 11 18:07:55 2011
@@ -69,27 +69,40 @@
     }
     POSIX_CALL(close(errpipe_read));
 
-    /* Dup fds for child. */
-    if (p2cread != -1) {
+    /* Dup fds for child.
+       dup2() removes the CLOEXEC flag but we must do it ourselves if dup2()
+       would be a no-op (issue #10806). */
+    if (p2cread == 0) {
+        int old = fcntl(p2cread, F_GETFD);
+        if (old != -1)
+            fcntl(p2cread, F_SETFD, old & ~FD_CLOEXEC);
+    } else if (p2cread != -1) {
         POSIX_CALL(dup2(p2cread, 0));  /* stdin */
     }
-    if (c2pwrite != -1) {
+    if (c2pwrite == 1) {
+        int old = fcntl(c2pwrite, F_GETFD);
+        if (old != -1)
+            fcntl(c2pwrite, F_SETFD, old & ~FD_CLOEXEC);
+    } else if (c2pwrite != -1) {
         POSIX_CALL(dup2(c2pwrite, 1));  /* stdout */
     }
-    if (errwrite != -1) {
+    if (errwrite == 2) {
+        int old = fcntl(errwrite, F_GETFD);
+        if (old != -1)
+            fcntl(errwrite, F_SETFD, old & ~FD_CLOEXEC);
+    } else if (errwrite != -1) {
         POSIX_CALL(dup2(errwrite, 2));  /* stderr */
     }
 
     /* Close pipe fds.  Make sure we don't close the same fd more than */
     /* once, or standard fds. */
-    if (p2cread != -1 && p2cread != 0) {
+    if (p2cread > 2) {
         POSIX_CALL(close(p2cread));
     }
-    if (c2pwrite != -1 && c2pwrite != p2cread && c2pwrite != 1) {
+    if (c2pwrite > 2) {
         POSIX_CALL(close(c2pwrite));
     }
-    if (errwrite != -1 && errwrite != p2cread &&
-        errwrite != c2pwrite && errwrite != 2) {
+    if (errwrite != c2pwrite && errwrite > 2) {
         POSIX_CALL(close(errwrite));
     }
 
@@ -415,27 +428,39 @@
     Py_BEGIN_ALLOW_THREADS
     res = pipe2(fds, O_CLOEXEC);
     Py_END_ALLOW_THREADS
-#else
-    /* We hold the GIL which offers some protection from other code calling
-     * fork() before the CLOEXEC flags have been set but we can't guarantee
-     * anything without pipe2(). */
-    long oldflags;
-
-    res = pipe(fds);
-
-    if (res == 0) {
-        oldflags = fcntl(fds[0], F_GETFD, 0);
-        if (oldflags < 0) res = oldflags;
-    }
-    if (res == 0)
-        res = fcntl(fds[0], F_SETFD, oldflags | FD_CLOEXEC);
-
-    if (res == 0) {
-        oldflags = fcntl(fds[1], F_GETFD, 0);
-        if (oldflags < 0) res = oldflags;
+    if (res != 0 && errno == ENOSYS)
+    {
+        if (PyErr_WarnEx(
+                PyExc_RuntimeWarning,
+                "pipe2 set errno ENOSYS; falling "
+                "back to non-atomic pipe+fcntl.", 1) != 0) {
+            return NULL;
+        }
+        {
+#endif
+        /* We hold the GIL which offers some protection from other code calling
+         * fork() before the CLOEXEC flags have been set but we can't guarantee
+         * anything without pipe2(). */
+        long oldflags;
+
+        res = pipe(fds);
+
+        if (res == 0) {
+            oldflags = fcntl(fds[0], F_GETFD, 0);
+            if (oldflags < 0) res = oldflags;
+        }
+        if (res == 0)
+            res = fcntl(fds[0], F_SETFD, oldflags | FD_CLOEXEC);
+
+        if (res == 0) {
+            oldflags = fcntl(fds[1], F_GETFD, 0);
+            if (oldflags < 0) res = oldflags;
+        }
+        if (res == 0)
+            res = fcntl(fds[1], F_SETFD, oldflags | FD_CLOEXEC);
+#ifdef HAVE_PIPE2
+        }
     }
-    if (res == 0)
-        res = fcntl(fds[1], F_SETFD, oldflags | FD_CLOEXEC);
 #endif
     if (res != 0)
         return PyErr_SetFromErrno(PyExc_OSError);

Modified: python/branches/py3k-cdecimal/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/_testcapimodule.c	Tue Jan 11 18:07:55 2011
@@ -2188,7 +2188,7 @@
             /* argument converter not called? */
             return NULL;
         /* Should be 1 */
-        res = PyLong_FromLong(Py_REFCNT(str2));
+        res = PyLong_FromSsize_t(Py_REFCNT(str2));
         Py_DECREF(str2);
         PyErr_Clear();
         return res;
@@ -2246,17 +2246,6 @@
     return NULL;
 }
 
-static PyObject *
-format_unicode(PyObject *self, PyObject *args)
-{
-    const char *format;
-    PyObject *arg;
-    if (!PyArg_ParseTuple(args, "yU", &format, &arg))
-        return NULL;
-    return PyUnicode_FromFormat(format, arg);
-
-}
-
 static PyMethodDef TestMethods[] = {
     {"raise_exception",         raise_exception,                 METH_VARARGS},
     {"raise_memoryerror",   (PyCFunction)raise_memoryerror,  METH_NOARGS},
@@ -2338,7 +2327,6 @@
     {"make_exception_with_doc", (PyCFunction)make_exception_with_doc,
      METH_VARARGS | METH_KEYWORDS},
     {"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS},
-    {"format_unicode",          format_unicode,                 METH_VARARGS},
     {NULL, NULL} /* sentinel */
 };
 

Modified: python/branches/py3k-cdecimal/Modules/atexitmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/atexitmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/atexitmodule.c	Tue Jan 11 18:07:55 2011
@@ -72,6 +72,7 @@
             PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
             if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
                 PySys_WriteStderr("Error in atexit._run_exitfuncs:\n");
+                PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
                 PyErr_Display(exc_type, exc_value, exc_tb);
             }
         }

Modified: python/branches/py3k-cdecimal/Modules/audioop.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/audioop.c	(original)
+++ python/branches/py3k-cdecimal/Modules/audioop.c	Tue Jan 11 18:07:55 2011
@@ -309,7 +309,7 @@
 }
 
 static int
-audioop_check_parameters(int len, int size)
+audioop_check_parameters(Py_ssize_t len, int size)
 {
     if (!audioop_check_size(size))
         return 0;

Modified: python/branches/py3k-cdecimal/Modules/gcmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/gcmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/gcmodule.c	Tue Jan 11 18:07:55 2011
@@ -1511,11 +1511,3 @@
     }
     PyObject_FREE(g);
 }
-
-/* for binary compatibility with 2.2 */
-#undef _PyObject_GC_Del
-void
-_PyObject_GC_Del(PyObject *op)
-{
-    PyObject_GC_Del(op);
-}

Modified: python/branches/py3k-cdecimal/Modules/main.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/main.c	(original)
+++ python/branches/py3k-cdecimal/Modules/main.c	Tue Jan 11 18:07:55 2011
@@ -527,11 +527,14 @@
 
     stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0);
 
-    if (Py_UnbufferedStdioFlag) {
 #if defined(MS_WINDOWS) || defined(__CYGWIN__)
-        _setmode(fileno(stdin), O_BINARY);
-        _setmode(fileno(stdout), O_BINARY);
+    /* don't translate newlines (\r\n <=> \n) */
+    _setmode(fileno(stdin), O_BINARY);
+    _setmode(fileno(stdout), O_BINARY);
+    _setmode(fileno(stderr), O_BINARY);
 #endif
+
+    if (Py_UnbufferedStdioFlag) {
 #ifdef HAVE_SETVBUF
         setvbuf(stdin,  (char *)NULL, _IONBF, BUFSIZ);
         setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ);

Modified: python/branches/py3k-cdecimal/Modules/md5module.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/md5module.c	(original)
+++ python/branches/py3k-cdecimal/Modules/md5module.c	Tue Jan 11 18:07:55 2011
@@ -228,9 +228,9 @@
    @param inlen  The length of the data (octets)
 */
 void md5_process(struct md5_state *md5,
-                const unsigned char *in, unsigned long inlen)
+                const unsigned char *in, Py_ssize_t inlen)
 {
-    unsigned long n;
+    Py_ssize_t n;
 
     assert(md5 != NULL);
     assert(in != NULL);

Modified: python/branches/py3k-cdecimal/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/posixmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/posixmodule.c	Tue Jan 11 18:07:55 2011
@@ -976,18 +976,18 @@
     int st_gid;
     int st_rdev;
     __int64 st_size;
-    int st_atime;
+    time_t st_atime;
     int st_atime_nsec;
-    int st_mtime;
+    time_t st_mtime;
     int st_mtime_nsec;
-    int st_ctime;
+    time_t st_ctime;
     int st_ctime_nsec;
 };
 
 static __int64 secs_between_epochs = 11644473600; /* Seconds between 1.1.1601 and 1.1.1970 */
 
 static void
-FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, int *time_out, int* nsec_out)
+FILE_TIME_to_time_t_nsec(FILETIME *in_ptr, time_t *time_out, int* nsec_out)
 {
     /* XXX endianness. Shouldn't matter, as all Windows implementations are little-endian */
     /* Cannot simply cast and dereference in_ptr,
@@ -995,12 +995,11 @@
     __int64 in;
     memcpy(&in, in_ptr, sizeof(in));
     *nsec_out = (int)(in % 10000000) * 100; /* FILETIME is in units of 100 nsec. */
-    /* XXX Win32 supports time stamps past 2038; we currently don't */
-    *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, int);
+    *time_out = Py_SAFE_DOWNCAST((in / 10000000) - secs_between_epochs, __int64, time_t);
 }
 
 static void
-time_t_to_FILE_TIME(int time_in, int nsec_in, FILETIME *out_ptr)
+time_t_to_FILE_TIME(time_t time_in, int nsec_in, FILETIME *out_ptr)
 {
     /* XXX endianness */
     __int64 out;
@@ -3138,15 +3137,19 @@
 #endif /* HAVE_UNAME */
 
 static int
-extract_time(PyObject *t, long* sec, long* usec)
+extract_time(PyObject *t, time_t* sec, long* usec)
 {
-    long intval;
+    time_t intval;
     if (PyFloat_Check(t)) {
         double tval = PyFloat_AsDouble(t);
-        PyObject *intobj = Py_TYPE(t)->tp_as_number->nb_int(t);
+        PyObject *intobj = PyNumber_Long(t);
         if (!intobj)
             return -1;
+#if SIZEOF_TIME_T > SIZEOF_LONG
+        intval = PyLong_AsUnsignedLongLongMask(intobj);
+#else
         intval = PyLong_AsLong(intobj);
+#endif
         Py_DECREF(intobj);
         if (intval == -1 && PyErr_Occurred())
             return -1;
@@ -3158,7 +3161,11 @@
             *usec = 0;
         return 0;
     }
+#if SIZEOF_TIME_T > SIZEOF_LONG
+    intval = PyLong_AsUnsignedLongLongMask(t);
+#else
     intval = PyLong_AsLong(t);
+#endif
     if (intval == -1 && PyErr_Occurred())
         return -1;
     *sec = intval;
@@ -3182,7 +3189,8 @@
     PyObject *oapath;
     char *apath;
     HANDLE hFile;
-    long atimesec, mtimesec, ausec, musec;
+    time_t atimesec, mtimesec;
+    long ausec, musec;
     FILETIME atime, mtime;
     PyObject *result = NULL;
 
@@ -3248,6 +3256,7 @@
            something is wrong with the file, when it also
            could be the time stamp that gives a problem. */
         win32_error("utime", NULL);
+        goto done;
     }
     Py_INCREF(Py_None);
     result = Py_None;
@@ -3258,7 +3267,8 @@
 
     PyObject *opath;
     char *path;
-    long atime, mtime, ausec, musec;
+    time_t atime, mtime;
+    long ausec, musec;
     int res;
     PyObject* arg;
 
@@ -5687,7 +5697,7 @@
 {
     Py_buffer pbuf;
     int fd;
-    Py_ssize_t size;
+    Py_ssize_t size, len;
 
     if (!PyArg_ParseTuple(args, "iy*:write", &fd, &pbuf))
         return NULL;
@@ -5695,8 +5705,15 @@
         PyBuffer_Release(&pbuf);
         return posix_error();
     }
+    len = pbuf.len;
     Py_BEGIN_ALLOW_THREADS
-    size = write(fd, pbuf.buf, (size_t)pbuf.len);
+#if defined(MS_WIN64) || defined(MS_WINDOWS)
+    if (len > INT_MAX)
+        len = INT_MAX;
+    size = write(fd, pbuf.buf, (int)len);
+#else
+    size = write(fd, pbuf.buf, len);
+#endif
     Py_END_ALLOW_THREADS
     PyBuffer_Release(&pbuf);
     if (size < 0)

Modified: python/branches/py3k-cdecimal/Modules/pyexpat.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/pyexpat.c	(original)
+++ python/branches/py3k-cdecimal/Modules/pyexpat.c	Tue Jan 11 18:07:55 2011
@@ -797,25 +797,13 @@
 static int
 readinst(char *buf, int buf_size, PyObject *meth)
 {
-    PyObject *arg = NULL;
-    PyObject *bytes = NULL;
-    PyObject *str = NULL;
-    int len = -1;
+    PyObject *str;
+    Py_ssize_t len;
     char *ptr;
 
-    if ((bytes = PyLong_FromLong(buf_size)) == NULL)
-        goto finally;
-
-    if ((arg = PyTuple_New(1)) == NULL) {
-        Py_DECREF(bytes);
-        goto finally;
-    }
-
-    PyTuple_SET_ITEM(arg, 0, bytes);
-
-    str = PyObject_Call(meth, arg, NULL);
+    str = PyObject_CallFunction(meth, "n", buf_size);
     if (str == NULL)
-        goto finally;
+        goto error;
 
     if (PyBytes_Check(str))
         ptr = PyBytes_AS_STRING(str);
@@ -825,21 +813,24 @@
         PyErr_Format(PyExc_TypeError,
                      "read() did not return a bytes object (type=%.400s)",
                      Py_TYPE(str)->tp_name);
-        goto finally;
+        goto error;
     }
     len = Py_SIZE(str);
     if (len > buf_size) {
         PyErr_Format(PyExc_ValueError,
                      "read() returned too much data: "
-                     "%i bytes requested, %i returned",
+                     "%i bytes requested, %zd returned",
                      buf_size, len);
-        goto finally;
+        goto error;
     }
     memcpy(buf, ptr, len);
-finally:
-    Py_XDECREF(arg);
+    Py_DECREF(str);
+    /* len <= buf_size <= INT_MAX */
+    return (int)len;
+
+error:
     Py_XDECREF(str);
-    return len;
+    return -1;
 }
 
 PyDoc_STRVAR(xmlparse_ParseFile__doc__,
@@ -1522,7 +1513,7 @@
 static PyTypeObject Xmlparsetype = {
         PyVarObject_HEAD_INIT(NULL, 0)
         "pyexpat.xmlparser",            /*tp_name*/
-        sizeof(xmlparseobject) + PyGC_HEAD_SIZE,/*tp_basicsize*/
+        sizeof(xmlparseobject),         /*tp_basicsize*/
         0,                              /*tp_itemsize*/
         /* methods */
         (destructor)xmlparse_dealloc,   /*tp_dealloc*/
@@ -1807,7 +1798,7 @@
         Py_XDECREF(rev_codes_dict);
         return NULL;
     }
-    
+
 #define MYCONST(name) \
     if (PyModule_AddStringConstant(errors_module, #name,               \
                                    (char *)XML_ErrorString(name)) < 0) \
@@ -1873,7 +1864,7 @@
         return NULL;
     if (PyModule_AddObject(errors_module, "messages", rev_codes_dict) < 0)
         return NULL;
-    
+
 #undef MYCONST
 
 #define MYCONST(c) PyModule_AddIntConstant(m, #c, c)

Modified: python/branches/py3k-cdecimal/Modules/selectmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/selectmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/selectmodule.c	Tue Jan 11 18:07:55 2011
@@ -81,10 +81,9 @@
 static int
 seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
 {
-    int i;
     int max = -1;
     int index = 0;
-    int len = -1;
+    Py_ssize_t i, len = -1;
     PyObject* fast_seq = NULL;
     PyObject* o = NULL;
 

Modified: python/branches/py3k-cdecimal/Modules/sha1module.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/sha1module.c	(original)
+++ python/branches/py3k-cdecimal/Modules/sha1module.c	Tue Jan 11 18:07:55 2011
@@ -203,9 +203,9 @@
    @param inlen  The length of the data (octets)
 */
 void sha1_process(struct sha1_state *sha1,
-                  const unsigned char *in, unsigned long inlen)
+                  const unsigned char *in, Py_ssize_t inlen)
 {
-    unsigned long n;
+    Py_ssize_t n;
 
     assert(sha1 != NULL);
     assert(in != NULL);

Modified: python/branches/py3k-cdecimal/Modules/sha256module.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/sha256module.c	(original)
+++ python/branches/py3k-cdecimal/Modules/sha256module.c	Tue Jan 11 18:07:55 2011
@@ -265,9 +265,9 @@
 /* update the SHA digest */
 
 static void
-sha_update(SHAobject *sha_info, SHA_BYTE *buffer, int count)
+sha_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count)
 {
-    int i;
+    Py_ssize_t i;
     SHA_INT32 clo;
 
     clo = sha_info->count_lo + ((SHA_INT32) count << 3);

Modified: python/branches/py3k-cdecimal/Modules/sha512module.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/sha512module.c	(original)
+++ python/branches/py3k-cdecimal/Modules/sha512module.c	Tue Jan 11 18:07:55 2011
@@ -291,9 +291,9 @@
 /* update the SHA digest */
 
 static void
-sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, int count)
+sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count)
 {
-    int i;
+    Py_ssize_t i;
     SHA_INT32 clo;
 
     clo = sha_info->count_lo + ((SHA_INT32) count << 3);

Modified: python/branches/py3k-cdecimal/Modules/timemodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/timemodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/timemodule.c	Tue Jan 11 18:07:55 2011
@@ -1,4 +1,3 @@
-
 /* Time module */
 
 #include "Python.h"
@@ -218,29 +217,6 @@
 }
 
 static PyObject *
-structtime_totuple(PyObject *t)
-{
-    PyObject *x = NULL;
-    unsigned int i;
-    PyObject *v = PyTuple_New(9);
-    if (v == NULL)
-        return NULL;
-
-    for (i=0; i<9; i++) {
-        x = PyStructSequence_GET_ITEM(t, i);
-        Py_INCREF(x);
-        PyTuple_SET_ITEM(v, i, x);
-    }
-
-    if (PyErr_Occurred()) {
-        Py_XDECREF(v);
-        return NULL;
-    }
-
-    return v;
-}
-
-static PyObject *
 time_convert(double when, struct tm * (*function)(const time_t *))
 {
     struct tm *p;
@@ -321,56 +297,62 @@
 gettmarg(PyObject *args, struct tm *p)
 {
     int y;
-    PyObject *t = NULL;
 
     memset((void *) p, '\0', sizeof(struct tm));
 
-    if (PyTuple_Check(args)) {
-        t = args;
-        Py_INCREF(t);
-    }
-    else if (Py_TYPE(args) == &StructTimeType) {
-        t = structtime_totuple(args);
-    }
-    else {
+    if (!PyTuple_Check(args)) {
         PyErr_SetString(PyExc_TypeError,
                         "Tuple or struct_time argument required");
         return 0;
     }
 
-    if (t == NULL || !PyArg_ParseTuple(t, "iiiiiiiii",
-                                       &y,
-                                       &p->tm_mon,
-                                       &p->tm_mday,
-                                       &p->tm_hour,
-                                       &p->tm_min,
-                                       &p->tm_sec,
-                                       &p->tm_wday,
-                                       &p->tm_yday,
-                                       &p->tm_isdst)) {
-        Py_XDECREF(t);
+    if (!PyArg_ParseTuple(args, "iiiiiiiii",
+                          &y, &p->tm_mon, &p->tm_mday,
+                          &p->tm_hour, &p->tm_min, &p->tm_sec,
+                          &p->tm_wday, &p->tm_yday, &p->tm_isdst))
         return 0;
-    }
-    Py_DECREF(t);
 
-    if (y < 1900) {
+    /* If year is specified with less than 4 digits, its interpretation
+     * depends on the accept2dyear value.
+     *
+     * If accept2dyear is true (default), a backward compatibility behavior is
+     * invoked as follows:
+     *
+     *   - for 2-digit year, century is guessed according to POSIX rules for
+     *      %y strptime format: 21st century for y < 69, 20th century
+     *      otherwise.  A deprecation warning is issued when century
+     *      information is guessed in this way.
+     *
+     *   - for 3-digit or negative year, a ValueError exception is raised.
+     *
+     * If accept2dyear is false (set by the program or as a result of a
+     * non-empty value assigned to PYTHONY2K environment variable) all year
+     * values are interpreted as given.
+     */
+    if (y < 1000) {
         PyObject *accept = PyDict_GetItemString(moddict,
                                                 "accept2dyear");
-        if (accept == NULL || !PyLong_CheckExact(accept) ||
-            !PyObject_IsTrue(accept)) {
-            PyErr_SetString(PyExc_ValueError,
-                            "year >= 1900 required");
-            return 0;
+        if (accept != NULL) {
+            int acceptval =  PyObject_IsTrue(accept);
+            if (acceptval == -1)
+                return 0;
+            if (acceptval) {
+                if (0 <= y && y < 69)
+                    y += 2000;
+                else if (69 <= y && y < 100)
+                    y += 1900;
+                else {
+                    PyErr_SetString(PyExc_ValueError,
+                                    "year out of range");
+                    return 0;
+                }
+                if (PyErr_WarnEx(PyExc_DeprecationWarning,
+                           "Century info guessed for a 2-digit year.", 1) != 0)
+                    return 0;
+            }
         }
-        if (69 <= y && y <= 99)
-            y += 1900;
-        else if (0 <= y && y <= 68)
-            y += 2000;
-        else {
-            PyErr_SetString(PyExc_ValueError,
-                            "year out of range");
+        else
             return 0;
-        }
     }
     p->tm_year = y - 1900;
     p->tm_mon--;
@@ -492,6 +474,15 @@
     else if (!gettmarg(tup, &buf) || !checktm(&buf))
         return NULL;
 
+#if defined(_MSC_VER) || defined(sun)
+    if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
+        PyErr_Format(PyExc_ValueError,
+                     "strftime() requires year in [1; 9999]",
+                     buf.tm_year + 1900);
+        return NULL;
+    }
+#endif
+
     /* Normalize tm_isdst just in case someone foolishly implements %Z
        based on the assumption that tm_isdst falls within the range of
        [-1, 1] */
@@ -599,19 +590,51 @@
     return strptime_result;
 }
 
+
 PyDoc_STRVAR(strptime_doc,
 "strptime(string, format) -> struct_time\n\
 \n\
 Parse a string to a time tuple according to a format specification.\n\
 See the library reference manual for formatting codes (same as strftime()).");
 
+static PyObject *
+_asctime(struct tm *timeptr)
+{
+    /* Inspired by Open Group reference implementation available at
+     * http://pubs.opengroup.org/onlinepubs/009695399/functions/asctime.html */
+    static char wday_name[7][3] = {
+        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+    };
+    static char mon_name[12][3] = {
+        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+    };
+    char buf[20]; /* 'Sun Sep 16 01:03:52\0' */
+    int n;
+
+    n = PyOS_snprintf(buf, sizeof(buf), "%.3s %.3s%3d %.2d:%.2d:%.2d",
+                      wday_name[timeptr->tm_wday],
+                      mon_name[timeptr->tm_mon],
+                      timeptr->tm_mday, timeptr->tm_hour,
+                      timeptr->tm_min, timeptr->tm_sec);
+    /* XXX: since the fields used by snprintf above are validated in checktm,
+     * the following condition should never trigger. We keep the check because
+     * historically fixed size buffer used in asctime was the source of
+     * crashes. */
+    if (n + 1 != sizeof(buf)) {
+        PyErr_SetString(PyExc_ValueError, "unconvertible time");
+        return NULL;
+    }
+
+    return PyUnicode_FromFormat("%s %d", buf, 1900 + timeptr->tm_year);
+}
 
 static PyObject *
 time_asctime(PyObject *self, PyObject *args)
 {
     PyObject *tup = NULL;
     struct tm buf;
-    char *p;
+
     if (!PyArg_UnpackTuple(args, "asctime", 0, 1, &tup))
         return NULL;
     if (tup == NULL) {
@@ -619,10 +642,7 @@
         buf = *localtime(&tt);
     } else if (!gettmarg(tup, &buf) || !checktm(&buf))
         return NULL;
-    p = asctime(&buf);
-    if (p[24] == '\n')
-        p[24] = '\0';
-    return PyUnicode_FromString(p);
+    return _asctime(&buf);
 }
 
 PyDoc_STRVAR(asctime_doc,
@@ -637,7 +657,7 @@
 {
     PyObject *ot = NULL;
     time_t tt;
-    char *p;
+    struct tm *timeptr;
 
     if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot))
         return NULL;
@@ -651,14 +671,12 @@
         if (tt == (time_t)-1 && PyErr_Occurred())
             return NULL;
     }
-    p = ctime(&tt);
-    if (p == NULL) {
+    timeptr = localtime(&tt);
+    if (timeptr == NULL) {
         PyErr_SetString(PyExc_ValueError, "unconvertible time");
         return NULL;
     }
-    if (p[24] == '\n')
-        p[24] = '\0';
-    return PyUnicode_FromString(p);
+    return _asctime(timeptr);
 }
 
 PyDoc_STRVAR(ctime_doc,
@@ -676,8 +694,11 @@
     time_t tt;
     if (!gettmarg(tup, &buf))
         return NULL;
+    buf.tm_wday = -1;  /* sentinel; original value ignored */
     tt = mktime(&buf);
-    if (tt == (time_t)(-1)) {
+    /* Return value of -1 does not necessarily mean an error, but tm_wday
+     * cannot remain set to -1 if mktime succedded. */
+    if (tt == (time_t)(-1) && buf.tm_wday == -1) {
         PyErr_SetString(PyExc_OverflowError,
                         "mktime argument out of range");
         return NULL;

Modified: python/branches/py3k-cdecimal/Modules/unicodedata.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/unicodedata.c	(original)
+++ python/branches/py3k-cdecimal/Modules/unicodedata.c	Tue Jan 11 18:07:55 2011
@@ -403,7 +403,8 @@
 {
     PyUnicodeObject *v;
     char decomp[256];
-    int code, index, count, i;
+    int code, index, count;
+    size_t i;
     unsigned int prefix_index;
     Py_UCS4 c;
 
@@ -450,15 +451,12 @@
     while (count-- > 0) {
         if (i)
             decomp[i++] = ' ';
-        assert((size_t)i < sizeof(decomp));
+        assert(i < sizeof(decomp));
         PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X",
                       decomp_data[++index]);
         i += strlen(decomp + i);
     }
-
-    decomp[i] = '\0';
-
-    return PyUnicode_FromString(decomp);
+    return PyUnicode_FromStringAndSize(decomp, i);
 }
 
 static void

Modified: python/branches/py3k-cdecimal/Modules/zlibmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/zlibmodule.c	(original)
+++ python/branches/py3k-cdecimal/Modules/zlibmodule.c	Tue Jan 11 18:07:55 2011
@@ -117,14 +117,21 @@
     PyObject *ReturnVal = NULL;
     Py_buffer pinput;
     Byte *input, *output;
-    int length, level=Z_DEFAULT_COMPRESSION, err;
+    unsigned int length;
+    int level=Z_DEFAULT_COMPRESSION, err;
     z_stream zst;
 
     /* require Python string object, optional 'level' arg */
     if (!PyArg_ParseTuple(args, "y*|i:compress", &pinput, &level))
         return NULL;
-    input = pinput.buf;
+
+    if (pinput.len > UINT_MAX) {
+        PyErr_SetString(PyExc_OverflowError,
+            "size does not fit in an unsigned int");
+        return NULL;
+    }
     length = pinput.len;
+    input = pinput.buf;
 
     zst.avail_out = length + length/1000 + 12 + 1;
 
@@ -199,7 +206,8 @@
     PyObject *result_str;
     Py_buffer pinput;
     Byte *input;
-    int length, err;
+    unsigned int length;
+    int err;
     int wsize=DEF_WBITS;
     Py_ssize_t r_strlen=DEFAULTALLOC;
     z_stream zst;
@@ -207,8 +215,14 @@
     if (!PyArg_ParseTuple(args, "y*|in:decompress",
                           &pinput, &wsize, &r_strlen))
         return NULL;
-    input = pinput.buf;
+
+    if (pinput.len > UINT_MAX) {
+        PyErr_SetString(PyExc_OverflowError,
+            "size does not fit in an unsigned int");
+        return NULL;
+    }
     length = pinput.len;
+    input = pinput.buf;
 
     if (r_strlen <= 0)
         r_strlen = 1;

Modified: python/branches/py3k-cdecimal/Objects/codeobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/codeobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/codeobject.c	Tue Jan 11 18:07:55 2011
@@ -347,11 +347,11 @@
         lineno = -1;
     if (co->co_filename && PyUnicode_Check(co->co_filename)) {
         return PyUnicode_FromFormat(
-            "<code object %.100U at %p, file \"%.300U\", line %d>",
+            "<code object %U at %p, file \"%U\", line %d>",
             co->co_name, co, co->co_filename, lineno);
     } else {
         return PyUnicode_FromFormat(
-            "<code object %.100U at %p, file ???, line %d>",
+            "<code object %U at %p, file ???, line %d>",
             co->co_name, co, lineno);
     }
 }
@@ -492,7 +492,7 @@
 int
 PyCode_Addr2Line(PyCodeObject *co, int addrq)
 {
-    int size = PyBytes_Size(co->co_lnotab) / 2;
+    Py_ssize_t size = PyBytes_Size(co->co_lnotab) / 2;
     unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab);
     int line = co->co_firstlineno;
     int addr = 0;
@@ -510,7 +510,8 @@
 int
 _PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair *bounds)
 {
-    int size, addr, line;
+    Py_ssize_t size;
+    int addr, line;
     unsigned char* p;
 
     p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab);

Modified: python/branches/py3k-cdecimal/Objects/fileobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/fileobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/fileobject.c	Tue Jan 11 18:07:55 2011
@@ -344,7 +344,7 @@
 }
 
 static int
-fileio_init(PyObject *self, PyObject *args, PyObject *kwds)
+stdprinter_init(PyObject *self, PyObject *args, PyObject *kwds)
 {
     PyErr_SetString(PyExc_TypeError,
                     "cannot create 'stderrprinter' instances");
@@ -390,7 +390,13 @@
 
     Py_BEGIN_ALLOW_THREADS
     errno = 0;
+#if defined(MS_WIN64) || defined(MS_WINDOWS)
+    if (n > INT_MAX)
+        n = INT_MAX;
+    n = write(self->fd, c, (int)n);
+#else
     n = write(self->fd, c, n);
+#endif
     Py_END_ALLOW_THREADS
 
     if (n < 0) {
@@ -509,7 +515,7 @@
     0,                                          /* tp_descr_get */
     0,                                          /* tp_descr_set */
     0,                                          /* tp_dictoffset */
-    fileio_init,                                /* tp_init */
+    stdprinter_init,                            /* tp_init */
     PyType_GenericAlloc,                        /* tp_alloc */
     stdprinter_new,                             /* tp_new */
     PyObject_Del,                               /* tp_free */

Modified: python/branches/py3k-cdecimal/Objects/listobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/listobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/listobject.c	Tue Jan 11 18:07:55 2011
@@ -1381,7 +1381,7 @@
 
 /* Conceptually a MergeState's constructor. */
 static void
-merge_init(MergeState *ms, int list_size, int has_keyfunc)
+merge_init(MergeState *ms, Py_ssize_t list_size, int has_keyfunc)
 {
     assert(ms != NULL);
     if (has_keyfunc) {

Modified: python/branches/py3k-cdecimal/Objects/obmalloc.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/obmalloc.c	(original)
+++ python/branches/py3k-cdecimal/Objects/obmalloc.c	Tue Jan 11 18:07:55 2011
@@ -682,11 +682,19 @@
 obmalloc in a small constant time, independent of the number of arenas
 obmalloc controls.  Since this test is needed at every entry point, it's
 extremely desirable that it be this fast.
+
+Since Py_ADDRESS_IN_RANGE may be reading from memory which was not allocated
+by Python, it is important that (POOL)->arenaindex is read only once, as
+another thread may be concurrently modifying the value without holding the
+GIL.  To accomplish this, the arenaindex_temp variable is used to store
+(POOL)->arenaindex for the duration of the Py_ADDRESS_IN_RANGE macro's
+execution.  The caller of the macro is responsible for declaring this
+variable.
 */
 #define Py_ADDRESS_IN_RANGE(P, POOL)                    \
-    ((POOL)->arenaindex < maxarenas &&                  \
-     (uptr)(P) - arenas[(POOL)->arenaindex].address < (uptr)ARENA_SIZE && \
-     arenas[(POOL)->arenaindex].address != 0)
+    ((arenaindex_temp = (POOL)->arenaindex) < maxarenas &&              \
+     (uptr)(P) - arenas[arenaindex_temp].address < (uptr)ARENA_SIZE && \
+     arenas[arenaindex_temp].address != 0)
 
 
 /* This is only useful when running memory debuggers such as
@@ -945,6 +953,9 @@
     block *lastfree;
     poolp next, prev;
     uint size;
+#ifndef Py_USING_MEMORY_DEBUGGER
+    uint arenaindex_temp;
+#endif
 
     if (p == NULL)      /* free(NULL) has no effect */
         return;
@@ -1167,6 +1178,9 @@
     void *bp;
     poolp pool;
     size_t size;
+#ifndef Py_USING_MEMORY_DEBUGGER
+    uint arenaindex_temp;
+#endif
 
     if (p == NULL)
         return PyObject_Malloc(nbytes);
@@ -1867,8 +1881,10 @@
 int
 Py_ADDRESS_IN_RANGE(void *P, poolp pool)
 {
-    return pool->arenaindex < maxarenas &&
-           (uptr)P - arenas[pool->arenaindex].address < (uptr)ARENA_SIZE &&
-           arenas[pool->arenaindex].address != 0;
+    uint arenaindex_temp = pool->arenaindex;
+
+    return arenaindex_temp < maxarenas &&
+           (uptr)P - arenas[arenaindex_temp].address < (uptr)ARENA_SIZE &&
+           arenas[arenaindex_temp].address != 0;
 }
 #endif

Modified: python/branches/py3k-cdecimal/Objects/typeobject.c
==============================================================================
--- python/branches/py3k-cdecimal/Objects/typeobject.c	(original)
+++ python/branches/py3k-cdecimal/Objects/typeobject.c	Tue Jan 11 18:07:55 2011
@@ -2325,7 +2325,7 @@
     res->ht_type.tp_basicsize = spec->basicsize;
     res->ht_type.tp_itemsize = spec->itemsize;
     res->ht_type.tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE;
-    
+
     for (slot = spec->slots; slot->slot; slot++) {
 	if (slot->slot >= sizeof(slotoffsets)/sizeof(slotoffsets[0])) {
 	    PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
@@ -2335,7 +2335,7 @@
     }
 
     return (PyObject*)res;
-    
+
  fail:
     Py_DECREF(res);
     return NULL;
@@ -6202,7 +6202,7 @@
            and first local variable on the stack. */
         PyFrameObject *f = PyThreadState_GET()->frame;
         PyCodeObject *co = f->f_code;
-        int i, n;
+        Py_ssize_t i, n;
         if (co == NULL) {
             PyErr_SetString(PyExc_SystemError,
                             "super(): no code object");

Modified: python/branches/py3k-cdecimal/Objects/typeslots.inc
==============================================================================
--- python/branches/py3k-cdecimal/Objects/typeslots.inc	(original)
+++ python/branches/py3k-cdecimal/Objects/typeslots.inc	Tue Jan 11 18:07:55 2011
@@ -1,6 +1,6 @@
-/* Generated by typeslots.py $Revision: 87011 $ */
-offsetof(PyHeapTypeObject, as_buffer.bf_getbuffer),
-offsetof(PyHeapTypeObject, as_buffer.bf_releasebuffer),
+/* Generated by typeslots.py $Revision: 87806 $ */
+0,
+0,
 offsetof(PyHeapTypeObject, as_mapping.mp_ass_subscript),
 offsetof(PyHeapTypeObject, as_mapping.mp_length),
 offsetof(PyHeapTypeObject, as_mapping.mp_subscript),

Modified: python/branches/py3k-cdecimal/Objects/typeslots.py
==============================================================================
--- python/branches/py3k-cdecimal/Objects/typeslots.py	(original)
+++ python/branches/py3k-cdecimal/Objects/typeslots.py	Tue Jan 11 18:07:55 2011
@@ -7,6 +7,8 @@
 res = {}
 for line in sys.stdin:
     m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
+    if not m:
+        continue
     member = m.group(1)
     if member.startswith("tp_"):
         member = "ht_type."+member
@@ -22,4 +24,7 @@
 
 M = max(res.keys())+1
 for i in range(1,M):
-    print("offsetof(PyHeapTypeObject, %s)," % res[i])
+    if i in res:
+        print("offsetof(PyHeapTypeObject, %s)," % res[i])
+    else:
+        print("0,")

Modified: python/branches/py3k-cdecimal/PC/python3.def
==============================================================================
--- python/branches/py3k-cdecimal/PC/python3.def	(original)
+++ python/branches/py3k-cdecimal/PC/python3.def	Tue Jan 11 18:07:55 2011
@@ -10,13 +10,6 @@
   PyBaseObject_Type=python32.PyBaseObject_Type DATA
   PyBool_FromLong=python32.PyBool_FromLong
   PyBool_Type=python32.PyBool_Type DATA
-  PyBuffer_FillContiguousStrides=python32.PyBuffer_FillContiguousStrides
-  PyBuffer_FillInfo=python32.PyBuffer_FillInfo
-  PyBuffer_FromContiguous=python32.PyBuffer_FromContiguous
-  PyBuffer_GetPointer=python32.PyBuffer_GetPointer
-  PyBuffer_IsContiguous=python32.PyBuffer_IsContiguous
-  PyBuffer_Release=python32.PyBuffer_Release
-  PyBuffer_ToContiguous=python32.PyBuffer_ToContiguous
   PyByteArrayIter_Type=python32.PyByteArrayIter_Type DATA
   PyByteArray_AsString=python32.PyByteArray_AsString
   PyByteArray_Concat=python32.PyByteArray_Concat
@@ -317,7 +310,6 @@
   PyMem_Malloc=python32.PyMem_Malloc
   PyMem_Realloc=python32.PyMem_Realloc
   PyMemberDescr_Type=python32.PyMemberDescr_Type DATA
-  PyMemoryView_FromBuffer=python32.PyMemoryView_FromBuffer
   PyMemoryView_FromObject=python32.PyMemoryView_FromObject
   PyMemoryView_GetContiguous=python32.PyMemoryView_GetContiguous
   PyMemoryView_Type=python32.PyMemoryView_Type DATA
@@ -399,7 +391,6 @@
   PyObject_CallObject=python32.PyObject_CallObject
   PyObject_CheckReadBuffer=python32.PyObject_CheckReadBuffer
   PyObject_ClearWeakRefs=python32.PyObject_ClearWeakRefs
-  PyObject_CopyData=python32.PyObject_CopyData
   PyObject_DelItem=python32.PyObject_DelItem
   PyObject_DelItemString=python32.PyObject_DelItemString
   PyObject_Dir=python32.PyObject_Dir
@@ -412,7 +403,6 @@
   PyObject_GenericSetAttr=python32.PyObject_GenericSetAttr
   PyObject_GetAttr=python32.PyObject_GetAttr
   PyObject_GetAttrString=python32.PyObject_GetAttrString
-  PyObject_GetBuffer=python32.PyObject_GetBuffer
   PyObject_GetItem=python32.PyObject_GetItem
   PyObject_GetIter=python32.PyObject_GetIter
   PyObject_HasAttr=python32.PyObject_HasAttr

Modified: python/branches/py3k-cdecimal/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k-cdecimal/Parser/tokenizer.c	(original)
+++ python/branches/py3k-cdecimal/Parser/tokenizer.c	Tue Jan 11 18:07:55 2011
@@ -590,7 +590,7 @@
         if (filename != NULL) {
             PyErr_Format(PyExc_SyntaxError,
                     "Non-UTF-8 code starting with '\\x%.2x' "
-                    "in file %.200U on line %i, "
+                    "in file %U on line %i, "
                     "but no encoding declared; "
                     "see http://python.org/dev/peps/pep-0263/ for details",
                     badchar, filename, tok->lineno + 1);
@@ -893,6 +893,13 @@
         if (tok->prompt != NULL) {
             char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
 #ifndef PGEN
+            if (newtok != NULL) {
+                char *translated = translate_newlines(newtok, 0, tok);
+                PyMem_FREE(newtok);
+                if (translated == NULL)
+                    return EOF;
+                newtok = translated;
+            }
             if (tok->encoding && newtok && *newtok) {
                 /* Recode to UTF-8 */
                 Py_ssize_t buflen;

Modified: python/branches/py3k-cdecimal/Python/ceval.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/ceval.c	(original)
+++ python/branches/py3k-cdecimal/Python/ceval.c	Tue Jan 11 18:07:55 2011
@@ -26,10 +26,11 @@
 
 typedef unsigned long long uint64;
 
-#if defined(__ppc__) /* <- Don't know if this is the correct symbol; this
-                           section should work for GCC on any PowerPC
-                           platform, irrespective of OS.
-                           POWER?  Who knows :-) */
+/* PowerPC suppport.
+   "__ppc__" appears to be the preprocessor definition to detect on OS X, whereas
+   "__powerpc__" appears to be the correct one for Linux with GCC
+*/
+#if defined(__ppc__) || defined (__powerpc__)
 
 #define READ_TIMESTAMP(var) ppc_getcounter(&var)
 

Modified: python/branches/py3k-cdecimal/Python/getargs.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/getargs.c	(original)
+++ python/branches/py3k-cdecimal/Python/getargs.c	Tue Jan 11 18:07:55 2011
@@ -146,10 +146,19 @@
 }
 
 static int
-addcleanup(void *ptr, PyObject **freelist, PyCapsule_Destructor destr)
+addcleanup(void *ptr, PyObject **freelist, int is_buffer)
 {
     PyObject *cobj;
     const char *name;
+    PyCapsule_Destructor destr;
+
+    if (is_buffer) {
+        destr = cleanup_buffer;
+        name = GETARGS_CAPSULE_NAME_CLEANUP_BUFFER;
+    } else {
+        destr = cleanup_ptr;
+        name = GETARGS_CAPSULE_NAME_CLEANUP_PTR;
+    }
 
     if (!*freelist) {
         *freelist = PyList_New(0);
@@ -159,13 +168,6 @@
         }
     }
 
-    if (destr == cleanup_ptr) {
-        name = GETARGS_CAPSULE_NAME_CLEANUP_PTR;
-    } else if (destr == cleanup_buffer) {
-        name = GETARGS_CAPSULE_NAME_CLEANUP_BUFFER;
-    } else {
-        return -1;
-    }
     cobj = PyCapsule_New(ptr, name, destr);
     if (!cobj) {
         destr(ptr);
@@ -597,8 +599,19 @@
 #define FETCH_SIZE      int *q=NULL;Py_ssize_t *q2=NULL;\
     if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \
     else q=va_arg(*p_va, int*);
-#define STORE_SIZE(s)   if (flags & FLAG_SIZE_T) *q2=s; else *q=s;
+#define STORE_SIZE(s)   \
+    if (flags & FLAG_SIZE_T) \
+        *q2=s; \
+    else { \
+        if (INT_MAX < s) { \
+            PyErr_SetString(PyExc_OverflowError, \
+                "size does not fit in an int"); \
+            return converterr("", arg, msgbuf, bufsize); \
+        } \
+        *q=s; \
+    }
 #define BUFFER_LEN      ((flags & FLAG_SIZE_T) ? *q2:*q)
+#define RETURN_ERR_OCCURRED return msgbuf
 
     const char *format = *p_format;
     char c = *format++;
@@ -610,19 +623,19 @@
         char *p = va_arg(*p_va, char *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<b>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<b>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else if (ival < 0) {
             PyErr_SetString(PyExc_OverflowError,
-            "unsigned byte integer is less than minimum");
-            return converterr("integer<b>", arg, msgbuf, bufsize);
+                            "unsigned byte integer is less than minimum");
+            RETURN_ERR_OCCURRED;
         }
         else if (ival > UCHAR_MAX) {
             PyErr_SetString(PyExc_OverflowError,
-            "unsigned byte integer is greater than maximum");
-            return converterr("integer<b>", arg, msgbuf, bufsize);
+                            "unsigned byte integer is greater than maximum");
+            RETURN_ERR_OCCURRED;
         }
         else
             *p = (unsigned char) ival;
@@ -634,10 +647,10 @@
         char *p = va_arg(*p_va, char *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<B>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsUnsignedLongMask(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<B>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = (unsigned char) ival;
         break;
@@ -647,19 +660,19 @@
         short *p = va_arg(*p_va, short *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<h>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<h>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else if (ival < SHRT_MIN) {
             PyErr_SetString(PyExc_OverflowError,
-            "signed short integer is less than minimum");
-            return converterr("integer<h>", arg, msgbuf, bufsize);
+                            "signed short integer is less than minimum");
+            RETURN_ERR_OCCURRED;
         }
         else if (ival > SHRT_MAX) {
             PyErr_SetString(PyExc_OverflowError,
-            "signed short integer is greater than maximum");
-            return converterr("integer<h>", arg, msgbuf, bufsize);
+                            "signed short integer is greater than maximum");
+            RETURN_ERR_OCCURRED;
         }
         else
             *p = (short) ival;
@@ -671,10 +684,10 @@
         unsigned short *p = va_arg(*p_va, unsigned short *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<H>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsUnsignedLongMask(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<H>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = (unsigned short) ival;
         break;
@@ -684,19 +697,19 @@
         int *p = va_arg(*p_va, int *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<i>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<i>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else if (ival > INT_MAX) {
             PyErr_SetString(PyExc_OverflowError,
-                "signed integer is greater than maximum");
-            return converterr("integer<i>", arg, msgbuf, bufsize);
+                            "signed integer is greater than maximum");
+            RETURN_ERR_OCCURRED;
         }
         else if (ival < INT_MIN) {
             PyErr_SetString(PyExc_OverflowError,
-                "signed integer is less than minimum");
-            return converterr("integer<i>", arg, msgbuf, bufsize);
+                            "signed integer is less than minimum");
+            RETURN_ERR_OCCURRED;
         }
         else
             *p = ival;
@@ -708,10 +721,10 @@
         unsigned int *p = va_arg(*p_va, unsigned int *);
         unsigned int ival;
         if (float_argument_error(arg))
-            return converterr("integer<I>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = (unsigned int)PyLong_AsUnsignedLongMask(arg);
         if (ival == (unsigned int)-1 && PyErr_Occurred())
-            return converterr("integer<I>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = ival;
         break;
@@ -723,14 +736,14 @@
         Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
         Py_ssize_t ival = -1;
         if (float_argument_error(arg))
-            return converterr("integer<n>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         iobj = PyNumber_Index(arg);
         if (iobj != NULL) {
             ival = PyLong_AsSsize_t(iobj);
             Py_DECREF(iobj);
         }
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<n>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         *p = ival;
         break;
     }
@@ -738,10 +751,10 @@
         long *p = va_arg(*p_va, long *);
         long ival;
         if (float_argument_error(arg))
-            return converterr("integer<l>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsLong(arg);
         if (ival == -1 && PyErr_Occurred())
-            return converterr("integer<l>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = ival;
         break;
@@ -763,10 +776,10 @@
         PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * );
         PY_LONG_LONG ival;
         if (float_argument_error(arg))
-            return converterr("long<L>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         ival = PyLong_AsLongLong(arg);
         if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred())
-            return converterr("long<L>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = ival;
         break;
@@ -788,7 +801,7 @@
         float *p = va_arg(*p_va, float *);
         double dval = PyFloat_AsDouble(arg);
         if (PyErr_Occurred())
-            return converterr("float<f>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = (float) dval;
         break;
@@ -798,7 +811,7 @@
         double *p = va_arg(*p_va, double *);
         double dval = PyFloat_AsDouble(arg);
         if (PyErr_Occurred())
-            return converterr("float<d>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = dval;
         break;
@@ -809,7 +822,7 @@
         Py_complex cval;
         cval = PyComplex_AsCComplex(arg);
         if (PyErr_Occurred())
-            return converterr("complex<D>", arg, msgbuf, bufsize);
+            RETURN_ERR_OCCURRED;
         else
             *p = cval;
         break;
@@ -845,7 +858,7 @@
             if (getbuffer(arg, (Py_buffer*)p, &buf) < 0)
                 return converterr(buf, arg, msgbuf, bufsize);
             format++;
-            if (addcleanup(p, freelist, cleanup_buffer)) {
+            if (addcleanup(p, freelist, 1)) {
                 return converterr(
                     "(cleanup problem)",
                     arg, msgbuf, bufsize);
@@ -891,7 +904,7 @@
                 if (getbuffer(arg, p, &buf) < 0)
                     return converterr(buf, arg, msgbuf, bufsize);
             }
-            if (addcleanup(p, freelist, cleanup_buffer)) {
+            if (addcleanup(p, freelist, 1)) {
                 return converterr(
                     "(cleanup problem)",
                     arg, msgbuf, bufsize);
@@ -1095,11 +1108,9 @@
                 if (*buffer == NULL) {
                     Py_DECREF(s);
                     PyErr_NoMemory();
-                    return converterr(
-                        "(memory error)",
-                        arg, msgbuf, bufsize);
+                    RETURN_ERR_OCCURRED;
                 }
-                if (addcleanup(*buffer, freelist, cleanup_ptr)) {
+                if (addcleanup(*buffer, freelist, 0)) {
                     Py_DECREF(s);
                     return converterr(
                         "(cleanup problem)",
@@ -1139,10 +1150,9 @@
             if (*buffer == NULL) {
                 Py_DECREF(s);
                 PyErr_NoMemory();
-                return converterr("(memory error)",
-                                  arg, msgbuf, bufsize);
+                RETURN_ERR_OCCURRED;
             }
-            if (addcleanup(*buffer, freelist, cleanup_ptr)) {
+            if (addcleanup(*buffer, freelist, 0)) {
                 Py_DECREF(s);
                 return converterr("(cleanup problem)",
                                 arg, msgbuf, bufsize);
@@ -1234,7 +1244,7 @@
             PyBuffer_Release((Py_buffer*)p);
             return converterr("contiguous buffer", arg, msgbuf, bufsize);
         }
-        if (addcleanup(p, freelist, cleanup_buffer)) {
+        if (addcleanup(p, freelist, 1)) {
             return converterr(
                 "(cleanup problem)",
                 arg, msgbuf, bufsize);
@@ -1249,6 +1259,11 @@
 
     *p_format = format;
     return NULL;
+
+#undef FETCH_SIZE
+#undef STORE_SIZE
+#undef BUFFER_LEN
+#undef RETURN_ERR_OCCURRED
 }
 
 static Py_ssize_t

Modified: python/branches/py3k-cdecimal/Python/pythonrun.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/pythonrun.c	(original)
+++ python/branches/py3k-cdecimal/Python/pythonrun.c	Tue Jan 11 18:07:55 2011
@@ -1202,7 +1202,8 @@
 {
     PyObject *m, *d, *v;
     const char *ext;
-    int set_file_name = 0, ret, len;
+    int set_file_name = 0, ret;
+    size_t len;
 
     m = PyImport_AddModule("__main__");
     if (m == NULL)

Modified: python/branches/py3k-cdecimal/Python/sysmodule.c
==============================================================================
--- python/branches/py3k-cdecimal/Python/sysmodule.c	(original)
+++ python/branches/py3k-cdecimal/Python/sysmodule.c	Tue Jan 11 18:07:55 2011
@@ -1427,9 +1427,9 @@
     flags__doc__,       /* doc */
     flags_fields,       /* fields */
 #ifdef RISCOS
-    12
+    13
 #else
-    11
+    12
 #endif
 };
 

Modified: python/branches/py3k-cdecimal/Tools/README
==============================================================================
--- python/branches/py3k-cdecimal/Tools/README	(original)
+++ python/branches/py3k-cdecimal/Tools/README	Tue Jan 11 18:07:55 2011
@@ -34,8 +34,12 @@
 
 test2to3        A demonstration of how to use 2to3 transparently in setup.py.
 
-unicode         Tools used to generate unicode database files for
-                Python 2.0 (by Fredrik Lundh).
+unicode         Tools for generating unicodedata and codecs from unicode.org
+                and other mapping files (by Fredrik Lundh, Marc-Andre Lemburg
+                and Martin von Loewis).
+
+unittestgui     A Tkinter based GUI test runner for unittest, with test
+                discovery.
 
 world           Script to take a list of Internet addresses and print
                 out where in the world those addresses originate from,

Modified: python/branches/py3k-cdecimal/configure
==============================================================================
--- python/branches/py3k-cdecimal/configure	(original)
+++ python/branches/py3k-cdecimal/configure	Tue Jan 11 18:07:55 2011
@@ -1,14 +1,14 @@
 #! /bin/sh
-# From configure.in Revision: 86687 .
+# From configure.in Revision: 87646 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for python 3.2.
+# Generated by GNU Autoconf 2.65 for python 3.2.
 #
 # Report bugs to <http://bugs.python.org/>.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -320,7 +320,7 @@
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -360,19 +360,19 @@
 fi # as_fn_arith
 
 
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
+# script with status $?, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
   fi
-  $as_echo "$as_me: error: $2" >&2
+  $as_echo "$as_me: error: $1" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -534,7 +534,7 @@
 exec 6>&1
 
 # Name of the host.
-# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
@@ -829,9 +829,8 @@
   fi
 
   case $ac_option in
-  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *=)   ac_optarg= ;;
-  *)    ac_optarg=yes ;;
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -876,7 +875,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -902,7 +901,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1106,7 +1105,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1122,7 +1121,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1152,8 +1151,8 @@
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
+  -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
     ;;
 
   *=*)
@@ -1161,7 +1160,7 @@
     # Reject names that are not valid shell variable names.
     case $ac_envvar in #(
       '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
     esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
@@ -1179,13 +1178,13 @@
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error $? "missing argument to $ac_option"
+  as_fn_error "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1208,7 +1207,7 @@
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1222,8 +1221,8 @@
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
+    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1238,9 +1237,9 @@
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error $? "working directory cannot be determined"
+  as_fn_error "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error $? "pwd does not report name of working directory"
+  as_fn_error "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1279,11 +1278,11 @@
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1323,7 +1322,7 @@
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking ...' messages
+  -q, --quiet, --silent   do not print \`checking...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -1509,9 +1508,9 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 python configure 3.2
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.65
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1581,7 +1580,7 @@
     mv -f conftest.er1 conftest.err
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
+  test $ac_status = 0; } >/dev/null && {
 	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
 	 test ! -s conftest.err
        }; then :
@@ -1605,10 +1604,10 @@
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval "test \"\${$3+set}\"" = set; then :
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -1644,7 +1643,7 @@
 else
   ac_header_preproc=no
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
 $as_echo "$ac_header_preproc" >&6; }
 
@@ -1667,15 +1666,17 @@
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## -------------------------------------- ##
+( cat <<\_ASBOX
+## -------------------------------------- ##
 ## Report this to http://bugs.python.org/ ##
-## -------------------------------------- ##"
+## -------------------------------------- ##
+_ASBOX
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -1739,7 +1740,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1816,7 +1817,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1870,7 +1871,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
 $as_echo_n "checking for uint$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1900,7 +1901,8 @@
 esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       if eval test \"x\$"$3"\" = x"no"; then :
+       eval as_val=\$$3
+   if test "x$as_val" = x""no; then :
 
 else
   break
@@ -1923,7 +1925,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
 $as_echo_n "checking for int$2_t... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1934,11 +1936,11 @@
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-	     enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
+	     0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
 test_array [0] = 0
 
   ;
@@ -1949,11 +1951,11 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-	        enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
+		($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
 		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
 test_array [0] = 0
 
@@ -1974,7 +1976,8 @@
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       if eval test \"x\$"$3"\" = x"no"; then :
+       eval as_val=\$$3
+   if test "x$as_val" = x""no; then :
 
 else
   break
@@ -2174,7 +2177,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2242,7 +2245,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
 $as_echo_n "checking for $2.$3... " >&6; }
-if eval "test \"\${$4+set}\"" = set; then :
+if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2290,18 +2293,15 @@
 
 } # ac_fn_c_check_member
 
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
 ac_fn_c_check_decl ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  as_decl_name=`echo $2|sed 's/ *(.*//'`
-  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
+$as_echo_n "checking whether $2 is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2310,12 +2310,8 @@
 int
 main ()
 {
-#ifndef $as_decl_name
-#ifdef __cplusplus
-  (void) $as_decl_use;
-#else
-  (void) $as_decl_name;
-#endif
+#ifndef $2
+  (void) $2;
 #endif
 
   ;
@@ -2340,7 +2336,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by python $as_me 3.2, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
 
@@ -2450,9 +2446,11 @@
   {
     echo
 
-    $as_echo "## ---------------- ##
+    cat <<\_ASBOX
+## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##"
+## ---------------- ##
+_ASBOX
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -2486,9 +2484,11 @@
 )
     echo
 
-    $as_echo "## ----------------- ##
+    cat <<\_ASBOX
+## ----------------- ##
 ## Output variables. ##
-## ----------------- ##"
+## ----------------- ##
+_ASBOX
     echo
     for ac_var in $ac_subst_vars
     do
@@ -2501,9 +2501,11 @@
     echo
 
     if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
+      cat <<\_ASBOX
+## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##"
+## ------------------- ##
+_ASBOX
       echo
       for ac_var in $ac_subst_files
       do
@@ -2517,9 +2519,11 @@
     fi
 
     if test -s confdefs.h; then
-      $as_echo "## ----------- ##
+      cat <<\_ASBOX
+## ----------- ##
 ## confdefs.h. ##
-## ----------- ##"
+## ----------- ##
+_ASBOX
       echo
       cat confdefs.h
       echo
@@ -2574,12 +2578,7 @@
 ac_site_file1=NONE
 ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
+  ac_site_file1=$CONFIG_SITE
 elif test "x$prefix" != xNONE; then
   ac_site_file1=$prefix/share/config.site
   ac_site_file2=$prefix/etc/config.site
@@ -2594,11 +2593,15 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
+<<<<<<< .working
     . "$ac_site_file" \
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+    . "$ac_site_file"
+>>>>>>> .merge-right.r87926
   fi
 done
 
@@ -2674,7 +2677,7 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -2775,7 +2778,7 @@
 		UNIVERSALSDK=$enableval
 		if test ! -d "${UNIVERSALSDK}"
 		then
-			as_fn_error $? "--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}" "$LINENO" 5
+			as_fn_error "--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}" "$LINENO" 5
 		fi
 		;;
 	esac
@@ -3167,7 +3170,7 @@
 # If the user switches compilers, we can't believe the cache
 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
 then
-  as_fn_error $? "cached CC is different -- throw away $cache_file
+  as_fn_error "cached CC is different -- throw away $cache_file
 (it is also a good idea to do 'make clean' before compiling)" "$LINENO" 5
 fi
 
@@ -3477,8 +3480,13 @@
 
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error $? "no acceptable C compiler found in \$PATH
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+>>>>>>> .merge-right.r87926
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3592,8 +3600,14 @@
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "C compiler cannot create executables
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3635,8 +3649,13 @@
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+>>>>>>> .merge-right.r87926
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3693,9 +3712,13 @@
     else
 	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
+as_fn_error "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
+<<<<<<< .working
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+See \`config.log' for more details." "$LINENO" 5; }
+>>>>>>> .merge-right.r87926
     fi
   fi
 fi
@@ -3746,8 +3769,13 @@
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error $? "cannot compute suffix of object files: cannot compile
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
+>>>>>>> .merge-right.r87926
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -4200,7 +4228,7 @@
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -4216,11 +4244,11 @@
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
   break
 fi
@@ -4259,7 +4287,7 @@
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -4275,18 +4303,23 @@
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
 
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
+>>>>>>> .merge-right.r87926
 fi
 
 ac_ext=c
@@ -4347,7 +4380,7 @@
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -4413,7 +4446,7 @@
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4545,7 +4578,8 @@
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
 "
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -5169,22 +5203,16 @@
 esac
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
+  for ac_t in install-sh install.sh shtool; do
+    if test -f "$ac_dir/$ac_t"; then
+      ac_aux_dir=$ac_dir
+      ac_install_sh="$ac_aux_dir/$ac_t -c"
+      break 2
+    fi
+  done
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -5522,7 +5550,7 @@
 		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
 
 		 else
-	           as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+	           as_fn_error "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
 
 		 fi
 
@@ -6016,7 +6044,8 @@
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -6030,7 +6059,7 @@
   as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if eval "test \"\${$as_ac_Header+set}\"" = set; then :
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -6057,7 +6086,8 @@
 eval ac_res=\$$as_ac_Header
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
@@ -6584,8 +6614,14 @@
   if test "$ac_cv_type_int" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (int)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (int)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_int=0
    fi
@@ -6617,8 +6653,14 @@
   if test "$ac_cv_type_long" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (long)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_long=0
    fi
@@ -6650,8 +6692,14 @@
   if test "$ac_cv_type_void_p" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (void *)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (void *)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_void_p=0
    fi
@@ -6683,8 +6731,14 @@
   if test "$ac_cv_type_short" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (short)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (short)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_short=0
    fi
@@ -6716,8 +6770,14 @@
   if test "$ac_cv_type_float" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (float)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (float)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_float=0
    fi
@@ -6749,8 +6809,14 @@
   if test "$ac_cv_type_double" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (double)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (double)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_double=0
    fi
@@ -6782,8 +6848,14 @@
   if test "$ac_cv_type_fpos_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (fpos_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (fpos_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_fpos_t=0
    fi
@@ -6815,8 +6887,14 @@
   if test "$ac_cv_type_size_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (size_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (size_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_size_t=0
    fi
@@ -6848,8 +6926,14 @@
   if test "$ac_cv_type_pid_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (pid_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (pid_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_pid_t=0
    fi
@@ -6908,8 +6992,14 @@
   if test "$ac_cv_type_long_long" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (long long)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_long_long=0
    fi
@@ -6969,8 +7059,14 @@
   if test "$ac_cv_type_long_double" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (long double)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long double)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_long_double=0
    fi
@@ -7031,8 +7127,14 @@
   if test "$ac_cv_type__Bool" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (_Bool)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (_Bool)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof__Bool=0
    fi
@@ -7079,8 +7181,14 @@
   if test "$ac_cv_type_uintptr_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (uintptr_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (uintptr_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_uintptr_t=0
    fi
@@ -7120,8 +7228,14 @@
   if test "$ac_cv_type_off_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (off_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (off_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_off_t=0
    fi
@@ -7182,8 +7296,14 @@
   if test "$ac_cv_type_time_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (time_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (time_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_time_t=0
    fi
@@ -7254,8 +7374,14 @@
   if test "$ac_cv_type_pthread_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (pthread_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (pthread_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_pthread_t=0
    fi
@@ -7342,7 +7468,7 @@
     		MACOSX_DEFAULT_ARCH="ppc"
     		;;
     	*)
-    		as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
+    		as_fn_error "Unexpected output of 'arch' on OSX" "$LINENO" 5
     		;;
     	esac
     else
@@ -7354,7 +7480,7 @@
     		MACOSX_DEFAULT_ARCH="ppc64"
     		;;
     	*)
-    		as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
+    		as_fn_error "Unexpected output of 'arch' on OSX" "$LINENO" 5
     		;;
     	esac
 
@@ -7380,7 +7506,7 @@
 $as_echo "yes" >&6; }
 	if test $enable_shared = "yes"
 	then
-		as_fn_error $? "Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" "$LINENO" 5
+		as_fn_error "Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" "$LINENO" 5
 	fi
 else
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -7533,8 +7659,8 @@
 				esac
 		fi;;
 	NetBSD*|DragonFly*)
-		LDSHARED="cc -shared"
-		LDCXXSHARED="c++ -shared";;
+		LDSHARED='$(CC) -shared'
+		LDCXXSHARED='$(CXX) -shared';;
 	OpenUNIX*|UnixWare*)
 		if test "$GCC" = "yes" ; then
 			LDSHARED='$(CC) -shared'
@@ -8176,12 +8302,12 @@
   withval=$with_dbmliborder;
 if test x$with_dbmliborder = xyes
 then
-as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
+as_fn_error "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
 else
   for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
     if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
     then
-      as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
+      as_fn_error "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
     fi
   done
 fi
@@ -8974,7 +9100,7 @@
 			;;
 		solaris)
 			if test -f /etc/netconfig; then
-                          if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
+                          if $GREP -q tcp6 /etc/netconfig; then
 				ipv6type=$i
 				ipv6trylibc=yes
                           fi
@@ -9180,7 +9306,7 @@
 $as_echo "#define WITH_VALGRIND 1" >>confdefs.h
 
 else
-  as_fn_error $? "Valgrind support requested but headers not available" "$LINENO" 5
+  as_fn_error "Valgrind support requested but headers not available" "$LINENO" 5
 
 fi
 
@@ -9274,7 +9400,8 @@
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -10269,7 +10396,8 @@
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -10278,44 +10406,25 @@
 done
 
 
-ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2"
-if test "x$ac_cv_func_dup2" = x""yes; then :
-  $as_echo "#define HAVE_DUP2 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" dup2.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS dup2.$ac_objext"
- ;;
-esac
-
-fi
-
-ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd"
-if test "x$ac_cv_func_getcwd" = x""yes; then :
-  $as_echo "#define HAVE_GETCWD 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" getcwd.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getcwd.$ac_objext"
- ;;
-esac
-
-fi
-
-ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
-if test "x$ac_cv_func_strdup" = x""yes; then :
-  $as_echo "#define HAVE_STRDUP 1" >>confdefs.h
+for ac_func in dup2 getcwd strdup
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
 else
   case " $LIBOBJS " in
-  *" strdup.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS strdup.$ac_objext"
+  *" $ac_func.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
  ;;
 esac
 
 fi
+done
 
 
 for ac_func in getpgrp
@@ -11528,7 +11637,7 @@
 then LIBM=$withval
      { $as_echo "$as_me:${as_lineno-$LINENO}: result: set LIBM=\"$withval\"" >&5
 $as_echo "set LIBM=\"$withval\"" >&6; }
-else as_fn_error $? "proper usage is --with-libm=STRING" "$LINENO" 5
+else as_fn_error "proper usage is --with-libm=STRING" "$LINENO" 5
 fi
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: default LIBM=\"$LIBM\"" >&5
@@ -11552,7 +11661,7 @@
 then LIBC=$withval
      { $as_echo "$as_me:${as_lineno-$LINENO}: result: set LIBC=\"$withval\"" >&5
 $as_echo "set LIBC=\"$withval\"" >&6; }
-else as_fn_error $? "proper usage is --with-libc=STRING" "$LINENO" 5
+else as_fn_error "proper usage is --with-libc=STRING" "$LINENO" 5
 fi
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: default LIBC=\"$LIBC\"" >&5
@@ -11836,7 +11945,8 @@
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -11848,7 +11958,8 @@
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -12111,7 +12222,11 @@
 15|30)
   ;;
 *)
+<<<<<<< .working
   as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;;
+=======
+  as_fn_error "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;;
+>>>>>>> .merge-right.r87926
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5
 $as_echo "$enable_big_digits" >&6; }
@@ -12162,8 +12277,14 @@
   if test "$ac_cv_type_wchar_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+<<<<<<< .working
 as_fn_error 77 "cannot compute sizeof (wchar_t)
 See \`config.log' for more details" "$LINENO" 5; }
+=======
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (wchar_t)
+See \`config.log' for more details." "$LINENO" 5; }; }
+>>>>>>> .merge-right.r87926
    else
      ac_cv_sizeof_wchar_t=0
    fi
@@ -12532,8 +12653,13 @@
 
      ;; #(
    *)
+<<<<<<< .working
      as_fn_error $? "unknown endianness
  presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+=======
+     as_fn_error "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+>>>>>>> .merge-right.r87926
  esac
 
 
@@ -12794,7 +12920,7 @@
   have_readline=no
 
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 if test $have_readline = yes
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12968,7 +13094,7 @@
   have_readline=no
 
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+rm -f conftest.err conftest.$ac_ext
 if test $have_readline = yes
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -13784,7 +13910,11 @@
 
 
 case $ac_sys_system in
+<<<<<<< .working
   OSF*) as_fn_error $? "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;;
+=======
+  OSF*) as_fn_error "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;;
+>>>>>>> .merge-right.r87926
 esac
 
 ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2"
@@ -13902,7 +14032,6 @@
 
 ac_libobjs=
 ac_ltlibobjs=
-U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -14065,19 +14194,19 @@
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
+# script with status $?, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
   fi
-  $as_echo "$as_me: error: $2" >&2
+  $as_echo "$as_me: error: $1" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -14273,7 +14402,7 @@
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -14327,7 +14456,7 @@
 # values after options handling.
 ac_log="
 This file was extended by python $as_me 3.2, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -14351,8 +14480,8 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
+config_files="`echo $ac_config_files`"
+config_headers="`echo $ac_config_headers`"
 
 _ACEOF
 
@@ -14389,10 +14518,10 @@
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 python config.status 3.2
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.65,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -14408,16 +14537,11 @@
 while test $# != 0
 do
   case $1 in
-  --*=?*)
+  --*=*)
     ac_option=`expr "X$1" : 'X\([^=]*\)='`
     ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
-  --*=)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=
-    ac_shift=:
-    ;;
   *)
     ac_option=$1
     ac_optarg=$2
@@ -14439,7 +14563,6 @@
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    '') as_fn_error $? "missing file argument" ;;
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
@@ -14452,7 +14575,7 @@
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    as_fn_error $? "ambiguous option: \`$1'
+    as_fn_error "ambiguous option: \`$1'
 Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
@@ -14461,7 +14584,7 @@
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) as_fn_error $? "unrecognized option: \`$1'
+  -*) as_fn_error "unrecognized option: \`$1'
 Try \`$0 --help' for more information." ;;
 
   *) as_fn_append ac_config_targets " $1"
@@ -14520,7 +14643,11 @@
     "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
     "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;;
 
+<<<<<<< .working
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+=======
+  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+>>>>>>> .merge-right.r87926
   esac
 done
 
@@ -14557,7 +14684,7 @@
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -14574,7 +14701,7 @@
 fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
+  ac_cs_awk_cr='\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
@@ -14588,18 +14715,18 @@
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -14688,28 +14815,20 @@
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+  || as_fn_error "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
-# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
-h
-s///
-s/^/:/
-s/[	 ]*$/:/
-s/:\$(srcdir):/:/g
-s/:\${srcdir}:/:/g
-s/:@srcdir@:/:/g
-s/^:*//
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
 s/:*$//
-x
-s/\(=[	 ]*\).*/\1/
-G
-s/\n//
 s/^[^=]*=[	 ]*$//
 }'
 fi
@@ -14737,7 +14856,7 @@
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -14822,7 +14941,7 @@
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -14835,7 +14954,11 @@
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
+<<<<<<< .working
   :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+=======
+  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+>>>>>>> .merge-right.r87926
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -14863,7 +14986,11 @@
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
+<<<<<<< .working
 	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+=======
+	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+>>>>>>> .merge-right.r87926
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -14890,7 +15017,11 @@
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
+<<<<<<< .working
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+=======
+      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+>>>>>>> .merge-right.r87926
     esac
     ;;
   esac
@@ -15021,22 +15152,22 @@
 $ac_datarootdir_hack
 "
 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined" >&5
+which seems to be undefined.  Please make sure it is defined." >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined" >&2;}
+which seems to be undefined.  Please make sure it is defined." >&2;}
 
   rm -f "$tmp/stdin"
   case $ac_file in
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -15047,19 +15178,19 @@
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error $? "could not create -" "$LINENO" 5
+      || as_fn_error "could not create -" "$LINENO" 5
   fi
  ;;
 
@@ -15079,7 +15210,7 @@
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -15100,7 +15231,7 @@
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || as_fn_exit 1
+  $ac_cs_success || as_fn_exit $?
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5

Modified: python/branches/py3k-cdecimal/configure.in
==============================================================================
--- python/branches/py3k-cdecimal/configure.in	(original)
+++ python/branches/py3k-cdecimal/configure.in	Tue Jan 11 18:07:55 2011
@@ -1752,8 +1752,8 @@
 				esac
 		fi;;
 	NetBSD*|DragonFly*)
-		LDSHARED="cc -shared"
-		LDCXXSHARED="c++ -shared";;
+		LDSHARED='$(CC) -shared'
+		LDCXXSHARED='$(CXX) -shared';;
 	OpenUNIX*|UnixWare*)
 		if test "$GCC" = "yes" ; then
 			LDSHARED='$(CC) -shared'
@@ -2352,7 +2352,7 @@
 			;;
 		solaris)
 			if test -f /etc/netconfig; then
-                          if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
+                          if $GREP -q tcp6 /etc/netconfig; then
 				ipv6type=$i
 				ipv6trylibc=yes
                           fi


More information about the Python-checkins mailing list