[Python-checkins] r66293 - in python/branches/tlee-ast-optimize: Doc/extending/windows.rst Doc/library/2to3.rst Doc/library/basehttpserver.rst Doc/library/bsddb.rst Doc/library/cgi.rst Doc/library/codecs.rst Doc/library/cookie.rst Doc/library/ctypes.rst Doc/library/dbhash.rst Doc/library/functions.rst Doc/library/logging.rst Doc/library/math.rst Doc/library/multiprocessing.rst Doc/library/optparse.rst Doc/library/smtplib.rst Doc/library/sqlite3.rst Doc/library/threading.rst Doc/library/urllib.rst Doc/library/urlparse.rst Doc/library/warnings.rst Doc/reference/datamodel.rst Doc/whatsnew/2.6.rst Include/cobject.h Lib/BaseHTTPServer.py Lib/Cookie.py Lib/abc.py Lib/asynchat.py Lib/bsddb/__init__.py Lib/bsddb/dbshelve.py Lib/bsddb/dbtables.py Lib/bsddb/dbutils.py Lib/bsddb/test/test_all.py Lib/bsddb/test/test_associate.py Lib/bsddb/test/test_basics.py Lib/bsddb/test/test_compare.py Lib/bsddb/test/test_compat.py Lib/bsddb/test/test_cursor_pget_bug.py Lib/bsddb/test/test_dbobj.py Lib/bsddb/test/test_dbshelve.py Lib/bsddb/test/test_dbtables.py Lib/bsddb/test/test_distributed_transactions.py Lib/bsddb/test/test_early_close.py Lib/bsddb/test/test_get_none.py Lib/bsddb/test/test_join.py Lib/bsddb/test/test_lock.py Lib/bsddb/test/test_misc.py Lib/bsddb/test/test_pickle.py Lib/bsddb/test/test_queue.py Lib/bsddb/test/test_recno.py Lib/bsddb/test/test_replication.py Lib/bsddb/test/test_sequence.py Lib/bsddb/test/test_thread.py Lib/cgi.py Lib/dbhash.py Lib/distutils/dist.py Lib/distutils/msvc9compiler.py Lib/distutils/tests/test_dist.py Lib/hashlib.py Lib/httplib.py Lib/lib2to3 Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_paren.py Lib/lib2to3/fixes/fix_raw_input.py Lib/lib2to3/fixes/fix_sys_exc.py Lib/lib2to3/main.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/support.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/logging/__init__.py Lib/logging/config.py Lib/mimetools.py Lib/msilib/__init__.py Lib/multiprocessing/managers.py Lib/os.py Lib/platform.py Lib/pydoc.py Lib/test/crashers/iter.py Lib/test/string_tests.py Lib/test/test_asyncore.py Lib/test/test_cgi.py Lib/test/test_fileio.py Lib/test/test_float.py Lib/test/test_logging.py Lib/test/test_os.py Lib/test/test_py3kwarn.py Lib/test/test_support.py Lib/test/test_unicode.py Lib/test/test_urlparse.py Lib/test/test_warnings.py Lib/threading.py Lib/urlparse.py Lib/warnings.py Lib/zipfile.py Makefile.pre.in Misc/ACKS Misc/NEWS Modules/_bsddb.c Modules/_fileio.c Modules/_multiprocessing/multiprocessing.h Modules/bsddb.h Objects/cobject.c Objects/stringobject.c PC/VS7.1/pythoncore.vcproj PC/VS7.1/readme.txt PC/VS8.0/_bsddb.vcproj PC/VS8.0/_ctypes.vcproj PC/VS8.0/_multiprocessing.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyproject.vsprops PC/VS8.0/sqlite3.vcproj PCbuild/vs9to8.py Python/_warnings.c Python/getargs.c Python/import.c README Tools/scripts/2to3 configure configure.in pyconfig.h.in

thomas.lee python-checkins at python.org
Sun Sep 7 18:03:27 CEST 2008


Author: thomas.lee
Date: Sun Sep  7 18:03:22 2008
New Revision: 66293

Log:
Merged revisions 66050-66292 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

................
  r66053 | georg.brandl | 2008-08-28 19:40:18 +1000 (Thu, 28 Aug 2008) | 2 lines
  
  #3711: .dll isn't a valid Python extension anymore.
................
  r66058 | antoine.pitrou | 2008-08-30 04:39:48 +1000 (Sat, 30 Aug 2008) | 7 lines
  
  #3668: When PyArg_ParseTuple correctly parses a s* format, but raises an
  exception afterwards (for a subsequent parameter), the user code will
  not call PyBuffer_Release() and memory will leak.
  
  Reviewed by Amaury Forgeot d'Arc.
................
  r66060 | armin.rigo | 2008-08-30 07:21:52 +1000 (Sat, 30 Aug 2008) | 3 lines
  
  A collection of crashers, all variants of the idea
  of issue #3720.
................
  r66062 | georg.brandl | 2008-08-30 19:49:36 +1000 (Sat, 30 Aug 2008) | 2 lines
  
  #3730: mention "server" attribute explicitly.
................
  r66063 | georg.brandl | 2008-08-30 19:52:44 +1000 (Sat, 30 Aug 2008) | 2 lines
  
  #3716: fix typo.
................
  r66065 | georg.brandl | 2008-08-30 20:03:09 +1000 (Sat, 30 Aug 2008) | 2 lines
  
  #3569: eval() also accepts "exec"able code objects.
................
  r66067 | georg.brandl | 2008-08-30 23:17:39 +1000 (Sat, 30 Aug 2008) | 2 lines
  
  super() actually returns a super object.
................
  r66071 | andrew.kuchling | 2008-08-31 01:19:57 +1000 (Sun, 31 Aug 2008) | 1 line
  
  Partial edits from revision and tidying pass
................
  r66072 | andrew.kuchling | 2008-08-31 01:21:23 +1000 (Sun, 31 Aug 2008) | 1 line
  
  Tidy up some sentences
................
  r66073 | andrew.kuchling | 2008-08-31 01:25:47 +1000 (Sun, 31 Aug 2008) | 1 line
  
  Correction from Antoine Pitrou: BufferedWriter and Reader support seek()
................
  r66074 | andrew.kuchling | 2008-08-31 02:44:54 +1000 (Sun, 31 Aug 2008) | 1 line
  
  Edit four more sections
................
  r66076 | georg.brandl | 2008-08-31 05:03:43 +1000 (Sun, 31 Aug 2008) | 2 lines
  
  #3707: fix inf. recursion in pydoc topic search. Rev'd by Antoine.
................
  r66080 | georg.brandl | 2008-08-31 08:00:28 +1000 (Sun, 31 Aug 2008) | 2 lines
  
  Fix markup.
................
  r66082 | andrew.kuchling | 2008-08-31 08:56:54 +1000 (Sun, 31 Aug 2008) | 1 line
  
  More edits; markup fixes
................
  r66083 | andrew.kuchling | 2008-08-31 12:24:08 +1000 (Sun, 31 Aug 2008) | 1 line
  
  More edits
................
  r66085 | nick.coghlan | 2008-08-31 23:10:50 +1000 (Sun, 31 Aug 2008) | 1 line
  
  Issue 2235: document the ability to block inheritance of __hash__ in the language reference
................
  r66088 | jesus.cea | 2008-09-01 00:00:51 +1000 (Mon, 01 Sep 2008) | 6 lines
  
  Update bsddb code to version 4.7.3pre2. This code should
  be compatible with Python 3.0, also.
  
    http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3
................
  r66090 | andrew.kuchling | 2008-09-01 00:29:31 +1000 (Mon, 01 Sep 2008) | 1 line
  
  Edit the library section, rearranging items to flow better and making lots of edits
................
  r66091 | andrew.kuchling | 2008-09-01 01:41:48 +1000 (Mon, 01 Sep 2008) | 1 line
  
  Last batch of edits; remove the 'other changes' section
................
  r66092 | andrew.kuchling | 2008-09-01 01:48:44 +1000 (Mon, 01 Sep 2008) | 1 line
  
  Update patch/bug count
................
  r66093 | gregory.p.smith | 2008-09-01 02:34:18 +1000 (Mon, 01 Sep 2008) | 3 lines
  
  issue3715: docstring representation of hex escaped string needs to be double
  escaped.
................
  r66097 | benjamin.peterson | 2008-09-02 00:13:43 +1000 (Tue, 02 Sep 2008) | 4 lines
  
  #3703 unhelpful _fileio.FileIO error message when trying to open a directory
  
  Reviewer: Gregory P. Smith
................
  r66098 | georg.brandl | 2008-09-02 00:15:55 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  #3749: fix c'n'p errors.
................
  r66099 | benjamin.peterson | 2008-09-02 00:18:30 +1000 (Tue, 02 Sep 2008) | 4 lines
  
  Fix compilation when --without-threads is given #3683
  
  Reviewer: Georg Brandl, Benjamin Peterson
................
  r66100 | hirokazu.yamamoto | 2008-09-02 00:24:04 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Issue #3732: Backported r53335 to supress deprecation warning.
  Reviewed by Benjamin Peterson.
................
  r66103 | vinay.sajip | 2008-09-02 00:30:10 +1000 (Tue, 02 Sep 2008) | 1 line
  
  logging: fixed lack of use of encoding attribute specified on a stream.
................
  r66104 | hirokazu.yamamoto | 2008-09-02 00:32:58 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  Issue #3748: platform.architecture() printed vogus message on windows.
  Reviewed by Marc-Andre Lemburg.
................
  r66105 | vinay.sajip | 2008-09-02 00:33:59 +1000 (Tue, 02 Sep 2008) | 1 line
  
  logging: fixed lack of use of encoding attribute specified on a stream.
................
  r66110 | vinay.sajip | 2008-09-02 01:08:07 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Added section about configuring logging in a library. Thanks to Thomas Heller for the idea.
................
  r66114 | jesse.noller | 2008-09-02 02:47:25 +1000 (Tue, 02 Sep 2008) | 2 lines
  
  Submit Nick's patch for issue 3589, reviewed by jnoller
................
  r66115 | benjamin.peterson | 2008-09-02 03:10:46 +1000 (Tue, 02 Sep 2008) | 1 line
  
  revert r66114 for Jesse
................
  r66117 | benjamin.peterson | 2008-09-02 03:17:22 +1000 (Tue, 02 Sep 2008) | 25 lines
  
  Merged revisions 65887,65889,65967-65968,65981 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r65887 | benjamin.peterson | 2008-08-19 17:45:04 -0500 (Tue, 19 Aug 2008) | 1 line
    
    allow the raw_input fixer to handle calls after the raw_input (ie. raw_input().split())
  ........
    r65889 | benjamin.peterson | 2008-08-19 18:11:03 -0500 (Tue, 19 Aug 2008) | 1 line
    
    no need for 2.4 compatibility now
  ........
    r65967 | benjamin.peterson | 2008-08-21 18:43:37 -0500 (Thu, 21 Aug 2008) | 1 line
    
    allow a Call to have no arguments
  ........
    r65968 | benjamin.peterson | 2008-08-21 18:45:13 -0500 (Thu, 21 Aug 2008) | 1 line
    
    add a fixer for sys.exc_info etc by Jeff Balogh #2357
  ........
    r65981 | benjamin.peterson | 2008-08-22 15:41:30 -0500 (Fri, 22 Aug 2008) | 1 line
    
    add a fixer to add parenthese for list and gen comps #2367
  ........
................
  r66118 | vinay.sajip | 2008-09-02 03:44:14 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Bug #3738: Documentation is now more accurate in describing handler close methods.
................
  r66119 | amaury.forgeotdarc | 2008-09-02 05:52:00 +1000 (Tue, 02 Sep 2008) | 5 lines
  
  Issue #3751: str.rpartition would perform a left-partition when called with
  a unicode argument.
  
  will backport.
................
  r66123 | jesus.cea | 2008-09-02 06:48:16 +1000 (Tue, 02 Sep 2008) | 1 line
  
  In Python3.0, "test.test_support" is renamed to "test.support".
................
  r66127 | benjamin.peterson | 2008-09-02 09:12:58 +1000 (Tue, 02 Sep 2008) | 4 lines
  
  remove py3k warnings about the threading api; update docs
  
  Reviewer: Benjamin Peterson
................
  r66134 | andrew.kuchling | 2008-09-02 11:13:42 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Describe the __hash__ changes
................
  r66135 | brett.cannon | 2008-09-02 11:25:16 +1000 (Tue, 02 Sep 2008) | 10 lines
  
  Move test.test_support.catch_warning() to the warnings module, rename it
  catch_warnings(), and clean up the API.
  
  While expanding the test suite, a bug was found where a warning about the
  'line' argument to showwarning() was not letting functions with '*args' go
  without a warning.
  
  Closes issue 3602.
  Code review by Benjamin Peterson.
................
  r66136 | andrew.kuchling | 2008-09-02 11:39:18 +1000 (Tue, 02 Sep 2008) | 1 line
  
  typo fix
................
  r66137 | jesus.cea | 2008-09-02 12:29:06 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Improve compatibility with Python3.0 testsuite
................
  r66141 | gregory.p.smith | 2008-09-02 15:29:51 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Issue #3678: Correctly pass LDFLAGS and LDLAST to the linker on shared
  library targets in the Makefile.
................
  r66142 | gregory.p.smith | 2008-09-02 15:36:11 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Issue #3708: os.urandom no longer goes into an infinite loop when passed a
  non-integer floating point number.
................
  r66143 | mark.summerfield | 2008-09-02 17:23:16 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  a typo
................
  r66144 | nick.coghlan | 2008-09-02 20:14:47 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Issue 3747: Fix caching in ABCMeta.__subclasscheck__ (R: Georg Brandl)
................
  r66145 | marc-andre.lemburg | 2008-09-02 20:32:34 +1000 (Tue, 02 Sep 2008) | 5 lines
  
  Add quotes around the file name to avoid issues with spaces.
  
  Closes #3719.
................
  r66150 | marc-andre.lemburg | 2008-09-02 22:11:19 +1000 (Tue, 02 Sep 2008) | 3 lines
  
  Add news item for #3719.
................
  r66154 | andrew.kuchling | 2008-09-02 23:06:00 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Clarify example; add imports
................
  r66155 | andrew.kuchling | 2008-09-02 23:08:11 +1000 (Tue, 02 Sep 2008) | 1 line
  
  Add e-mail address
................
  r66162 | hirokazu.yamamoto | 2008-09-03 06:36:44 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Issue #3759: test_asyncore.py leaked handle.
  Reviewed by Amaury Forgeot d'Arc 
................
  r66166 | amaury.forgeotdarc | 2008-09-03 07:17:05 +1000 (Wed, 03 Sep 2008) | 2 lines
  
  Use vs9to8.py to refresh the Visual Studio 2005 build files.
................
  r66167 | amaury.forgeotdarc | 2008-09-03 07:50:47 +1000 (Wed, 03 Sep 2008) | 5 lines
  
  Attempt to correct the build files for the Microsoft VS7.1 compiler.
  
  I don't have a working VS7.1, but VS2005 can automatically convert 
  the project and build a working python interpreter.
................
  r66171 | amaury.forgeotdarc | 2008-09-03 09:19:56 +1000 (Wed, 03 Sep 2008) | 9 lines
  
  Issue 2975: when compiling multiple extension modules with visual studio 2008
  from the same python instance, some environment variables (LIB, INCLUDE) 
  would grow without limit.
  
  Tested with these statements:
      distutils.ccompiler.new_compiler().initialize()
      print os.environ['LIB']
  But I don't know how to turn them into reliable unit tests.
................
  r66174 | benjamin.peterson | 2008-09-03 10:21:32 +1000 (Wed, 03 Sep 2008) | 15 lines
  
  Merged revisions 66173 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r66173 | benjamin.peterson | 2008-09-02 18:57:48 -0500 (Tue, 02 Sep 2008) | 8 lines
    
    A little 2to3 refactoring #3637
    
    This moves command line logic from refactor.py to a new file called
    main.py.  RefactoringTool now merely deals with the actual fixers and
    refactoring; options processing for example is abstracted out.
    
    This patch was reviewed by Gregory P. Smith.
  ........
................
  r66175 | benjamin.peterson | 2008-09-03 11:53:28 +1000 (Wed, 03 Sep 2008) | 1 line
  
  update 2to3 script from 2to3 trunk
................
  r66177 | benjamin.peterson | 2008-09-03 12:14:03 +1000 (Wed, 03 Sep 2008) | 9 lines
  
  Merged revisions 66176 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r66176 | benjamin.peterson | 2008-09-02 21:04:06 -0500 (Tue, 02 Sep 2008) | 1 line
    
    fix typo
  ........
................
  r66179 | gregory.p.smith | 2008-09-03 15:57:48 +1000 (Wed, 03 Sep 2008) | 7 lines
  
  Fix issue 3645: OpenBSD required -lcurses when linking with readline
  to get the correct completion_matches function to avoid crashes on
  x86_64 (amd64).
  
  I don't have OpenBSD to test myself.  I tested that it does not break
  anything on linux.  It is simple.
................
  r66180 | vinay.sajip | 2008-09-03 19:20:05 +1000 (Wed, 03 Sep 2008) | 1 line
  
  Issue #3726: Allowed spaces in separators in logging configuration files.
................
  r66181 | marc-andre.lemburg | 2008-09-03 21:13:56 +1000 (Wed, 03 Sep 2008) | 4 lines
  
  Issue #2562: Fix distutils PKG-INFO writing logic to allow having
  non-ascii characters and Unicode in setup.py meta-data.
................
  r66182 | jesus.cea | 2008-09-04 03:50:32 +1000 (Thu, 04 Sep 2008) | 1 line
  
  Fix some leaks - Neal Norwitz
................
  r66184 | jesse.noller | 2008-09-04 04:10:30 +1000 (Thu, 04 Sep 2008) | 2 lines
  
  Fix issue 3110 - solaris compilation of multiprocessing fails, reviewed by pitrou
................
  r66190 | benjamin.peterson | 2008-09-04 07:48:20 +1000 (Thu, 04 Sep 2008) | 1 line
  
  3.0 still has the old threading names
................
  r66192 | jesus.cea | 2008-09-04 08:07:11 +1000 (Thu, 04 Sep 2008) | 1 line
  
  Python3.0 bsddb testsuite compatibility improvements
................
  r66196 | facundo.batista | 2008-09-04 08:35:50 +1000 (Thu, 04 Sep 2008) | 5 lines
  
  
  Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module
  to the urlparse one.  Added a PendingDeprecationWarning in the old
  module, it will be deprecated in the future.  Docs and tests updated.
................
  r66197 | brett.cannon | 2008-09-04 08:45:11 +1000 (Thu, 04 Sep 2008) | 6 lines
  
  test_py3kwarn had been overlooked when test.test_support.catch_warning() was
  re-implemented to use warnings.catch_warnings() and had its API improved.
  
  Closes issue #3768.
  Code review by Benjamin Peterson.
................
  r66211 | vinay.sajip | 2008-09-04 17:31:21 +1000 (Thu, 04 Sep 2008) | 1 line
  
  Issue #3772: Fixed regression problem in StreamHandler.emit().
................
  r66213 | hirokazu.yamamoto | 2008-09-04 21:15:14 +1000 (Thu, 04 Sep 2008) | 2 lines
  
  Issue #3762: platform.architecture() fails if python is lanched via its symbolic link.
  Reviewed by Amaury Forgeot d'Arc.
................
  r66217 | andrew.kuchling | 2008-09-04 23:26:24 +1000 (Thu, 04 Sep 2008) | 1 line
  
  #3671: various corrections and markup fixes noted by Kent Johnson
................
  r66219 | hirokazu.yamamoto | 2008-09-05 00:25:30 +1000 (Fri, 05 Sep 2008) | 1 line
  
  Added NEWS
................
  r66226 | benjamin.peterson | 2008-09-05 09:31:27 +1000 (Fri, 05 Sep 2008) | 1 line
  
  flesh out the documentation on using 2to3
................
  r66229 | brett.cannon | 2008-09-05 13:52:59 +1000 (Fri, 05 Sep 2008) | 1 line
  
  Make it more obvious that warnings.catch_warnings() and its arguments should be considered keyword-only.
................
  r66231 | andrew.kuchling | 2008-09-06 01:15:56 +1000 (Sat, 06 Sep 2008) | 1 line
  
  #3671: Typo fix
................
  r66232 | brett.cannon | 2008-09-06 04:33:51 +1000 (Sat, 06 Sep 2008) | 5 lines
  
  Deprecate bsddb for removal in Python 3.0.
  
  Closes issue 3776.
  Review by Nick Coghlan.
................
  r66235 | antoine.pitrou | 2008-09-06 08:04:54 +1000 (Sat, 06 Sep 2008) | 6 lines
  
  #3601: test_unicode.test_raiseMemError fails in UCS4
  
  Reviewed by Benjamin Peterson on IRC.
................
  r66237 | brett.cannon | 2008-09-06 08:59:17 +1000 (Sat, 06 Sep 2008) | 7 lines
  
  GNU coding guidelines say that ``make check`` should verify the build. That
  clashes with what Python's build target did. Rename the target to 'patchcheck'
  to avoid the culture clash.
  
  Closes issue 3758.
  Reviewed by Benjamin Peterson.
................
  r66240 | antoine.pitrou | 2008-09-06 09:30:23 +1000 (Sat, 06 Sep 2008) | 5 lines
  
  Issue #3535: zipfile couldn't read some zip files larger than 2GB.
  
  Reviewed by Amaury Forgeot d'Arc.
................
  r66244 | jesse.noller | 2008-09-06 11:20:11 +1000 (Sat, 06 Sep 2008) | 2 lines
  
  Fix typo in multiprocessing doc, cancel_join_thread was missing _thread
................
  r66246 | benjamin.peterson | 2008-09-06 13:00:00 +1000 (Sat, 06 Sep 2008) | 1 line
  
  actually tell the name of the flag to use
................
  r66249 | andrew.kuchling | 2008-09-06 22:50:05 +1000 (Sat, 06 Sep 2008) | 1 line
  
  Various corrections
................
  r66250 | andrew.kuchling | 2008-09-06 23:04:02 +1000 (Sat, 06 Sep 2008) | 1 line
  
  #3040: include 'dest' argument in example; trim some trailing whitespace
................
  r66262 | benjamin.peterson | 2008-09-07 05:28:11 +1000 (Sun, 07 Sep 2008) | 4 lines
  
  #1638033: add support for httponly on Cookie.Morsel
  
  Reviewer: Benjamin
................
  r66264 | benjamin.peterson | 2008-09-07 05:42:39 +1000 (Sun, 07 Sep 2008) | 1 line
  
  docs are pretty good about new-style classes these days
................
  r66268 | andrew.kuchling | 2008-09-07 06:28:01 +1000 (Sun, 07 Sep 2008) | 1 line
  
  #3669 from Robert Lehmann: simplify use of iterator in example
................
  r66270 | amaury.forgeotdarc | 2008-09-07 06:53:51 +1000 (Sun, 07 Sep 2008) | 3 lines
  
  #3796: A test class was not run in test_float.
  Reviewed by Benjamin.
................
  r66272 | andrew.kuchling | 2008-09-07 07:26:02 +1000 (Sun, 07 Sep 2008) | 1 line
  
  #1317: describe the does_esmtp, ehlo_resp, esmtp_features, and helo_resp attributes
................
  r66275 | antoine.pitrou | 2008-09-07 09:04:32 +1000 (Sun, 07 Sep 2008) | 3 lines
  
  Backport relevant part of r66274 (in issue #874900).
................
  r66277 | benjamin.peterson | 2008-09-07 09:19:15 +1000 (Sun, 07 Sep 2008) | 1 line
  
  fix missing module
................
  r66281 | josiah.carlson | 2008-09-07 13:53:58 +1000 (Sun, 07 Sep 2008) | 3 lines
  
  This fixes a small inconsistency between trunk and 3.0, closing bug 3764.
................
  r66282 | josiah.carlson | 2008-09-07 14:37:10 +1000 (Sun, 07 Sep 2008) | 3 lines
  
  undoing change that broke trunk.  Need to find a better solution to this.
................
  r66283 | gregory.p.smith | 2008-09-07 15:15:18 +1000 (Sun, 07 Sep 2008) | 5 lines
  
  - Issue #1204: The configure script now tests for additional libraries
    that may be required when linking against readline.  This fixes issues
    with x86_64 builds on some platforms (at least a few Linux flavors as
    well as OpenBSD/amd64).
................
  r66284 | gregory.p.smith | 2008-09-07 15:15:58 +1000 (Sun, 07 Sep 2008) | 2 lines
  
  reran autoconf for r66283's checkin
................


Added:
   python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_paren.py
      - copied unchanged from r66284, /python/trunk/Lib/lib2to3/fixes/fix_paren.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_sys_exc.py
      - copied unchanged from r66284, /python/trunk/Lib/lib2to3/fixes/fix_sys_exc.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/main.py
      - copied unchanged from r66284, /python/trunk/Lib/lib2to3/main.py
   python/branches/tlee-ast-optimize/Lib/test/crashers/iter.py
      - copied unchanged from r66284, /python/trunk/Lib/test/crashers/iter.py
Modified:
   python/branches/tlee-ast-optimize/   (props changed)
   python/branches/tlee-ast-optimize/Doc/extending/windows.rst
   python/branches/tlee-ast-optimize/Doc/library/2to3.rst
   python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst
   python/branches/tlee-ast-optimize/Doc/library/bsddb.rst
   python/branches/tlee-ast-optimize/Doc/library/cgi.rst
   python/branches/tlee-ast-optimize/Doc/library/codecs.rst
   python/branches/tlee-ast-optimize/Doc/library/cookie.rst
   python/branches/tlee-ast-optimize/Doc/library/ctypes.rst
   python/branches/tlee-ast-optimize/Doc/library/dbhash.rst
   python/branches/tlee-ast-optimize/Doc/library/functions.rst
   python/branches/tlee-ast-optimize/Doc/library/logging.rst
   python/branches/tlee-ast-optimize/Doc/library/math.rst
   python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst
   python/branches/tlee-ast-optimize/Doc/library/optparse.rst
   python/branches/tlee-ast-optimize/Doc/library/smtplib.rst
   python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst
   python/branches/tlee-ast-optimize/Doc/library/threading.rst
   python/branches/tlee-ast-optimize/Doc/library/urllib.rst
   python/branches/tlee-ast-optimize/Doc/library/urlparse.rst
   python/branches/tlee-ast-optimize/Doc/library/warnings.rst
   python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst
   python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst
   python/branches/tlee-ast-optimize/Include/cobject.h
   python/branches/tlee-ast-optimize/Lib/BaseHTTPServer.py
   python/branches/tlee-ast-optimize/Lib/Cookie.py
   python/branches/tlee-ast-optimize/Lib/abc.py
   python/branches/tlee-ast-optimize/Lib/asynchat.py
   python/branches/tlee-ast-optimize/Lib/bsddb/__init__.py
   python/branches/tlee-ast-optimize/Lib/bsddb/dbshelve.py
   python/branches/tlee-ast-optimize/Lib/bsddb/dbtables.py
   python/branches/tlee-ast-optimize/Lib/bsddb/dbutils.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_associate.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_basics.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compare.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compat.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_cursor_pget_bug.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbobj.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbshelve.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbtables.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_distributed_transactions.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_early_close.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_get_none.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_join.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_lock.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_misc.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_pickle.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_queue.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_recno.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_sequence.py
   python/branches/tlee-ast-optimize/Lib/bsddb/test/test_thread.py
   python/branches/tlee-ast-optimize/Lib/cgi.py
   python/branches/tlee-ast-optimize/Lib/dbhash.py
   python/branches/tlee-ast-optimize/Lib/distutils/dist.py
   python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py
   python/branches/tlee-ast-optimize/Lib/distutils/tests/test_dist.py
   python/branches/tlee-ast-optimize/Lib/hashlib.py
   python/branches/tlee-ast-optimize/Lib/httplib.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/   (props changed)
   python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/tests/support.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py
   python/branches/tlee-ast-optimize/Lib/logging/__init__.py
   python/branches/tlee-ast-optimize/Lib/logging/config.py
   python/branches/tlee-ast-optimize/Lib/mimetools.py
   python/branches/tlee-ast-optimize/Lib/msilib/__init__.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py
   python/branches/tlee-ast-optimize/Lib/os.py
   python/branches/tlee-ast-optimize/Lib/platform.py
   python/branches/tlee-ast-optimize/Lib/pydoc.py
   python/branches/tlee-ast-optimize/Lib/test/string_tests.py
   python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py
   python/branches/tlee-ast-optimize/Lib/test/test_cgi.py
   python/branches/tlee-ast-optimize/Lib/test/test_fileio.py
   python/branches/tlee-ast-optimize/Lib/test/test_float.py
   python/branches/tlee-ast-optimize/Lib/test/test_logging.py
   python/branches/tlee-ast-optimize/Lib/test/test_os.py
   python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py
   python/branches/tlee-ast-optimize/Lib/test/test_support.py
   python/branches/tlee-ast-optimize/Lib/test/test_unicode.py
   python/branches/tlee-ast-optimize/Lib/test/test_urlparse.py
   python/branches/tlee-ast-optimize/Lib/test/test_warnings.py
   python/branches/tlee-ast-optimize/Lib/threading.py
   python/branches/tlee-ast-optimize/Lib/urlparse.py
   python/branches/tlee-ast-optimize/Lib/warnings.py
   python/branches/tlee-ast-optimize/Lib/zipfile.py
   python/branches/tlee-ast-optimize/Makefile.pre.in
   python/branches/tlee-ast-optimize/Misc/ACKS
   python/branches/tlee-ast-optimize/Misc/NEWS
   python/branches/tlee-ast-optimize/Modules/_bsddb.c
   python/branches/tlee-ast-optimize/Modules/_fileio.c
   python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h
   python/branches/tlee-ast-optimize/Modules/bsddb.h
   python/branches/tlee-ast-optimize/Objects/cobject.c
   python/branches/tlee-ast-optimize/Objects/stringobject.c
   python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj
   python/branches/tlee-ast-optimize/PC/VS7.1/readme.txt
   python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj
   python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj
   python/branches/tlee-ast-optimize/PC/VS8.0/_multiprocessing.vcproj
   python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj
   python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln
   python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops
   python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj
   python/branches/tlee-ast-optimize/PCbuild/vs9to8.py
   python/branches/tlee-ast-optimize/Python/_warnings.c
   python/branches/tlee-ast-optimize/Python/getargs.c
   python/branches/tlee-ast-optimize/Python/import.c
   python/branches/tlee-ast-optimize/README
   python/branches/tlee-ast-optimize/Tools/scripts/2to3
   python/branches/tlee-ast-optimize/configure
   python/branches/tlee-ast-optimize/configure.in
   python/branches/tlee-ast-optimize/pyconfig.h.in

Modified: python/branches/tlee-ast-optimize/Doc/extending/windows.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/extending/windows.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/extending/windows.rst	Sun Sep  7 18:03:22 2008
@@ -102,10 +102,14 @@
    and it should call :cfunc:`Py_InitModule` with the string ``"spam"`` as its
    first argument (use the minimal :file:`example.c` in this directory as a guide).
    By convention, it lives in a file called :file:`spam.c` or :file:`spammodule.c`.
-   The output file should be called :file:`spam.dll` or :file:`spam.pyd` (the
-   latter is supported to avoid confusion with a system library :file:`spam.dll` to
-   which your module could be a Python interface) in Release mode, or
-   :file:`spam_d.dll` or :file:`spam_d.pyd` in Debug mode.
+   The output file should be called :file:`spam.pyd` (in Release mode) or  
+   :file:`spam_d.pyd` (in Debug mode). The extension :file:`.pyd` was chosen
+   to avoid confusion with a system library :file:`spam.dll` to which your module
+   could be a Python interface.
+
+   .. versionchanged:: 2.5
+      Previously, file names like :file:`spam.dll` (in release mode) or
+      :file:`spam_d.dll` (in debug mode) were also recognized.
 
    Now your options are:
 

Modified: python/branches/tlee-ast-optimize/Doc/library/2to3.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/2to3.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/2to3.rst	Sun Sep  7 18:03:22 2008
@@ -5,15 +5,23 @@
 
 .. sectionauthor:: Benjamin Peterson
 
-2to3 is a Python program that reads your Python 2.x source code and applies a
-series of *fixers* to transform it into valid Python 3.x code.
+2to3 is a Python program that reads Python 2.x source code and applies a series
+of *fixers* to transform it into valid Python 3.x code.  The standard library
+contains a rich set of fixers that will handle almost all code.  2to3 supporting
+library :mod:`lib2to3` is, however, a flexible and generic library, so it is
+possible to write your own fixers for 2to3.  :mod:`lib2to3` could also be
+adapted to custom applications in which Python code needs to be edited
+automatically.
 
 
 Using 2to3
 ----------
 
-2to3 can be run with a list of files to transform or a directory to recursively
-traverse looking for files with the ``.py`` extension.
+2to3 will usually be installed with the Python interpreter as a script.  It is
+also located in the :file:`Tools/scripts` directory of the Python root.
+
+2to3's basic arguments are a list of files or directories to transform.  The
+directories are to recursively traversed for Python sources.
 
 Here is a sample Python 2.x source file, :file:`example.py`::
 
@@ -27,13 +35,14 @@
 
    $ 2to3 example.py
 
-A diff against the original source file will be printed.  2to3 can also write
-the needed modifications right back to the source file.  (A backup of the
-original file will also be made.)  This is done with the :option:`-w` flag::
+A diff against the original source file is printed.  2to3 can also write the
+needed modifications right back to the source file.  (Of course, a backup of the
+original is also be made.)  Writing the changes back is enabled with the
+:option:`-w` flag::
 
    $ 2to3 -w example.py
 
-:file:`example.py` will now look like this::
+After transformation, :file:`example.py` looks like this::
 
    def greet(name):
        print("Hello, {0}!".format(name))
@@ -41,10 +50,10 @@
    name = input()
    greet(name)
 
-Comments and and exact indentation will be preserved throughout the translation
+Comments and and exact indentation are preserved throughout the translation
 process.
 
-By default, 2to3 will run a set of predefined fixers.  The :option:`-l` flag
+By default, 2to3 runs a set of predefined fixers.  The :option:`-l` flag
 lists all avaible fixers.  An explicit set of fixers to run can be given by use
 of the :option:`-f` flag.  The following example runs only the ``imports`` and
 ``has_key`` fixers::
@@ -52,16 +61,30 @@
    $ 2to3 -f imports -f has_key example.py
 
 Some fixers are *explicit*, meaning they aren't run be default and must be
-listed on the command line.  Here, in addition to the default fixers, the
-``idioms`` fixer is run::
+listed on the command line to be run.  Here, in addition to the default fixers,
+the ``idioms`` fixer is run::
 
    $ 2to3 -f all -f idioms example.py
 
-Notice how ``all`` enables all default fixers.
+Notice how passing ``all`` enables all default fixers.
 
 Sometimes 2to3 will find will find a place in your source code that needs to be
 changed, but 2to3 cannot fix automatically.  In this case, 2to3 will print a
-warning beneath the diff for a file.
+warning beneath the diff for a file.  You should address the warning in order to
+have compliant 3.x code.
+
+2to3 can also refactor doctests.  To enable this mode, use the :option:`-d`
+flag.  Note that *only* doctests will be refactored.
+
+The :option:`-v` option enables the output of more information on the
+translation process.
+
+When the :option:`-p` is passed to it, 2to3 treats ``print`` as a function
+instead of a statement.  This is useful when ``from __future__ import
+print_function`` is being used.  If this option is not given, the print fixer
+will surround print calls in an extra set of parentheses because it cannot
+differentiate between the and print statement with parentheses (such as ``print
+("a" + "b" + "c")``) and a true function call.
 
 
 :mod:`lib2to3` - 2to3's library

Modified: python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst	Sun Sep  7 18:03:22 2008
@@ -68,6 +68,11 @@
       address.
 
 
+   .. attribute:: server
+
+      Contains the server instance.
+
+
    .. attribute:: command
 
       Contains the command (request type). For example, ``'GET'``.

Modified: python/branches/tlee-ast-optimize/Doc/library/bsddb.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/bsddb.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/bsddb.rst	Sun Sep  7 18:03:22 2008
@@ -6,6 +6,9 @@
    :synopsis: Interface to Berkeley DB database library
 .. sectionauthor:: Skip Montanaro <skip at pobox.com>
 
+.. deprecated:: 2.6
+    The :mod:`bsddb` module has been deprecated for removal in Python 3.0.
+
 
 The :mod:`bsddb` module provides an interface to the Berkeley DB library.  Users
 can create hash, btree or record based library files using the appropriate open

Modified: python/branches/tlee-ast-optimize/Doc/library/cgi.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/cgi.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/cgi.rst	Sun Sep  7 18:03:22 2008
@@ -282,49 +282,18 @@
 
    Parse a query in the environment or from a file (the file defaults to
    ``sys.stdin``).  The *keep_blank_values* and *strict_parsing* parameters are
-   passed to :func:`parse_qs` unchanged.
+   passed to :func:`urlparse.parse_qs` unchanged.
 
 
 .. function:: parse_qs(qs[, keep_blank_values[, strict_parsing]])
 
-   Parse a query string given as a string argument (data of type
-   :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a
-   dictionary.  The dictionary keys are the unique query variable names and the
-   values are lists of values for each name.
-
-   The optional argument *keep_blank_values* is a flag indicating whether blank
-   values in URL encoded queries should be treated as blank strings.   A true value
-   indicates that blanks should be retained as  blank strings.  The default false
-   value indicates that blank values are to be ignored and treated as if they were
-   not included.
-
-   The optional argument *strict_parsing* is a flag indicating what to do with
-   parsing errors.  If false (the default), errors are silently ignored.  If true,
-   errors raise a :exc:`ValueError` exception.
-
-   Use the :func:`urllib.urlencode` function to convert such dictionaries into
-   query strings.
-
+   This function is deprecated in this module. Use :func:`urlparse.parse_qs`
+   instead. It is maintained here only for backward compatiblity.
 
 .. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing]])
 
-   Parse a query string given as a string argument (data of type
-   :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a list of
-   name, value pairs.
-
-   The optional argument *keep_blank_values* is a flag indicating whether blank
-   values in URL encoded queries should be treated as blank strings.   A true value
-   indicates that blanks should be retained as  blank strings.  The default false
-   value indicates that blank values are to be ignored and treated as if they were
-   not included.
-
-   The optional argument *strict_parsing* is a flag indicating what to do with
-   parsing errors.  If false (the default), errors are silently ignored.  If true,
-   errors raise a :exc:`ValueError` exception.
-
-   Use the :func:`urllib.urlencode` function to convert such lists of pairs into
-   query strings.
-
+   This function is deprecated in this module. Use :func:`urlparse.parse_qsl`
+   instead. It is maintained here only for backward compatiblity.
 
 .. function:: parse_multipart(fp, pdict)
 
@@ -332,7 +301,7 @@
    Arguments are *fp* for the input file and *pdict* for a dictionary containing
    other parameters in the :mailheader:`Content-Type` header.
 
-   Returns a dictionary just like :func:`parse_qs` keys are the field names, each
+   Returns a dictionary just like :func:`urlparse.parse_qs` keys are the field names, each
    value is a list of values for that field.  This is easy to use but not much good
    if you are expecting megabytes to be uploaded --- in that case, use the
    :class:`FieldStorage` class instead which is much more flexible.

Modified: python/branches/tlee-ast-optimize/Doc/library/codecs.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/codecs.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/codecs.rst	Sun Sep  7 18:03:22 2008
@@ -51,13 +51,13 @@
    Codec Interface). The functions/methods are expected to work in a stateless
    mode.
 
-   *incrementalencoder* and *incrementalencoder*: These have to be factory
+   *incrementalencoder* and *incrementaldecoder*: These have to be factory
    functions providing the following interface:
 
    ``factory(errors='strict')``
 
    The factory functions must return objects providing the interfaces defined by
-   the base classes :class:`IncrementalEncoder` and :class:`IncrementalEncoder`,
+   the base classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`,
    respectively. Incremental codecs can maintain state.
 
    *streamreader* and *streamwriter*: These have to be factory functions providing
@@ -477,7 +477,7 @@
 
    The *errors* argument will be assigned to an attribute of the same name.
    Assigning to this attribute makes it possible to switch between different error
-   handling strategies during the lifetime of the :class:`IncrementalEncoder`
+   handling strategies during the lifetime of the :class:`IncrementalDecoder`
    object.
 
    The set of allowed values for the *errors* argument can be extended with

Modified: python/branches/tlee-ast-optimize/Doc/library/cookie.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/cookie.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/cookie.rst	Sun Sep  7 18:03:22 2008
@@ -148,7 +148,7 @@
 --------------
 
 
-.. class:: Morsel()
+.. class:: Morsel
 
    Abstract a key/value pair, which has some :rfc:`2109` attributes.
 
@@ -162,9 +162,17 @@
    * ``max-age``
    * ``secure``
    * ``version``
+   * ``httponly``
+
+   The attribute :attr:`httponly` specifies that the cookie is only transfered
+   in HTTP requests, and is not accessible through JavaScript. This is intended
+   to mitigate some forms of cross-site scripting.
 
    The keys are case-insensitive.
 
+   .. versionadded:: 2.6
+      The :attr:`httponly` attribute was added.
+
 
 .. attribute:: Morsel.value
 

Modified: python/branches/tlee-ast-optimize/Doc/library/ctypes.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/ctypes.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/ctypes.rst	Sun Sep  7 18:03:22 2008
@@ -10,7 +10,7 @@
 .. versionadded:: 2.5
 
 ``ctypes`` is a foreign function library for Python.  It provides C compatible
-data types, and allows calling functions in dlls/shared libraries.  It can be
+data types, and allows calling functions in DLLs or shared libraries.  It can be
 used to wrap these libraries in pure Python.
 
 
@@ -23,8 +23,8 @@
 actually work.  Since some code samples behave differently under Linux, Windows,
 or Mac OS X, they contain doctest directives in comments.
 
-Note: Some code sample references the ctypes :class:`c_int` type. This type is
-an alias to the :class:`c_long` type on 32-bit systems.  So, you should not be
+Note: Some code samples reference the ctypes :class:`c_int` type. This type is
+an alias for the :class:`c_long` type on 32-bit systems.  So, you should not be
 confused if :class:`c_long` is printed if you would expect :class:`c_int` ---
 they are actually the same type.
 
@@ -34,8 +34,8 @@
 Loading dynamic link libraries
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-``ctypes`` exports the *cdll*, and on Windows also *windll* and *oledll* objects
-to load dynamic link libraries.
+``ctypes`` exports the *cdll*, and on Windows *windll* and *oledll*
+objects, for loading dynamic link libraries.
 
 You load libraries by accessing them as attributes of these objects. *cdll*
 loads libraries which export functions using the standard ``cdecl`` calling
@@ -317,7 +317,7 @@
    >>> p = create_string_buffer("Hello", 10)  # create a 10 byte buffer
    >>> print sizeof(p), repr(p.raw)
    10 'Hello\x00\x00\x00\x00\x00'
-   >>> p.value = "Hi"      
+   >>> p.value = "Hi"
    >>> print sizeof(p), repr(p.raw)
    10 'Hi\x00lo\x00\x00\x00\x00\x00'
    >>>
@@ -908,7 +908,7 @@
    ...     p = p.next[0]
    ...
    foo bar foo bar foo bar foo bar
-   >>>    
+   >>>
 
 
 .. _ctypes-callback-functions:
@@ -2045,7 +2045,7 @@
 
    .. method:: _CData.from_buffer_copy(source[, offset])
 
-      This method creates a ctypes instance, the buffer is copied from
+      This method creates a ctypes instance, copying the buffer from
       the source object buffer which must be readable.  The optional
       ``offset`` parameter specifies an offset into the source buffer
       in bytes; the default is zero.  If the source buffer is not
@@ -2062,13 +2062,13 @@
 
    .. method:: from_param(obj)
 
-      This method adapts obj to a ctypes type.  It is called with the actual
-      object used in a foreign function call, when the type is present in the
-      foreign functions :attr:`argtypes` tuple; it must return an object that
-      can be used as function call parameter.
+      This method adapts *obj* to a ctypes type.  It is called with the actual
+      object used in a foreign function call when the type is present in the
+      foreign function's :attr:`argtypes` tuple; it must return an object that
+      can be used as a function call parameter.
 
-      All ctypes data types have a default implementation of this classmethod,
-      normally it returns ``obj`` if that is an instance of the type.  Some
+      All ctypes data types have a default implementation of this classmethod
+      that normally returns ``obj`` if that is an instance of the type.  Some
       types accept other objects as well.
 
 

Modified: python/branches/tlee-ast-optimize/Doc/library/dbhash.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/dbhash.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/dbhash.rst	Sun Sep  7 18:03:22 2008
@@ -5,10 +5,8 @@
    :synopsis: DBM-style interface to the BSD database library.
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake at acm.org>
 
-.. note::
-   The :mod:`dbhash` module has been renamed to :mod:`dbm.bsd` in Python 3.0.
-   The :term:`2to3` tool will automatically adapt imports when converting your
-   sources to 3.0.
+.. deprecated:: 2.6
+    The :mod:`dbhash` module has been deprecated for removal in Python 3.0.
 
 .. index:: module: bsddb
 

Modified: python/branches/tlee-ast-optimize/Doc/library/functions.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/functions.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/functions.rst	Sun Sep  7 18:03:22 2008
@@ -381,10 +381,10 @@
       >>> print eval('x+1')
       2
 
-   This function can also be used to execute arbitrary code objects (such as those
-   created by :func:`compile`).  In this case pass a code object instead of a
-   string.  The code object must have been compiled passing ``'eval'`` as the
-   *kind* argument.
+   This function can also be used to execute arbitrary code objects (such as
+   those created by :func:`compile`).  In this case pass a code object instead
+   of a string.  If the code object has been compiled with ``'exec'`` as the
+   *kind* argument, :func:`eval`\'s return value will be ``None``.
 
    Hints: dynamic execution of statements is supported by the :keyword:`exec`
    statement.  Execution of statements from a file is supported by the
@@ -1215,7 +1215,8 @@
 
 .. function:: super(type[, object-or-type])
 
-   Return the superclass of *type*.  If the second argument is omitted the super
+   Return a "super" object that acts like the superclass of *type*.
+   If the second argument is omitted the super
    object returned is unbound.  If the second argument is an object,
    ``isinstance(obj, type)`` must be true.  If the second argument is a type,
    ``issubclass(type2, type)`` must be true. :func:`super` only works for

Modified: python/branches/tlee-ast-optimize/Doc/library/logging.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/logging.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/logging.rst	Sun Sep  7 18:03:22 2008
@@ -422,6 +422,45 @@
 code approach, mainly separation of configuration and code and the ability of
 noncoders to easily modify the logging properties.
 
+Configuring Logging for a Library
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When developing a library which uses logging, some consideration needs to be
+given to its configuration. If the using application does not use logging, and
+library code makes logging calls, then a one-off message "No handlers could be
+found for logger X.Y.Z" is printed to the console. This message is intended
+to catch mistakes in logging configuration, but will confuse an application
+developer who is not aware of logging by the library.
+
+In addition to documenting how a library uses logging, a good way to configure
+library logging so that it does not cause a spurious message is to add a
+handler which does nothing. This avoids the message being printed, since a
+handler will be found: it just doesn't produce any output. If the library user
+configures logging for application use, presumably that configuration will add
+some handlers, and if levels are suitably configured then logging calls made
+in library code will send output to those handlers, as normal.
+
+A do-nothing handler can be simply defined as follows::
+
+    import logging
+
+    class NullHandler(logging.Handler):
+        def emit(self, record):
+            pass
+
+An instance of this handler should be added to the top-level logger of the
+logging namespace used by the library. If all logging by a library *foo* is
+done using loggers with names matching "foo.x.y", then the code::
+
+    import logging
+
+    h = NullHandler()
+    logging.getLogger("foo").addHandler(h)
+
+should have the desired effect. If an organisation produces a number of
+libraries, then the logger name specified can be "orgname.foo" rather than
+just "foo".
+
 
 Logging Levels
 --------------
@@ -1465,8 +1504,10 @@
 
 .. method:: Handler.close()
 
-   Tidy up any resources used by the handler. This version does nothing and is
-   intended to be implemented by subclasses.
+   Tidy up any resources used by the handler. This version does no output but
+   removes the handler from an internal list of handlers which is closed when
+   :func:`shutdown` is called. Subclasses should ensure that this gets called
+   from overridden :meth:`close` methods.
 
 
 .. method:: Handler.handle(record)
@@ -1528,7 +1569,7 @@
 
       Flushes the stream by calling its :meth:`flush` method. Note that the
       :meth:`close` method is inherited from :class:`Handler` and so does
-      nothing, so an explicit :meth:`flush` call may be needed at times.
+      no output, so an explicit :meth:`flush` call may be needed at times.
 
 
 FileHandler
@@ -1848,7 +1889,7 @@
       source of event log entries. However, if you do this, you will not be able
       to see the events as you intended in the Event Log Viewer - it needs to be
       able to access the registry to get the .dll name. The current version does
-      not do this (in fact it doesn't do anything).
+      not do this.
 
 
    .. method:: emit(record)

Modified: python/branches/tlee-ast-optimize/Doc/library/math.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/math.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/math.rst	Sun Sep  7 18:03:22 2008
@@ -317,7 +317,7 @@
    :exc:`OverflowError`, ``math.log(0L)`` may raise :exc:`ValueError` instead.
 
    All functions return a quiet *NaN* if at least one of the args is *NaN*.
-   Signaling *NaN*s raise an exception. The exception type still depends on the
+   Signaling *NaN*\s raise an exception. The exception type still depends on the
    platform and libm implementation. It's usually :exc:`ValueError` for *EDOM*
    and :exc:`OverflowError` for errno *ERANGE*.
 

Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst	Sun Sep  7 18:03:22 2008
@@ -1861,7 +1861,7 @@
     Bear in mind that a process that has put items in a queue will wait before
     terminating until all the buffered items are fed by the "feeder" thread to
     the underlying pipe.  (The child process can call the
-    :meth:`Queue.cancel_join` method of the queue to avoid this behaviour.)
+    :meth:`Queue.cancel_join_thread` method of the queue to avoid this behaviour.)
 
     This means that whenever you use a queue you need to make sure that all
     items which have been put on the queue will eventually be removed before the

Modified: python/branches/tlee-ast-optimize/Doc/library/optparse.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/optparse.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/optparse.rst	Sun Sep  7 18:03:22 2008
@@ -96,7 +96,7 @@
    ``sys.argv[1:]``, or of some other list provided as a substitute for
    ``sys.argv[1:]``".
 
-option   
+option
    an argument used to supply extra information to guide or customize the execution
    of a program.  There are many different syntaxes for options; the traditional
    Unix syntax is a hyphen ("-") followed by a single letter, e.g. ``"-x"`` or
@@ -468,7 +468,7 @@
                      action="store_true", dest="verbose", default=True,
                      help="make lots of noise [default]")
    parser.add_option("-q", "--quiet",
-                     action="store_false", dest="verbose", 
+                     action="store_false", dest="verbose",
                      help="be vewwy quiet (I'm hunting wabbits)")
    parser.add_option("-f", "--filename",
                      metavar="FILE", help="write output to FILE"),
@@ -1637,7 +1637,7 @@
        setattr(parser.values, option.dest, value)
 
    [...]
-   parser.add_option("-c", "--callback",
+   parser.add_option("-c", "--callback", dest="vararg_attr",
                      action="callback", callback=vararg_callback)
 
 The main weakness with this particular implementation is that negative numbers

Modified: python/branches/tlee-ast-optimize/Doc/library/smtplib.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/smtplib.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/smtplib.rst	Sun Sep  7 18:03:22 2008
@@ -178,6 +178,8 @@
 
    Identify yourself to the SMTP server using ``HELO``.  The hostname argument
    defaults to the fully qualified domain name of the local host.
+   The message returned by the server is stored as the :attr:`helo_resp` attribute
+   of the object.
 
    In normal operation it should not be necessary to call this method explicitly.
    It will be implicitly called by the :meth:`sendmail` when necessary.
@@ -187,7 +189,13 @@
 
    Identify yourself to an ESMTP server using ``EHLO``.  The hostname argument
    defaults to the fully qualified domain name of the local host.  Examine the
-   response for ESMTP option and store them for use by :meth:`has_extn`.
+   response for ESMTP option and store them for use by :meth:`has_extn`. 
+   Also sets several informational attributes: the message returned by 
+   the server is stored as the :attr:`ehlo_resp` attribute, :attr:`does_esmtp` 
+   is set to true or false depending on whether the server supports ESMTP, and
+   :attr:`esmtp_features` will be a dictionary containing the names of the
+   SMTP service extensions this server supports, and their
+   parameters (if any).
 
    Unless you wish to use :meth:`has_extn` before sending mail, it should not be
    necessary to call this method explicitly.  It will be implicitly called by

Modified: python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst	Sun Sep  7 18:03:22 2008
@@ -424,7 +424,7 @@
       import sqlite3, os
 
       con = sqlite3.connect('existing_db.db')
-      full_dump = os.linesep.join([line for line in con.iterdump()])
+      full_dump = os.linesep.join(con.iterdump())
       f = open('dump.sql', 'w')
       f.writelines(full_dump)
       f.close()

Modified: python/branches/tlee-ast-optimize/Doc/library/threading.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/threading.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/threading.rst	Sun Sep  7 18:03:22 2008
@@ -14,11 +14,12 @@
 
 .. note::
 
-   Some ``camelCase`` names have been converted to their underscored
-   equivalents. Others have been replaced by properties.  Using the old methods
-   in 2.6 will trigger a :exc:`DeprecationWarning` when Python is run with the
-   :option:`-3` flag and a full :exc:`DeprecationWarning` in 3.0.  The old names
-   will be removed early in the 3.x series.
+   Starting with Python 2.6, this module provides PEP 8 compliant aliases and
+   properties to replace the ``camelCase`` names that were inspired by Java's
+   threading API. This updated API is compatible with that of the
+   :mod:`multiprocessing` module. However, no schedule has been set for the
+   deprecation of the ``camelCase`` names and they remain fully supported in
+   both Python 2.x and 3.x.
 
 This module defines the following functions and objects:
 

Modified: python/branches/tlee-ast-optimize/Doc/library/urllib.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/urllib.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/urllib.rst	Sun Sep  7 18:03:22 2008
@@ -242,7 +242,7 @@
    of the sequence. When a sequence of two-element tuples is used as the *query*
    argument, the first element of each tuple is a key and the second is a value.
    The order of parameters in the encoded string will match the order of parameter
-   tuples in the sequence. The :mod:`cgi` module provides the functions
+   tuples in the sequence. The :mod:`urlparse` module provides the functions
    :func:`parse_qs` and :func:`parse_qsl` which are used to parse query strings
    into Python data structures.
 

Modified: python/branches/tlee-ast-optimize/Doc/library/urlparse.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/urlparse.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/urlparse.rst	Sun Sep  7 18:03:22 2008
@@ -101,6 +101,45 @@
    .. versionchanged:: 2.5
       Added attributes to return value.
 
+.. function:: parse_qs(qs[, keep_blank_values[, strict_parsing]])
+
+   Parse a query string given as a string argument (data of type
+   :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a
+   dictionary.  The dictionary keys are the unique query variable names and the
+   values are lists of values for each name.
+
+   The optional argument *keep_blank_values* is a flag indicating whether blank
+   values in URL encoded queries should be treated as blank strings.   A true value
+   indicates that blanks should be retained as  blank strings.  The default false
+   value indicates that blank values are to be ignored and treated as if they were
+   not included.
+
+   The optional argument *strict_parsing* is a flag indicating what to do with
+   parsing errors.  If false (the default), errors are silently ignored.  If true,
+   errors raise a :exc:`ValueError` exception.
+
+   Use the :func:`urllib.urlencode` function to convert such dictionaries into
+   query strings.
+
+
+.. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing]])
+
+   Parse a query string given as a string argument (data of type
+   :mimetype:`application/x-www-form-urlencoded`).  Data are returned as a list of
+   name, value pairs.
+
+   The optional argument *keep_blank_values* is a flag indicating whether blank
+   values in URL encoded queries should be treated as blank strings.   A true value
+   indicates that blanks should be retained as  blank strings.  The default false
+   value indicates that blank values are to be ignored and treated as if they were
+   not included.
+
+   The optional argument *strict_parsing* is a flag indicating what to do with
+   parsing errors.  If false (the default), errors are silently ignored.  If true,
+   errors raise a :exc:`ValueError` exception.
+
+   Use the :func:`urllib.urlencode` function to convert such lists of pairs into
+   query strings.
 
 .. function:: urlunparse(parts)
 

Modified: python/branches/tlee-ast-optimize/Doc/library/warnings.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/warnings.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/warnings.rst	Sun Sep  7 18:03:22 2008
@@ -263,3 +263,53 @@
    :func:`filterwarnings`, including that of the :option:`-W` command line options
    and calls to :func:`simplefilter`.
 
+
+Available Classes
+-----------------
+
+.. class:: catch_warnings([\*, record=False[, module=None]])
+
+    A context manager that guards the warnings filter from being permanently
+    mutated. The manager returns an instance of :class:`WarningsRecorder`. The 
+    *record* argument specifies whether warnings that would typically be
+    handled by :func:`showwarning` should instead be recorded by the
+    :class:`WarningsRecorder` instance. This argument is typically set when
+    testing for expected warnings behavior. The *module* argument may be a
+    module object that is to be used instead of the :mod:`warnings` module.
+    This argument should only be set when testing the :mod:`warnings` module 
+    or some similar use-case.
+
+    Typical usage of the context manager is like so::
+
+        def fxn():
+            warn("fxn is deprecated", DeprecationWarning)
+            return "spam spam bacon spam"
+
+        # The function 'fxn' is known to raise a DeprecationWarning.
+        with catch_warnings() as w:
+            warnings.filterwarning('ignore', 'fxn is deprecated', DeprecationWarning)
+            fxn()  # DeprecationWarning is temporarily suppressed.
+
+    .. note::
+
+        In Python 3.0, the arguments to the constructor for
+        :class:`catch_warnings` are keyword-only arguments.
+
+    .. versionadded:: 2.6
+
+
+.. class:: WarningsRecorder()
+
+    A subclass of :class:`list` that stores all warnings passed to
+    :func:`showwarning` when returned by a :class:`catch_warnings` context
+    manager created with its *record* argument set to ``True``. Each recorded
+    warning is represented by an object whose attributes correspond to the
+    arguments to :func:`showwarning`. As a convenience, a
+    :class:`WarningsRecorder` instance has the attributes of the last
+    recorded warning set on the :class:`WarningsRecorder` instance as well.
+
+    .. method:: reset()
+
+        Delete all recorded warnings.
+
+    .. versionadded:: 2.6

Modified: python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst	Sun Sep  7 18:03:22 2008
@@ -1382,13 +1382,29 @@
    be in the wrong hash bucket).
 
    User-defined classes have :meth:`__cmp__` and :meth:`__hash__` methods
-   by default; with them, all objects compare unequal and ``x.__hash__()``
-   returns ``id(x)``.
+   by default; with them, all objects compare unequal (except with themselves)
+   and ``x.__hash__()`` returns ``id(x)``.
+
+   Classes which inherit a :meth:`__hash__` method from a parent class but
+   change the meaning of :meth:`__cmp__` or :meth:`__eq__` such that the hash
+   value returned is no longer appropriate (e.g. by switching to a value-based
+   concept of equality instead of the default identity based equality) can
+   explicitly flag themselves as being unhashable by setting
+   ``__hash__ = None`` in the class definition. Doing so means that not only
+   will instances of the class raise an appropriate :exc:`TypeError` when
+   a program attempts to retrieve their hash value, but they will also be
+   correctly identified as unhashable when checking
+   ``isinstance(obj, collections.Hashable)`` (unlike classes which define
+   their own :meth:`__hash__` to explicitly raise :exc:`TypeError`).
 
    .. versionchanged:: 2.5
       :meth:`__hash__` may now also return a long integer object; the 32-bit
       integer is then derived from the hash of that object.
 
+   .. versionchanged:: 2.6
+      :attr:`__hash__` may now be set to :const:`None` to explicitly flag
+      instances of a class as unhashable.
+
 
 .. method:: object.__nonzero__(self)
 
@@ -1431,7 +1447,7 @@
    Note that if the attribute is found through the normal mechanism,
    :meth:`__getattr__` is not called.  (This is an intentional asymmetry between
    :meth:`__getattr__` and :meth:`__setattr__`.) This is done both for efficiency
-   reasons and because otherwise :meth:`__setattr__` would have no way to access
+   reasons and because otherwise :meth:`__getattr__` would have no way to access
    other attributes of the instance.  Note that at least for instance variables,
    you can fake total control by not inserting any values in the instance attribute
    dictionary (but instead inserting them in another object).  See the

Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst	Sun Sep  7 18:03:22 2008
@@ -4,7 +4,7 @@
 
 .. XXX add trademark info for Apple, Microsoft, SourceForge.
 
-:Author: A.M. Kuchling
+:Author: A.M. Kuchling (amk at amk.ca)
 :Release: |release|
 :Date: |today|
 
@@ -53,6 +53,25 @@
 schedule is described in :pep:`361`; currently the final release is
 scheduled for October 1 2008.
 
+The major theme of Python 2.6 is preparing the migration path to
+Python 3.0, a major redesign of the language.  Whenever possible,
+Python 2.6 incorporates new features and syntax from 3.0 while
+remaining compatible with existing code by not removing older features
+or syntax.  When it's not possible to do that, Python 2.6 tries to do
+what it can, adding compatibility functions in a
+:mod:`future_builtins` module and a :option:`-3` switch to warn about
+usages that will become unsupported in 3.0.
+
+Some significant new packages have been added to the standard library,
+such as the :mod:`multiprocessing` and :mod:`json` modules, but
+there aren't many new features that aren't related to Python 3.0 in
+some way.
+
+Python 2.6 also sees a number of improvements and bugfixes throughout
+the source.  A search through the change logs finds there were 259
+patches applied and 612 bugs fixed between Python 2.5 and 2.6.  Both
+figures are likely to be underestimates.
+
 This article doesn't attempt to provide a complete specification of
 the new features, but instead provides a convenient overview.  For
 full details, you should refer to the documentation for Python 2.6. If
@@ -73,13 +92,14 @@
 Python 3.0
 ================
 
-The development cycle for Python 2.6 also saw the release of the first
-alphas of Python 3.0, and the development of 3.0 has influenced
-a number of features in 2.6.
+The development cycle for Python versions 2.6 and 3.0 was
+synchronized, with the alpha and beta releases for both versions being
+made on the same days.  The development of 3.0 has influenced many
+features in 2.6.
 
 Python 3.0 is a far-ranging redesign of Python that breaks
 compatibility with the 2.x series.  This means that existing Python
-code will need a certain amount of conversion in order to run on
+code will need some conversion in order to run on
 Python 3.0.  However, not all the changes in 3.0 necessarily break
 compatibility.  In cases where new features won't cause existing code
 to break, they've been backported to 2.6 and are described in this
@@ -91,6 +111,14 @@
 * The addition of :func:`functools.reduce` as a synonym for the built-in
   :func:`reduce` function.
 
+Python 3.0 adds several new built-in functions and changes the
+semantics of some existing built-ins.  Functions that are new in 3.0
+such as :func:`bin` have simply been added to Python 2.6, but existing
+built-ins haven't been changed; instead, the :mod:`future_builtins`
+module has versions with the new 3.0 semantics.  Code written to be
+compatible with 3.0 can do ``from future_builtins import hex, map`` as
+necessary.
+
 A new command-line switch, :option:`-3`, enables warnings
 about features that will be removed in Python 3.0.  You can run code
 with this switch to see how much work will be necessary to port
@@ -98,35 +126,28 @@
 to Python code as the boolean variable :data:`sys.py3kwarning`,
 and to C extension code as :cdata:`Py_Py3kWarningFlag`.
 
-Python 3.0 adds several new built-in functions and change the
-semantics of some existing built-ins.  Entirely new functions such as
-:func:`bin` have simply been added to Python 2.6, but existing
-built-ins haven't been changed; instead, the :mod:`future_builtins`
-module has versions with the new 3.0 semantics.  Code written to be
-compatible with 3.0 can do ``from future_builtins import hex, map``
-as necessary.
-
 .. seealso::
 
-   The 3xxx series of PEPs, which describes the development process for
-   Python 3.0 and various features that have been accepted, rejected,
-   or are still under consideration.
+   The 3xxx series of PEPs, which contains proposals for Python 3.0.
+   :pep:`3000` describes the development process for Python 3.0.
+   Start with :pep:`3100` that describes the general goals for Python
+   3.0, and then explore the higher-numbered PEPS that propose
+   specific features.
 
 
-Development Changes
+Changes to the Development Process
 ==================================================
 
 While 2.6 was being developed, the Python development process
-underwent two significant changes: the developer group
-switched from SourceForge's issue tracker to a customized
-Roundup installation, and the documentation was converted from
-LaTeX to reStructuredText.
+underwent two significant changes: we switched from SourceForge's
+issue tracker to a customized Roundup installation, and the
+documentation was converted from LaTeX to reStructuredText.
 
 
 New Issue Tracker: Roundup
 --------------------------------------------------
 
-For a long time, the Python developers have been growing increasingly
+For a long time, the Python developers had been growing increasingly
 annoyed by SourceForge's bug tracker.  SourceForge's hosted solution
 doesn't permit much customization; for example, it wasn't possible to
 customize the life cycle of issues.
@@ -134,14 +155,14 @@
 The infrastructure committee of the Python Software Foundation
 therefore posted a call for issue trackers, asking volunteers to set
 up different products and import some of the bugs and patches from
-SourceForge.  Four different trackers were examined: Atlassian's `Jira
+SourceForge.  Four different trackers were examined: `Jira
 <http://www.atlassian.com/software/jira/>`__,
 `Launchpad <http://www.launchpad.net>`__,
 `Roundup <http://roundup.sourceforge.net/>`__, and
 `Trac <http://trac.edgewall.org/>`__.
 The committee eventually settled on Jira
 and Roundup as the two candidates.  Jira is a commercial product that
-offers a no-cost hosted instance to free-software projects; Roundup
+offers no-cost hosted instances to free-software projects; Roundup
 is an open-source project that requires volunteers
 to administer it and a server to host it.
 
@@ -153,12 +174,13 @@
 this edition of "What's New in Python" links to the bug/patch
 item for each change.
 
-Hosting is kindly provided by
+Hosting of the Python bug tracker is kindly provided by
 `Upfront Systems <http://www.upfrontsystems.co.za/>`__
 of Stellenbosch, South Africa.  Martin von Loewis put a
 lot of effort into importing existing bugs and patches from
 SourceForge; his scripts for this import operation are at
-http://svn.python.org/view/tracker/importer/.
+http://svn.python.org/view/tracker/importer/ and may be useful to
+other projects wished to move from SourceForge to Roundup.
 
 .. seealso::
 
@@ -171,37 +193,45 @@
   http://roundup.sourceforge.net/
     Roundup downloads and documentation.
 
+  http://svn.python.org/view/tracker/importer/
+    Martin von Loewis's conversion scripts.
 
 New Documentation Format: reStructuredText Using Sphinx
 -----------------------------------------------------------
 
-Since the Python project's inception around 1989, the documentation
-had been written using LaTeX.  At that time, most documentation was
-printed out for later study, not viewed online. LaTeX was widely used
-because it provided attractive printed output while remaining
-straightforward to write, once the basic rules of the markup have been
+The Python documentation was written using LaTeX since the project
+started around 1989.  In the 1980s and early 1990s, most documentation
+was printed out for later study, not viewed online. LaTeX was widely
+used because it provided attractive printed output while remaining
+straightforward to write once the basic rules of the markup were
 learned.
 
-LaTeX is still used today for writing technical publications destined
-for printing, but the landscape for programming tools has shifted.  We
-no longer print out reams of documentation; instead, we browse through
-it online and HTML has become the most important format to support.
-Unfortunately, converting LaTeX to HTML is fairly complicated, and
-Fred L. Drake Jr., the Python documentation editor for many years,
-spent a lot of time wrestling the conversion process into shape.
-Occasionally people would suggest converting the documentation into
-SGML or, later, XML, but performing a good conversion is a major task
-and no one pursued the task to completion.
-
-During the 2.6 development cycle, Georg Brandl put a substantial
-effort into building a new toolchain for processing the documentation.
-The resulting package is called Sphinx, and is available from
-http://sphinx.pocoo.org/.  The input format is reStructuredText, a
-markup commonly used in the Python community that supports custom
-extensions and directives.  Sphinx concentrates on HTML output,
-producing attractively styled and modern HTML, though printed output
-is still supported through conversion to LaTeX.  Sphinx is a
-standalone package that can be used in documenting other projects.
+Today LaTeX is still used for writing publications destined for
+printing, but the landscape for programming tools has shifted.  We no
+longer print out reams of documentation; instead, we browse through it
+online and HTML has become the most important format to support.
+Unfortunately, converting LaTeX to HTML is fairly complicated and Fred
+L. Drake Jr., the long-time Python documentation editor, spent a lot
+of time maintaining the conversion process.  Occasionally people would
+suggest converting the documentation into SGML and later XML, but
+performing a good conversion is a major task and no one ever committed
+the time required to finish the job.
+
+During the 2.6 development cycle, Georg Brandl put a lot of effort
+into building a new toolchain for processing the documentation.  The
+resulting package is called Sphinx, and is available from
+http://sphinx.pocoo.org/.
+
+Sphinx concentrates on HTML output, producing attractively styled and
+modern HTML; printed output is still supported through conversion to
+LaTeX.  The input format is reStructuredText, a markup syntax
+supporting custom extensions and directives that is commonly used in
+the Python community.
+
+Sphinx is a standalone package that can be used for writing, and
+almost two dozen other projects
+(`listed on the Sphinx web site <http://sphinx.pocoo.org/examples.html>`__)
+have adopted Sphinx as their documentation tool.
 
 .. seealso::
 
@@ -219,13 +249,13 @@
 =============================
 
 The previous version, Python 2.5, added the ':keyword:`with`'
-statement an optional feature, to be enabled by a ``from __future__
+statement as an optional feature, to be enabled by a ``from __future__
 import with_statement`` directive.  In 2.6 the statement no longer needs to
 be specially enabled; this means that :keyword:`with` is now always a
 keyword.  The rest of this section is a copy of the corresponding
-section from "What's New in Python 2.5" document; if you read
-it back when Python 2.5 came out, you can skip the rest of this
-section.
+section from the "What's New in Python 2.5" document; if you're
+familiar with the ':keyword:`with`' statement
+from Python 2.5, you can skip this section.
 
 The ':keyword:`with`' statement clarifies code that previously would use
 ``try...finally`` blocks to ensure that clean-up code is executed.  In this
@@ -233,7 +263,7 @@
 section, I'll examine the implementation details and show how to write objects
 for use with this statement.
 
-The ':keyword:`with`' statement is a new control-flow structure whose basic
+The ':keyword:`with`' statement is a control-flow structure whose basic
 structure is::
 
    with expression [as variable]:
@@ -280,7 +310,7 @@
 The lock is acquired before the block is executed and always released once  the
 block is complete.
 
-The new :func:`localcontext` function in the :mod:`decimal` module makes it easy
+The :func:`localcontext` function in the :mod:`decimal` module makes it easy
 to save and restore the current decimal context, which encapsulates the desired
 precision and rounding characteristics for computations::
 
@@ -400,8 +430,8 @@
 The contextlib module
 ---------------------
 
-The new :mod:`contextlib` module provides some functions and a decorator that
-are useful for writing objects for use with the ':keyword:`with`' statement.
+The :mod:`contextlib` module provides some functions and a decorator that
+are useful when writing objects for use with the ':keyword:`with`' statement.
 
 The decorator is called :func:`contextmanager`, and lets you write a single
 generator function instead of defining a new class.  The generator should yield
@@ -412,8 +442,8 @@
 executed in the :meth:`__exit__` method.  Any exception raised in the block will
 be raised by the :keyword:`yield` statement.
 
-Our database example from the previous section could be written  using this
-decorator as::
+Using this decorator, our database example from the previous section
+could be written as::
 
    from contextlib import contextmanager
 
@@ -473,12 +503,15 @@
 When you ran a module that was located inside a package, relative
 imports didn't work correctly.
 
-The fix in Python 2.6 adds a :attr:`__package__` attribute to modules.
-When present, relative imports will be relative to the value of this
-attribute instead of the :attr:`__name__` attribute.  PEP 302-style
-importers can then set :attr:`__package__`.  The :mod:`runpy` module
-that implements the :option:`-m` switch now does this, so relative imports
-can now be used in scripts running from inside a package.
+The fix for Python 2.6 adds a :attr:`__package__` attribute to
+modules.  When this attribute is present, relative imports will be
+relative to the value of this attribute instead of the
+:attr:`__name__` attribute.
+
+PEP 302-style importers can then set :attr:`__package__` as necessary.
+The :mod:`runpy` module that implements the :option:`-m` switch now
+does this, so relative imports will now work correctly in scripts
+running from inside a package.
 
 .. ======================================================================
 
@@ -487,10 +520,10 @@
 PEP 370: Per-user ``site-packages`` Directory
 =====================================================
 
-When you run Python, the module search path ``sys.modules`` usually
+When you run Python, the module search path ``sys.path`` usually
 includes a directory whose path ends in ``"site-packages"``.  This
 directory is intended to hold locally-installed packages available to
-all users on a machine or using a particular site installation.
+all users using a machine or a particular site installation.
 
 Python 2.6 introduces a convention for user-specific site directories.
 The directory varies depending on the platform:
@@ -543,8 +576,8 @@
 and the :meth:`join` method to wait for the process to exit.
 
 Here's a simple example where the subprocess will calculate a
-factorial.  The function doing the calculation is a bit strange; it's
-written to take significantly longer when the input argument is a
+factorial.  The function doing the calculation is written strangely so
+that it takes significantly longer when the input argument is a
 multiple of 4.
 
 ::
@@ -579,28 +612,31 @@
 	result = queue.get()
 	print 'Factorial', N, '=', result
 
-A :class:`Queue` object is created and stored as a global.  The child
-process will use the value of the variable when the child was created;
-because it's a :class:`Queue`, parent and child can use the object to
-communicate.  (If the parent were to change the value of the global
-variable, the child's value would be unaffected, and vice versa.)
+A :class:`Queue` is used to communicate the input parameter *N* and
+the result.  The :class:`Queue` object is stored in a global variable.
+The child process will use the value of the variable when the child
+was created; because it's a :class:`Queue`, parent and child can use
+the object to communicate.  (If the parent were to change the value of
+the global variable, the child's value would be unaffected, and vice
+versa.)
 
 Two other classes, :class:`Pool` and :class:`Manager`, provide
 higher-level interfaces.  :class:`Pool` will create a fixed number of
 worker processes, and requests can then be distributed to the workers
-by calling :meth:`apply` or `apply_async`, adding a single request,
-and :meth:`map` or :meth:`map_async` to distribute a number of
+by calling :meth:`apply` or :meth:`apply_async` to add a single request,
+and :meth:`map` or :meth:`map_async` to add a number of
 requests.  The following code uses a :class:`Pool` to spread requests
-across 5 worker processes, receiving a list of results back.
+across 5 worker processes and retrieve a list of results::
 
-::
-
-   from multiprocessing import Pool
+    from multiprocessing import Pool
 
+    def factorial(N, dictionary):
+	"Compute a factorial."
+	...
     p = Pool(5)
     result = p.map(factorial, range(1, 1000, 10))
     for v in result:
-        print v
+	print v
 
 This produces the following output::
 
@@ -611,14 +647,15 @@
     33452526613163807108170062053440751665152000000000
     ...
 
-The :class:`Manager` class creates a separate server process that can
-hold master copies of Python data structures.  Other processes can
-then access and modify these data structures by using proxy objects.
-The following example creates a shared dictionary by calling the
-:meth:`dict` method; the worker processes then insert values into the
-dictionary.  (No locking is done automatically, which doesn't matter
-in this example.  :class:`Manager`'s methods also include
-:meth:`Lock`, :meth:`RLock`, and :meth:`Semaphore` to create shared locks.
+The other high-level interface, the :class:`Manager` class, creates a
+separate server process that can hold master copies of Python data
+structures.  Other processes can then access and modify these data
+structures using proxy objects.  The following example creates a
+shared dictionary by calling the :meth:`dict` method; the worker
+processes then insert values into the dictionary.  (Locking is not
+done for you automatically, which doesn't matter in this example.
+:class:`Manager`'s methods also include :meth:`Lock`, :meth:`RLock`,
+and :meth:`Semaphore` to create shared locks.)
 
 ::
 
@@ -661,7 +698,7 @@
     21 51090942171709440000
     31 8222838654177922817725562880000000
     41 33452526613163807108170062053440751665152000000000
-    51 1551118753287382280224243016469303211063259720016986112000000000000
+    51 15511187532873822802242430164693032110632597200169861120000...
 
 .. seealso::
 
@@ -691,9 +728,8 @@
      "User ID: {0}".format("root") -> "User ID: root"
 
      # Use the named keyword arguments
-     uid = 'root'
-
-     'User ID: {uid}   Last seen: {last_login}'.format(uid='root',
+     'User ID: {uid}   Last seen: {last_login}'.format(
+            uid='root',
             last_login = '5 Mar 2008 07:20') ->
        'User ID: root   Last seen: 5 Mar 2008 07:20'
 
@@ -711,9 +747,9 @@
          Python version: 2.6a1+ (trunk:61261M, Mar  5 2008, 20:29:41) \n
          [GCC 4.0.1 (Apple Computer, Inc. build 5367)]'
 
-     import mimetypes
-     'Content-type: {0[.mp4]}'.format(mimetypes.types_map) ->
-       'Content-type: video/mp4'
+    import mimetypes
+    'Content-type: {0[.mp4]}'.format(mimetypes.types_map) ->
+        'Content-type: video/mp4'
 
 Note that when using dictionary-style notation such as ``[.mp4]``, you
 don't need to put any quotation marks around the string; it will look
@@ -728,18 +764,24 @@
      # Field 0: left justify, pad to 15 characters
      # Field 1: right justify, pad to 6 characters
      fmt = '{0:15} ${1:>6}'
+
      fmt.format('Registration', 35) ->
        'Registration    $    35'
+
      fmt.format('Tutorial', 50) ->
        'Tutorial        $    50'
+
      fmt.format('Banquet', 125) ->
        'Banquet         $   125'
 
 Format specifiers can reference other fields through nesting::
 
     fmt = '{0:{1}}'
-    fmt.format('Invoice #1234', 15) ->
+
+    width = 15
+    fmt.format('Invoice #1234', width) ->
       'Invoice #1234  '
+
     width = 35
     fmt.format('Invoice #1234', width) ->
       'Invoice #1234                      '
@@ -794,8 +836,9 @@
        else:
            return str(self)
 
-There's also a format() built-in that will format a single value.  It calls
-the type's :meth:`__format__` method with the provided specifier::
+There's also a :func:`format` built-in that will format a single
+value.  It calls the type's :meth:`__format__` method with the
+provided specifier::
 
     >>> format(75.6564, '.2f')
     '75.66'
@@ -804,7 +847,7 @@
 .. seealso::
 
    :ref:`formatstrings`
-      The reference format fields.
+      The reference documentation for format fields.
 
    :pep:`3101` - Advanced String Formatting
       PEP written by Talin. Implemented by Eric Smith.
@@ -817,8 +860,8 @@
 =====================================================
 
 The ``print`` statement becomes the :func:`print` function in Python 3.0.
-Making :func:`print` a function makes it easier to change
-by doing 'def print(...)' or importing a new function from somewhere else.
+Making :func:`print` a function makes it possible to replace the function
+by doing ``def print(...)`` or importing a new function from somewhere else.
 
 Python 2.6 has a ``__future__`` import that removes ``print`` as language
 syntax, letting you use the functional form instead.  For example::
@@ -832,11 +875,11 @@
 
 The parameters are:
 
- * **args**: positional arguments whose values will be printed out.
- * **sep**: the separator, which will be printed between arguments.
- * **end**: the ending text, which will be printed after all of the
+ * *args*: positional arguments whose values will be printed out.
+ * *sep*: the separator, which will be printed between arguments.
+ * *end*: the ending text, which will be printed after all of the
    arguments have been output.
- * **file**: the file object to which the output will be sent.
+ * *file*: the file object to which the output will be sent.
 
 .. seealso::
 
@@ -851,32 +894,32 @@
 =====================================================
 
 One error that Python programmers occasionally make
-is the following::
+is writing the following code::
 
     try:
         ...
-    except TypeError, ValueError:
+    except TypeError, ValueError:  # Wrong!
         ...
 
-The author is probably trying to catch both
-:exc:`TypeError` and :exc:`ValueError` exceptions, but this code
-actually does something different: it will catch
-:exc:`TypeError` and bind the resulting exception object
-to the local name ``"ValueError"``.  The correct code
-would have specified a tuple::
+The author is probably trying to catch both :exc:`TypeError` and
+:exc:`ValueError` exceptions, but this code actually does something
+different: it will catch :exc:`TypeError` and bind the resulting
+exception object to the local name ``"ValueError"``.  The
+:exc:`ValueError` exception will not be caught at all.  The correct
+code specifies a tuple of exceptions::
 
     try:
         ...
     except (TypeError, ValueError):
         ...
 
-This error is possible because the use of the comma here is ambiguous:
+This error happens because the use of the comma here is ambiguous:
 does it indicate two different nodes in the parse tree, or a single
-node that's a tuple.
+node that's a tuple?
 
-Python 3.0 changes the syntax to make this unambiguous by replacing
-the comma with the word "as".  To catch an exception and store the
-exception object in the variable ``exc``, you must write::
+Python 3.0 makes this unambiguous by replacing the comma with the word
+"as".  To catch an exception and store the exception object in the
+variable ``exc``, you must write::
 
     try:
         ...
@@ -886,7 +929,8 @@
 Python 3.0 will only support the use of "as", and therefore interprets
 the first example as catching two different exceptions.  Python 2.6
 supports both the comma and "as", so existing code will continue to
-work.
+work.  We therefore suggest using "as" when writing new Python code
+that will only be executed with 2.6.
 
 .. seealso::
 
@@ -933,10 +977,10 @@
     bytearray(b'ABC')
     >>> b = bytearray(u'\u21ef\u3244', 'utf-8')
     >>> b
-    bytearray(b'\xe2\x87\xaf \xe3\x89\x84')
+    bytearray(b'\xe2\x87\xaf\xe3\x89\x84')
     >>> b[0] = '\xe3'
     >>> b
-    bytearray(b'\xe3\x87\xaf \xe3\x89\x84')
+    bytearray(b'\xe3\x87\xaf\xe3\x89\x84')
     >>> unicode(str(b), 'utf-8')
     u'\u31ef \u3244'
 
@@ -971,14 +1015,15 @@
 Python's built-in file objects support a number of methods, but
 file-like objects don't necessarily support all of them.  Objects that
 imitate files usually support :meth:`read` and :meth:`write`, but they
-may not support :meth:`readline`.  Python 3.0 introduces a layered I/O
-library in the :mod:`io` module that separates buffering and
-text-handling features from the fundamental read and write operations.
+may not support :meth:`readline`, for example.  Python 3.0 introduces
+a layered I/O library in the :mod:`io` module that separates buffering
+and text-handling features from the fundamental read and write
+operations.
 
 There are three levels of abstract base classes provided by
 the :mod:`io` module:
 
-* :class:`RawIOBase`: defines raw I/O operations: :meth:`read`,
+* :class:`RawIOBase` defines raw I/O operations: :meth:`read`,
   :meth:`readinto`,
   :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`,
   and :meth:`close`.
@@ -992,7 +1037,7 @@
 
   .. XXX should 2.6 register them in io.py?
 
-* :class:`BufferedIOBase`: is an abstract base class that
+* :class:`BufferedIOBase` is an abstract base class that
   buffers data in memory to reduce the number of
   system calls used, making I/O processing more efficient.
   It supports all of the methods of :class:`RawIOBase`,
@@ -1000,12 +1045,13 @@
 
   There are five concrete classes implementing this ABC.
   :class:`BufferedWriter` and :class:`BufferedReader` are for objects
-  that only support writing or reading and don't support random
-  access.  :class:`BufferedRandom` adds the :meth:`seek` method for
-  random access, and :class:`BufferedRWPair` is for objects such as
-  TTYs that have both read and write operations that act upon
-  unconnected streams of data.  The :class:`BytesIO`
-  class supports reading, writing, and seeking over an in-memory buffer.
+  that support write-only or read-only usage that have a :meth:`seek`
+  method for random access.  :class:`BufferedRandom` objects support
+  read and write access upon the same underlying stream, and
+  :class:`BufferedRWPair` is for objects such as TTYs that have both
+  read and write operations acting upon unconnected streams of data.
+  The :class:`BytesIO` class supports reading, writing, and seeking
+  over an in-memory buffer.
 
 * :class:`TextIOBase`: Provides functions for reading and writing
   strings (remember, strings will be Unicode in Python 3.0),
@@ -1019,14 +1065,12 @@
   to the underlying object.  :class:`StringIO` simply buffers
   everything in memory without ever writing anything to disk.
 
-  (In current 2.6 alpha releases, :class:`io.StringIO` is implemented in
+  (In Python 2.6, :class:`io.StringIO` is implemented in
   pure Python, so it's pretty slow.   You should therefore stick with the
   existing :mod:`StringIO` module or :mod:`cStringIO` for now.  At some
   point Python 3.0's :mod:`io` module will be rewritten into C for speed,
   and perhaps the C implementation will be  backported to the 2.x releases.)
 
-  .. XXX check before final release: is io.py still written in Python?
-
 In Python 2.6, the underlying implementations haven't been
 restructured to build on top of the :mod:`io` module's classes.  The
 module is being provided to make it easier to write code that's
@@ -1054,7 +1098,7 @@
 treat memory-mapped files as a string of characters to be searched.
 
 The primary users of the buffer protocol are numeric-processing
-packages such as NumPy, which can expose the internal representation
+packages such as NumPy, which expose the internal representation
 of arrays so that callers can write data directly into an array instead
 of going through a slower API.  This PEP updates the buffer protocol in light of experience
 from NumPy development, adding a number of new features
@@ -1072,7 +1116,7 @@
 
 .. XXX PyObject_GetBuffer not documented in c-api
 
-The **flags** argument to :cfunc:`PyObject_GetBuffer` specifies
+The *flags* argument to :cfunc:`PyObject_GetBuffer` specifies
 constraints upon the memory returned.  Some examples are:
 
  * :const:`PyBUF_WRITABLE` indicates that the memory must be writable.
@@ -1081,7 +1125,7 @@
 
  * :const:`PyBUF_C_CONTIGUOUS` and :const:`PyBUF_F_CONTIGUOUS`
    requests a C-contiguous (last dimension varies the fastest) or
-   Fortran-contiguous (first dimension varies the fastest) layout.
+   Fortran-contiguous (first dimension varies the fastest) array layout.
 
 Two new argument codes for :cfunc:`PyArg_ParseTuple`,
 ``s*`` and ``z*``, return locked buffer objects for a parameter.
@@ -1100,14 +1144,15 @@
 PEP 3119: Abstract Base Classes
 =====================================================
 
-Some object-oriented languages such as Java support interfaces: declarations
-that a class has a given set of methods or supports a given access protocol.
-Abstract Base Classes (or ABCs) are an equivalent feature for Python. The ABC
-support consists of an :mod:`abc` module containing a metaclass called
-:class:`ABCMeta`, special handling
-of this metaclass by the :func:`isinstance` and :func:`issubclass` built-ins,
-and a collection of basic ABCs that the Python developers think will be widely
-useful.
+Some object-oriented languages such as Java support interfaces,
+declaring that a class has a given set of methods or supports a given
+access protocol.  Abstract Base Classes (or ABCs) are an equivalent
+feature for Python. The ABC support consists of an :mod:`abc` module
+containing a metaclass called :class:`ABCMeta`, special handling of
+this metaclass by the :func:`isinstance` and :func:`issubclass`
+built-ins, and a collection of basic ABCs that the Python developers
+think will be widely useful.  Future versions of Python will probably
+add more ABCs.
 
 Let's say you have a particular class and wish to know whether it supports
 dictionary-style access.  The phrase "dictionary-style" is vague, however.
@@ -1117,11 +1162,12 @@
 methods?  What about the iterative variants  such as :meth:`iterkeys`?  :meth:`copy`
 and :meth:`update`?  Iterating over the object with :func:`iter`?
 
-Python 2.6 includes a number of different ABCs in the :mod:`collections`
-module.  :class:`Iterable` indicates that a class defines :meth:`__iter__`,
-and :class:`Container` means the class supports  ``x in y`` expressions
-by defining a :meth:`__contains__` method.  The basic dictionary interface of
-getting items, setting items, and
+The Python 2.6 :mod:`collections` module includes a number of
+different ABCs that represent these distinctions.  :class:`Iterable`
+indicates that a class defines :meth:`__iter__`, and
+:class:`Container` means the class defines a :meth:`__contains__`
+method and therefore supports ``x in y`` expressions.  The basic
+dictionary interface of getting items, setting items, and
 :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by the
 :class:`MutableMapping` ABC.
 
@@ -1168,21 +1214,22 @@
 	if not isinstance(d, collections.MutableMapping):
 	    raise ValueError("Mapping object expected, not %r" % d)
 
-(Don't feel that you must now begin writing lots of checks as in the
+Don't feel that you must now begin writing lots of checks as in the
 above example.  Python has a strong tradition of duck-typing, where
-explicit type-checking isn't done and code simply calls methods on
+explicit type-checking is never done and code simply calls methods on
 an object, trusting that those methods will be there and raising an
-exception if they aren't.  Be judicious in checking for ABCs
-and only do it where it helps.)
+exception if they aren't.  Be judicious in checking for ABCs and only
+do it where it's absolutely necessary.
 
 You can write your own ABCs by using ``abc.ABCMeta`` as the
 metaclass in a class definition::
 
-  from abc import ABCMeta
+  from abc import ABCMeta, abstractmethod
 
   class Drawable():
       __metaclass__ = ABCMeta
 
+      @abstractmethod
       def draw(self, x, y, scale=1.0):
 	  pass
 
@@ -1201,35 +1248,34 @@
 this ABC therefore don't need to provide their own implementation
 of :meth:`draw_doubled`, though they can do so.  An implementation
 of :meth:`draw` is necessary, though; the ABC can't provide
-a useful generic implementation.  You
-can apply the ``@abstractmethod`` decorator to methods such as
-:meth:`draw` that must be implemented; Python will
-then raise an exception for classes that
-don't define the method::
-
-    class Drawable():
-	__metaclass__ = ABCMeta
-
-	@abstractmethod
-	def draw(self, x, y, scale):
-	    pass
+a useful generic implementation.
 
+You can apply the ``@abstractmethod`` decorator to methods such as
+:meth:`draw` that must be implemented; Python will then raise an
+exception for classes that don't define the method.
 Note that the exception is only raised when you actually
-try to create an instance of a subclass without the method::
+try to create an instance of a subclass lacking the method::
 
-    >>> s=Square()
+    >>> class Circle(Drawable):
+    ...     pass
+    ...
+    >>> c=Circle()
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
-    TypeError: Can't instantiate abstract class Square with abstract methods draw
+    TypeError: Can't instantiate abstract class Circle with abstract methods draw
     >>>
 
-Abstract data attributes can be declared using the ``@abstractproperty`` decorator::
+Abstract data attributes can be declared using the
+``@abstractproperty`` decorator::
+
+    from abc import abstractproperty
+    ...
 
     @abstractproperty
     def readonly(self):
        return self._x
 
-Subclasses must then define a :meth:`readonly` property
+Subclasses must then define a :meth:`readonly` property.
 
 .. seealso::
 
@@ -1246,9 +1292,9 @@
 =====================================================
 
 Python 3.0 changes the syntax for octal (base-8) integer literals,
-which are now prefixed by "0o" or "0O" instead of a leading zero, and
-adds support for binary (base-2) integer literals, signalled by a "0b"
-or "0B" prefix.
+prefixing them with "0o" or "0O" instead of a leading zero, and adds
+support for binary (base-2) integer literals, signalled by a "0b" or
+"0B" prefix.
 
 Python 2.6 doesn't drop support for a leading 0 signalling
 an octal number, but it does add support for "0o" and "0b"::
@@ -1264,13 +1310,15 @@
 
     >>> oct(42)
     '052'
+    >>> future_builtins.oct(42)
+    '0o52'
     >>> bin(173)
     '0b10101101'
 
 The :func:`int` and :func:`long` built-ins will now accept the "0o"
 and "0b" prefixes when base-8 or base-2 are requested, or when the
-**base** argument is zero (meaning the base used is determined from
-the string):
+*base* argument is zero (signalling that the base used should be
+determined from the string):
 
     >>> int ('0o52', 0)
     42
@@ -1322,9 +1370,9 @@
 PEP 3141: A Type Hierarchy for Numbers
 =====================================================
 
-In Python 3.0, several abstract base classes for numeric types,
-inspired by Scheme's numeric tower, are being added.
-This change was backported to 2.6 as the :mod:`numbers` module.
+Python 3.0 adds several abstract base classes for numeric types
+inspired by Scheme's numeric tower.  These classes were backported to
+2.6 as the :mod:`numbers` module.
 
 The most general ABC is :class:`Number`.  It defines no operations at
 all, and only exists to allow checking if an object is a number by
@@ -1372,8 +1420,8 @@
 The :mod:`fractions` Module
 --------------------------------------------------
 
-To fill out the hierarchy of numeric types, a rational-number class is
-provided by the :mod:`fractions` module.  Rational numbers store their
+To fill out the hierarchy of numeric types, the :mod:`fractions`
+module provides a rational-number class.  Rational numbers store their
 values as a numerator and denominator forming a fraction, and can
 exactly represent numbers such as ``2/3`` that floating-point numbers
 can only approximate.
@@ -1391,8 +1439,8 @@
     >>> a/b
     Fraction(5, 3)
 
-To help in converting floating-point numbers to rationals,
-the float type now has a :meth:`as_integer_ratio()` method that returns
+For converting floating-point numbers to rationals,
+the float type now has an :meth:`as_integer_ratio()` method that returns
 the numerator and denominator for a fraction that evaluates to the same
 floating-point value::
 
@@ -1417,11 +1465,11 @@
 Other Language Changes
 ======================
 
-Here are all of the changes that Python 2.6 makes to the core Python language.
+Some smaller changes made to the core Python language are:
 
 * The :func:`hasattr` function was catching and ignoring all errors,
   under the assumption that they meant a :meth:`__getattr__` method
-  was failing somewhere and the return value of :func:`hasattr` would
+  was failing somehow and the return value of :func:`hasattr` would
   therefore be ``False``.  This logic shouldn't be applied to
   :exc:`KeyboardInterrupt` and :exc:`SystemExit`, however; Python 2.6
   will no longer discard such exceptions when :func:`hasattr`
@@ -1442,7 +1490,7 @@
 
   (Contributed by Alexander Belopolsky; :issue:`1686487`.)
 
-  It's also now legal to provide keyword arguments after a ``*args`` argument
+  It's also become legal to provide keyword arguments after a ``*args`` argument
   to a function call.
 
     >>> def f(*args, **kw):
@@ -1454,31 +1502,34 @@
   Previously this would have been a syntax error.
   (Contributed by Amaury Forgeot d'Arc; :issue:`3473`.)
 
-* A new built-in, ``next(*iterator*, [*default*])`` returns the next item
+* A new built-in, ``next(iterator, [default])`` returns the next item
   from the specified iterator.  If the *default* argument is supplied,
   it will be returned if *iterator* has been exhausted; otherwise,
-  the :exc:`StopIteration` exception will be raised.  (:issue:`2719`)
+  the :exc:`StopIteration` exception will be raised.  (Backported
+  in :issue:`2719`.)
 
 * Tuples now have :meth:`index` and :meth:`count` methods matching the
   list type's :meth:`index` and :meth:`count` methods::
 
-    >>> t = (0,1,2,3,4)
+    >>> t = (0,1,2,3,4,0,1,2)
     >>> t.index(3)
     3
+    >>> t.count(0)
+    2
 
   (Contributed by Raymond Hettinger)
 
 * The built-in types now have improved support for extended slicing syntax,
-  where various combinations of ``(start, stop, step)`` are supplied.
+  accepting various combinations of ``(start, stop, step)``.
   Previously, the support was partial and certain corner cases wouldn't work.
   (Implemented by Thomas Wouters.)
 
   .. Revision 57619
 
-* Properties now have three attributes, :attr:`getter`,
-  :attr:`setter` and :attr:`deleter`, that are useful shortcuts for
-  adding or modifying a getter, setter or deleter function to an
-  existing property. You would use them like this::
+* Properties now have three attributes, :attr:`getter`, :attr:`setter`
+  and :attr:`deleter`, that are decorators providing useful shortcuts
+  for adding a getter, setter or deleter function to an existing
+  property. You would use them like this::
 
     class C(object):
 	@property
@@ -1518,12 +1569,7 @@
 
   (Contributed by Raymond Hettinger.)
 
-* A numerical nicety: when creating a complex number from two floats
-  on systems that support signed zeros (-0 and +0), the
-  :func:`complex` constructor will now preserve the sign
-  of the zero.  (Fixed by Mark T. Dickinson; :issue:`1507`)
-
-* More floating-point features were also added.  The :func:`float` function
+* Many floating-point features were added.  The :func:`float` function
   will now turn the string ``nan`` into an
   IEEE 754 Not A Number value, and ``+inf`` and ``-inf`` into
   positive or negative infinity.  This works on any platform with
@@ -1534,7 +1580,7 @@
   infinite or Not A Number.  (:issue:`1640`)
 
   Conversion functions were added to convert floating-point numbers
-  into hexadecimal strings.  (:issue:`3008`) These functions lets you
+  into hexadecimal strings (:issue:`3008`).  These functions
   convert floats to and from a string representation without
   introducing rounding errors from the conversion between decimal and
   binary.  Floats have a :meth:`hex` method that returns a string
@@ -1550,49 +1596,26 @@
       >>> b.hex()
       '0x1.5555555555555p-2'
 
-* The :mod:`math` module has a number of new functions, and the existing
-  functions have been improved to give more consistent behaviour
-  across platforms, especially with respect to handling of
-  floating-point exceptions and IEEE 754 special values.
-  The new functions are:
-
-  * :func:`~math.isinf` and :func:`~math.isnan` determine whether a given float
-    is a (positive or negative) infinity or a NaN (Not a Number), respectively.
-
-  * :func:`~math.copysign` copies the sign bit of an IEEE 754 number,
-    returning the absolute value of *x* combined with the sign bit of
-    *y*.  For example, ``math.copysign(1, -0.0)`` returns -1.0.
-    (Contributed by Christian Heimes.)
-
-  * :func:`~math.factorial` computes the factorial of a number.
-    (Contributed by Raymond Hettinger; :issue:`2138`.)
-
-  * :func:`~math.fsum` adds up the stream of numbers from an iterable,
-    and is careful to avoid loss of precision by calculating partial sums.
-    (Contributed by Jean Brouwers, Raymond Hettinger, and Mark Dickinson;
-    :issue:`2819`.)
-
-  * The inverse hyperbolic functions :func:`~math.acosh`, :func:`~math.asinh`
-    and :func:`~math.atanh`.
-
-  * The function :func:`~math.log1p`, returning the natural logarithm of *1+x*
-    (base *e*).
-
-  There's also a new :func:`trunc` built-in function as a result of the
-  backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__.
-
-  The existing math functions have been modified to follow the
-  recommendations of the C99 standard with respect to special values
-  whenever possible.  For example, ``sqrt(-1.)`` should now give a
-  :exc:`ValueError` across (nearly) all platforms, while
-  ``sqrt(float('NaN'))`` should return a NaN on all IEEE 754
-  platforms.  Where Annex 'F' of the C99 standard recommends signaling
-  'divide-by-zero' or 'invalid', Python will raise :exc:`ValueError`.
-  Where Annex 'F' of the C99 standard recommends signaling 'overflow',
-  Python will raise :exc:`OverflowError`.  (See :issue:`711019`,
-  :issue:`1640`.)
+* A numerical nicety: when creating a complex number from two floats
+  on systems that support signed zeros (-0 and +0), the
+  :func:`complex` constructor will now preserve the sign
+  of the zero.  (Fixed by Mark T. Dickinson; :issue:`1507`.)
 
-  (Contributed by Christian Heimes and Mark Dickinson.)
+* Classes that inherit a :meth:`__hash__` method from a parent class
+  can set ``__hash__ = None`` to indicate that the class isn't
+  hashable.  This will make ``hash(obj)`` raise a :exc:`TypeError`
+  and the class will not be indicated as implementing the
+  :class:`Hashable` ABC.
+
+  You should do this when you've defined a :meth:`__cmp__` or
+  :meth:`__eq__` method that compares objects by their value rather
+  than by identity.  All objects have a default hash method that uses
+  ``id(obj)`` as the hash value.  There's no tidy way to remove the
+  :meth:`__hash__` method inherited from a parent class, so
+  assigning ``None`` was implemented as an override.  At the
+  C level, extensions can set ``tp_hash`` to
+  :cfunc:`PyObject_HashNotImplemented`.
+  (Fixed by Nick Coghlan and Amaury Forgeot d'Arc; :issue:`2235`.)
 
 * Changes to the :class:`Exception` interface
   as dictated by :pep:`352` continue to be made.  For 2.6,
@@ -1614,7 +1637,7 @@
   :issue:`1444529`.)
 
 * The :func:`complex` constructor now accepts strings containing
-  parenthesized complex numbers, letting ``complex(repr(cmplx))``
+  parenthesized complex numbers, meaning that ``complex(repr(cplx))``
   will now round-trip values.  For example, ``complex('(3+4j)')``
   now returns the value (3+4j).  (:issue:`1491866`)
 
@@ -1635,11 +1658,11 @@
 * Instance method objects have new attributes for the object and function
   comprising the method; the new synonym for :attr:`im_self` is
   :attr:`__self__`, and :attr:`im_func` is also available as :attr:`__func__`.
-  The old names are still supported in Python 2.6; they're gone in 3.0.
+  The old names are still supported in Python 2.6, but are gone in 3.0.
 
 * An obscure change: when you use the the :func:`locals` function inside a
   :keyword:`class` statement, the resulting dictionary no longer returns free
-  variables.  (Free variables, in this case, are variables referred to in the
+  variables.  (Free variables, in this case, are variables referenced in the
   :keyword:`class` statement  that aren't attributes of the class.)
 
 .. ======================================================================
@@ -1654,7 +1677,7 @@
   (Contributed by Neal Norwitz and Brett Cannon; :issue:`1631171`.)
 
 * Type objects now have a cache of methods that can reduce
-  the amount of work required to find the correct method implementation
+  the work required to find the correct method implementation
   for a particular class; once cached, the interpreter doesn't need to
   traverse base classes to figure out the right method to call.
   The cache is cleared if a base class or the class itself is modified,
@@ -1674,19 +1697,18 @@
   but it's impossible for the Python interpreter to determine that.
   See :issue:`1878` for some discussion.)
 
-* Function calls that use keyword arguments
-  are significantly faster thanks to a patch that does a quick pointer
-  comparison, usually saving the time of a full string comparison.
-  (Contributed by Raymond Hettinger, after an initial implementation by
-  Antoine Pitrou; :issue:`1819`.)
+* Function calls that use keyword arguments are significantly faster
+  by doing a quick pointer comparison, usually saving the time of a
+  full string comparison.  (Contributed by Raymond Hettinger, after an
+  initial implementation by Antoine Pitrou; :issue:`1819`.)
 
 * All of the functions in the :mod:`struct` module have been rewritten in
   C, thanks to work at the Need For Speed sprint.
   (Contributed by Raymond Hettinger.)
 
-* Internally, a bit is now set in type objects to indicate some of the standard
-  built-in types.  This speeds up checking if an object is a subclass of one of
-  these types.  (Contributed by Neal Norwitz.)
+* Some of the standard built-in types now set a bit in their type
+  objects.  This speeds up checking whether an object is a subclass of
+  one of these types.  (Contributed by Neal Norwitz.)
 
 * Unicode strings now use faster code for detecting
   whitespace and line breaks; this speeds up the :meth:`split` method
@@ -1699,10 +1721,10 @@
 
 * To reduce memory usage, the garbage collector will now clear internal
   free lists when garbage-collecting the highest generation of objects.
-  This may return memory to the OS sooner.
+  This may return memory to the operating system sooner.
 
 The net result of the 2.6 optimizations is that Python 2.6 runs the pystone
-benchmark around XX% faster than Python 2.5.
+benchmark around XXX% faster than Python 2.5.
 
 .. ======================================================================
 
@@ -1713,27 +1735,26 @@
 
 Two command-line options have been reserved for use by other Python
 implementations.  The :option:`-J` switch has been reserved for use by
-Jython for Jython-specific options, such as ones that are passed to
+Jython for Jython-specific options, such as switches that are passed to
 the underlying JVM.  :option:`-X` has been reserved for options
 specific to a particular implementation of Python such as CPython,
 Jython, or IronPython.  If either option is used with Python 2.6, the
 interpreter will report that the option isn't currently used.
 
-It's now possible to prevent Python from writing :file:`.pyc` or
-:file:`.pyo` files on importing a module by supplying the :option:`-B`
-switch to the Python interpreter, or by setting the
-:envvar:`PYTHONDONTWRITEBYTECODE` environment variable before running
-the interpreter.  This setting is available to Python programs as the
-``sys.dont_write_bytecode`` variable, and can be changed by Python
-code to modify the interpreter's behaviour.  (Contributed by Neal
-Norwitz and Georg Brandl.)
+Python can now be prevented from writing :file:`.pyc` or :file:`.pyo`
+files by supplying the :option:`-B` switch to the Python interpreter,
+or by setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment
+variable before running the interpreter.  This setting is available to
+Python programs as the ``sys.dont_write_bytecode`` variable, and
+Python code can change the value to modify the interpreter's
+behaviour.  (Contributed by Neal Norwitz and Georg Brandl.)
 
 The encoding used for standard input, output, and standard error can
 be specified by setting the :envvar:`PYTHONIOENCODING` environment
 variable before running the interpreter.  The value should be a string
-in the form ``**encoding**`` or ``**encoding**:**errorhandler**``.
-The **encoding** part specifies the encoding's name, e.g. ``utf-8`` or
-``latin-1``; the optional **errorhandler** part specifies
+in the form ``<encoding>`` or ``<encoding>:<errorhandler>``.
+The *encoding* part specifies the encoding's name, e.g. ``utf-8`` or
+``latin-1``; the optional *errorhandler* part specifies
 what to do with characters that can't be handled by the encoding,
 and  should be one of "error", "ignore", or "replace".   (Contributed
 by Martin von Loewis.)
@@ -1743,14 +1764,14 @@
 New, Improved, and Deprecated Modules
 =====================================
 
-As usual, Python's standard library received a number of enhancements and bug
-fixes.  Here's a partial list of the most notable changes, sorted alphabetically
-by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more
-complete list of changes, or look through the Subversion logs for all the
-details.
+As in every release, Python's standard library received a number of
+enhancements and bug fixes.  Here's a partial list of the most notable
+changes, sorted alphabetically by module name. Consult the
+:file:`Misc/NEWS` file in the source tree for a more complete list of
+changes, or look through the Subversion logs for all the details.
 
 * (3.0-warning mode) Python 3.0 will feature a reorganized standard
-  library; many outdated modules are being dropped.
+  library that will drop many outdated modules and rename others.
   Python 2.6 running in 3.0-warning mode will warn about these modules
   when they are imported.
 
@@ -1777,99 +1798,43 @@
   :mod:`pure`,
   :mod:`statvfs`,
   :mod:`sunaudiodev`,
-  :mod:`test.testall`,
+  :mod:`test.testall`, and
   :mod:`toaiff`.
 
-  Various MacOS modules have been removed:
-  :mod:`_builtinSuites`,
-  :mod:`aepack`,
-  :mod:`aetools`,
-  :mod:`aetypes`,
-  :mod:`applesingle`,
-  :mod:`appletrawmain`,
-  :mod:`appletrunner`,
-  :mod:`argvemulator`,
-  :mod:`Audio_mac`,
-  :mod:`autoGIL`,
-  :mod:`Carbon`,
-  :mod:`cfmfile`,
-  :mod:`CodeWarrior`,
-  :mod:`ColorPicker`,
-  :mod:`EasyDialogs`,
-  :mod:`Explorer`,
-  :mod:`Finder`,
-  :mod:`FrameWork`,
-  :mod:`findertools`,
-  :mod:`ic`,
-  :mod:`icglue`,
-  :mod:`icopen`,
-  :mod:`macerrors`,
-  :mod:`MacOS`,
-  :mod:`macostools`,
-  :mod:`macresource`,
-  :mod:`MiniAEFrame`,
-  :mod:`Nav`,
-  :mod:`Netscape`,
-  :mod:`OSATerminology`,
-  :mod:`pimp`,
-  :mod:`PixMapWrapper`,
-  :mod:`StdSuites`,
-  :mod:`SystemEvents`,
-  :mod:`Terminal`,
-  :mod:`terminalcommand`.
-
-  A number of old IRIX-specific modules were deprecated:
-  :mod:`al` and :mod:`AL`,
-  :mod:`cd`,
-  :mod:`cddb`,
-  :mod:`cdplayer`,
-  :mod:`CL` and :mod:`cl`,
-  :mod:`DEVICE`,
-  :mod:`ERRNO`,
-  :mod:`FILE`,
-  :mod:`FL` and :mod:`fl`,
-  :mod:`flp`,
-  :mod:`fm`,
-  :mod:`GET`,
-  :mod:`GLWS`,
-  :mod:`GL` and :mod:`gl`,
-  :mod:`IN`,
-  :mod:`IOCTL`,
-  :mod:`jpeg`,
-  :mod:`panelparser`,
-  :mod:`readcd`,
-  :mod:`SV` and :mod:`sv`,
-  :mod:`torgb`,
-  :mod:`videoreader`,
-  :mod:`WAIT`.
-
 * The :mod:`asyncore` and :mod:`asynchat` modules are
   being actively maintained again, and a number of patches and bugfixes
   were applied.  (Maintained by Josiah Carlson; see :issue:`1736190` for
   one patch.)
 
+.. |uacute| unicode:: 0xA9
+
+* The :mod:`bsddb` module also has a new maintainer, Jes|uacute|s Cea,
+  and the package is now available as a standalone package.
+  The web page for the package is
+  `www.jcea.es/programacion/pybsddb.htm <http://www.jcea.es/programacion/pybsddb.htm>`__.
+
 * The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
   available, instead of restricting itself to protocol 1.
   (Contributed by W. Barnes; :issue:`1551443`.)
 
-* The :mod:`cgi` module will now read variables from the query string of an
-  HTTP POST request.  This makes it possible to use form actions with
-  URLs such as "/cgi-bin/add.py?category=1".  (Contributed by
-  Alexandre Fiori and Nubis; :issue:`1817`.)
-
-* The :mod:`cmath` module underwent an extensive set of revisions,
-  thanks to Mark Dickinson and Christian Heimes, that added some new
-  features and greatly improved the accuracy of the computations.
+* The :mod:`cgi` module will now read variables from the query string
+  of an HTTP POST request.  This makes it possible to use form actions
+  with URLs that include query strings such as
+  "/cgi-bin/add.py?category=1".  (Contributed by Alexandre Fiori and
+  Nubis; :issue:`1817`.)
 
+* The :mod:`cmath` module underwent extensive revision,
+  contributed by Mark Dickinson and Christian Heimes.
   Five new functions were added:
 
   * :func:`polar` converts a complex number to polar form, returning
-    the modulus and argument of that complex number.
+    the modulus and argument of the complex number.
 
-  * :func:`rect` does the opposite, turning a (modulus, argument) pair
+  * :func:`rect` does the opposite, turning a modulus, argument pair
     back into the corresponding complex number.
 
-  * :func:`phase` returns the phase or argument of a complex number.
+  * :func:`phase` returns the argument (also called the angle) of a complex
+    number.
 
   * :func:`isnan` returns True if either
     the real or imaginary part of its argument is a NaN.
@@ -1913,8 +1878,8 @@
      >>> v2
      variable(id=1, name='amplitude', type='int', size=4)
 
-  Where the new :class:`namedtuple` type proved suitable, the standard
-  library has been modified to return them.  For example,
+  Several places in the standard library that returned tuples have
+  been modified to return :class:`namedtuple` instances.  For example,
   the :meth:`Decimal.as_tuple` method now returns a named tuple with
   :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields.
 
@@ -1941,10 +1906,9 @@
 
   (Contributed by Raymond Hettinger.)
 
-* A new method in the :mod:`curses` module: for a window, :meth:`chgat` changes
-  the display characters for a  certain number of characters on a single line.
-  (Contributed by Fabian Kreutz.)
-  ::
+* A new window method in the :mod:`curses` module,
+  :meth:`chgat`, changes the display attributes for a certain number of
+  characters on a single line.  (Contributed by Fabian Kreutz.)  ::
 
      # Boldface text starting at y=0,x=21
      # and affecting the rest of the line.
@@ -1979,32 +1943,29 @@
   support added by Raymond Hettinger.)
 
 * The :mod:`difflib` module's :class:`SequenceMatcher` class
-  now returns named tuples representing matches.
-  In addition to behaving like tuples, the returned values
-  also have :attr:`a`, :attr:`b`, and :attr:`size` attributes.
+  now returns named tuples representing matches,
+  with :attr:`a`, :attr:`b`, and :attr:`size` attributes.
   (Contributed by Raymond Hettinger.)
 
-* An optional ``timeout`` parameter was added to the
-  :class:`ftplib.FTP` class constructor as well as the :meth:`connect`
-  method, specifying a timeout measured in seconds.  (Added by Facundo
-  Batista.)  Also, the :class:`FTP` class's
-  :meth:`storbinary` and :meth:`storlines`
-  now take an optional *callback* parameter that will be called with
-  each block of data after the data has been sent.
+* An optional ``timeout`` parameter, specifying a timeout measured in
+  seconds, was added to the :class:`ftplib.FTP` class constructor as
+  well as the :meth:`connect` method.  (Added by Facundo Batista.)
+  Also, the :class:`FTP` class's :meth:`storbinary` and
+  :meth:`storlines` now take an optional *callback* parameter that
+  will be called with each block of data after the data has been sent.
   (Contributed by Phil Schwartz; :issue:`1221598`.)
 
 * The :func:`reduce` built-in function is also available in the
-  :mod:`functools` module.  In Python 3.0, the built-in is dropped and it's
-  only available from :mod:`functools`; currently there are no plans
-  to drop the built-in in the 2.x series.  (Patched by
-  Christian Heimes; :issue:`1739906`.)
+  :mod:`functools` module.  In Python 3.0, the built-in has been
+  dropped and :func:`reduce` is only available from :mod:`functools`;
+  currently there are no plans to drop the built-in in the 2.x series.
+  (Patched by Christian Heimes; :issue:`1739906`.)
 
 * When possible, the :mod:`getpass` module will now use
-  :file:`/dev/tty` (when available) to print
-  a prompting message and read the password, falling back to using
-  standard error and standard input.    If the password may be echoed to
-  the terminal, a warning is printed before the prompt is displayed.
-  (Contributed by Gregory P. Smith.)
+  :file:`/dev/tty` to print a prompt message and read the password,
+  falling back to standard error and standard input.  If the
+  password may be echoed to the terminal, a warning is printed before
+  the prompt is displayed.  (Contributed by Gregory P. Smith.)
 
 * The :func:`glob.glob` function can now return Unicode filenames if
   a Unicode path was used and Unicode filenames are matched within the
@@ -2012,9 +1973,9 @@
 
 * The :mod:`gopherlib` module has been removed.
 
-* A new function in the :mod:`heapq` module: ``merge(iter1, iter2, ...)``
-  takes any number of iterables that return data *in sorted
-  order*, and returns a new iterator that returns the contents of all
+* A new function in the :mod:`heapq` module, ``merge(iter1, iter2, ...)``,
+  takes any number of iterables returning data in sorted
+  order, and returns a new generator that returns the contents of all
   the iterators, also in sorted order.  For example::
 
      heapq.merge([1, 3, 5, 9], [2, 8, 16]) ->
@@ -2027,14 +1988,14 @@
 
   :mod:`heapq` is now implemented to only use less-than comparison,
   instead of the less-than-or-equal comparison it previously used.
-  This makes :mod:`heapq`'s usage of a type match that of the
+  This makes :mod:`heapq`'s usage of a type match the
   :meth:`list.sort` method.
   (Contributed by Raymond Hettinger.)
 
-* An optional ``timeout`` parameter was added to the
-  :class:`httplib.HTTPConnection` and :class:`HTTPSConnection`
-  class constructors, specifying a timeout measured in seconds.
-  (Added by Facundo Batista.)
+* An optional ``timeout`` parameter, specifying a timeout measured in
+  seconds, was added to the :class:`httplib.HTTPConnection` and
+  :class:`HTTPSConnection` class constructors.  (Added by Facundo
+  Batista.)
 
 * Most of the :mod:`inspect` module's functions, such as
   :func:`getmoduleinfo` and :func:`getargs`, now return named tuples.
@@ -2053,56 +2014,56 @@
   others, the missing values are set to *fillvalue*.  For example::
 
      itertools.izip_longest([1,2,3], [1,2,3,4,5]) ->
-       [(1, 1), (2, 2), (3, 3), (None, 4), (None, 5)]
+       (1, 1), (2, 2), (3, 3), (None, 4), (None, 5)
 
   ``product(iter1, iter2, ..., [repeat=N])`` returns the Cartesian product
   of the supplied iterables, a set of tuples containing
   every possible combination of the elements returned from each iterable. ::
 
      itertools.product([1,2,3], [4,5,6]) ->
-       [(1, 4), (1, 5), (1, 6),
+        (1, 4), (1, 5), (1, 6),
 	(2, 4), (2, 5), (2, 6),
-	(3, 4), (3, 5), (3, 6)]
+	(3, 4), (3, 5), (3, 6)
 
   The optional *repeat* keyword argument is used for taking the
   product of an iterable or a set of iterables with themselves,
   repeated *N* times.  With a single iterable argument, *N*-tuples
   are returned::
 
-     itertools.product([1,2], repeat=3)) ->
-       [(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),
-        (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]
+     itertools.product([1,2], repeat=3) ->
+        (1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),
+        (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)
 
   With two iterables, *2N*-tuples are returned. ::
 
-     itertools(product([1,2], [3,4], repeat=2) ->
-       [(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),
+     itertools.product([1,2], [3,4], repeat=2) ->
+        (1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),
         (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),
         (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),
-        (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]
+        (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)
 
   ``combinations(iterable, r)`` returns sub-sequences of length *r* from
   the elements of *iterable*. ::
 
     itertools.combinations('123', 2) ->
-      [('1', '2'), ('1', '3'), ('2', '3')]
+       ('1', '2'), ('1', '3'), ('2', '3')
 
     itertools.combinations('123', 3) ->
-      [('1', '2', '3')]
+       ('1', '2', '3')
 
     itertools.combinations('1234', 3) ->
-      [('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'),
-       ('2', '3', '4')]
+       ('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'),
+       ('2', '3', '4')
 
   ``permutations(iter[, r])`` returns all the permutations of length *r* of
   the iterable's elements.  If *r* is not specified, it will default to the
   number of elements produced by the iterable. ::
 
     itertools.permutations([1,2,3,4], 2) ->
-      [(1, 2), (1, 3), (1, 4),
+       (1, 2), (1, 3), (1, 4),
        (2, 1), (2, 3), (2, 4),
        (3, 1), (3, 2), (3, 4),
-       (4, 1), (4, 2), (4, 3)]
+       (4, 1), (4, 2), (4, 3)
 
   ``itertools.chain(*iterables)`` is an existing function in
   :mod:`itertools` that gained a new constructor in Python 2.6.
@@ -2112,14 +2073,14 @@
   all the elements of the second, and so on. ::
 
     chain.from_iterable([[1,2,3], [4,5,6]]) ->
-       [1, 2, 3, 4, 5, 6]
+        1, 2, 3, 4, 5, 6
 
   (All contributed by Raymond Hettinger.)
 
 * The :mod:`logging` module's :class:`FileHandler` class
   and its subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`,
   and :class:`TimedRotatingFileHandler` now
-  have an optional *delay* parameter to its constructor.  If *delay*
+  have an optional *delay* parameter to their constructors.  If *delay*
   is true, opening of the log file is deferred until the first
   :meth:`emit` call is made.  (Contributed by Vinay Sajip.)
 
@@ -2128,15 +2089,55 @@
   in determining when midnight occurs and in generating filenames;
   otherwise local time will be used.
 
-* The :mod:`macfs` module has been removed.  This in turn required the
-  :func:`macostools.touched` function to be removed because it depended on the
-  :mod:`macfs` module.  (:issue:`1490190`)
+* Several new functions were added to the :mod:`math` module:
 
-* :class:`mmap` objects now have a :meth:`rfind` method that finds
-  a substring, beginning at the end of the string and searching
-  backwards.  The :meth:`find` method
-  also gained an *end* parameter containing the index at which to stop
-  the forward search.
+  * :func:`~math.isinf` and :func:`~math.isnan` determine whether a given float
+    is a (positive or negative) infinity or a NaN (Not a Number), respectively.
+
+  * :func:`~math.copysign` copies the sign bit of an IEEE 754 number,
+    returning the absolute value of *x* combined with the sign bit of
+    *y*.  For example, ``math.copysign(1, -0.0)`` returns -1.0.
+    (Contributed by Christian Heimes.)
+
+  * :func:`~math.factorial` computes the factorial of a number.
+    (Contributed by Raymond Hettinger; :issue:`2138`.)
+
+  * :func:`~math.fsum` adds up the stream of numbers from an iterable,
+    and is careful to avoid loss of precision through using partial sums.
+    (Contributed by Jean Brouwers, Raymond Hettinger, and Mark Dickinson;
+    :issue:`2819`.)
+
+  * :func:`~math.acosh`, :func:`~math.asinh`
+    and :func:`~math.atanh` compute the inverse hyperbolic functions.
+
+  * :func:`~math.log1p` returns the natural logarithm of *1+x*
+    (base *e*).
+
+  * :func:`trunc` rounds a number toward zero, returning the closest
+    :class:`Integral` that's between the function's argument and zero.
+    Added as part of the backport of
+    `PEP 3141's type hierarchy for numbers <#pep-3141>`__.
+
+* The :mod:`math` module has been improved to give more consistent
+  behaviour across platforms, especially with respect to handling of
+  floating-point exceptions and IEEE 754 special values.
+
+  Whenever possible, the module follows the recommendations of the C99
+  standard about 754's special values.  For example, ``sqrt(-1.)``
+  should now give a :exc:`ValueError` across almost all platforms,
+  while ``sqrt(float('NaN'))`` should return a NaN on all IEEE 754
+  platforms.  Where Annex 'F' of the C99 standard recommends signaling
+  'divide-by-zero' or 'invalid', Python will raise :exc:`ValueError`.
+  Where Annex 'F' of the C99 standard recommends signaling 'overflow',
+  Python will raise :exc:`OverflowError`.  (See :issue:`711019` and
+  :issue:`1640`.)
+
+  (Contributed by Christian Heimes and Mark Dickinson.)
+
+* :class:`mmap` objects now have a :meth:`rfind` method that searches for a
+  substring beginning at the end of the string and searching
+  backwards.  The :meth:`find` method also gained an *end* parameter
+  giving an index at which to stop searching.
   (Contributed by John Lenton.)
 
 * The :mod:`operator` module gained a
@@ -2154,7 +2155,8 @@
   The :func:`attrgetter` function now accepts dotted names and performs
   the corresponding attribute lookups::
 
-    >>> inst_name = operator.attrgetter('__class__.__name__')
+    >>> inst_name = operator.attrgetter(
+    ...        '__class__.__name__')
     >>> inst_name('')
     'str'
     >>> inst_name(help)
@@ -2162,14 +2164,28 @@
 
   (Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)
 
-* New functions in the :mod:`os` module include
-  ``fchmod(fd, mode)``,   ``fchown(fd, uid, gid)``,
-  and ``lchmod(path, mode)``, on operating systems that support these
-  functions. :func:`fchmod` and :func:`fchown` let you change the mode
-  and ownership of an opened file, and :func:`lchmod` changes the mode
-  of a symlink.
+* The :mod:`os` module now wraps several new system calls.
+  ``fchmod(fd, mode)`` and ``fchown(fd, uid, gid)`` change the mode
+  and ownership of an opened file, and ``lchmod(path, mode)`` changes
+  the mode of a symlink.  (Contributed by Georg Brandl and Christian
+  Heimes.)
+
+  :func:`chflags` and :func:`lchflags` are wrappers for the
+  corresponding system calls (where they're available), changing the
+  flags set on a file.  Constants for the flag values are defined in
+  the :mod:`stat` module; some possible values include
+  :const:`UF_IMMUTABLE` to signal the file may not be changed and
+  :const:`UF_APPEND` to indicate that data can only be appended to the
+  file.  (Contributed by M. Levinson.)
 
-  (Contributed by Georg Brandl and Christian Heimes.)
+  ``os.closerange(low, high)`` efficiently closes all file descriptors
+  from *low* to *high*, ignoring any errors and not including *high* itself.
+  This function is now used by the :mod:`subprocess` module to make starting
+  processes faster.  (Contributed by Georg Brandl; :issue:`1663329`.)
+
+* The ``os.environ`` object's :meth:`clear` method will now unset the
+  environment variables using :func:`os.unsetenv` in addition to clearing
+  the object's keys.  (Contributed by Martin Horcicka; :issue:`1181`.)
 
 * The :func:`os.walk` function now has a ``followlinks`` parameter. If
   set to True, it will follow symlinks pointing to directories and
@@ -2178,10 +2194,6 @@
   into an infinite recursion if there's a symlink that points to a
   parent directory.  (:issue:`1273829`)
 
-* The ``os.environ`` object's :meth:`clear` method will now unset the
-  environment variables using :func:`os.unsetenv` in addition to clearing
-  the object's keys.  (Contributed by Martin Horcicka; :issue:`1181`.)
-
 * In the :mod:`os.path` module, the :func:`splitext` function
   has been changed to not split on leading period characters.
   This produces better results when operating on Unix's dot-files.
@@ -2189,22 +2201,22 @@
   now returns ``('.ipython', '')`` instead of ``('', '.ipython')``.
   (:issue:`115886`)
 
-  A new function, :func:`relpath(path, start)` returns a relative path
+  A new function, ``os.path.relpath(path, start='.')``, returns a relative path
   from the ``start`` path, if it's supplied, or from the current
   working directory to the destination ``path``.  (Contributed by
   Richard Barran; :issue:`1339796`.)
 
   On Windows, :func:`os.path.expandvars` will now expand environment variables
-  in the form "%var%", and "~user" will be expanded into the
+  given in the form "%var%", and "~user" will be expanded into the
   user's home directory path.  (Contributed by Josiah Carlson;
   :issue:`957650`.)
 
 * The Python debugger provided by the :mod:`pdb` module
-  gained a new command: "run" restarts the Python program being debugged,
+  gained a new command: "run" restarts the Python program being debugged
   and can optionally take new command-line arguments for the program.
   (Contributed by Rocky Bernstein; :issue:`1393667`.)
 
-  The :func:`post_mortem` function, used to enter debugging of a
+  The :func:`post_mortem` function, used to begin debugging a
   traceback, will now use the traceback returned by :func:`sys.exc_info`
   if no traceback is supplied.   (Contributed by Facundo Batista;
   :issue:`1106316`.)
@@ -2232,24 +2244,12 @@
 
   (Contributed by Paul Moore; :issue:`2439`.)
 
-* New functions in the :mod:`posix` module: :func:`chflags` and :func:`lchflags`
-  are wrappers for the corresponding system calls (where they're available).
-  Constants for the flag values are defined in the :mod:`stat` module; some
-  possible values include :const:`UF_IMMUTABLE` to signal the file may not be
-  changed and :const:`UF_APPEND` to indicate that data can only be appended to the
-  file.  (Contributed by M. Levinson.)
-
-  ``os.closerange(*low*, *high*)`` efficiently closes all file descriptors
-  from *low* to *high*, ignoring any errors and not including *high* itself.
-  This function is now used by the :mod:`subprocess` module to make starting
-  processes faster.  (Contributed by Georg Brandl; :issue:`1663329`.)
-
 * The :mod:`pyexpat` module's :class:`Parser` objects now allow setting
   their :attr:`buffer_size` attribute to change the size of the buffer
   used to hold character data.
   (Contributed by Achim Gaedke; :issue:`1137`.)
 
-* The :mod:`Queue` module now provides queue classes that retrieve entries
+* The :mod:`Queue` module now provides queue variants that retrieve entries
   in different orders.  The :class:`PriorityQueue` class stores
   queued items in a heap and retrieves them in priority order,
   and :class:`LifoQueue` retrieves the most recently added entries first,
@@ -2266,12 +2266,12 @@
   The new ``triangular(low, high, mode)`` function returns random
   numbers following a triangular distribution.   The returned values
   are between *low* and *high*, not including *high* itself, and
-  with *mode* as the mode, the most frequently occurring value
+  with *mode* as the most frequently occurring value
   in the distribution.  (Contributed by Wladmir van der Laan and
   Raymond Hettinger; :issue:`1681432`.)
 
 * Long regular expression searches carried out by the  :mod:`re`
-  module will now check for signals being delivered, so especially
+  module will check for signals being delivered, so
   time-consuming searches can now be interrupted.
   (Contributed by Josh Hoyt and Ralf Schmitt; :issue:`846388`.)
 
@@ -2296,27 +2296,27 @@
 
 * The :mod:`select` module now has wrapper functions
   for the Linux :cfunc:`epoll` and BSD :cfunc:`kqueue` system calls.
-  Also, a :meth:`modify` method was added to the existing :class:`poll`
+  :meth:`modify` method was added to the existing :class:`poll`
   objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor
-  or file object and an event mask,
-
+  or file object and an event mask, modifying the recorded event mask
+  for that file.
   (Contributed by Christian Heimes; :issue:`1657`.)
 
 * The :mod:`sets` module has been deprecated; it's better to
   use the built-in :class:`set` and :class:`frozenset` types.
 
-* The :func:`shutil.copytree` function now has an optional **ignore** argument
+* The :func:`shutil.copytree` function now has an optional *ignore* argument
   that takes a callable object.  This callable will receive each directory path
   and a list of the directory's contents, and returns a list of names that
   will be ignored, not copied.
 
   The :mod:`shutil` module also provides an :func:`ignore_patterns`
-  function for use with this new parameter.
-  :func:`ignore_patterns` takes an arbitrary number of glob-style patterns
-  and will ignore any files and directories that match this pattern.
-  The following example copies a directory tree, but skip both SVN's internal
-  :file:`.svn` directories and Emacs backup
-  files, which have names ending with '~'::
+  function for use with this new parameter.  :func:`ignore_patterns`
+  takes an arbitrary number of glob-style patterns and returns a
+  callable that will ignore any files and directories that match any
+  of these patterns.  The following example copies a directory tree,
+  but skips both :file:`.svn` directories and Emacs backup files,
+  which have names ending with '~'::
 
       shutil.copytree('Doc/library', '/tmp/library',
                       ignore=shutil.ignore_patterns('*~', '.svn'))
@@ -2325,7 +2325,8 @@
 
 * Integrating signal handling with GUI handling event loops
   like those used by Tkinter or GTk+ has long been a problem; most
-  software ends up polling, waking up every fraction of a second.
+  software ends up polling, waking up every fraction of a second to check
+  if any GUI events have occurred.
   The :mod:`signal` module can now make this more efficient.
   Calling ``signal.set_wakeup_fd(fd)`` sets a file descriptor
   to be used; when a signal is received, a byte is written to that
@@ -2338,7 +2339,7 @@
   will be added to the list of descriptors monitored by the event loop via
   :cfunc:`select` or :cfunc:`poll`.
   On receiving a signal, a byte will be written and the main event loop
-  will be woken up, without the need to poll.
+  will be woken up, avoiding the need to poll.
 
   (Contributed by Adam Olsen; :issue:`1583`.)
 
@@ -2347,7 +2348,7 @@
   (Contributed by Ralf Schmitt.)
 
   The :func:`setitimer` and :func:`getitimer` functions have also been
-  added on systems that support these system calls.  :func:`setitimer`
+  added (where they're available).  :func:`setitimer`
   allows setting interval timers that will cause a signal to be
   delivered to the process after a specified time, measured in
   wall-clock time, consumed process time, or combined process+system
@@ -2355,22 +2356,20 @@
 
 * The :mod:`smtplib` module now supports SMTP over SSL thanks to the
   addition of the :class:`SMTP_SSL` class. This class supports an
-  interface identical to the existing :class:`SMTP` class.   Both
-  class constructors also have an optional ``timeout`` parameter
-  that specifies a timeout for the initial connection attempt, measured in
-  seconds.
-
-  An implementation of the LMTP protocol (:rfc:`2033`) was also added to
-  the module.  LMTP is used in place of SMTP when transferring e-mail
-  between agents that don't manage a mail queue.
-
-  (SMTP over SSL contributed by Monty Taylor; timeout parameter
-  added by Facundo Batista; LMTP implemented by Leif
-  Hedstrom; :issue:`957003`.)
-
-* In the :mod:`smtplib` module, SMTP.starttls() now complies with :rfc:`3207`
-  and forgets any knowledge obtained from the server not obtained from
-  the TLS negotiation itself.  (Patch contributed by Bill Fenner;
+  interface identical to the existing :class:`SMTP` class.
+  (Contributed by Monty Taylor.)  Both class constructors also have an
+  optional ``timeout`` parameter that specifies a timeout for the
+  initial connection attempt, measured in seconds.  (Contributed by
+  Facundo Batista.)
+
+  An implementation of the LMTP protocol (:rfc:`2033`) was also added
+  to the module.  LMTP is used in place of SMTP when transferring
+  e-mail between agents that don't manage a mail queue.  (LMTP
+  implemented by Leif Hedstrom; :issue:`957003`.)
+
+  SMTP.starttls() now complies with :rfc:`3207` and forgets any
+  knowledge obtained from the server not obtained from the TLS
+  negotiation itself.  (Patch contributed by Bill Fenner;
   :issue:`829951`.)
 
 * The :mod:`socket` module now supports TIPC (http://tipc.sf.net),
@@ -2402,15 +2401,13 @@
   :cfunc:`TerminateProcess`.
   (Contributed by Christian Heimes.)
 
-* A new variable in the :mod:`sys` module,
-  :attr:`float_info`, is an object
-  containing information about the platform's floating-point support
-  derived from the :file:`float.h` file.  Attributes of this object
-  include
-  :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon`
-  (smallest difference between 1.0 and the next largest value
-  representable), and several others.  (Contributed by Christian Heimes;
-  :issue:`1534`.)
+* A new variable in the :mod:`sys` module, :attr:`float_info`, is an
+  object containing information derived from the :file:`float.h` file
+  about the platform's floating-point support.  Attributes of this
+  object include :attr:`mant_dig` (number of digits in the mantissa),
+  :attr:`epsilon` (smallest difference between 1.0 and the next
+  largest value representable), and several others.  (Contributed by
+  Christian Heimes; :issue:`1534`.)
 
   Another new variable, :attr:`dont_write_bytecode`, controls whether Python
   writes any :file:`.pyc` or :file:`.pyo` files on importing a module.
@@ -2448,16 +2445,17 @@
   is GNU tar; specify the ``format`` parameter to open a file
   using a different format::
 
-    tar = tarfile.open("output.tar", "w", format=tarfile.PAX_FORMAT)
+    tar = tarfile.open("output.tar", "w",
+                       format=tarfile.PAX_FORMAT)
 
-  The new ``errors`` parameter lets you specify an error handling
-  scheme for character conversions: the three standard ways Python can
-  handle errors ``'strict'``, ``'ignore'``, ``'replace'`` , or the
-  special value ``'utf-8'``, which replaces bad characters with their
-  UTF-8 representation.  Character conversions occur because the PAX
-  format supports Unicode filenames, defaulting to UTF-8 encoding.
+  The new ``errors`` parameter specifies an error handling scheme for
+  character conversions.  ``'strict'``, ``'ignore'``, and
+  ``'replace'`` are the three standard ways Python can handle errors,;
+  ``'utf-8'`` is a special value that replaces bad characters with
+  their UTF-8 representation.  (Character conversions occur because the
+  PAX format supports Unicode filenames, defaulting to UTF-8 encoding.)
 
-  The :meth:`TarFile.add` method now accepts a ``exclude`` argument that's
+  The :meth:`TarFile.add` method now accepts an ``exclude`` argument that's
   a function that can be used to exclude certain filenames from
   an archive.
   The function must take a filename and return true if the file
@@ -2486,9 +2484,9 @@
   ``with tempfile.NamedTemporaryFile() as tmp: ...``.
   (Contributed by Alexander Belopolsky; :issue:`2021`.)
 
-* The :mod:`test.test_support` module now contains a
+* The :mod:`test.test_support` module now contains an
   :func:`EnvironmentVarGuard`
-  context manager that  supports temporarily changing environment variables and
+  context manager that temporarily changes environment variables and
   automatically restores them to their old values.
 
   Another context manager, :class:`TransientResource`, can surround calls
@@ -2497,7 +2495,8 @@
   a network test may ignore certain failures when connecting to an
   external web site::
 
-      with test_support.TransientResource(IOError, errno=errno.ETIMEDOUT):
+      with test_support.TransientResource(IOError,
+                                      errno=errno.ETIMEDOUT):
           f = urllib.urlopen('https://sf.net')
           ...
 
@@ -2508,7 +2507,8 @@
   by specifying ``drop_whitespace=False``
   as an argument::
 
-    >>> S = """This  sentence  has a bunch   of    extra   whitespace."""
+    >>> S = """This  sentence  has a bunch   of
+    ...   extra   whitespace."""
     >>> print textwrap.fill(S, width=15)
     This  sentence
     has a bunch
@@ -2523,14 +2523,16 @@
 
   (Contributed by Dwayne Bailey; :issue:`1581073`.)
 
-* The :mod:`threading` module API is being changed for Python 3.0, to
-  use properties such as :attr:`daemon` instead of :meth:`setDaemon`
-  and :meth:`isDaemon` methods, and some methods have been renamed to
-  use underscores instead of camel-case; for example, the
-  :meth:`activeCount` method is renamed to :meth:`active_count`.  The
-  2.6 version of the module supports the same properties and renamed
-  methods, but doesn't remove the old methods.  (Carried out by
-  various people, most notably Benjamin Peterson.)
+* The :mod:`threading` module API is being changed to use properties
+  such as :attr:`daemon` instead of :meth:`setDaemon` and
+  :meth:`isDaemon` methods, and some methods have been renamed to use
+  underscores instead of camel-case; for example, the
+  :meth:`activeCount` method is renamed to :meth:`active_count`.  Both
+  the 2.6 and 3.0 versions of the module support the same properties
+  and renamed methods, but don't remove the old methods.  No date has been set
+  for the deprecation of the old APIs in Python 3.x; the old APIs won't 
+  be removed in any 2.x version.
+  (Carried out by several people, most notably Benjamin Peterson.)
 
   The :mod:`threading` module's :class:`Thread` objects
   gained an :attr:`ident` property that returns the thread's
@@ -2555,11 +2557,11 @@
   Gregor Lingl.  New features in the module include:
 
   * Better animation of turtle movement and rotation.
-  * Control over turtle movement using the new delay(),
-    tracer(), and speed() methods.
+  * Control over turtle movement using the new :meth:`delay`,
+    :meth:`tracer`, and :meth:`speed` methods.
   * The ability to set new shapes for the turtle, and to
     define a new coordinate system.
-  * Turtles now have an undo() method that can roll back actions.
+  * Turtles now have an :meth:`undo()` method that can roll back actions.
   * Simple support for reacting to input events such as mouse and keyboard
     activity, making it possible to write simple games.
   * A :file:`turtle.cfg` file can be used to customize the starting appearance
@@ -2575,7 +2577,8 @@
   :func:`urllib2.urlopen` function.  The parameter specifies a timeout
   measured in seconds.   For example::
 
-     >>> u = urllib2.urlopen("http://slow.example.com", timeout=3)
+     >>> u = urllib2.urlopen("http://slow.example.com",
+                             timeout=3)
      Traceback (most recent call last):
        ...
      urllib2.URLError: <urlopen error timed out>
@@ -2601,7 +2604,7 @@
   attribute; if true, the exception and formatted traceback are returned
   as HTTP headers "X-Exception" and "X-Traceback".  This feature is
   for debugging purposes only and should not be used on production servers
-  because the tracebacks could possibly reveal passwords or other sensitive
+  because the tracebacks might reveal passwords or other sensitive
   information.  (Contributed by Alan McIntyre as part of his
   project for Google's Summer of Code 2007.)
 
@@ -2622,7 +2625,8 @@
 
     z = zipfile.ZipFile('python-251.zip')
 
-    # Unpack a single file, writing it relative to the /tmp directory.
+    # Unpack a single file, writing it relative
+    # to the /tmp directory.
     z.extract('Python/sysmodule.c', '/tmp')
 
     # Unpack all the files in the archive.
@@ -2644,11 +2648,12 @@
 The :mod:`ast` module
 ----------------------
 
-The :mod:`ast` module provides an Abstract Syntax Tree representation
-of Python code.  For Python 2.6, Armin Ronacher contributed a set of
-helper functions that perform various common tasks.  These will be useful
-for HTML templating packages, code analyzers, and similar tools that
-process Python code.
+The :mod:`ast` module provides an Abstract Syntax Tree
+representation of Python code, and Armin Ronacher
+contributed a set of helper functions that perform a variety of
+common tasks.  These will be useful for HTML templating
+packages, code analyzers, and similar tools that process
+Python code.
 
 The :func:`parse` function takes an expression and returns an AST.
 The :func:`dump` function outputs a representation of a tree, suitable
@@ -2664,28 +2669,46 @@
     """)
     print ast.dump(t)
 
-This outputs::
+This outputs a deeply nested tree::
 
-    Module(body=[Assign(targets=[Name(id='d', ctx=Store())],
-    value=Dict(keys=[], values=[])), For(target=Name(id='i',
-    ctx=Store()), iter=Str(s='abcdefghijklm'),
-    body=[Assign(targets=[Subscript(value=Name(id='d', ctx=Load()),
-    slice=Index(value=BinOp(left=Name(id='i', ctx=Load()), op=Add(),
-    right=Name(id='i', ctx=Load()))), ctx=Store())],
-    value=BinOp(left=BinOp(left=Call(func=Name(id='ord', ctx=Load()),
-    args=[Name(id='i', ctx=Load())], keywords=[], starargs=None,
-    kwargs=None), op=Sub(), right=Call(func=Name(id='ord',
-    ctx=Load()), args=[Str(s='a')], keywords=[], starargs=None,
-    kwargs=None)), op=Add(), right=Num(n=1)))], orelse=[]),
-    Print(dest=None, values=[Name(id='d', ctx=Load())], nl=True)])
+    Module(body=[
+      Assign(targets=[
+	Name(id='d', ctx=Store())
+       ], value=Dict(keys=[], values=[]))
+      For(target=Name(id='i', ctx=Store()),
+	  iter=Str(s='abcdefghijklm'), body=[
+	Assign(targets=[
+	  Subscript(value=
+	   Name(id='d', ctx=Load()),
+	     slice=
+	     Index(value=
+	    BinOp(left=Name(id='i', ctx=Load()), op=Add(),
+	     right=Name(id='i', ctx=Load()))), ctx=Store())
+	 ], value=
+	 BinOp(left=
+	  BinOp(left=
+	   Call(func=
+	    Name(id='ord', ctx=Load()), args=[
+	     Name(id='i', ctx=Load())
+	    ], keywords=[], starargs=None, kwargs=None),
+	   op=Sub(), right=Call(func=
+	    Name(id='ord', ctx=Load()), args=[
+	     Str(s='a')
+	    ], keywords=[], starargs=None, kwargs=None)),
+          op=Add(), right=Num(n=1)))
+       ], orelse=[])
+      Print(dest=None, values=[
+	Name(id='d', ctx=Load())
+       ], nl=True)
+     ])
 
 The :func:`literal_eval` method takes a string or an AST
-representing a literal expression, one that contains a Python
-expression containing only strings, numbers, dictionaries, etc. but no
-statements or function calls, and returns the resulting value.  If you
-need to unserialize an expression but need to worry about security
-and can't risk using an :func:`eval` call, :func:`literal_eval` will
-handle it safely::
+representing a literal expression, parses and evaluates it, and
+returns the resulting value.  A literal expression is a Python
+expression containing only strings, numbers, dictionaries,
+etc. but no statements or function calls.  If you need to
+evaluate an expression but accept the security risk of using an
+:func:`eval` call, :func:`literal_eval` will handle it safely::
 
     >>> literal = '("a", "b", {2:4, 3:8, 1:2})'
     >>> print ast.literal_eval(literal)
@@ -2705,7 +2728,7 @@
 The :mod:`future_builtins` module
 --------------------------------------
 
-Python 3.0 makes various changes to the repertoire of built-in
+Python 3.0 makes many changes to the repertoire of built-in
 functions, and most of the changes can't be introduced in the Python
 2.x series because they would break compatibility.
 The :mod:`future_builtins` module provides versions
@@ -2714,23 +2737,24 @@
 
 The functions in this module currently include:
 
-* ``ascii(**obj**)``: equivalent to :func:`repr`.  In Python 3.0,
+* ``ascii(obj)``: equivalent to :func:`repr`.  In Python 3.0,
   :func:`repr` will return a Unicode string, while :func:`ascii` will
   return a pure ASCII bytestring.
 
-* ``filter(**predicate**, **iterable**)``,
-  ``map(**func**, **iterable1**, ...)``: the 3.0 versions
-  return iterators, differing from the 2.x built-ins that return lists.
+* ``filter(predicate, iterable)``,
+  ``map(func, iterable1, ...)``: the 3.0 versions
+  return iterators, unlike the 2.x built-ins which return lists.
 
-* ``hex(**value**)``, ``oct(**value**)``: instead of calling the
+* ``hex(value)``, ``oct(value)``: instead of calling the
   :meth:`__hex__` or :meth:`__oct__` methods, these versions will
   call the :meth:`__index__` method and convert the result to hexadecimal
-  or octal.
+  or octal.  :func:`oct` will use the new ``0o`` notation for its
+  result.
 
 .. ======================================================================
 
-The :mod:`json` module
-----------------------
+The :mod:`json` module: JavaScript Object Notation
+--------------------------------------------------------------------
 
 The new :mod:`json` module supports the encoding and decoding of Python types in
 JSON (Javascript Object Notation). JSON is a lightweight interchange format
@@ -2748,21 +2772,22 @@
        >>> json.loads(in_json) # Decode into a Python object
        {"spam" : "foo", "parrot" : 42}
 
-It is also possible to write your own decoders and encoders to support more
-types. Pretty-printing of the JSON strings is also supported.
+It's also possible to write your own decoders and encoders to support
+more types. Pretty-printing of the JSON strings is also supported.
 
-:mod:`json` (originally called simplejson) was written by Bob Ippolito.
+:mod:`json` (originally called simplejson) was written by Bob
+Ippolito.
 
 
 .. ======================================================================
 
-plistlib: A Property-List Parser
+The :mod:`plistlib` module: A Property-List Parser
 --------------------------------------------------
 
-A commonly-used format on MacOS X is the ``.plist`` format,
-which stores basic data types (numbers, strings, lists,
-and dictionaries) and serializes them into an XML-based format.
-(It's a lot like the XML-RPC serialization of data types.)
+The ``.plist`` format is commonly used on MacOS X to
+store basic data types (numbers, strings, lists,
+and dictionaries) by serializing them into an XML-based format.
+It resembles the XML-RPC serialization of data types.
 
 Despite being primarily used on MacOS X, the format
 has nothing Mac-specific about it and the Python implementation works
@@ -2778,7 +2803,7 @@
     # Create data structure
     data_struct = dict(lastAccessed=datetime.datetime.now(),
 		       version=1,
-		       categories=('Personal', 'Shared', 'Private'))
+		       categories=('Personal','Shared','Private'))
 
     # Create string containing XML.
     plist_str = plistlib.writePlistToString(data_struct)
@@ -2823,20 +2848,20 @@
 Win32 LastError variables at the outset of each wrapped call.
 (Implemented by Thomas Heller; :issue:`1798`.)
 
-For the Unix ``errno`` variable: when creating a wrapped function,
-you can supply ``use_errno=True`` as a keyword parameter
-to the :func:`DLL` function
-and then call the module-level methods :meth:`set_errno`
-and :meth:`get_errno` to set and retrieve the error value.
+You can now retrieve the Unix ``errno`` variable after a function
+call.  When creating a wrapped function, you can supply
+``use_errno=True`` as a keyword parameter to the :func:`DLL` function
+and then call the module-level methods :meth:`set_errno` and
+:meth:`get_errno` to set and retrieve the error value.
 
-The Win32 LastError variable is supported similarly by
+The Win32 LastError variable is similarly supported by
 the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions.
 You supply ``use_last_error=True`` as a keyword parameter
 and then call the module-level methods :meth:`set_last_error`
 and :meth:`get_last_error`.
 
 The :func:`byref` function, used to retrieve a pointer to a ctypes
-instance, now has an optional **offset** parameter that is a byte
+instance, now has an optional *offset* parameter that is a byte
 count that will be added to the returned pointer.
 
 .. ======================================================================
@@ -2845,15 +2870,15 @@
 --------------------------------------------------
 
 Bill Janssen made extensive improvements to Python 2.6's support for
-the Secure Sockets Layer by adding a new module, :mod:`ssl`, on top of
-the `OpenSSL <http://www.openssl.org/>`__ library.  This new module
-provides more control over the protocol negotiated, the X.509
-certificates used, and has better support for writing SSL servers (as
-opposed to clients) in Python.  The existing SSL support in the
-:mod:`socket` module hasn't been removed and continues to work,
+the Secure Sockets Layer by adding a new module, :mod:`ssl`, that's
+built atop the `OpenSSL <http://www.openssl.org/>`__ library.
+This new module provides more control over the protocol negotiated,
+the X.509 certificates used, and has better support for writing SSL
+servers (as opposed to clients) in Python.  The existing SSL support
+in the :mod:`socket` module hasn't been removed and continues to work,
 though it will be removed in Python 3.0.
 
-To use the new module, first you must create a TCP connection in the
+To use the new module, you must first create a TCP connection in the
 usual way and then pass it to the :func:`ssl.wrap_socket` function.
 It's possible to specify whether a certificate is required, and to
 obtain certificate info by calling the :meth:`getpeercert` method.
@@ -2870,9 +2895,15 @@
 
 Changes to Python's build process and to the C API include:
 
-* Python 2.6 can be built with Microsoft Visual Studio 2008.
-  See the :file:`PCbuild9` directory for the build files.
-  (Implemented by Christian Heimes.)
+* Python now must be compiled with C89 compilers (after 19
+  years!).  This means that the Python source tree has dropped its
+  own implementations of :cfunc:`memmove` and :cfunc:`strerror`, which
+  are in the C89 standard library.
+
+* Python 2.6 can be built with Microsoft Visual Studio 2008 (version
+  9.0), and this is the new default compiler.  See the
+  :file:`PCbuild` directory for the build files.  (Implemented by
+  Christian Heimes.)
 
 * On MacOS X, Python 2.6 can be compiled as a 4-way universal build.
   The :program:`configure` script
@@ -2881,11 +2912,6 @@
   architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both.
   (Contributed by Ronald Oussoren.)
 
-* Python now can only be compiled with C89 compilers (after 19
-  years!).  This means that the Python source tree can now drop its
-  own implementations of :cfunc:`memmove` and :cfunc:`strerror`, which
-  are in the C89 standard library.
-
 * The BerkeleyDB module now has a C API object, available as
   ``bsddb.db.api``.   This object can be used by other C extensions
   that wish to use the :mod:`bsddb` module for their own purposes.
@@ -2914,14 +2940,14 @@
   function, :cfunc:`PyImport_ImportModuleNoBlock`, will look for a
   module in ``sys.modules`` first, then try to import it after
   acquiring an import lock.  If the import lock is held by another
-  thread, the :exc:`ImportError` is raised.
+  thread, an :exc:`ImportError` is raised.
   (Contributed by Christian Heimes.)
 
 * Several functions return information about the platform's
   floating-point support.  :cfunc:`PyFloat_GetMax` returns
   the maximum representable floating point value,
   and :cfunc:`PyFloat_GetMin` returns the minimum
-  positive value.  :cfunc:`PyFloat_GetInfo` returns a dictionary
+  positive value.  :cfunc:`PyFloat_GetInfo` returns an object
   containing more information from the :file:`float.h` file, such as
   ``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"``
   (smallest difference between 1.0 and the next largest value
@@ -2964,7 +2990,7 @@
   internal free lists of objects that can be re-used.  The data
   structures for these free lists now follow a naming convention: the
   variable is always named ``free_list``, the counter is always named
-  ``numfree``, and a macro :cmacro:`Py<typename>_MAXFREELIST` is
+  ``numfree``, and a macro ``Py<typename>_MAXFREELIST`` is
   always defined.
 
 * A new Makefile target, "make check", prepares the Python source tree
@@ -2988,6 +3014,14 @@
 * The support for Windows 95, 98, ME and NT4 has been dropped.
   Python 2.6 requires at least Windows 2000 SP4.
 
+* The new default compiler on Windows is Visual Studio 2008 (version
+  9.0). The build directories for Visual Studio 2003 (version 7.1) and
+  2005 (version 8.0) were moved into the PC/ directory. The new
+  :file:`PCbuild` directory supports cross compilation for X64, debug
+  builds and Profile Guided Optimization (PGO). PGO builds are roughly
+  10% faster than normal builds.  (Contributed by Christian Heimes
+  with help from Amaury Forgeot d'Arc and Martin von Loewis.)
+
 * The :mod:`msvcrt` module now supports
   both the normal and wide char variants of the console I/O
   API.  The :func:`getwch` function reads a keypress and returns a Unicode
@@ -2995,9 +3029,9 @@
   takes a Unicode character and writes it to the console.
   (Contributed by Christian Heimes.)
 
-* :func:`os.path.expandvars` will now expand environment variables
-  in the form "%var%", and "~user" will be expanded into the
-  user's home directory path.  (Contributed by Josiah Carlson.)
+* :func:`os.path.expandvars` will now expand environment variables in
+  the form "%var%", and "~user" will be expanded into the user's home
+  directory path.  (Contributed by Josiah Carlson; :issue:`957650`.)
 
 * The :mod:`socket` module's socket objects now have an
   :meth:`ioctl` method that provides a limited interface to the
@@ -3021,14 +3055,6 @@
   return field values as an integer or a string.
   (Contributed by Floris Bruynooghe; :issue:`2125`.)
 
-* The new default compiler on Windows is Visual Studio 2008 (VS 9.0). The
-  build directories for Visual Studio 2003 (VS7.1) and 2005 (VS8.0)
-  were moved into the PC/ directory. The new PCbuild directory supports
-  cross compilation for X64, debug builds and Profile Guided Optimization
-  (PGO). PGO builds are roughly 10% faster than normal builds.
-  (Contributed by Christian Heimes with help from Amaury Forgeot d'Arc and
-  Martin von Loewis.)
-
 .. ======================================================================
 
 Port-Specific Changes: MacOS X
@@ -3039,29 +3065,80 @@
   :option:`--with-framework-name=` option to the
   :program:`configure` script.
 
-.. ======================================================================
+* The :mod:`macfs` module has been removed.  This in turn required the
+  :func:`macostools.touched` function to be removed because it depended on the
+  :mod:`macfs` module.  (:issue:`1490190`)
 
+* Many other MacOS modules have been deprecated and will removed in
+  Python 3.0:
+  :mod:`_builtinSuites`,
+  :mod:`aepack`,
+  :mod:`aetools`,
+  :mod:`aetypes`,
+  :mod:`applesingle`,
+  :mod:`appletrawmain`,
+  :mod:`appletrunner`,
+  :mod:`argvemulator`,
+  :mod:`Audio_mac`,
+  :mod:`autoGIL`,
+  :mod:`Carbon`,
+  :mod:`cfmfile`,
+  :mod:`CodeWarrior`,
+  :mod:`ColorPicker`,
+  :mod:`EasyDialogs`,
+  :mod:`Explorer`,
+  :mod:`Finder`,
+  :mod:`FrameWork`,
+  :mod:`findertools`,
+  :mod:`ic`,
+  :mod:`icglue`,
+  :mod:`icopen`,
+  :mod:`macerrors`,
+  :mod:`MacOS`,
+  :mod:`macfs`,
+  :mod:`macostools`,
+  :mod:`macresource`,
+  :mod:`MiniAEFrame`,
+  :mod:`Nav`,
+  :mod:`Netscape`,
+  :mod:`OSATerminology`,
+  :mod:`pimp`,
+  :mod:`PixMapWrapper`,
+  :mod:`StdSuites`,
+  :mod:`SystemEvents`,
+  :mod:`Terminal`, and
+  :mod:`terminalcommand`.
 
-.. _section-other:
+.. ======================================================================
 
-Other Changes and Fixes
-=======================
+Port-Specific Changes: IRIX
+-----------------------------------
 
-As usual, there were a bunch of other improvements and bugfixes
-scattered throughout the source tree.  A search through the change
-logs finds there were XXX patches applied and YYY bugs fixed between
-Python 2.5 and 2.6.  Both figures are likely to be underestimates.
-
-Some of the more notable changes are:
-
-* It's now possible to prevent Python from writing any :file:`.pyc`
-  or :file:`.pyo` files by either supplying the :option:`-B` switch
-  or setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable
-  to any non-empty string when running the Python interpreter.  These
-  are also used to set the :data:`sys.dont_write_bytecode` attribute;
-  Python code can change this variable to control whether bytecode
-  files are subsequently written.
-  (Contributed by Neal Norwitz and Georg Brandl.)
+A number of old IRIX-specific modules were deprecated and will
+be removed in Python 3.0:
+:mod:`al` and :mod:`AL`,
+:mod:`cd`,
+:mod:`cddb`,
+:mod:`cdplayer`,
+:mod:`CL` and :mod:`cl`,
+:mod:`DEVICE`,
+:mod:`ERRNO`,
+:mod:`FILE`,
+:mod:`FL` and :mod:`fl`,
+:mod:`flp`,
+:mod:`fm`,
+:mod:`GET`,
+:mod:`GLWS`,
+:mod:`GL` and :mod:`gl`,
+:mod:`IN`,
+:mod:`IOCTL`,
+:mod:`jpeg`,
+:mod:`panelparser`,
+:mod:`readcd`,
+:mod:`SV` and :mod:`sv`,
+:mod:`torgb`,
+:mod:`videoreader`, and
+:mod:`WAIT`.
 
 .. ======================================================================
 
@@ -3072,10 +3149,14 @@
 This section lists previously described changes and other bugfixes
 that may require changes to your code:
 
+* Classes that aren't supposed to be hashable should
+  set ``__hash__ = None`` in their definitions to indicate
+  the fact.
+
 * The :meth:`__init__` method of :class:`collections.deque`
   now clears any existing contents of the deque
   before adding elements from the iterable.  This change makes the
-  behavior match that of ``list.__init__()``.
+  behavior match ``list.__init__()``.
 
 * The :class:`Decimal` constructor now accepts leading and trailing
   whitespace when passed a string.  Previously it would raise an
@@ -3094,6 +3175,10 @@
   functions now default to absolute imports, not relative imports.
   This will affect C extensions that import other modules.
 
+* C API: extension data types that shouldn't be hashable
+  should define their ``tp_hash`` slot to
+  :cfunc:`PyObject_HashNotImplemented`.
+
 * The :mod:`socket` module exception :exc:`socket.error` now inherits
   from :exc:`IOError`.  Previously it wasn't a subclass of
   :exc:`StandardError` but now it is, through :exc:`IOError`.
@@ -3127,7 +3212,8 @@
 Acknowledgements
 ================
 
-The author would like to thank the following people for offering suggestions,
-corrections and assistance with various drafts of this article:
-Georg Brandl, Jim Jewett.
+The author would like to thank the following people for offering
+suggestions, corrections and assistance with various drafts of this
+article: Georg Brandl, Steve Brown, Nick Coghlan, Jim Jewett, Kent
+Johnson, Chris Lambacher, Antoine Pitrou.
 

Modified: python/branches/tlee-ast-optimize/Include/cobject.h
==============================================================================
--- python/branches/tlee-ast-optimize/Include/cobject.h	(original)
+++ python/branches/tlee-ast-optimize/Include/cobject.h	Sun Sep  7 18:03:22 2008
@@ -48,6 +48,15 @@
 /* Modify a C object. Fails (==0) if object has a destructor. */
 PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj);
 
+
+typedef struct {
+    PyObject_HEAD
+    void *cobject;
+    void *desc;
+    void (*destructor)(void *);
+} PyCObject;
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: python/branches/tlee-ast-optimize/Lib/BaseHTTPServer.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/BaseHTTPServer.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/BaseHTTPServer.py	Sun Sep  7 18:03:22 2008
@@ -73,11 +73,11 @@
 import sys
 import time
 import socket # For gethostbyaddr()
-from test.test_support import catch_warning
-from warnings import filterwarnings
-with catch_warning(record=False):
-    filterwarnings("ignore", ".*mimetools has been removed",
-                    DeprecationWarning)
+from warnings import filterwarnings, catch_warnings
+with catch_warnings():
+    if sys.py3kwarning:
+        filterwarnings("ignore", ".*mimetools has been removed",
+                        DeprecationWarning)
     import mimetools
 import SocketServer
 

Modified: python/branches/tlee-ast-optimize/Lib/Cookie.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/Cookie.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/Cookie.py	Sun Sep  7 18:03:22 2008
@@ -408,6 +408,9 @@
     # For historical reasons, these attributes are also reserved:
     #   expires
     #
+    # This is an extension from Microsoft:
+    #   httponly
+    #
     # This dictionary provides a mapping from the lowercase
     # variant on the left to the appropriate traditional
     # formatting on the right.
@@ -417,6 +420,7 @@
                    "domain"      : "Domain",
                    "max-age" : "Max-Age",
                    "secure"      : "secure",
+                   "httponly"  : "httponly",
                    "version" : "Version",
                    }
 
@@ -499,6 +503,8 @@
                 RA("%s=%d" % (self._reserved[K], V))
             elif K == "secure":
                 RA(str(self._reserved[K]))
+            elif K == "httponly":
+                RA(str(self._reserved[K]))
             else:
                 RA("%s=%s" % (self._reserved[K], V))
 

Modified: python/branches/tlee-ast-optimize/Lib/abc.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/abc.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/abc.py	Sun Sep  7 18:03:22 2008
@@ -159,12 +159,12 @@
         # Check if it's a subclass of a registered class (recursive)
         for rcls in cls._abc_registry:
             if issubclass(subclass, rcls):
-                cls._abc_registry.add(subclass)
+                cls._abc_cache.add(subclass)
                 return True
         # Check if it's a subclass of a subclass (recursive)
         for scls in cls.__subclasses__():
             if issubclass(subclass, scls):
-                cls._abc_registry.add(subclass)
+                cls._abc_cache.add(subclass)
                 return True
         # No dice; update negative cache
         cls._abc_negative_cache.add(subclass)

Modified: python/branches/tlee-ast-optimize/Lib/asynchat.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/asynchat.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/asynchat.py	Sun Sep  7 18:03:22 2008
@@ -49,8 +49,9 @@
 import socket
 import asyncore
 from collections import deque
+from sys import py3kwarning
 from test.test_support import catch_warning
-from warnings import filterwarnings
+from warnings import filterwarnings, catch_warnings
 
 class async_chat (asyncore.dispatcher):
     """This is an abstract class.  You must derive from this class, and add
@@ -218,8 +219,9 @@
             # handle classic producer behavior
             obs = self.ac_out_buffer_size
             try:
-                with catch_warning(record=False):
-                    filterwarnings("ignore", ".*buffer", DeprecationWarning)
+                with catch_warnings():
+                    if py3kwarning:
+                        filterwarnings("ignore", ".*buffer", DeprecationWarning)
                     data = buffer(first, 0, obs)
             except TypeError:
                 data = first.more()

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/__init__.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/__init__.py	Sun Sep  7 18:03:22 2008
@@ -42,6 +42,12 @@
 import sys
 absolute_import = (sys.version_info[0] >= 3)
 
+if sys.py3kwarning:
+    import warnings
+    warnings.warnpy3k("in 3.x, bsddb has been removed; "
+                      "please use the pybsddb project instead",
+                      DeprecationWarning, 2)
+
 try:
     if __name__ == 'bsddb3':
         # import _pybsddb binary as it should be the more recent version from
@@ -110,7 +116,7 @@
                 key = _DeadlockWrap(cur.first, 0,0,0)[0]
                 yield key
 
-                next = cur.next
+                next = getattr(cur, "next")
                 while 1:
                     try:
                         key = _DeadlockWrap(next, 0,0,0)[0]
@@ -123,7 +129,7 @@
                         # FIXME-20031101-greg: race condition.  cursor could
                         # be closed by another thread before this call.
                         _DeadlockWrap(cur.set, key,0,0,0)
-                        next = cur.next
+                        next = getattr(cur, "next")
             except _bsddb.DBNotFoundError:
                 pass
             except _bsddb.DBCursorClosedError:
@@ -152,7 +158,7 @@
                 key = kv[0]
                 yield kv
 
-                next = cur.next
+                next = getattr(cur, "next")
                 while 1:
                     try:
                         kv = _DeadlockWrap(next)
@@ -166,7 +172,7 @@
                         # FIXME-20031101-greg: race condition.  cursor could
                         # be closed by another thread before this call.
                         _DeadlockWrap(cur.set, key,0,0,0)
-                        next = cur.next
+                        next = getattr(cur, "next")
             except _bsddb.DBNotFoundError:
                 pass
             except _bsddb.DBCursorClosedError:
@@ -302,12 +308,15 @@
         self._checkCursor()
         return _DeadlockWrap(self.dbc.set_range, key)
 
-    def next(self):
+    def next(self):  # Renamed by "2to3"
         self._checkOpen()
         self._checkCursor()
-        rv = _DeadlockWrap(self.dbc.next)
+        rv = _DeadlockWrap(getattr(self.dbc, "next"))
         return rv
 
+    if sys.version_info[0] >= 3 :  # For "2to3" conversion
+        next = __next__
+
     def previous(self):
         self._checkOpen()
         self._checkCursor()

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/dbshelve.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/dbshelve.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/dbshelve.py	Sun Sep  7 18:03:22 2008
@@ -218,8 +218,13 @@
 
     def associate(self, secondaryDB, callback, flags=0):
         def _shelf_callback(priKey, priData, realCallback=callback):
-            data = cPickle.loads(priData)
+            # Safe in Python 2.x because expresion short circuit
+            if sys.version_info[0] < 3 or isinstance(priData, bytes) :
+                data = cPickle.loads(priData)
+            else :
+                data = cPickle.loads(bytes(priData, "iso8859-1"))  # 8 bits
             return realCallback(priKey, data)
+
         return self.db.associate(secondaryDB, _shelf_callback, flags)
 
 
@@ -232,7 +237,7 @@
         data = apply(self.db.get, args, kw)
         try:
             return cPickle.loads(data)
-        except (TypeError, cPickle.UnpicklingError):
+        except (EOFError, TypeError, cPickle.UnpicklingError):
             return data  # we may be getting the default value, or None,
                          # so it doesn't need unpickled.
 
@@ -350,7 +355,11 @@
             return None
         else:
             key, data = rec
-            return key, cPickle.loads(data)
+            # Safe in Python 2.x because expresion short circuit
+            if sys.version_info[0] < 3 or isinstance(data, bytes) :
+                return key, cPickle.loads(data)
+            else :
+                return key, cPickle.loads(bytes(data, "iso8859-1"))  # 8 bits
 
     #----------------------------------------------
     # Methods allowed to pass-through to self.dbc

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/dbtables.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/dbtables.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/dbtables.py	Sun Sep  7 18:03:22 2008
@@ -26,17 +26,16 @@
 
 try:
     # For Pythons w/distutils pybsddb
-    from bsddb3.db import *
+    from bsddb3 import db
 except ImportError:
     # For Python 2.3
-    from bsddb.db import *
+    from bsddb import db
 
 # XXX(nnorwitz): is this correct? DBIncompleteError is conditional in _bsddb.c
-try:
-    DBIncompleteError
-except NameError:
+if not hasattr(db,"DBIncompleteError") :
     class DBIncompleteError(Exception):
         pass
+    db.DBIncompleteError = DBIncompleteError
 
 class TableDBError(StandardError):
     pass
@@ -104,6 +103,7 @@
                      # row in the table.  (no data is stored)
 _rowid_str_len = 8   # length in bytes of the unique rowid strings
 
+
 def _data_key(table, col, rowid):
     return table + _data + col + _data + rowid
 
@@ -142,37 +142,104 @@
         Use keyword arguments when calling this constructor.
         """
         self.db = None
-        myflags = DB_THREAD
+        myflags = db.DB_THREAD
         if create:
-            myflags |= DB_CREATE
-        flagsforenv = (DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_LOG |
-                       DB_INIT_TXN | dbflags)
+            myflags |= db.DB_CREATE
+        flagsforenv = (db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_INIT_LOG |
+                       db.DB_INIT_TXN | dbflags)
         # DB_AUTO_COMMIT isn't a valid flag for env.open()
         try:
-            dbflags |= DB_AUTO_COMMIT
+            dbflags |= db.DB_AUTO_COMMIT
         except AttributeError:
             pass
         if recover:
-            flagsforenv = flagsforenv | DB_RECOVER
-        self.env = DBEnv()
+            flagsforenv = flagsforenv | db.DB_RECOVER
+        self.env = db.DBEnv()
         # enable auto deadlock avoidance
-        self.env.set_lk_detect(DB_LOCK_DEFAULT)
+        self.env.set_lk_detect(db.DB_LOCK_DEFAULT)
         self.env.open(dbhome, myflags | flagsforenv)
         if truncate:
-            myflags |= DB_TRUNCATE
-        self.db = DB(self.env)
+            myflags |= db.DB_TRUNCATE
+        self.db = db.DB(self.env)
         # this code relies on DBCursor.set* methods to raise exceptions
         # rather than returning None
         self.db.set_get_returns_none(1)
         # allow duplicate entries [warning: be careful w/ metadata]
-        self.db.set_flags(DB_DUP)
-        self.db.open(filename, DB_BTREE, dbflags | myflags, mode)
+        self.db.set_flags(db.DB_DUP)
+        self.db.open(filename, db.DB_BTREE, dbflags | myflags, mode)
         self.dbfilename = filename
+
+        if sys.version_info[0] >= 3 :
+            class cursor_py3k(object) :
+                def __init__(self, dbcursor) :
+                    self._dbcursor = dbcursor
+
+                def close(self) :
+                    return self._dbcursor.close()
+
+                def set_range(self, search) :
+                    v = self._dbcursor.set_range(bytes(search, "iso8859-1"))
+                    if v != None :
+                        v = (v[0].decode("iso8859-1"),
+                                v[1].decode("iso8859-1"))
+                    return v
+
+                def __next__(self) :
+                    v = getattr(self._dbcursor, "next")()
+                    if v != None :
+                        v = (v[0].decode("iso8859-1"),
+                                v[1].decode("iso8859-1"))
+                    return v
+
+            class db_py3k(object) :
+                def __init__(self, db) :
+                    self._db = db
+
+                def cursor(self, txn=None) :
+                    return cursor_py3k(self._db.cursor(txn=txn))
+
+                def has_key(self, key, txn=None) :
+                    return getattr(self._db,"has_key")(bytes(key, "iso8859-1"),
+                            txn=txn)
+
+                def put(self, key, value, flags=0, txn=None) :
+                    key = bytes(key, "iso8859-1")
+                    if value != None :
+                        value = bytes(value, "iso8859-1")
+                    return self._db.put(key, value, flags=flags, txn=txn)
+
+                def put_bytes(self, key, value, txn=None) :
+                    key = bytes(key, "iso8859-1")
+                    return self._db.put(key, value, txn=txn)
+
+                def get(self, key, txn=None, flags=0) :
+                    key = bytes(key, "iso8859-1")
+                    v = self._db.get(key, txn=txn, flags=flags)
+                    if v != None :
+                        v = v.decode("iso8859-1")
+                    return v
+
+                def get_bytes(self, key, txn=None, flags=0) :
+                    key = bytes(key, "iso8859-1")
+                    return self._db.get(key, txn=txn, flags=flags)
+
+                def delete(self, key, txn=None) :
+                    key = bytes(key, "iso8859-1")
+                    return self._db.delete(key, txn=txn)
+
+                def close (self) :
+                    return self._db.close()
+
+            self.db = db_py3k(self.db)
+        else :  # Python 2.x
+            pass
+
         # Initialize the table names list if this is a new database
         txn = self.env.txn_begin()
         try:
-            if not self.db.has_key(_table_names_key, txn):
-                self.db.put(_table_names_key, pickle.dumps([], 1), txn=txn)
+            if not getattr(self.db, "has_key")(_table_names_key, txn):
+                getattr(self.db, "put_bytes", self.db.put) \
+                        (_table_names_key, pickle.dumps([], 1), txn=txn)
         # Yes, bare except
         except:
             txn.abort()
@@ -196,13 +263,13 @@
     def checkpoint(self, mins=0):
         try:
             self.env.txn_checkpoint(mins)
-        except DBIncompleteError:
+        except db.DBIncompleteError:
             pass
 
     def sync(self):
         try:
             self.db.sync()
-        except DBIncompleteError:
+        except db.DBIncompleteError:
             pass
 
     def _db_print(self) :
@@ -219,7 +286,7 @@
                 else:
                     cur.close()
                     return
-        except DBNotFoundError:
+        except db.DBNotFoundError:
             cur.close()
 
 
@@ -229,6 +296,7 @@
         raises TableDBError if it already exists or for other DB errors.
         """
         assert isinstance(columns, list)
+
         txn = None
         try:
             # checking sanity of the table and column names here on
@@ -242,27 +310,32 @@
                         "bad column name: contains reserved metastrings")
 
             columnlist_key = _columns_key(table)
-            if self.db.has_key(columnlist_key):
+            if getattr(self.db, "has_key")(columnlist_key):
                 raise TableAlreadyExists, "table already exists"
 
             txn = self.env.txn_begin()
             # store the table's column info
-            self.db.put(columnlist_key, pickle.dumps(columns, 1), txn=txn)
+            getattr(self.db, "put_bytes", self.db.put)(columnlist_key,
+                    pickle.dumps(columns, 1), txn=txn)
 
             # add the table name to the tablelist
-            tablelist = pickle.loads(self.db.get(_table_names_key, txn=txn,
-                                                 flags=DB_RMW))
+            tablelist = pickle.loads(getattr(self.db, "get_bytes",
+                self.db.get) (_table_names_key, txn=txn, flags=db.DB_RMW))
             tablelist.append(table)
             # delete 1st, in case we opened with DB_DUP
             self.db.delete(_table_names_key, txn=txn)
-            self.db.put(_table_names_key, pickle.dumps(tablelist, 1), txn=txn)
+            getattr(self.db, "put_bytes", self.db.put)(_table_names_key,
+                    pickle.dumps(tablelist, 1), txn=txn)
 
             txn.commit()
             txn = None
-        except DBError, dberror:
+        except db.DBError, dberror:
             if txn:
                 txn.abort()
-            raise TableDBError, dberror[1]
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1]
+            else :
+                raise TableDBError, dberror.args[1]
 
 
     def ListTableColumns(self, table):
@@ -274,9 +347,10 @@
             raise ValueError, "bad table name: contains reserved metastrings"
 
         columnlist_key = _columns_key(table)
-        if not self.db.has_key(columnlist_key):
+        if not getattr(self.db, "has_key")(columnlist_key):
             return []
-        pickledcolumnlist = self.db.get(columnlist_key)
+        pickledcolumnlist = getattr(self.db, "get_bytes",
+                self.db.get)(columnlist_key)
         if pickledcolumnlist:
             return pickle.loads(pickledcolumnlist)
         else:
@@ -284,7 +358,7 @@
 
     def ListTables(self):
         """Return a list of tables in this database."""
-        pickledtablelist = self.db.get(_table_names_key)
+        pickledtablelist = self.db.get_get(_table_names_key)
         if pickledtablelist:
             return pickle.loads(pickledtablelist)
         else:
@@ -300,6 +374,7 @@
         all of its current columns.
         """
         assert isinstance(columns, list)
+
         try:
             self.CreateTable(table, columns)
         except TableAlreadyExists:
@@ -311,7 +386,8 @@
 
                 # load the current column list
                 oldcolumnlist = pickle.loads(
-                    self.db.get(columnlist_key, txn=txn, flags=DB_RMW))
+                    getattr(self.db, "get_bytes",
+                        self.db.get)(columnlist_key, txn=txn, flags=db.DB_RMW))
                 # create a hash table for fast lookups of column names in the
                 # loop below
                 oldcolumnhash = {}
@@ -329,7 +405,7 @@
                 if newcolumnlist != oldcolumnlist :
                     # delete the old one first since we opened with DB_DUP
                     self.db.delete(columnlist_key, txn=txn)
-                    self.db.put(columnlist_key,
+                    getattr(self.db, "put_bytes", self.db.put)(columnlist_key,
                                 pickle.dumps(newcolumnlist, 1),
                                 txn=txn)
 
@@ -337,18 +413,22 @@
                 txn = None
 
                 self.__load_column_info(table)
-            except DBError, dberror:
+            except db.DBError, dberror:
                 if txn:
                     txn.abort()
-                raise TableDBError, dberror[1]
+                if sys.version_info[0] < 3 :
+                    raise TableDBError, dberror[1]
+                else :
+                    raise TableDBError, dberror.args[1]
 
 
     def __load_column_info(self, table) :
         """initialize the self.__tablecolumns dict"""
         # check the column names
         try:
-            tcolpickles = self.db.get(_columns_key(table))
-        except DBNotFoundError:
+            tcolpickles = getattr(self.db, "get_bytes",
+                    self.db.get)(_columns_key(table))
+        except db.DBNotFoundError:
             raise TableDBError, "unknown table: %r" % (table,)
         if not tcolpickles:
             raise TableDBError, "unknown table: %r" % (table,)
@@ -366,11 +446,14 @@
                 blist.append(random.randint(0,255))
             newid = struct.pack('B'*_rowid_str_len, *blist)
 
+            if sys.version_info[0] >= 3 :
+                newid = newid.decode("iso8859-1")  # 8 bits
+
             # Guarantee uniqueness by adding this key to the database
             try:
                 self.db.put(_rowid_key(table, newid), None, txn=txn,
-                            flags=DB_NOOVERWRITE)
-            except DBKeyExistError:
+                            flags=db.DB_NOOVERWRITE)
+            except db.DBKeyExistError:
                 pass
             else:
                 unique = 1
@@ -382,9 +465,10 @@
         """Insert(table, datadict) - Insert a new row into the table
         using the keys+values from rowdict as the column values.
         """
+
         txn = None
         try:
-            if not self.db.has_key(_columns_key(table)):
+            if not getattr(self.db, "has_key")(_columns_key(table)):
                 raise TableDBError, "unknown table"
 
             # check the validity of each column name
@@ -406,7 +490,7 @@
             txn.commit()
             txn = None
 
-        except DBError, dberror:
+        except db.DBError, dberror:
             # WIBNI we could just abort the txn and re-raise the exception?
             # But no, because TableDBError is not related to DBError via
             # inheritance, so it would be backwards incompatible.  Do the next
@@ -415,7 +499,10 @@
             if txn:
                 txn.abort()
                 self.db.delete(_rowid_key(table, rowid))
-            raise TableDBError, dberror[1], info[2]
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1], info[2]
+            else :
+                raise TableDBError, dberror.args[1], info[2]
 
 
     def Modify(self, table, conditions={}, mappings={}):
@@ -429,6 +516,7 @@
           condition callable expecting the data string as an argument and
           returning the new string for that column.
         """
+
         try:
             matching_rowids = self.__Select(table, [], conditions)
 
@@ -447,7 +535,7 @@
                             self.db.delete(
                                 _data_key(table, column, rowid),
                                 txn=txn)
-                        except DBNotFoundError:
+                        except db.DBNotFoundError:
                              # XXXXXXX row key somehow didn't exist, assume no
                              # error
                             dataitem = None
@@ -465,8 +553,11 @@
                         txn.abort()
                     raise
 
-        except DBError, dberror:
-            raise TableDBError, dberror[1]
+        except db.DBError, dberror:
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1]
+            else :
+                raise TableDBError, dberror.args[1]
 
     def Delete(self, table, conditions={}):
         """Delete(table, conditions) - Delete items matching the given
@@ -476,6 +567,7 @@
           condition functions expecting the data string as an
           argument and returning a boolean.
         """
+
         try:
             matching_rowids = self.__Select(table, [], conditions)
 
@@ -490,23 +582,26 @@
                         try:
                             self.db.delete(_data_key(table, column, rowid),
                                            txn=txn)
-                        except DBNotFoundError:
+                        except db.DBNotFoundError:
                             # XXXXXXX column may not exist, assume no error
                             pass
 
                     try:
                         self.db.delete(_rowid_key(table, rowid), txn=txn)
-                    except DBNotFoundError:
+                    except db.DBNotFoundError:
                         # XXXXXXX row key somehow didn't exist, assume no error
                         pass
                     txn.commit()
                     txn = None
-                except DBError, dberror:
+                except db.DBError, dberror:
                     if txn:
                         txn.abort()
                     raise
-        except DBError, dberror:
-            raise TableDBError, dberror[1]
+        except db.DBError, dberror:
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1]
+            else :
+                raise TableDBError, dberror.args[1]
 
 
     def Select(self, table, columns, conditions={}):
@@ -525,8 +620,11 @@
             if columns is None:
                 columns = self.__tablecolumns[table]
             matching_rowids = self.__Select(table, columns, conditions)
-        except DBError, dberror:
-            raise TableDBError, dberror[1]
+        except db.DBError, dberror:
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1]
+            else :
+                raise TableDBError, dberror.args[1]
         # return the matches as a list of dictionaries
         return matching_rowids.values()
 
@@ -579,8 +677,19 @@
             # leave all unknown condition callables alone as equals
             return 0
 
-        conditionlist = conditions.items()
-        conditionlist.sort(cmp_conditions)
+        if sys.version_info[0] < 3 :
+            conditionlist = conditions.items()
+            conditionlist.sort(cmp_conditions)
+        else :  # Insertion Sort. Please, improve
+            conditionlist = []
+            for i in conditions.items() :
+                for j, k in enumerate(conditionlist) :
+                    r = cmp_conditions(k, i)
+                    if r == 1 :
+                        conditionlist.insert(j, i)
+                        break
+                else :
+                    conditionlist.append(i)
 
         # Apply conditions to column data to find what we want
         cur = self.db.cursor()
@@ -615,9 +724,13 @@
 
                     key, data = cur.next()
 
-            except DBError, dberror:
-                if dberror[0] != DB_NOTFOUND:
-                    raise
+            except db.DBError, dberror:
+                if sys.version_info[0] < 3 :
+                    if dberror[0] != db.DB_NOTFOUND:
+                        raise
+                else :
+                    if dberror.args[0] != db.DB_NOTFOUND:
+                        raise
                 continue
 
         cur.close()
@@ -635,9 +748,13 @@
                     try:
                         rowdata[column] = self.db.get(
                             _data_key(table, column, rowid))
-                    except DBError, dberror:
-                        if dberror[0] != DB_NOTFOUND:
-                            raise
+                    except db.DBError, dberror:
+                        if sys.version_info[0] < 3 :
+                            if dberror[0] != db.DB_NOTFOUND:
+                                raise
+                        else :
+                            if dberror.args[0] != db.DB_NOTFOUND:
+                                raise
                         rowdata[column] = None
 
         # return the matches
@@ -660,7 +777,7 @@
             while 1:
                 try:
                     key, data = cur.set_range(table_key)
-                except DBNotFoundError:
+                except db.DBNotFoundError:
                     break
                 # only delete items in this table
                 if key[:len(table_key)] != table_key:
@@ -672,7 +789,7 @@
             while 1:
                 try:
                     key, data = cur.set_range(table_key)
-                except DBNotFoundError:
+                except db.DBNotFoundError:
                     break
                 # only delete items in this table
                 if key[:len(table_key)] != table_key:
@@ -683,7 +800,8 @@
 
             # delete the tablename from the table name list
             tablelist = pickle.loads(
-                self.db.get(_table_names_key, txn=txn, flags=DB_RMW))
+                getattr(self.db, "get_bytes", self.db.get)(_table_names_key,
+                    txn=txn, flags=db.DB_RMW))
             try:
                 tablelist.remove(table)
             except ValueError:
@@ -691,7 +809,8 @@
                 pass
             # delete 1st, incase we opened with DB_DUP
             self.db.delete(_table_names_key, txn=txn)
-            self.db.put(_table_names_key, pickle.dumps(tablelist, 1), txn=txn)
+            getattr(self.db, "put_bytes", self.db.put)(_table_names_key,
+                    pickle.dumps(tablelist, 1), txn=txn)
 
             txn.commit()
             txn = None
@@ -699,7 +818,10 @@
             if self.__tablecolumns.has_key(table):
                 del self.__tablecolumns[table]
 
-        except DBError, dberror:
+        except db.DBError, dberror:
             if txn:
                 txn.abort()
-            raise TableDBError, dberror[1]
+            if sys.version_info[0] < 3 :
+                raise TableDBError, dberror[1]
+            else :
+                raise TableDBError, dberror.args[1]

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/dbutils.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/dbutils.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/dbutils.py	Sun Sep  7 18:03:22 2008
@@ -61,7 +61,7 @@
     """
     sleeptime = _deadlock_MinSleepTime
     max_retries = _kwargs.get('max_retries', -1)
-    if 'max_retries' in _kwargs:
+    if _kwargs.has_key('max_retries'):
         del _kwargs['max_retries']
     while True:
         try:

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py	Sun Sep  7 18:03:22 2008
@@ -6,21 +6,375 @@
 import unittest
 try:
     # For Pythons w/distutils pybsddb
-    from bsddb3 import db
     import bsddb3 as bsddb
 except ImportError:
     # For Python 2.3
-    from bsddb import db
     import bsddb
 
+
+if sys.version_info[0] >= 3 :
+    charset = "iso8859-1"  # Full 8 bit
+
+    class cursor_py3k(object) :
+        def __init__(self, db, *args, **kwargs) :
+            self._dbcursor = db.cursor(*args, **kwargs)
+
+        def __getattr__(self, v) :
+            return getattr(self._dbcursor, v)
+
+        def _fix(self, v) :
+            if v == None : return None
+            key, value = v
+            if isinstance(key, bytes) :
+                key = key.decode(charset)
+            return (key, value.decode(charset))
+
+        def __next__(self) :
+            v = getattr(self._dbcursor, "next")()
+            return self._fix(v)
+
+        next = __next__
+
+        def previous(self) :
+            v = self._dbcursor.previous()
+            return self._fix(v)
+
+        def last(self) :
+            v = self._dbcursor.last()
+            return self._fix(v)
+
+        def set(self, k) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            v = self._dbcursor.set(k)
+            return self._fix(v)
+
+        def set_recno(self, num) :
+            v = self._dbcursor.set_recno(num)
+            return self._fix(v)
+
+        def set_range(self, k, dlen=-1, doff=-1) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            v = self._dbcursor.set_range(k, dlen=dlen, doff=doff)
+            return self._fix(v)
+
+        def dup(self, flags=0) :
+            cursor = self._dbcursor.dup(flags)
+            return dup_cursor_py3k(cursor)
+
+        def next_dup(self) :
+            v = self._dbcursor.next_dup()
+            return self._fix(v)
+
+        def next_nodup(self) :
+            v = self._dbcursor.next_nodup()
+            return self._fix(v)
+
+        def put(self, key, value, flags=0, dlen=-1, doff=-1) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if isinstance(value, str) :
+                value = bytes(value, charset)
+            return self._dbcursor.put(key, value, flags=flags, dlen=dlen,
+                    doff=doff)
+
+        def current(self, flags=0, dlen=-1, doff=-1) :
+            v = self._dbcursor.current(flags=flags, dlen=dlen, doff=doff)
+            return self._fix(v)
+
+        def first(self) :
+            v = self._dbcursor.first()
+            return self._fix(v)
+
+        def pget(self, key=None, data=None, flags=0) :
+            # Incorrect because key can be a bare number,
+            # but enough to pass testsuite
+            if isinstance(key, int) and (data==None) and (flags==0) :
+                flags = key
+                key = None
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if isinstance(data, int) and (flags==0) :
+                flags = data
+                data = None
+            if isinstance(data, str) :
+                data = bytes(data, charset)
+            v=self._dbcursor.pget(key=key, data=data, flags=flags)
+            if v != None :
+                v1, v2, v3 = v
+                if isinstance(v1, bytes) :
+                    v1 = v1.decode(charset)
+                if isinstance(v2, bytes) :
+                    v2 = v2.decode(charset)
+
+                v = (v1, v2, v3.decode(charset))
+
+            return v
+
+        def join_item(self) :
+            v = self._dbcursor.join_item()
+            if v != None :
+                v = v.decode(charset)
+            return v
+
+        def get(self, *args, **kwargs) :
+            l = len(args)
+            if l == 2 :
+                k, f = args
+                if isinstance(k, str) :
+                    k = bytes(k, "iso8859-1")
+                args = (k, f)
+            elif l == 3 :
+                k, d, f = args
+                if isinstance(k, str) :
+                    k = bytes(k, charset)
+                if isinstance(d, str) :
+                    d = bytes(d, charset)
+                args =(k, d, f)
+
+            v = self._dbcursor.get(*args, **kwargs)
+            if v != None :
+                k, v = v
+                if isinstance(k, bytes) :
+                    k = k.decode(charset)
+                v = (k, v.decode(charset))
+            return v
+
+        def get_both(self, key, value) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if isinstance(value, str) :
+                value = bytes(value, charset)
+            v=self._dbcursor.get_both(key, value)
+            return self._fix(v)
+
+    class dup_cursor_py3k(cursor_py3k) :
+        def __init__(self, dbcursor) :
+            self._dbcursor = dbcursor
+
+    class DB_py3k(object) :
+        def __init__(self, *args, **kwargs) :
+            args2=[]
+            for i in args :
+                if isinstance(i, DBEnv_py3k) :
+                    i = i._dbenv
+                args2.append(i)
+            args = tuple(args2)
+            for k, v in kwargs.items() :
+                if isinstance(v, DBEnv_py3k) :
+                    kwargs[k] = v._dbenv
+
+            self._db = bsddb._db.DB_orig(*args, **kwargs)
+
+        def __contains__(self, k) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            return getattr(self._db, "has_key")(k)
+
+        def __getitem__(self, k) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            v = self._db[k]
+            if v != None :
+                v = v.decode(charset)
+            return v
+
+        def __setitem__(self, k, v) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            if isinstance(v, str) :
+                v = bytes(v, charset)
+            self._db[k] = v
+
+        def __delitem__(self, k) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            del self._db[k]
+
+        def __getattr__(self, v) :
+            return getattr(self._db, v)
+
+        def __len__(self) :
+            return len(self._db)
+
+        def has_key(self, k, txn=None) :
+            if isinstance(k, str) :
+                k = bytes(k, charset)
+            return self._db.has_key(k, txn=txn)
+
+        def put(self, key, value, txn=None, flags=0, dlen=-1, doff=-1) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if isinstance(value, str) :
+                value = bytes(value, charset)
+            return self._db.put(key, value, flags=flags, txn=txn, dlen=dlen,
+                    doff=doff)
+
+        def append(self, value, txn=None) :
+            if isinstance(value, str) :
+                value = bytes(value, charset)
+            return self._db.append(value, txn=txn)
+
+        def get_size(self, key) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            return self._db.get_size(key)
+
+        def get(self, key, default="MagicCookie", txn=None, flags=0, dlen=-1, doff=-1) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if default != "MagicCookie" :  # Magic for 'test_get_none.py'
+                v=self._db.get(key, default=default, txn=txn, flags=flags,
+                        dlen=dlen, doff=doff)
+            else :
+                v=self._db.get(key, txn=txn, flags=flags,
+                        dlen=dlen, doff=doff)
+            if (v != None) and isinstance(v, bytes) :
+                v = v.decode(charset)
+            return v
+
+        def pget(self, key, txn=None) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            v=self._db.pget(key, txn=txn)
+            if v != None :
+                v1, v2 = v
+                if isinstance(v1, bytes) :
+                    v1 = v1.decode(charset)
+
+                v = (v1, v2.decode(charset))
+            return v
+
+        def get_both(self, key, value, txn=None, flags=0) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            if isinstance(value, str) :
+                value = bytes(value, charset)
+            v=self._db.get_both(key, value, txn=txn, flags=flags)
+            if v != None :
+                v = v.decode(charset)
+            return v
+
+        def delete(self, key, txn=None) :
+            if isinstance(key, str) :
+                key = bytes(key, charset)
+            return self._db.delete(key, txn=txn)
+
+        def keys(self) :
+            k = self._db.keys()
+            if len(k) and isinstance(k[0], bytes) :
+                return [i.decode(charset) for i in self._db.keys()]
+            else :
+                return k
+
+        def items(self) :
+            data = self._db.items()
+            if not len(data) : return data
+            data2 = []
+            for k, v in data :
+                if isinstance(k, bytes) :
+                    k = k.decode(charset)
+                data2.append((k, v.decode(charset)))
+            return data2
+
+        def associate(self, secondarydb, callback, flags=0, txn=None) :
+            class associate_callback(object) :
+                def __init__(self, callback) :
+                    self._callback = callback
+
+                def callback(self, key, data) :
+                    if isinstance(key, str) :
+                        key = key.decode(charset)
+                    data = data.decode(charset)
+                    key = self._callback(key, data)
+                    if (key != bsddb._db.DB_DONOTINDEX) and isinstance(key,
+                            str) :
+                        key = bytes(key, charset)
+                    return key
+
+            return self._db.associate(secondarydb._db,
+                    associate_callback(callback).callback, flags=flags, txn=txn)
+
+        def cursor(self, txn=None, flags=0) :
+            return cursor_py3k(self._db, txn=txn, flags=flags)
+
+        def join(self, cursor_list) :
+            cursor_list = [i._dbcursor for i in cursor_list]
+            return dup_cursor_py3k(self._db.join(cursor_list))
+
+    class DBEnv_py3k(object) :
+        def __init__(self, *args, **kwargs) :
+            self._dbenv = bsddb._db.DBEnv_orig(*args, **kwargs)
+
+        def __getattr__(self, v) :
+            return getattr(self._dbenv, v)
+
+    class DBSequence_py3k(object) :
+        def __init__(self, db, *args, **kwargs) :
+            self._db=db
+            self._dbsequence = bsddb._db.DBSequence_orig(db._db, *args, **kwargs)
+
+        def __getattr__(self, v) :
+            return getattr(self._dbsequence, v)
+
+        def open(self, key, *args, **kwargs) :
+            return self._dbsequence.open(bytes(key, charset), *args, **kwargs)
+
+        def get_key(self) :
+            return  self._dbsequence.get_key().decode(charset)
+
+        def get_dbp(self) :
+            return self._db
+
+    import string
+    string.letters=[chr(i) for i in xrange(65,91)]
+
+    bsddb._db.DBEnv_orig = bsddb._db.DBEnv
+    bsddb._db.DB_orig = bsddb._db.DB
+    bsddb._db.DBSequence_orig = bsddb._db.DBSequence
+
+    def do_proxy_db_py3k(flag) :
+        flag2 = do_proxy_db_py3k.flag
+        do_proxy_db_py3k.flag = flag
+        if flag :
+            bsddb.DBEnv = bsddb.db.DBEnv = bsddb._db.DBEnv = DBEnv_py3k
+            bsddb.DB = bsddb.db.DB = bsddb._db.DB = DB_py3k
+            bsddb._db.DBSequence = DBSequence_py3k
+        else :
+            bsddb.DBEnv = bsddb.db.DBEnv = bsddb._db.DBEnv = bsddb._db.DBEnv_orig
+            bsddb.DB = bsddb.db.DB = bsddb._db.DB = bsddb._db.DB_orig
+            bsddb._db.DBSequence = bsddb._db.DBSequence_orig
+        return flag2
+
+    do_proxy_db_py3k.flag = False
+    do_proxy_db_py3k(True)
+
+try:
+    # For Pythons w/distutils pybsddb
+    from bsddb3 import db, dbtables, dbutils, dbshelve, \
+            hashopen, btopen, rnopen, dbobj
+except ImportError:
+    # For Python 2.3
+    from bsddb import db, dbtables, dbutils, dbshelve, \
+            hashopen, btopen, rnopen, dbobj
+
 try:
     from bsddb3 import test_support
 except ImportError:
-    from test import test_support
+    if sys.version_info[0] < 3 :
+        from test import test_support
+    else :
+        from test import support as test_support
+
 
 try:
-    from threading import Thread, currentThread
-    del Thread, currentThread
+    if sys.version_info[0] < 3 :
+        from threading import Thread, currentThread
+        del Thread, currentThread
+    else :
+        from threading import Thread, current_thread
+        del Thread, current_thread
     have_threads = True
 except ImportError:
     have_threads = False

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_associate.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_associate.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_associate.py	Sun Sep  7 18:03:22 2008
@@ -7,19 +7,8 @@
 from pprint import pprint
 
 import unittest
-from test_all import verbose, have_threads, get_new_environment_path
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbshelve
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbshelve
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, dbshelve, test_support, verbose, have_threads, \
+        get_new_environment_path
 
 
 #----------------------------------------------------------------------
@@ -152,7 +141,7 @@
         for key, value in musicdata.items():
             if type(self.keytype) == type(''):
                 key = "%02d" % key
-            d.put(key, string.join(value, '|'), txn=txn)
+            d.put(key, '|'.join(value), txn=txn)
 
     def createDB(self, txn=None):
         self.cur = None
@@ -238,13 +227,13 @@
         rec = self.cur.first()
         while rec is not None:
             if type(self.keytype) == type(''):
-                self.assert_(string.atoi(rec[0]))  # for primary db, key is a number
+                self.assert_(int(rec[0]))  # for primary db, key is a number
             else:
                 self.assert_(rec[0] and type(rec[0]) == type(0))
             count = count + 1
             if verbose:
                 print rec
-            rec = self.cur.next()
+            rec = getattr(self.cur, "next")()
         self.assertEqual(count, len(musicdata))  # all items accounted for
 
 
@@ -270,7 +259,7 @@
             count = count + 1
             if verbose:
                 print rec
-            rec = self.cur.next()
+            rec = getattr(self.cur, "next")()
         # all items accounted for EXCEPT for 1 with "Blues" genre
         self.assertEqual(count, len(musicdata)-1)
 
@@ -278,9 +267,11 @@
 
     def getGenre(self, priKey, priData):
         self.assertEqual(type(priData), type(""))
+        genre = priData.split('|')[2]
+
         if verbose:
             print 'getGenre key: %r data: %r' % (priKey, priData)
-        genre = string.split(priData, '|')[2]
+
         if genre == 'Blues':
             return db.DB_DONOTINDEX
         else:
@@ -404,13 +395,13 @@
         for key, value in musicdata.items():
             if type(self.keytype) == type(''):
                 key = "%02d" % key
-            d.put(key, string.join(value, '|'))
+            d.put(key, '|'.join(value))
 
     def writer2(self, d):
         for x in range(100, 600):
             key = 'z%2d' % x
             value = [key] * 4
-            d.put(key, string.join(value, '|'))
+            d.put(key, '|'.join(value))
 
 
 class ThreadedAssociateHashTestCase(ShelveAssociateTestCase):

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_basics.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_basics.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_basics.py	Sun Sep  7 18:03:22 2008
@@ -10,19 +10,8 @@
 import unittest
 import time
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
-from test_all import verbose, get_new_environment_path, get_new_database_path
+from test_all import db, test_support, verbose, get_new_environment_path, \
+        get_new_database_path
 
 DASH = '-'
 
@@ -150,7 +139,11 @@
         try:
             d.delete('abcd')
         except db.DBNotFoundError, val:
-            self.assertEqual(val[0], db.DB_NOTFOUND)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.DB_NOTFOUND)
+            else :
+                self.assertEqual(val.args[0], db.DB_NOTFOUND)
             if verbose: print val
         else:
             self.fail("expected exception")
@@ -169,7 +162,11 @@
         try:
             d.put('abcd', 'this should fail', flags=db.DB_NOOVERWRITE)
         except db.DBKeyExistError, val:
-            self.assertEqual(val[0], db.DB_KEYEXIST)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.DB_KEYEXIST)
+            else :
+                self.assertEqual(val.args[0], db.DB_KEYEXIST)
             if verbose: print val
         else:
             self.fail("expected exception")
@@ -255,8 +252,10 @@
 
         self.assertEqual(d['new record'], 'a replacement record')
 
-        self.assertEqual(d.has_key('0001'), 1)
-        self.assertEqual(d.has_key('spam'), 0)
+# We check also the positional parameter
+        self.assertEqual(d.has_key('0001', None), 1)
+# We check also the keyword parameter
+        self.assertEqual(d.has_key('spam', txn=None), 0)
 
         items = d.items()
         self.assertEqual(len(items), self._numKeys+1)
@@ -302,7 +301,11 @@
                 rec = c.next()
             except db.DBNotFoundError, val:
                 if get_raises_error:
-                    self.assertEqual(val[0], db.DB_NOTFOUND)
+                    import sys
+                    if sys.version_info[0] < 3 :
+                        self.assertEqual(val[0], db.DB_NOTFOUND)
+                    else :
+                        self.assertEqual(val.args[0], db.DB_NOTFOUND)
                     if verbose: print val
                     rec = None
                 else:
@@ -323,7 +326,11 @@
                 rec = c.prev()
             except db.DBNotFoundError, val:
                 if get_raises_error:
-                    self.assertEqual(val[0], db.DB_NOTFOUND)
+                    import sys
+                    if sys.version_info[0] < 3 :
+                        self.assertEqual(val[0], db.DB_NOTFOUND)
+                    else :
+                        self.assertEqual(val.args[0], db.DB_NOTFOUND)
                     if verbose: print val
                     rec = None
                 else:
@@ -346,7 +353,11 @@
         try:
             n = c.set('bad key')
         except db.DBNotFoundError, val:
-            self.assertEqual(val[0], db.DB_NOTFOUND)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.DB_NOTFOUND)
+            else :
+                self.assertEqual(val.args[0], db.DB_NOTFOUND)
             if verbose: print val
         else:
             if set_raises_error:
@@ -360,7 +371,11 @@
         try:
             n = c.get_both('0404', 'bad data')
         except db.DBNotFoundError, val:
-            self.assertEqual(val[0], db.DB_NOTFOUND)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.DB_NOTFOUND)
+            else :
+                self.assertEqual(val.args[0], db.DB_NOTFOUND)
             if verbose: print val
         else:
             if get_raises_error:
@@ -389,7 +404,11 @@
             rec = c.current()
         except db.DBKeyEmptyError, val:
             if get_raises_error:
-                self.assertEqual(val[0], db.DB_KEYEMPTY)
+                import sys
+                if sys.version_info[0] < 3 :
+                    self.assertEqual(val[0], db.DB_KEYEMPTY)
+                else :
+                    self.assertEqual(val.args[0], db.DB_KEYEMPTY)
                 if verbose: print val
             else:
                 self.fail("unexpected DBKeyEmptyError")
@@ -434,7 +453,11 @@
                 # a bug may cause a NULL pointer dereference...
                 apply(getattr(c, method), args)
             except db.DBError, val:
-                self.assertEqual(val[0], 0)
+                import sys
+                if sys.version_info[0] < 3 :
+                    self.assertEqual(val[0], 0)
+                else :
+                    self.assertEqual(val.args[0], 0)
                 if verbose: print val
             else:
                 self.fail("no exception raised when using a buggy cursor's"
@@ -803,8 +826,8 @@
         rec = c.set("dup1")
         self.assertEqual(rec, ('dup1', 'The'))
 
-        next = c.next()
-        self.assertEqual(next, ('dup1', 'quick'))
+        next_reg = c.next()
+        self.assertEqual(next_reg, ('dup1', 'quick'))
 
         rec = c.set("dup1")
         count = c.count()
@@ -919,7 +942,7 @@
             if verbose:
                 print rec
             rec = c3.next()
-        self.assertEqual(count, 52)
+        self.assertEqual(count, len(string.letters))
 
 
         c1.close()

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compare.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compare.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compare.py	Sun Sep  7 18:03:22 2008
@@ -7,19 +7,10 @@
 from cStringIO import StringIO
 
 import unittest
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbshelve
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbshelve
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+
+from test_all import db, dbshelve, test_support, \
+        get_new_environment_path, get_new_database_path
+
 
 lexical_cmp = cmp
 
@@ -37,7 +28,25 @@
 class ComparatorTests (unittest.TestCase):
     def comparator_test_helper (self, comparator, expected_data):
         data = expected_data[:]
-        data.sort (comparator)
+
+        import sys
+        if sys.version_info[0] < 3 :
+            if sys.version_info[:3] < (2, 4, 0):
+                data.sort(comparator)
+            else :
+                data.sort(cmp=comparator)
+        else :  # Insertion Sort. Please, improve
+            data2 = []
+            for i in data :
+                for j, k in enumerate(data2) :
+                    r = comparator(k, i)
+                    if r == 1 :
+                        data2.insert(j, i)
+                        break
+                else :
+                    data2.append(i)
+            data = data2
+
         self.failUnless (data == expected_data,
                          "comparator `%s' is not right: %s vs. %s"
                          % (comparator, expected_data, data))

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compat.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compat.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_compat.py	Sun Sep  7 18:03:22 2008
@@ -6,16 +6,10 @@
 import os, string
 import unittest
 
-from test_all import verbose, get_new_database_path
+from test_all import db, hashopen, btopen, rnopen, verbose, \
+        get_new_database_path
 
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, hashopen, btopen, rnopen
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, hashopen, btopen, rnopen
-
 class CompatibilityTestCase(unittest.TestCase):
     def setUp(self):
         self.filename = get_new_database_path()
@@ -34,7 +28,7 @@
         self.do_bthash_test(hashopen, 'hashopen')
 
     def test03_rnopen(self):
-        data = string.split("The quick brown fox jumped over the lazy dog.")
+        data = "The quick brown fox jumped over the lazy dog.".split()
         if verbose:
             print "\nTesting: rnopen"
 

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_cursor_pget_bug.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_cursor_pget_bug.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_cursor_pget_bug.py	Sun Sep  7 18:03:22 2008
@@ -1,19 +1,8 @@
 import unittest
 import os, glob
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, test_support, get_new_environment_path, \
+        get_new_database_path
 
 #----------------------------------------------------------------------
 

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbobj.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbobj.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbobj.py	Sun Sep  7 18:03:22 2008
@@ -2,19 +2,8 @@
 import os, string
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbobj
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbobj
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, dbobj, test_support, get_new_environment_path, \
+        get_new_database_path
 
 #----------------------------------------------------------------------
 
@@ -36,7 +25,7 @@
         class TestDBEnv(dbobj.DBEnv): pass
         class TestDB(dbobj.DB):
             def put(self, key, *args, **kwargs):
-                key = string.upper(key)
+                key = key.upper()
                 # call our parent classes put method with an upper case key
                 return apply(dbobj.DB.put, (self, key) + args, kwargs)
         self.env = TestDBEnv()

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbshelve.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbshelve.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbshelve.py	Sun Sep  7 18:03:22 2008
@@ -4,22 +4,11 @@
 
 import os, string
 import random
-from types import *
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbshelve
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbshelve
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
 
-from test_all import verbose, get_new_environment_path, get_new_database_path
+from test_all import db, dbshelve, test_support, verbose, \
+        get_new_environment_path, get_new_database_path
 
 
 
@@ -31,22 +20,38 @@
     def __init__(self):
         self.value = random.random()
 
-    def __cmp__(self, other):
+    def __repr__(self) :  # For Python 3.0 comparison
+        return "DataClass %f" %self.value
+
+    def __cmp__(self, other):  # For Python 2.x comparison
         return cmp(self.value, other)
 
+
 class DBShelveTestCase(unittest.TestCase):
     def setUp(self):
+        import sys
+        if sys.version_info[0] >= 3 :
+            from test_all import do_proxy_db_py3k
+            self._flag_proxy_db_py3k = do_proxy_db_py3k(False)
         self.filename = get_new_database_path()
         self.do_open()
 
     def tearDown(self):
+        import sys
+        if sys.version_info[0] >= 3 :
+            from test_all import do_proxy_db_py3k
+            do_proxy_db_py3k(self._flag_proxy_db_py3k)
         self.do_close()
         test_support.unlink(self.filename)
 
     def mk(self, key):
         """Turn key into an appropriate key type for this db"""
         # override in child class for RECNO
-        return key
+        import sys
+        if sys.version_info[0] < 3 :
+            return key
+        else :
+            return bytes(key, "iso8859-1")  # 8 bits
 
     def populateDB(self, d):
         for x in string.letters:
@@ -112,9 +117,15 @@
 
         dbvalues = d.values()
         self.assertEqual(len(dbvalues), len(d.keys()))
-        values.sort()
-        dbvalues.sort()
-        self.assertEqual(values, dbvalues)
+        import sys
+        if sys.version_info[0] < 3 :
+            values.sort()
+            dbvalues.sort()
+            self.assertEqual(values, dbvalues)
+        else :  # XXX: Convert all to strings. Please, improve
+            values.sort(key=lambda x : str(x))
+            dbvalues.sort(key=lambda x : str(x))
+            self.assertEqual(repr(values), repr(dbvalues))
 
         items = d.items()
         self.assertEqual(len(items), len(values))
@@ -154,7 +165,8 @@
                 print rec
             key, value = rec
             self.checkrec(key, value)
-            rec = c.next()
+            # Hack to avoid conversion by 2to3 tool
+            rec = getattr(c, "next")()
         del c
 
         self.assertEqual(count, len(d))
@@ -190,21 +202,33 @@
 
     def checkrec(self, key, value):
         # override this in a subclass if the key type is different
+
+        import sys
+        if sys.version_info[0] >= 3 :
+            if isinstance(key, bytes) :
+                key = key.decode("iso8859-1")  # 8 bits
+
         x = key[1]
         if key[0] == 'S':
-            self.assertEqual(type(value), StringType)
+            self.assertEqual(type(value), str)
             self.assertEqual(value, 10 * x)
 
         elif key[0] == 'I':
-            self.assertEqual(type(value), IntType)
+            self.assertEqual(type(value), int)
             self.assertEqual(value, ord(x))
 
         elif key[0] == 'L':
-            self.assertEqual(type(value), ListType)
+            self.assertEqual(type(value), list)
             self.assertEqual(value, [x] * 10)
 
         elif key[0] == 'O':
-            self.assertEqual(type(value), InstanceType)
+            import sys
+            if sys.version_info[0] < 3 :
+                from types import InstanceType
+                self.assertEqual(type(value), InstanceType)
+            else :
+                self.assertEqual(type(value), DataClass)
+
             self.assertEqual(value.S, 10 * x)
             self.assertEqual(value.I, ord(x))
             self.assertEqual(value.L, [x] * 10)
@@ -266,6 +290,10 @@
         DBShelveTestCase.setUp(self)
 
     def tearDown(self):
+        import sys
+        if sys.version_info[0] >= 3 :
+            from test_all import do_proxy_db_py3k
+            do_proxy_db_py3k(self._flag_proxy_db_py3k)
         self.do_close()
         test_support.rmtree(self.homeDir)
 

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbtables.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbtables.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_dbtables.py	Sun Sep  7 18:03:22 2008
@@ -28,20 +28,8 @@
     import pickle
 
 import unittest
-from test_all import verbose, get_new_environment_path, get_new_database_path
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbtables
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbtables
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
+from test_all import db, dbtables, test_support, verbose, \
+        get_new_environment_path, get_new_database_path
 
 #----------------------------------------------------------------------
 
@@ -49,12 +37,21 @@
     db_name = 'test-table.db'
 
     def setUp(self):
+        import sys
+        if sys.version_info[0] >= 3 :
+            from test_all import do_proxy_db_py3k
+            self._flag_proxy_db_py3k = do_proxy_db_py3k(False)
+
         self.testHomeDir = get_new_environment_path()
         self.tdb = dbtables.bsdTableDB(
             filename='tabletest.db', dbhome=self.testHomeDir, create=1)
 
     def tearDown(self):
         self.tdb.close()
+        import sys
+        if sys.version_info[0] >= 3 :
+            from test_all import do_proxy_db_py3k
+            do_proxy_db_py3k(self._flag_proxy_db_py3k)
         test_support.rmtree(self.testHomeDir)
 
     def test01(self):
@@ -65,7 +62,12 @@
         except dbtables.TableDBError:
             pass
         self.tdb.CreateTable(tabname, [colname])
-        self.tdb.Insert(tabname, {colname: pickle.dumps(3.14159, 1)})
+        import sys
+        if sys.version_info[0] < 3 :
+            self.tdb.Insert(tabname, {colname: pickle.dumps(3.14159, 1)})
+        else :
+            self.tdb.Insert(tabname, {colname: pickle.dumps(3.14159,
+                1).decode("iso8859-1")})  # 8 bits
 
         if verbose:
             self.tdb._db_print()
@@ -73,7 +75,11 @@
         values = self.tdb.Select(
             tabname, [colname], conditions={colname: None})
 
-        colval = pickle.loads(values[0][colname])
+        import sys
+        if sys.version_info[0] < 3 :
+            colval = pickle.loads(values[0][colname])
+        else :
+            colval = pickle.loads(bytes(values[0][colname], "iso8859-1"))
         self.assert_(colval > 3.141)
         self.assert_(colval < 3.142)
 
@@ -83,11 +89,23 @@
         col0 = 'coolness factor'
         col1 = 'but can it fly?'
         col2 = 'Species'
-        testinfo = [
-            {col0: pickle.dumps(8, 1), col1: 'no', col2: 'Penguin'},
-            {col0: pickle.dumps(-1, 1), col1: 'no', col2: 'Turkey'},
-            {col0: pickle.dumps(9, 1), col1: 'yes', col2: 'SR-71A Blackbird'}
-        ]
+
+        import sys
+        if sys.version_info[0] < 3 :
+            testinfo = [
+                {col0: pickle.dumps(8, 1), col1: 'no', col2: 'Penguin'},
+                {col0: pickle.dumps(-1, 1), col1: 'no', col2: 'Turkey'},
+                {col0: pickle.dumps(9, 1), col1: 'yes', col2: 'SR-71A Blackbird'}
+            ]
+        else :
+            testinfo = [
+                {col0: pickle.dumps(8, 1).decode("iso8859-1"),
+                    col1: 'no', col2: 'Penguin'},
+                {col0: pickle.dumps(-1, 1).decode("iso8859-1"),
+                    col1: 'no', col2: 'Turkey'},
+                {col0: pickle.dumps(9, 1).decode("iso8859-1"),
+                    col1: 'yes', col2: 'SR-71A Blackbird'}
+            ]
 
         try:
             self.tdb.Drop(tabname)
@@ -97,8 +115,14 @@
         for row in testinfo :
             self.tdb.Insert(tabname, row)
 
-        values = self.tdb.Select(tabname, [col2],
-            conditions={col0: lambda x: pickle.loads(x) >= 8})
+        import sys
+        if sys.version_info[0] < 3 :
+            values = self.tdb.Select(tabname, [col2],
+                conditions={col0: lambda x: pickle.loads(x) >= 8})
+        else :
+            values = self.tdb.Select(tabname, [col2],
+                conditions={col0: lambda x:
+                    pickle.loads(bytes(x, "iso8859-1")) >= 8})
 
         self.assertEqual(len(values), 2)
         if values[0]['Species'] == 'Penguin' :

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_distributed_transactions.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_distributed_transactions.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_distributed_transactions.py	Sun Sep  7 18:03:22 2008
@@ -4,19 +4,8 @@
 import os
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, test_support, get_new_environment_path, \
+        get_new_database_path
 
 try :
     a=set()
@@ -79,12 +68,16 @@
 
     def test01_distributed_transactions(self) :
         txns=set()
+        adapt = lambda x : x
+        import sys
+        if sys.version_info[0] >= 3 :
+            adapt = lambda x : bytes(x, "ascii")
     # Create transactions, "prepare" them, and
     # let them be garbage collected.
         for i in xrange(self.num_txns) :
-            txn=self.dbenv.txn_begin()
-            gid="%%%dd" %db.DB_XIDDATASIZE
-            gid=gid %i
+            txn = self.dbenv.txn_begin()
+            gid = "%%%dd" %db.DB_XIDDATASIZE
+            gid = adapt(gid %i)
             self.db.put(i, gid, txn=txn, flags=db.DB_APPEND)
             txns.add(gid)
             txn.prepare(gid)

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_early_close.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_early_close.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_early_close.py	Sun Sep  7 18:03:22 2008
@@ -5,19 +5,7 @@
 import os
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
-from test_all import verbose, get_new_environment_path, get_new_database_path
+from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path
 
 # We're going to get warnings in this module about trying to close the db when
 # its env is already closed.  Let's just ignore those.

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_get_none.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_get_none.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_get_none.py	Sun Sep  7 18:03:22 2008
@@ -5,14 +5,7 @@
 import os, string
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import verbose, get_new_database_path
+from test_all import db, verbose, get_new_database_path
 
 
 #----------------------------------------------------------------------
@@ -39,8 +32,8 @@
         data = d.get('bad key')
         self.assertEqual(data, None)
 
-        data = d.get('a')
-        self.assertEqual(data, 'a'*40)
+        data = d.get(string.letters[0])
+        self.assertEqual(data, string.letters[0]*40)
 
         count = 0
         c = d.cursor()
@@ -50,7 +43,7 @@
             rec = c.next()
 
         self.assertEqual(rec, None)
-        self.assertEqual(count, 52)
+        self.assertEqual(count, len(string.letters))
 
         c.close()
         d.close()
@@ -67,8 +60,8 @@
         self.assertRaises(db.DBNotFoundError, d.get, 'bad key')
         self.assertRaises(KeyError, d.get, 'bad key')
 
-        data = d.get('a')
-        self.assertEqual(data, 'a'*40)
+        data = d.get(string.letters[0])
+        self.assertEqual(data, string.letters[0]*40)
 
         count = 0
         exceptionHappened = 0
@@ -84,7 +77,7 @@
 
         self.assertNotEqual(rec, None)
         self.assert_(exceptionHappened)
-        self.assertEqual(count, 52)
+        self.assertEqual(count, len(string.letters))
 
         c.close()
         d.close()

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_join.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_join.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_join.py	Sun Sep  7 18:03:22 2008
@@ -4,22 +4,9 @@
 import os
 
 import unittest
-from test_all import verbose
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbshelve
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbshelve
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
 
+from test_all import db, dbshelve, test_support, verbose, \
+        get_new_environment_path, get_new_database_path
 
 #----------------------------------------------------------------------
 

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_lock.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_lock.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_lock.py	Sun Sep  7 18:03:22 2008
@@ -5,23 +5,16 @@
 import time
 
 import unittest
-from test_all import verbose, have_threads, get_new_environment_path, get_new_database_path
+from test_all import db, test_support, verbose, have_threads, \
+        get_new_environment_path, get_new_database_path
 
 if have_threads :
-    from threading import Thread, currentThread
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
+    from threading import Thread
+    import sys
+    if sys.version_info[0] < 3 :
+        from threading import currentThread
+    else :
+        from threading import current_thread as currentThread
 
 #----------------------------------------------------------------------
 
@@ -87,7 +80,11 @@
                               args=(db.DB_LOCK_WRITE,)))
 
         for t in threads:
-            t.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                t.setDaemon(True)
+            else :
+                t.daemon = True
             t.start()
         for t in threads:
             t.join()
@@ -111,7 +108,11 @@
         deadlock_detection.end=False
         deadlock_detection.count=0
         t=Thread(target=deadlock_detection)
-        t.setDaemon(True)
+        import sys
+        if sys.version_info[0] < 3 :
+            t.setDaemon(True)
+        else :
+            t.daemon = True
         t.start()
         self.env.set_timeout(100000, db.DB_SET_LOCK_TIMEOUT)
         anID = self.env.lock_id()
@@ -134,7 +135,12 @@
             self.assertTrue(deadlock_detection.count>0)
 
     def theThread(self, lockType):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
+
         if lockType ==  db.DB_LOCK_WRITE:
             lt = "write"
         else:

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_misc.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_misc.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_misc.py	Sun Sep  7 18:03:22 2008
@@ -4,19 +4,7 @@
 import os
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbshelve, hashopen
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbshelve, hashopen
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, dbshelve, hashopen, test_support, get_new_environment_path, get_new_database_path
 
 #----------------------------------------------------------------------
 
@@ -39,7 +27,11 @@
         # check for crash fixed when db_home is used before open()
         self.assert_(env.db_home is None)
         env.open(self.homeDir, db.DB_CREATE)
-        self.assertEqual(self.homeDir, env.db_home)
+        import sys
+        if sys.version_info[0] < 3 :
+            self.assertEqual(self.homeDir, env.db_home)
+        else :
+            self.assertEqual(bytes(self.homeDir, "ascii"), env.db_home)
 
     def test03_repr_closed_db(self):
         db = hashopen(self.filename)

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_pickle.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_pickle.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_pickle.py	Sun Sep  7 18:03:22 2008
@@ -7,20 +7,7 @@
     cPickle = None
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError, e:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
+from test_all import db, test_support, get_new_environment_path, get_new_database_path
 
 #----------------------------------------------------------------------
 

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_queue.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_queue.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_queue.py	Sun Sep  7 18:03:22 2008
@@ -6,15 +6,7 @@
 from pprint import pprint
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import verbose, get_new_database_path
-
+from test_all import db, verbose, get_new_database_path
 
 #----------------------------------------------------------------------
 
@@ -47,14 +39,14 @@
         for x in string.letters:
             d.append(x * 40)
 
-        self.assertEqual(len(d), 52)
+        self.assertEqual(len(d), len(string.letters))
 
         d.put(100, "some more data")
         d.put(101, "and some more ")
         d.put(75,  "out of order")
         d.put(1,   "replacement data")
 
-        self.assertEqual(len(d), 55)
+        self.assertEqual(len(d), len(string.letters)+3)
 
         if verbose:
             print "before close" + '-' * 30
@@ -69,7 +61,11 @@
             print "after open" + '-' * 30
             pprint(d.stat())
 
-        d.append("one more")
+        # Test "txn" as a positional parameter
+        d.append("one more", None)
+        # Test "txn" as a keyword parameter
+        d.append("another one", txn=None)
+
         c = d.cursor()
 
         if verbose:
@@ -119,14 +115,14 @@
         for x in string.letters:
             d.append(x * 40)
 
-        self.assertEqual(len(d), 52)
+        self.assertEqual(len(d), len(string.letters))
 
         d.put(100, "some more data")
         d.put(101, "and some more ")
         d.put(75,  "out of order")
         d.put(1,   "replacement data")
 
-        self.assertEqual(len(d), 55)
+        self.assertEqual(len(d), len(string.letters)+3)
 
         if verbose:
             print "before close" + '-' * 30

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_recno.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_recno.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_recno.py	Sun Sep  7 18:03:22 2008
@@ -6,19 +6,7 @@
 from pprint import pprint
 import unittest
 
-from test_all import verbose, get_new_environment_path, get_new_database_path
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path
 
 letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
@@ -72,7 +60,11 @@
         try:
             data = d[0]  # This should raise a KeyError!?!?!
         except db.DBInvalidArgError, val:
-            self.assertEqual(val[0], db.EINVAL)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.EINVAL)
+            else :
+                self.assertEqual(val.args[0], db.EINVAL)
             if verbose: print val
         else:
             self.fail("expected exception")
@@ -277,7 +269,11 @@
         try:                    # this one will fail
             d.append('bad' * 20)
         except db.DBInvalidArgError, val:
-            self.assertEqual(val[0], db.EINVAL)
+            import sys
+            if sys.version_info[0] < 3 :
+                self.assertEqual(val[0], db.EINVAL)
+            else :
+                self.assertEqual(val.args[0], db.EINVAL)
             if verbose: print val
         else:
             self.fail("expected exception")

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py	Sun Sep  7 18:03:22 2008
@@ -5,21 +5,9 @@
 import time
 import unittest
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    # For Python 2.3
-    from bsddb import db
-
-from test_all import have_threads, get_new_environment_path, get_new_database_path
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+from test_all import db, test_support, have_threads, verbose, \
+        get_new_environment_path, get_new_database_path
 
-from test_all import verbose
 
 #----------------------------------------------------------------------
 
@@ -254,9 +242,14 @@
 
         from threading import Thread
         t_m=Thread(target=thread_master)
-        t_m.setDaemon(True)
         t_c=Thread(target=thread_client)
-        t_c.setDaemon(True)
+        import sys
+        if sys.version_info[0] < 3 :
+            t_m.setDaemon(True)
+            t_c.setDaemon(True)
+        else :
+            t_m.daemon = True
+            t_c.daemon = True
 
         self.t_m = t_m
         self.t_c = t_c
@@ -400,7 +393,11 @@
                             from threading import Thread
                             election_status[0] = True
                             t=Thread(target=elect)
-                            t.setDaemon(True)
+                            import sys
+                            if sys.version_info[0] < 3 :
+                                t.setDaemon(True)
+                            else :
+                                t.daemon = True
                             t.start()
 
             self.thread_do = thread_do

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_sequence.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_sequence.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_sequence.py	Sun Sep  7 18:03:22 2008
@@ -1,18 +1,7 @@
 import unittest
 import os
 
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db
-except ImportError:
-    from bsddb import db
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
-
-from test_all import get_new_environment_path, get_new_database_path
+from test_all import db, test_support, get_new_environment_path, get_new_database_path
 
 
 class DBSequenceTest(unittest.TestCase):

Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_thread.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_thread.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_thread.py	Sun Sep  7 18:03:22 2008
@@ -16,23 +16,16 @@
         pass
 
 import unittest
-from test_all import verbose, have_threads, get_new_environment_path, get_new_database_path
+from test_all import db, dbutils, test_support, verbose, have_threads, \
+        get_new_environment_path, get_new_database_path
 
 if have_threads :
-    from threading import Thread, currentThread
-
-
-try:
-    # For Pythons w/distutils pybsddb
-    from bsddb3 import db, dbutils
-except ImportError:
-    # For Python 2.3
-    from bsddb import db, dbutils
-
-try:
-    from bsddb3 import test_support
-except ImportError:
-    from test import test_support
+    from threading import Thread
+    import sys
+    if sys.version_info[0] < 3 :
+        from threading import currentThread
+    else :
+        from threading import current_thread as currentThread
 
 
 #----------------------------------------------------------------------
@@ -106,7 +99,11 @@
                         args = (self.d, x),
                         name = 'reader %d' % x,
                         )#verbose = verbose)
-            rt.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                rt.setDaemon(True)
+            else :
+                rt.daemon = True
             readers.append(rt)
 
         writers=[]
@@ -121,7 +118,11 @@
             writers.append(wt)
 
         for t in writers:
-            t.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                t.setDaemon(True)
+            else :
+                t.daemon = True
             t.start()
 
         for t in writers:
@@ -130,7 +131,12 @@
             t.join()
 
     def writerThread(self, d, keys, readers):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
+
         if verbose:
             print "%s: creating records %d - %d" % (name, start, stop)
 
@@ -155,7 +161,11 @@
             print "%s: thread finished" % name
 
     def readerThread(self, d, readerNum):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
 
         for i in xrange(5) :
             c = d.cursor()
@@ -221,7 +231,11 @@
                         args = (self.d, x),
                         name = 'reader %d' % x,
                         )#verbose = verbose)
-            rt.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                rt.setDaemon(True)
+            else :
+                rt.daemon = True
             readers.append(rt)
 
         writers = []
@@ -236,7 +250,11 @@
             writers.append(wt)
 
         for t in writers:
-            t.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                t.setDaemon(True)
+            else :
+                t.daemon = True
             t.start()
 
         for t in writers:
@@ -245,7 +263,11 @@
             t.join()
 
     def writerThread(self, d, keys, readers):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
         if verbose:
             print "%s: creating records %d - %d" % (name, start, stop)
 
@@ -268,7 +290,11 @@
             print "%s: thread finished" % name
 
     def readerThread(self, d, readerNum):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
 
         c = d.cursor()
         count = 0
@@ -335,7 +361,11 @@
                         args = (self.d, x),
                         name = 'reader %d' % x,
                         )#verbose = verbose)
-            rt.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                rt.setDaemon(True)
+            else :
+                rt.daemon = True
             readers.append(rt)
 
         writers = []
@@ -349,11 +379,19 @@
             writers.append(wt)
 
         dt = Thread(target = self.deadlockThread)
-        dt.setDaemon(True)
+        import sys
+        if sys.version_info[0] < 3 :
+            dt.setDaemon(True)
+        else :
+            dt.daemon = True
         dt.start()
 
         for t in writers:
-            t.setDaemon(True)
+            import sys
+            if sys.version_info[0] < 3 :
+                t.setDaemon(True)
+            else :
+                t.daemon = True
             t.start()
 
         for t in writers:
@@ -365,7 +403,12 @@
         dt.join()
 
     def writerThread(self, d, keys, readers):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
+
         count=len(keys)//len(readers)
         while len(keys):
             try:
@@ -388,7 +431,11 @@
             print "%s: thread finished" % name
 
     def readerThread(self, d, readerNum):
-        name = currentThread().getName()
+        import sys
+        if sys.version_info[0] < 3 :
+            name = currentThread().getName()
+        else :
+            name = currentThread().name
 
         finished = False
         while not finished:

Modified: python/branches/tlee-ast-optimize/Lib/cgi.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/cgi.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/cgi.py	Sun Sep  7 18:03:22 2008
@@ -39,13 +39,16 @@
 import os
 import urllib
 import UserDict
-from test.test_support import catch_warning
-from warnings import filterwarnings
-with catch_warning(record=False):
-    filterwarnings("ignore", ".*mimetools has been removed",
-                    DeprecationWarning)
+import urlparse
+
+from warnings import filterwarnings, catch_warnings, warn
+with catch_warnings():
+    if sys.py3kwarning:
+        filterwarnings("ignore", ".*mimetools has been removed",
+                        DeprecationWarning)
     import mimetools
-    filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
+    if sys.py3kwarning:
+        filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
     import rfc822
 
 try:
@@ -172,72 +175,21 @@
     return parse_qs(qs, keep_blank_values, strict_parsing)
 
 
-def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
-    """Parse a query given as a string argument.
+# parse query string function called from urlparse,
+# this is done in order to maintain backward compatiblity.
 
-        Arguments:
+def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
+    """Parse a query given as a string argument."""
+    warn("cgi.parse_qs is deprecated, use urlparse.parse_qs \
+            instead",PendingDeprecationWarning)
+    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
-        qs: URL-encoded query string to be parsed
-
-        keep_blank_values: flag indicating whether blank values in
-            URL encoded queries should be treated as blank strings.
-            A true value indicates that blanks should be retained as
-            blank strings.  The default false value indicates that
-            blank values are to be ignored and treated as if they were
-            not included.
-
-        strict_parsing: flag indicating what to do with parsing errors.
-            If false (the default), errors are silently ignored.
-            If true, errors raise a ValueError exception.
-    """
-    dict = {}
-    for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
-        if name in dict:
-            dict[name].append(value)
-        else:
-            dict[name] = [value]
-    return dict
 
 def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
-    """Parse a query given as a string argument.
-
-    Arguments:
-
-    qs: URL-encoded query string to be parsed
-
-    keep_blank_values: flag indicating whether blank values in
-        URL encoded queries should be treated as blank strings.  A
-        true value indicates that blanks should be retained as blank
-        strings.  The default false value indicates that blank values
-        are to be ignored and treated as if they were  not included.
-
-    strict_parsing: flag indicating what to do with parsing errors. If
-        false (the default), errors are silently ignored. If true,
-        errors raise a ValueError exception.
-
-    Returns a list, as G-d intended.
-    """
-    pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
-    r = []
-    for name_value in pairs:
-        if not name_value and not strict_parsing:
-            continue
-        nv = name_value.split('=', 1)
-        if len(nv) != 2:
-            if strict_parsing:
-                raise ValueError, "bad query field: %r" % (name_value,)
-            # Handle case of a control-name with no equal sign
-            if keep_blank_values:
-                nv.append('')
-            else:
-                continue
-        if len(nv[1]) or keep_blank_values:
-            name = urllib.unquote(nv[0].replace('+', ' '))
-            value = urllib.unquote(nv[1].replace('+', ' '))
-            r.append((name, value))
-
-    return r
-
+    """Parse a query given as a string argument."""
+    warn("cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead",
+            PendingDeprecationWarning)
+    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
 def parse_multipart(fp, pdict):
     """Parse multipart input.
@@ -644,8 +596,8 @@
         if self.qs_on_post:
             qs += '&' + self.qs_on_post
         self.list = list = []
-        for key, value in parse_qsl(qs, self.keep_blank_values,
-                                    self.strict_parsing):
+        for key, value in urlparse.parse_qsl(qs, self.keep_blank_values,
+                                            self.strict_parsing):
             list.append(MiniFieldStorage(key, value))
         self.skip_lines()
 
@@ -658,8 +610,8 @@
             raise ValueError, 'Invalid boundary in multipart form: %r' % (ib,)
         self.list = []
         if self.qs_on_post:
-            for key, value in parse_qsl(self.qs_on_post, self.keep_blank_values,
-                                        self.strict_parsing):
+            for key, value in urlparse.parse_qsl(self.qs_on_post,
+                                self.keep_blank_values, self.strict_parsing):
                 self.list.append(MiniFieldStorage(key, value))
             FieldStorageClass = None
 

Modified: python/branches/tlee-ast-optimize/Lib/dbhash.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/dbhash.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/dbhash.py	Sun Sep  7 18:03:22 2008
@@ -1,6 +1,9 @@
 """Provide a (g)dbm-compatible interface to bsddb.hashopen."""
 
 import sys
+if sys.py3kwarning:
+    import warnings
+    warnings.warnpy3k("in 3.x, dbhash has been removed", DeprecationWarning, 2)
 try:
     import bsddb
 except ImportError:

Modified: python/branches/tlee-ast-optimize/Lib/distutils/dist.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/dist.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/dist.py	Sun Sep  7 18:03:22 2008
@@ -23,6 +23,9 @@
 from distutils import log
 from distutils.debug import DEBUG
 
+# Encoding used for the PKG-INFO files
+PKG_INFO_ENCODING = 'utf-8'
+
 # Regex to define acceptable Distutils command names.  This is not *quite*
 # the same as a Python NAME -- I don't allow leading underscores.  The fact
 # that they're very similar is no coincidence; the default naming scheme is
@@ -1084,23 +1087,23 @@
         if self.provides or self.requires or self.obsoletes:
             version = '1.1'
 
-        file.write('Metadata-Version: %s\n' % version)
-        file.write('Name: %s\n' % self.get_name() )
-        file.write('Version: %s\n' % self.get_version() )
-        file.write('Summary: %s\n' % self.get_description() )
-        file.write('Home-page: %s\n' % self.get_url() )
-        file.write('Author: %s\n' % self.get_contact() )
-        file.write('Author-email: %s\n' % self.get_contact_email() )
-        file.write('License: %s\n' % self.get_license() )
+        self._write_field(file, 'Metadata-Version', version)
+        self._write_field(file, 'Name', self.get_name())
+        self._write_field(file, 'Version', self.get_version())
+        self._write_field(file, 'Summary', self.get_description())
+        self._write_field(file, 'Home-page', self.get_url())
+        self._write_field(file, 'Author', self.get_contact())
+        self._write_field(file, 'Author-email', self.get_contact_email())
+        self._write_field(file, 'License', self.get_license())
         if self.download_url:
-            file.write('Download-URL: %s\n' % self.download_url)
+            self._write_field(file, 'Download-URL', self.download_url)
 
-        long_desc = rfc822_escape( self.get_long_description() )
-        file.write('Description: %s\n' % long_desc)
+        long_desc = rfc822_escape( self.get_long_description())
+        self._write_field(file, 'Description', long_desc)
 
         keywords = string.join( self.get_keywords(), ',')
         if keywords:
-            file.write('Keywords: %s\n' % keywords )
+            self._write_field(file, 'Keywords', keywords)
 
         self._write_list(file, 'Platform', self.get_platforms())
         self._write_list(file, 'Classifier', self.get_classifiers())
@@ -1110,9 +1113,18 @@
         self._write_list(file, 'Provides', self.get_provides())
         self._write_list(file, 'Obsoletes', self.get_obsoletes())
 
+    def _write_field(self, file, name, value):
+
+        if isinstance(value, unicode):
+            value = value.encode(PKG_INFO_ENCODING)
+        else:
+            value = str(value)
+        file.write('%s: %s\n' % (name, value))
+
     def _write_list (self, file, name, values):
+
         for value in values:
-            file.write('%s: %s\n' % (name, value))
+            self._write_field(file, name, value)
 
     # -- Metadata query methods ----------------------------------------
 

Modified: python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py	Sun Sep  7 18:03:22 2008
@@ -193,6 +193,17 @@
             reduced_paths.append(np)
     return reduced_paths
 
+def removeDuplicates(variable):
+    """Remove duplicate values of an environment variable.
+    """
+    oldList = variable.split(os.pathsep)
+    newList = []
+    for i in oldList:
+        if i not in newList:
+            newList.append(i)
+    newVariable = os.pathsep.join(newList)
+    return newVariable
+
 def find_vcvarsall(version):
     """Find the vcvarsall.bat file
 
@@ -252,12 +263,12 @@
         if '=' not in line:
             continue
         line = line.strip()
-        key, value = line.split('=')
+        key, value = line.split('=', 1)
         key = key.lower()
         if key in interesting:
             if value.endswith(os.pathsep):
                 value = value[:-1]
-            result[key] = value
+            result[key] = removeDuplicates(value)
 
     if len(result) != len(interesting):
         raise ValueError(str(list(result.keys())))

Modified: python/branches/tlee-ast-optimize/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/tests/test_dist.py	Sun Sep  7 18:03:22 2008
@@ -1,3 +1,5 @@
+# -*- coding: latin-1 -*-
+
 """Tests for distutils.dist."""
 
 import distutils.cmd
@@ -95,6 +97,39 @@
         finally:
             os.unlink(TESTFN)
 
+    def test_write_pkg_file(self):
+        # Check DistributionMetadata handling of Unicode fields
+        my_file = os.path.join(os.path.dirname(__file__), 'f')
+        klass = distutils.dist.Distribution
+
+        dist = klass(attrs={'author': u'Mister Café',
+                            'name': 'my.package',
+                            'maintainer': u'Café Junior',
+                            'description': u'Café torréfié',
+                            'long_description': u'Héhéhé'})
+
+
+        # let's make sure the file can be written
+        # with Unicode fields. they are encoded with
+        # PKG_INFO_ENCODING
+        try:
+            dist.metadata.write_pkg_file(open(my_file, 'w'))
+        finally:
+            if os.path.exists(my_file):
+                os.remove(my_file)
+
+        # regular ascii is of course always usable
+        dist = klass(attrs={'author': 'Mister Cafe',
+                            'name': 'my.package',
+                            'maintainer': 'Cafe Junior',
+                            'description': 'Cafe torrefie',
+                            'long_description': 'Hehehe'})
+
+        try:
+            dist.metadata.write_pkg_file(open(my_file, 'w'))
+        finally:
+            if os.path.exists(my_file):
+                os.remove(my_file)
 
 class MetadataTestCase(unittest.TestCase):
 

Modified: python/branches/tlee-ast-optimize/Lib/hashlib.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/hashlib.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/hashlib.py	Sun Sep  7 18:03:22 2008
@@ -45,7 +45,7 @@
     >>> m.update("Nobody inspects")
     >>> m.update(" the spammish repetition")
     >>> m.digest()
-    '\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
+    '\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9'
 
 More condensed:
 

Modified: python/branches/tlee-ast-optimize/Lib/httplib.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/httplib.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/httplib.py	Sun Sep  7 18:03:22 2008
@@ -67,12 +67,13 @@
 """
 
 import socket
+from sys import py3kwarning
 from urlparse import urlsplit
 import warnings
-from test.test_support import catch_warning
-with catch_warning(record=False):
-    warnings.filterwarnings("ignore", ".*mimetools has been removed",
-                            DeprecationWarning)
+with warnings.catch_warnings():
+    if py3kwarning:
+        warnings.filterwarnings("ignore", ".*mimetools has been removed",
+                                DeprecationWarning)
     import mimetools
 
 try:

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py	Sun Sep  7 18:03:22 2008
@@ -47,8 +47,8 @@
         """Initializer.  Subclass may override.
 
         Args:
-            options: an optparse.Values instance which can be used
-                to inspect the command line options.
+            options: an dict containing the options passed to RefactoringTool
+            that could be used to customize the fixer through the command line.
             log: a list to append warnings and other messages to.
         """
         self.options = options

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py	Sun Sep  7 18:03:22 2008
@@ -51,12 +51,12 @@
 
 def ArgList(args, lparen=LParen(), rparen=RParen()):
     """A parenthesised argument list, used by Call()"""
-    return Node(syms.trailer,
-                [lparen.clone(),
-                 Node(syms.arglist, args),
-                 rparen.clone()])
+    node = Node(syms.trailer, [lparen.clone(), rparen.clone()])
+    if args:
+        node.insert_child(1, Node(syms.arglist, args))
+    return node
 
-def Call(func_name, args, prefix=None):
+def Call(func_name, args=None, prefix=None):
     """A function call"""
     node = Node(syms.power, [func_name, ArgList(args)])
     if prefix is not None:

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py	Sun Sep  7 18:03:22 2008
@@ -8,7 +8,7 @@
 class FixRawInput(fixer_base.BaseFix):
 
     PATTERN = """
-              power< name='raw_input' trailer< '(' [any] ')' > >
+              power< name='raw_input' trailer< '(' [any] ')' > any* >
               """
 
     def transform(self, node, results):

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py	Sun Sep  7 18:03:22 2008
@@ -16,8 +16,8 @@
 import os
 import sys
 import difflib
-import optparse
 import logging
+import operator
 from collections import defaultdict
 from itertools import chain
 
@@ -30,74 +30,19 @@
 from . import fixes
 from . import pygram
 
-def main(fixer_dir, args=None):
-    """Main program.
 
-    Args:
-        fixer_dir: directory where fixer modules are located.
-        args: optional; a list of command line arguments. If omitted,
-              sys.argv[1:] is used.
-
-    Returns a suggested exit status (0, 1, 2).
-    """
-    # Set up option parser
-    parser = optparse.OptionParser(usage="refactor.py [options] file|dir ...")
-    parser.add_option("-d", "--doctests_only", action="store_true",
-                      help="Fix up doctests only")
-    parser.add_option("-f", "--fix", action="append", default=[],
-                      help="Each FIX specifies a transformation; default all")
-    parser.add_option("-l", "--list-fixes", action="store_true",
-                      help="List available transformations (fixes/fix_*.py)")
-    parser.add_option("-p", "--print-function", action="store_true",
-                      help="Modify the grammar so that print() is a function")
-    parser.add_option("-v", "--verbose", action="store_true",
-                      help="More verbose logging")
-    parser.add_option("-w", "--write", action="store_true",
-                      help="Write back modified files")
-
-    # Parse command line arguments
-    options, args = parser.parse_args(args)
-    if options.list_fixes:
-        print "Available transformations for the -f/--fix option:"
-        for fixname in get_all_fix_names(fixer_dir):
-            print fixname
-        if not args:
-            return 0
-    if not args:
-        print >>sys.stderr, "At least one file or directory argument required."
-        print >>sys.stderr, "Use --help to show usage."
-        return 2
-
-    # Set up logging handler
-    if sys.version_info < (2, 4):
-        hdlr = logging.StreamHandler()
-        fmt = logging.Formatter('%(name)s: %(message)s')
-        hdlr.setFormatter(fmt)
-        logging.root.addHandler(hdlr)
-    else:
-        logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)
-
-    # Initialize the refactoring tool
-    rt = RefactoringTool(fixer_dir, options)
-
-    # Refactor all files and directories passed as arguments
-    if not rt.errors:
-        rt.refactor_args(args)
-        rt.summarize()
-
-    # Return error status (0 if rt.errors is zero)
-    return int(bool(rt.errors))
-
-
-def get_all_fix_names(fixer_dir):
-    """Return a sorted list of all available fix names."""
+def get_all_fix_names(fixer_pkg, remove_prefix=True):
+    """Return a sorted list of all available fix names in the given package."""
+    pkg = __import__(fixer_pkg, [], [], ["*"])
+    fixer_dir = os.path.dirname(pkg.__file__)
     fix_names = []
     names = os.listdir(fixer_dir)
     names.sort()
     for name in names:
         if name.startswith("fix_") and name.endswith(".py"):
-            fix_names.append(name[4:-3])
-    fix_names.sort()
+            if remove_prefix:
+                name = name[4:]
+            fix_names.append(name[:-3])
     return fix_names
 
 def get_head_types(pat):
@@ -137,22 +82,36 @@
             head_nodes[t].append(fixer)
     return head_nodes
 
+def get_fixers_from_package(pkg_name):
+    """
+    Return the fully qualified names for fixers in the package pkg_name.
+    """
+    return [pkg_name + "." + fix_name
+            for fix_name in get_all_fix_names(pkg_name, False)]
+
 
 class RefactoringTool(object):
 
-    def __init__(self, fixer_dir, options):
+    _default_options = {"print_function": False}
+
+    def __init__(self, fixer_names, options=None, explicit=[]):
         """Initializer.
 
         Args:
-            fixer_dir: directory in which to find fixer modules.
-            options: an optparse.Values instance.
-        """
-        self.fixer_dir = fixer_dir
-        self.options = options
+            fixer_names: a list of fixers to import
+            options: an dict with configuration.
+            explicit: a list of fixers to run even if they are explicit.
+        """
+        self.fixers = fixer_names
+        self.explicit = explicit
+        self.options = self._default_options.copy()
+        if options is not None:
+            self.options.update(options)
         self.errors = []
         self.logger = logging.getLogger("RefactoringTool")
         self.fixer_log = []
-        if self.options.print_function:
+        self.wrote = False
+        if self.options["print_function"]:
             del pygram.python_grammar.keywords["print"]
         self.driver = driver.Driver(pygram.python_grammar,
                                     convert=pytree.convert,
@@ -172,30 +131,24 @@
           want a pre-order AST traversal, and post_order is the list that want
           post-order traversal.
         """
-        if os.path.isabs(self.fixer_dir):
-            fixer_pkg = os.path.relpath(self.fixer_dir, os.path.join(os.path.dirname(__file__), '..'))
-        else:
-            fixer_pkg = self.fixer_dir
-        fixer_pkg = fixer_pkg.replace(os.path.sep, ".")
-        if os.path.altsep:
-            fixer_pkg = self.fixer_dir.replace(os.path.altsep, ".")
         pre_order_fixers = []
         post_order_fixers = []
-        fix_names = self.options.fix
-        if not fix_names or "all" in fix_names:
-            fix_names = get_all_fix_names(self.fixer_dir)
-        for fix_name in fix_names:
+        for fix_mod_path in self.fixers:
             try:
-                mod = __import__(fixer_pkg + ".fix_" + fix_name, {}, {}, ["*"])
+                mod = __import__(fix_mod_path, {}, {}, ["*"])
             except ImportError:
-                self.log_error("Can't find transformation %s", fix_name)
+                self.log_error("Can't load transformation module %s",
+                               fix_mod_path)
                 continue
+            fix_name = fix_mod_path.rsplit(".", 1)[-1]
+            if fix_name.startswith("fix_"):
+                fix_name = fix_name[4:]
             parts = fix_name.split("_")
             class_name = "Fix" + "".join([p.title() for p in parts])
             try:
                 fix_class = getattr(mod, class_name)
             except AttributeError:
-                self.log_error("Can't find fixes.fix_%s.%s",
+                self.log_error("Can't find %s.%s",
                                fix_name, class_name)
                 continue
             try:
@@ -204,12 +157,12 @@
                 self.log_error("Can't instantiate fixes.fix_%s.%s()",
                                fix_name, class_name, exc_info=True)
                 continue
-            if fixer.explicit and fix_name not in self.options.fix:
+            if fixer.explicit and self.explicit is not True and \
+                    fix_mod_path not in self.explicit:
                 self.log_message("Skipping implicit fixer: %s", fix_name)
                 continue
 
-            if self.options.verbose:
-                self.log_message("Adding transformation: %s", fix_name)
+            self.log_debug("Adding transformation: %s", fix_name)
             if fixer.order == "pre":
                 pre_order_fixers.append(fixer)
             elif fixer.order == "post":
@@ -217,8 +170,9 @@
             else:
                 raise ValueError("Illegal fixer order: %r" % fixer.order)
 
-        pre_order_fixers.sort(key=lambda x: x.run_order)
-        post_order_fixers.sort(key=lambda x: x.run_order)
+        key_func = operator.attrgetter("run_order")
+        pre_order_fixers.sort(key=key_func)
+        post_order_fixers.sort(key=key_func)
         return (pre_order_fixers, post_order_fixers)
 
     def log_error(self, msg, *args, **kwds):
@@ -232,36 +186,38 @@
             msg = msg % args
         self.logger.info(msg)
 
-    def refactor_args(self, args):
-        """Refactors files and directories from an argument list."""
-        for arg in args:
-            if arg == "-":
-                self.refactor_stdin()
-            elif os.path.isdir(arg):
-                self.refactor_dir(arg)
+    def log_debug(self, msg, *args):
+        if args:
+            msg = msg % args
+        self.logger.debug(msg)
+
+    def refactor(self, items, write=False, doctests_only=False):
+        """Refactor a list of files and directories."""
+        for dir_or_file in items:
+            if os.path.isdir(dir_or_file):
+                self.refactor_dir(dir_or_file, write)
             else:
-                self.refactor_file(arg)
+                self.refactor_file(dir_or_file, write)
 
-    def refactor_dir(self, arg):
+    def refactor_dir(self, dir_name, write=False, doctests_only=False):
         """Descends down a directory and refactor every Python file found.
 
         Python files are assumed to have a .py extension.
 
         Files and subdirectories starting with '.' are skipped.
         """
-        for dirpath, dirnames, filenames in os.walk(arg):
-            if self.options.verbose:
-                self.log_message("Descending into %s", dirpath)
+        for dirpath, dirnames, filenames in os.walk(dir_name):
+            self.log_debug("Descending into %s", dirpath)
             dirnames.sort()
             filenames.sort()
             for name in filenames:
                 if not name.startswith(".") and name.endswith("py"):
                     fullname = os.path.join(dirpath, name)
-                    self.refactor_file(fullname)
+                    self.refactor_file(fullname, write, doctests_only)
             # Modify dirnames in-place to remove subdirs with leading dots
             dirnames[:] = [dn for dn in dirnames if not dn.startswith(".")]
 
-    def refactor_file(self, filename):
+    def refactor_file(self, filename, write=False, doctests_only=False):
         """Refactors a file."""
         try:
             f = open(filename)
@@ -272,21 +228,20 @@
             input = f.read() + "\n" # Silence certain parse errors
         finally:
             f.close()
-        if self.options.doctests_only:
-            if self.options.verbose:
-                self.log_message("Refactoring doctests in %s", filename)
+        if doctests_only:
+            self.log_debug("Refactoring doctests in %s", filename)
             output = self.refactor_docstring(input, filename)
             if output != input:
-                self.write_file(output, filename, input)
-            elif self.options.verbose:
-                self.log_message("No doctest changes in %s", filename)
+                self.processed_file(output, filename, input, write=write)
+            else:
+                self.log_debug("No doctest changes in %s", filename)
         else:
             tree = self.refactor_string(input, filename)
             if tree and tree.was_changed:
                 # The [:-1] is to take off the \n we added earlier
-                self.write_file(str(tree)[:-1], filename)
-            elif self.options.verbose:
-                self.log_message("No changes in %s", filename)
+                self.processed_file(str(tree)[:-1], filename, write=write)
+            else:
+                self.log_debug("No changes in %s", filename)
 
     def refactor_string(self, data, name):
         """Refactor a given input string.
@@ -305,30 +260,25 @@
             self.log_error("Can't parse %s: %s: %s",
                            name, err.__class__.__name__, err)
             return
-        if self.options.verbose:
-            self.log_message("Refactoring %s", name)
+        self.log_debug("Refactoring %s", name)
         self.refactor_tree(tree, name)
         return tree
 
-    def refactor_stdin(self):
-        if self.options.write:
-            self.log_error("Can't write changes back to stdin")
-            return
+    def refactor_stdin(self, doctests_only=False):
         input = sys.stdin.read()
-        if self.options.doctests_only:
-            if self.options.verbose:
-                self.log_message("Refactoring doctests in stdin")
+        if doctests_only:
+            self.log_debug("Refactoring doctests in stdin")
             output = self.refactor_docstring(input, "<stdin>")
             if output != input:
-                self.write_file(output, "<stdin>", input)
-            elif self.options.verbose:
-                self.log_message("No doctest changes in stdin")
+                self.processed_file(output, "<stdin>", input)
+            else:
+                self.log_debug("No doctest changes in stdin")
         else:
             tree = self.refactor_string(input, "<stdin>")
             if tree and tree.was_changed:
-                self.write_file(str(tree), "<stdin>", input)
-            elif self.options.verbose:
-                self.log_message("No changes in stdin")
+                self.processed_file(str(tree), "<stdin>", input)
+            else:
+                self.log_debug("No changes in stdin")
 
     def refactor_tree(self, tree, name):
         """Refactors a parse tree (modifying the tree in place).
@@ -380,14 +330,9 @@
                         node.replace(new)
                         node = new
 
-    def write_file(self, new_text, filename, old_text=None):
-        """Writes a string to a file.
-
-        If there are no changes, this is a no-op.
-
-        Otherwise, it first shows a unified diff between the old text
-        and the new text, and then rewrites the file; the latter is
-        only done if the write option is set.
+    def processed_file(self, new_text, filename, old_text=None, write=False):
+        """
+        Called when a file has been refactored, and there are changes.
         """
         self.files.append(filename)
         if old_text is None:
@@ -401,14 +346,22 @@
             finally:
                 f.close()
         if old_text == new_text:
-            if self.options.verbose:
-                self.log_message("No changes to %s", filename)
+            self.log_debug("No changes to %s", filename)
             return
         diff_texts(old_text, new_text, filename)
-        if not self.options.write:
-            if self.options.verbose:
-                self.log_message("Not writing changes to %s", filename)
+        if not write:
+            self.log_debug("Not writing changes to %s", filename)
             return
+        if write:
+            self.write_file(new_text, filename, old_text)
+
+    def write_file(self, new_text, filename, old_text=None):
+        """Writes a string to a file.
+
+        It first shows a unified diff between the old text and the new text, and
+        then rewrites the file; the latter is only done if the write option is
+        set.
+        """
         backup = filename + ".bak"
         if os.path.lexists(backup):
             try:
@@ -431,8 +384,8 @@
                 self.log_error("Can't write %s: %s", filename, err)
         finally:
             f.close()
-        if self.options.verbose:
-            self.log_message("Wrote changes to %s", filename)
+        self.log_debug("Wrote changes to %s", filename)
+        self.wrote = True
 
     PS1 = ">>> "
     PS2 = "... "
@@ -491,9 +444,9 @@
         try:
             tree = self.parse_block(block, lineno, indent)
         except Exception, err:
-            if self.options.verbose:
+            if self.log.isEnabledFor(logging.DEBUG):
                 for line in block:
-                    self.log_message("Source: %s", line.rstrip("\n"))
+                    self.log_debug("Source: %s", line.rstrip("\n"))
             self.log_error("Can't parse docstring in %s line %s: %s: %s",
                            filename, lineno, err.__class__.__name__, err)
             return block
@@ -510,7 +463,7 @@
         return block
 
     def summarize(self):
-        if self.options.write:
+        if self.wrote:
             were = "were"
         else:
             were = "need to be"
@@ -582,7 +535,3 @@
                                      "(original)", "(refactored)",
                                      lineterm=""):
         print line
-
-
-if __name__ == "__main__":
-    sys.exit(main())

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/support.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/support.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/support.py	Sun Sep  7 18:03:22 2008
@@ -13,6 +13,7 @@
 
 # Local imports
 from .. import pytree
+from .. import refactor
 from ..pgen2 import driver
 
 test_dir = os.path.dirname(__file__)
@@ -38,6 +39,21 @@
 def reformat(string):
     return dedent(string) + "\n\n"
 
+def get_refactorer(fixers=None, options=None):
+    """
+    A convenience function for creating a RefactoringTool for tests.
+
+    fixers is a list of fixers for the RefactoringTool to use. By default
+    "lib2to3.fixes.*" is used. options is an optional dictionary of options to
+    be passed to the RefactoringTool.
+    """
+    if fixers is not None:
+        fixers = ["lib2to3.fixes.fix_" + fix for fix in fixers]
+    else:
+        fixers = refactor.get_fixers_from_package("lib2to3.fixes")
+    options = options or {}
+    return refactor.RefactoringTool(fixers, options, explicit=True)
+
 def all_project_files():
     for dirpath, dirnames, filenames in os.walk(proj_dir):
         for filename in filenames:

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py	Sun Sep  7 18:03:22 2008
@@ -19,17 +19,10 @@
 from .. import pytree
 from .. import refactor
 
-class Options:
-    def __init__(self, **kwargs):
-        for k, v in kwargs.items():
-            setattr(self, k, v)
-        self.verbose = False
-
 class Test_all(support.TestCase):
     def setUp(self):
-        options = Options(fix=["all", "idioms", "ws_comma", "buffer"],
-                          print_function=False)
-        self.refactor = refactor.RefactoringTool("lib2to3/fixes", options)
+        options = {"print_function" : False}
+        self.refactor = support.get_refactorer(options=options)
 
     def test_all_project_files(self):
         for filepath in support.all_project_files():

Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py	Sun Sep  7 18:03:22 2008
@@ -21,19 +21,12 @@
 from .. import fixer_util
 
 
-class Options:
-    def __init__(self, **kwargs):
-        for k, v in kwargs.items():
-            setattr(self, k, v)
-
-        self.verbose = False
-
 class FixerTestCase(support.TestCase):
     def setUp(self, fix_list=None):
-        if not fix_list:
+        if fix_list is None:
             fix_list = [self.fixer]
-        options = Options(fix=fix_list, print_function=False)
-        self.refactor = refactor.RefactoringTool("lib2to3/fixes", options)
+        options = {"print_function" : False}
+        self.refactor = support.get_refactorer(fix_list, options)
         self.fixer_log = []
         self.filename = "<string>"
 
@@ -70,10 +63,10 @@
             self.failUnlessEqual(self.fixer_log, [])
 
     def assert_runs_after(self, *names):
-        fix = [self.fixer]
-        fix.extend(names)
-        options = Options(fix=fix, print_function=False)
-        r = refactor.RefactoringTool("lib2to3/fixes", options)
+        fixes = [self.fixer]
+        fixes.extend(names)
+        options = {"print_function" : False}
+        r = support.get_refactorer(fixes, options)
         (pre, post) = r.get_fixers()
         n = "fix_" + self.fixer
         if post and post[-1].__class__.__module__.endswith(n):
@@ -1340,6 +1333,21 @@
         a = """x = input(foo(a) + 6)"""
         self.check(b, a)
 
+    def test_5(self):
+        b = """x = raw_input(invite).split()"""
+        a = """x = input(invite).split()"""
+        self.check(b, a)
+
+    def test_6(self):
+        b = """x = raw_input(invite) . split ()"""
+        a = """x = input(invite) . split ()"""
+        self.check(b, a)
+
+    def test_8(self):
+        b = "x = int(raw_input())"
+        a = "x = int(input())"
+        self.check(b, a)
+
 class Test_funcattrs(FixerTestCase):
     fixer = "funcattrs"
 
@@ -3330,6 +3338,98 @@
         """
         self.check_both(b, a)
 
+class Test_sys_exc(FixerTestCase):
+    fixer = "sys_exc"
+
+    def test_0(self):
+        b = "sys.exc_type"
+        a = "sys.exc_info()[0]"
+        self.check(b, a)
+
+    def test_1(self):
+        b = "sys.exc_value"
+        a = "sys.exc_info()[1]"
+        self.check(b, a)
+
+    def test_2(self):
+        b = "sys.exc_traceback"
+        a = "sys.exc_info()[2]"
+        self.check(b, a)
+
+    def test_3(self):
+        b = "sys.exc_type # Foo"
+        a = "sys.exc_info()[0] # Foo"
+        self.check(b, a)
+
+    def test_4(self):
+        b = "sys.  exc_type"
+        a = "sys.  exc_info()[0]"
+        self.check(b, a)
+
+    def test_5(self):
+        b = "sys  .exc_type"
+        a = "sys  .exc_info()[0]"
+        self.check(b, a)
+
+
+class Test_paren(FixerTestCase):
+    fixer = "paren"
+
+    def test_0(self):
+        b = """[i for i in 1, 2 ]"""
+        a = """[i for i in (1, 2) ]"""
+        self.check(b, a)
+
+    def test_1(self):
+        b = """[i for i in 1, 2, ]"""
+        a = """[i for i in (1, 2,) ]"""
+        self.check(b, a)
+
+    def test_2(self):
+        b = """[i for i  in     1, 2 ]"""
+        a = """[i for i  in     (1, 2) ]"""
+        self.check(b, a)
+
+    def test_3(self):
+        b = """[i for i in 1, 2 if i]"""
+        a = """[i for i in (1, 2) if i]"""
+        self.check(b, a)
+
+    def test_4(self):
+        b = """[i for i in 1,    2    ]"""
+        a = """[i for i in (1,    2)    ]"""
+        self.check(b, a)
+
+    def test_5(self):
+        b = """(i for i in 1, 2)"""
+        a = """(i for i in (1, 2))"""
+        self.check(b, a)
+
+    def test_6(self):
+        b = """(i for i in 1   ,2   if i)"""
+        a = """(i for i in (1   ,2)   if i)"""
+        self.check(b, a)
+
+    def test_unchanged_0(self):
+        s = """[i for i in (1, 2)]"""
+        self.unchanged(s)
+
+    def test_unchanged_1(self):
+        s = """[i for i in foo()]"""
+        self.unchanged(s)
+
+    def test_unchanged_2(self):
+        s = """[i for i in (1, 2) if nothing]"""
+        self.unchanged(s)
+
+    def test_unchanged_3(self):
+        s = """(i for i in (1, 2))"""
+        self.unchanged(s)
+
+    def test_unchanged_4(self):
+        s = """[i for i in m]"""
+        self.unchanged(s)
+
 
 if __name__ == "__main__":
     import __main__

Modified: python/branches/tlee-ast-optimize/Lib/logging/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/logging/__init__.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/logging/__init__.py	Sun Sep  7 18:03:22 2008
@@ -719,6 +719,7 @@
     to a stream. Note that this class does not close the stream, as
     sys.stdout or sys.stderr may be used.
     """
+
     def __init__(self, strm=None):
         """
         Initialize the handler.
@@ -743,10 +744,11 @@
         Emit a record.
 
         If a formatter is specified, it is used to format the record.
-        The record is then written to the stream with a trailing newline
-        [N.B. this may be removed depending on feedback]. If exception
-        information is present, it is formatted using
-        traceback.print_exception and appended to the stream.
+        The record is then written to the stream with a trailing newline.  If
+        exception information is present, it is formatted using
+        traceback.print_exception and appended to the stream.  If the stream
+        has an 'encoding' attribute, it is used to encode the message before
+        output to the stream.
         """
         try:
             msg = self.format(record)
@@ -755,7 +757,10 @@
                 self.stream.write(fs % msg)
             else:
                 try:
-                    self.stream.write(fs % msg)
+                    if getattr(self.stream, 'encoding', None) is not None:
+                        self.stream.write(fs % msg.encode(self.stream.encoding))
+                    else:
+                        self.stream.write(fs % msg)
                 except UnicodeError:
                     self.stream.write(fs % msg.encode("UTF-8"))
             self.flush()

Modified: python/branches/tlee-ast-optimize/Lib/logging/config.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/logging/config.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/logging/config.py	Sun Sep  7 18:03:22 2008
@@ -22,7 +22,7 @@
 Should work under Python versions >= 1.5.2, except that source line
 information is not available unless 'sys._getframe()' is.
 
-Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2008 Vinay Sajip. All Rights Reserved.
 
 To use, simply 'import logging' and log away!
 """
@@ -101,6 +101,8 @@
             found = getattr(found, n)
     return found
 
+def _strip_spaces(alist):
+    return map(lambda x: string.strip(x), alist)
 
 def _create_formatters(cp):
     """Create and return formatters"""
@@ -108,9 +110,10 @@
     if not len(flist):
         return {}
     flist = string.split(flist, ",")
+    flist = _strip_spaces(flist)
     formatters = {}
     for form in flist:
-        sectname = "formatter_%s" % string.strip(form)
+        sectname = "formatter_%s" % form
         opts = cp.options(sectname)
         if "format" in opts:
             fs = cp.get(sectname, "format", 1)
@@ -136,10 +139,11 @@
     if not len(hlist):
         return {}
     hlist = string.split(hlist, ",")
+    hlist = _strip_spaces(hlist)
     handlers = {}
     fixups = [] #for inter-handler references
     for hand in hlist:
-        sectname = "handler_%s" % string.strip(hand)
+        sectname = "handler_%s" % hand
         klass = cp.get(sectname, "class")
         opts = cp.options(sectname)
         if "formatter" in opts:
@@ -192,8 +196,9 @@
     hlist = cp.get(sectname, "handlers")
     if len(hlist):
         hlist = string.split(hlist, ",")
+        hlist = _strip_spaces(hlist)
         for hand in hlist:
-            log.addHandler(handlers[string.strip(hand)])
+            log.addHandler(handlers[hand])
 
     #and now the others...
     #we don't want to lose the existing loggers,
@@ -243,8 +248,9 @@
         hlist = cp.get(sectname, "handlers")
         if len(hlist):
             hlist = string.split(hlist, ",")
+            hlist = _strip_spaces(hlist)
             for hand in hlist:
-                logger.addHandler(handlers[string.strip(hand)])
+                logger.addHandler(handlers[hand])
 
     #Disable any old loggers. There's no point deleting
     #them as other threads may continue to hold references

Modified: python/branches/tlee-ast-optimize/Lib/mimetools.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/mimetools.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/mimetools.py	Sun Sep  7 18:03:22 2008
@@ -2,11 +2,12 @@
 
 
 import os
+import sys
 import tempfile
-from test.test_support import catch_warning
-from warnings import filterwarnings
-with catch_warning(record=False):
-    filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
+from warnings import filterwarnings, catch_warnings
+with catch_warnings(record=False):
+    if sys.py3kwarning:
+        filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
     import rfc822
 
 from warnings import warnpy3k

Modified: python/branches/tlee-ast-optimize/Lib/msilib/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/msilib/__init__.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/msilib/__init__.py	Sun Sep  7 18:03:22 2008
@@ -2,7 +2,7 @@
 # Copyright (C) 2005 Martin v. Löwis
 # Licensed to PSF under a Contributor Agreement.
 from _msi import *
-import sets, os, string, re
+import os, string, re
 
 Win64=0
 
@@ -184,7 +184,7 @@
     def __init__(self, name):
         self.name = name
         self.files = []
-        self.filenames = sets.Set()
+        self.filenames = set()
         self.index = 0
 
     def gen_id(self, file):
@@ -215,7 +215,7 @@
         os.unlink(filename)
         db.Commit()
 
-_directories = sets.Set()
+_directories = set()
 class Directory:
     def __init__(self, db, cab, basedir, physical, _logical, default, componentflags=None):
         """Create a new directory in the Directory table. There is a current component
@@ -239,8 +239,8 @@
         self.physical = physical
         self.logical = logical
         self.component = None
-        self.short_names = sets.Set()
-        self.ids = sets.Set()
+        self.short_names = set()
+        self.ids = set()
         self.keyfiles = {}
         self.componentflags = componentflags
         if basedir:

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py	Sun Sep  7 18:03:22 2008
@@ -371,7 +371,13 @@
 
             self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid)
             if ident not in self.id_to_refcount:
-                self.id_to_refcount[ident] = None
+                self.id_to_refcount[ident] = 0
+            # increment the reference count immediately, to avoid
+            # this object being garbage collected before a Proxy
+            # object for it can be created.  The caller of create()
+            # is responsible for doing a decref once the Proxy object
+            # has been created.
+            self.incref(c, ident)
             return ident, tuple(exposed)
         finally:
             self.mutex.release()
@@ -393,11 +399,7 @@
     def incref(self, c, ident):
         self.mutex.acquire()
         try:
-            try:
-                self.id_to_refcount[ident] += 1
-            except TypeError:
-                assert self.id_to_refcount[ident] is None
-                self.id_to_refcount[ident] = 1
+            self.id_to_refcount[ident] += 1
         finally:
             self.mutex.release()
 
@@ -634,6 +636,8 @@
                     token, self._serializer, manager=self,
                     authkey=self._authkey, exposed=exp
                     )
+                conn = self._Client(token.address, authkey=self._authkey)
+                dispatch(conn, None, 'decref', (token.id,))
                 return proxy
             temp.__name__ = typeid
             setattr(cls, typeid, temp)
@@ -726,10 +730,13 @@
         elif kind == '#PROXY':
             exposed, token = result
             proxytype = self._manager._registry[token.typeid][-1]
-            return proxytype(
+            proxy = proxytype(
                 token, self._serializer, manager=self._manager,
                 authkey=self._authkey, exposed=exposed
                 )
+            conn = self._Client(token.address, authkey=self._authkey)
+            dispatch(conn, None, 'decref', (token.id,))
+            return proxy
         raise convert_to_error(kind, result)
 
     def _getvalue(self):

Modified: python/branches/tlee-ast-optimize/Lib/os.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/os.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/os.py	Sun Sep  7 18:03:22 2008
@@ -753,8 +753,10 @@
             _urandomfd = open("/dev/urandom", O_RDONLY)
         except (OSError, IOError):
             raise NotImplementedError("/dev/urandom (or equivalent) not found")
-        bytes = ""
-        while len(bytes) < n:
-            bytes += read(_urandomfd, n - len(bytes))
-        close(_urandomfd)
-        return bytes
+        try:
+            bs = b""
+            while n - len(bs) >= 1:
+                bs += read(_urandomfd, n - len(bs))
+        finally:
+            close(_urandomfd)
+        return bs

Modified: python/branches/tlee-ast-optimize/Lib/platform.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/platform.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/platform.py	Sun Sep  7 18:03:22 2008
@@ -933,7 +933,7 @@
     filepath = _abspath(filepath)
     while os.path.islink(filepath):
         filepath = os.path.normpath(
-            os.path.join(filepath,os.readlink(filepath)))
+            os.path.join(os.path.dirname(filepath),os.readlink(filepath)))
     return filepath
 
 def _syscmd_uname(option,default=''):
@@ -964,9 +964,12 @@
         case the command should fail.
 
     """
+    if sys.platform in ('dos','win32','win16','os2'):
+        # XXX Others too ?
+        return default
     target = _follow_symlinks(target)
     try:
-        f = os.popen('file %s 2> /dev/null' % target)
+        f = os.popen('file "%s" 2> /dev/null' % target)
     except (AttributeError,os.error):
         return default
     output = string.strip(f.read())

Modified: python/branches/tlee-ast-optimize/Lib/pydoc.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/pydoc.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/pydoc.py	Sun Sep  7 18:03:22 2008
@@ -1552,11 +1552,11 @@
         'del': ('del', 'BASICMETHODS'),
         'elif': 'if',
         'else': ('else', 'while for'),
-        'except': 'except',
+        'except': 'try',
         'exec': ('exec', ''),
-        'finally': 'finally',
+        'finally': 'try',
         'for': ('for', 'break continue while'),
-        'from': 'from',
+        'from': 'import',
         'global': ('global', 'NAMESPACES'),
         'if': ('if', 'TRUTHVALUE'),
         'import': ('import', 'MODULES'),

Modified: python/branches/tlee-ast-optimize/Lib/test/string_tests.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/string_tests.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/string_tests.py	Sun Sep  7 18:03:22 2008
@@ -1117,6 +1117,9 @@
         self.checkraises(ValueError, S, 'partition', '')
         self.checkraises(TypeError, S, 'partition', None)
 
+        # mixed use of str and unicode
+        self.assertEqual('a/b/c'.partition(u'/'), ('a', '/', 'b/c'))
+
     def test_rpartition(self):
 
         self.checkequal(('this is the rparti', 'ti', 'on method'),
@@ -1132,6 +1135,8 @@
         self.checkraises(ValueError, S, 'rpartition', '')
         self.checkraises(TypeError, S, 'rpartition', None)
 
+        # mixed use of str and unicode
+        self.assertEqual('a/b/c'.rpartition(u'/'), ('a/b', '/', 'c'))
 
 class MixinStrStringUserStringTest:
     # Additional tests for 8bit strings, i.e. str, UserString and

Modified: python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py	Sun Sep  7 18:03:22 2008
@@ -389,6 +389,7 @@
         def test_recv(self):
             fd = os.open(TESTFN, os.O_RDONLY)
             w = asyncore.file_wrapper(fd)
+            os.close(fd)
 
             self.assertNotEqual(w.fd, fd)
             self.assertNotEqual(w.fileno(), fd)
@@ -402,6 +403,7 @@
             d2 = "I want to buy some cheese."
             fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND)
             w = asyncore.file_wrapper(fd)
+            os.close(fd)
 
             w.write(d1)
             w.send(d2)

Modified: python/branches/tlee-ast-optimize/Lib/test/test_cgi.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_cgi.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_cgi.py	Sun Sep  7 18:03:22 2008
@@ -55,23 +55,6 @@
     except StandardError, err:
         return ComparableException(err)
 
-# A list of test cases.  Each test case is a a two-tuple that contains
-# a string with the query and a dictionary with the expected result.
-
-parse_qsl_test_cases = [
-    ("", []),
-    ("&", []),
-    ("&&", []),
-    ("=", [('', '')]),
-    ("=a", [('', 'a')]),
-    ("a", [('a', '')]),
-    ("a=", [('a', '')]),
-    ("a=", [('a', '')]),
-    ("&a=b", [('a', 'b')]),
-    ("a=a+b&b=b+c", [('a', 'a b'), ('b', 'b c')]),
-    ("a=1&a=2", [('a', '1'), ('a', '2')]),
-]
-
 parse_strict_test_cases = [
     ("", ValueError("bad query field: ''")),
     ("&", ValueError("bad query field: ''")),
@@ -143,11 +126,6 @@
 
 class CgiTests(unittest.TestCase):
 
-    def test_qsl(self):
-        for orig, expect in parse_qsl_test_cases:
-            result = cgi.parse_qsl(orig, keep_blank_values=True)
-            self.assertEqual(result, expect, "Error parsing %s" % repr(orig))
-
     def test_strict(self):
         for orig, expect in parse_strict_test_cases:
             # Test basic parsing

Modified: python/branches/tlee-ast-optimize/Lib/test/test_fileio.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_fileio.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_fileio.py	Sun Sep  7 18:03:22 2008
@@ -101,6 +101,17 @@
             # should raise on closed file
             self.assertRaises(ValueError, method)
 
+    def testOpendir(self):
+        # Issue 3703: opening a directory should fill the errno
+        # Windows always returns "[Errno 13]: Permission denied
+        # Unix calls dircheck() and returns "[Errno 21]: Is a directory"
+        try:
+            _fileio._FileIO('.', 'r')
+        except IOError as e:
+            self.assertNotEqual(e.errno, 0)
+        else:
+            self.fail("Should have raised IOError")
+
 
 class OtherFileTests(unittest.TestCase):
 

Modified: python/branches/tlee-ast-optimize/Lib/test/test_float.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_float.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_float.py	Sun Sep  7 18:03:22 2008
@@ -5,6 +5,7 @@
 import math
 from math import isinf, isnan, copysign, ldexp
 import operator
+import random, fractions
 
 INF = float("inf")
 NAN = float("nan")
@@ -23,7 +24,7 @@
         self.assertRaises(ValueError, float, "+-3.14")
         self.assertRaises(ValueError, float, "-+3.14")
         self.assertRaises(ValueError, float, "--3.14")
-        if have_unicode:
+        if test_support.have_unicode:
             self.assertEqual(float(unicode("  3.14  ")), 3.14)
             self.assertEqual(float(unicode("  \u0663.\u0661\u0664  ",'raw-unicode-escape')), 3.14)
             # Implementation limitation in PyFloat_FromString()
@@ -54,7 +55,7 @@
         self.assertRaises(ValueError, float, "  -0x3.p-1  ")
         self.assertRaises(ValueError, float, "  +0x3.p-1  ")
         self.assertEqual(float("  25.e-1  "), 2.5)
-        self.assertEqual(fcmp(float("  .25e-1  "), .025), 0)
+        self.assertEqual(test_support.fcmp(float("  .25e-1  "), .025), 0)
 
     def test_floatconversion(self):
         # Make sure that calls to __float__() work properly
@@ -736,6 +737,7 @@
 
 def test_main():
     test_support.run_unittest(
+        GeneralFloatCases,
         FormatFunctionsTestCase,
         UnknownFormatTestCase,
         IEEEFormatTestCase,

Modified: python/branches/tlee-ast-optimize/Lib/test/test_logging.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_logging.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_logging.py	Sun Sep  7 18:03:22 2008
@@ -587,6 +587,48 @@
     # config5 specifies a custom handler class to be loaded
     config5 = config1.replace('class=StreamHandler', 'class=logging.StreamHandler')
 
+    # config6 uses ', ' delimiters in the handlers and formatters sections
+    config6 = """
+    [loggers]
+    keys=root,parser
+
+    [handlers]
+    keys=hand1, hand2
+
+    [formatters]
+    keys=form1, form2
+
+    [logger_root]
+    level=WARNING
+    handlers=
+
+    [logger_parser]
+    level=DEBUG
+    handlers=hand1
+    propagate=1
+    qualname=compiler.parser
+
+    [handler_hand1]
+    class=StreamHandler
+    level=NOTSET
+    formatter=form1
+    args=(sys.stdout,)
+
+    [handler_hand2]
+    class=FileHandler
+    level=NOTSET
+    formatter=form1
+    args=('test.blah', 'a')
+
+    [formatter_form1]
+    format=%(levelname)s ++ %(message)s
+    datefmt=
+
+    [formatter_form2]
+    format=%(message)s
+    datefmt=
+    """
+
     def apply_config(self, conf):
         try:
             fn = tempfile.mktemp(".ini")
@@ -653,6 +695,9 @@
     def test_config5_ok(self):
         self.test_config1_ok(config=self.config5)
 
+    def test_config6_ok(self):
+        self.test_config1_ok(config=self.config6)
+
 class LogRecordStreamHandler(StreamRequestHandler):
 
     """Handler for a streaming logging request. It saves the log message in the
@@ -814,6 +859,31 @@
             ('foo', 'DEBUG', '3'),
         ])
 
+class EncodingTest(BaseTest):
+    def test_encoding_plain_file(self):
+        # In Python 2.x, a plain file object is treated as having no encoding.
+        log = logging.getLogger("test")
+        fn = tempfile.mktemp(".log")
+        # the non-ascii data we write to the log.
+        data = "foo\x80"
+        try:
+            handler = logging.FileHandler(fn)
+            log.addHandler(handler)
+            try:
+                # write non-ascii data to the log.
+                log.warning(data)
+            finally:
+                log.removeHandler(handler)
+                handler.close()
+            # check we wrote exactly those bytes, ignoring trailing \n etc
+            f = open(fn)
+            try:
+                self.failUnlessEqual(f.read().rstrip(), data)
+            finally:
+                f.close()
+        finally:
+            if os.path.isfile(fn):
+                os.remove(fn)
 
 # Set the locale to the platform-dependent default.  I have no idea
 # why the test does this, but in any case we save the current locale
@@ -822,7 +892,8 @@
 def test_main():
     run_unittest(BuiltinLevelsTest, BasicFilterTest,
                     CustomLevelsAndFiltersTest, MemoryHandlerTest,
-                    ConfigFileTest, SocketHandlerTest, MemoryTest)
+                    ConfigFileTest, SocketHandlerTest, MemoryTest,
+                    EncodingTest)
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/tlee-ast-optimize/Lib/test/test_os.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_os.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_os.py	Sun Sep  7 18:03:22 2008
@@ -497,6 +497,10 @@
             self.assertEqual(len(os.urandom(10)), 10)
             self.assertEqual(len(os.urandom(100)), 100)
             self.assertEqual(len(os.urandom(1000)), 1000)
+            # see http://bugs.python.org/issue3708
+            self.assertEqual(len(os.urandom(0.9)), 0)
+            self.assertEqual(len(os.urandom(1.1)), 1)
+            self.assertEqual(len(os.urandom(2.0)), 2)
         except NotImplementedError:
             pass
 

Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py	Sun Sep  7 18:03:22 2008
@@ -220,28 +220,28 @@
             # With object as the base class
             class WarnOnlyCmp(object):
                 def __cmp__(self, other): pass
-            self.assertEqual(len(w.warnings), 1)
+            self.assertEqual(len(w), 1)
             self.assertWarning(None, w,
                  "Overriding __cmp__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class WarnOnlyEq(object):
                 def __eq__(self, other): pass
-            self.assertEqual(len(w.warnings), 1)
+            self.assertEqual(len(w), 1)
             self.assertWarning(None, w,
                  "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class WarnCmpAndEq(object):
                 def __cmp__(self, other): pass
                 def __eq__(self, other): pass
-            self.assertEqual(len(w.warnings), 2)
-            self.assertWarning(None, w.warnings[-2],
+            self.assertEqual(len(w), 2)
+            self.assertWarning(None, w[-2],
                  "Overriding __cmp__ blocks inheritance of __hash__ in 3.x")
             self.assertWarning(None, w,
                  "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class NoWarningOnlyHash(object):
                 def __hash__(self): pass
-            self.assertEqual(len(w.warnings), 0)
+            self.assertEqual(len(w), 0)
             # With an intermediate class in the heirarchy
             class DefinesAllThree(object):
                 def __cmp__(self, other): pass
@@ -249,63 +249,28 @@
                 def __hash__(self): pass
             class WarnOnlyCmp(DefinesAllThree):
                 def __cmp__(self, other): pass
-            self.assertEqual(len(w.warnings), 1)
+            self.assertEqual(len(w), 1)
             self.assertWarning(None, w,
                  "Overriding __cmp__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class WarnOnlyEq(DefinesAllThree):
                 def __eq__(self, other): pass
-            self.assertEqual(len(w.warnings), 1)
+            self.assertEqual(len(w), 1)
             self.assertWarning(None, w,
                  "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class WarnCmpAndEq(DefinesAllThree):
                 def __cmp__(self, other): pass
                 def __eq__(self, other): pass
-            self.assertEqual(len(w.warnings), 2)
-            self.assertWarning(None, w.warnings[-2],
+            self.assertEqual(len(w), 2)
+            self.assertWarning(None, w[-2],
                  "Overriding __cmp__ blocks inheritance of __hash__ in 3.x")
             self.assertWarning(None, w,
                  "Overriding __eq__ blocks inheritance of __hash__ in 3.x")
             w.reset()
             class NoWarningOnlyHash(DefinesAllThree):
                 def __hash__(self): pass
-            self.assertEqual(len(w.warnings), 0)
-
-    def test_pep8ified_threading(self):
-        import threading
-
-        t = threading.Thread()
-        with catch_warning() as w:
-            msg = "isDaemon() is deprecated in favor of the " \
-                  "Thread.daemon property"
-            self.assertWarning(t.isDaemon(), w, msg)
-            w.reset()
-            msg = "setDaemon() is deprecated in favor of the " \
-                  "Thread.daemon property"
-            self.assertWarning(t.setDaemon(True), w, msg)
-            w.reset()
-            msg = "getName() is deprecated in favor of the " \
-                  "Thread.name property"
-            self.assertWarning(t.getName(), w, msg)
-            w.reset()
-            msg = "setName() is deprecated in favor of the " \
-                  "Thread.name property"
-            self.assertWarning(t.setName("name"), w, msg)
-            w.reset()
-            msg = "isAlive() is deprecated in favor of is_alive()"
-            self.assertWarning(t.isAlive(), w, msg)
-            w.reset()
-            e = threading.Event()
-            msg = "isSet() is deprecated in favor of is_set()"
-            self.assertWarning(e.isSet(), w, msg)
-            w.reset()
-            msg = "currentThread() is deprecated in favor of current_thread()"
-            self.assertWarning(threading.currentThread(), w, msg)
-            w.reset()
-            msg = "activeCount() is deprecated in favor of active_count()"
-            self.assertWarning(threading.activeCount(), w, msg)
-
+            self.assertEqual(len(w), 0)
 
 
 class TestStdlibRemovals(unittest.TestCase):
@@ -340,7 +305,7 @@
                            'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'),
                           }
     optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop',
-                        'sv', 'cPickle')
+                        'sv', 'cPickle', 'bsddb', 'dbhash')
 
     def check_removal(self, module_name, optional=False):
         """Make sure the specified module, when imported, raises a

Modified: python/branches/tlee-ast-optimize/Lib/test/test_support.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_support.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_support.py	Sun Sep  7 18:03:22 2008
@@ -18,7 +18,7 @@
            "is_resource_enabled", "requires", "find_unused_port", "bind_port",
            "fcmp", "have_unicode", "is_jython", "TESTFN", "HOST", "FUZZ",
            "findfile", "verify", "vereq", "sortdict", "check_syntax_error",
-           "open_urlresource", "WarningMessage", "catch_warning", "CleanImport",
+           "open_urlresource", "catch_warning", "CleanImport",
            "EnvironmentVarGuard", "captured_output",
            "captured_stdout", "TransientResource", "transient_internet",
            "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest",
@@ -381,71 +381,8 @@
     return open(fn)
 
 
-class WarningMessage(object):
-    "Holds the result of a single showwarning() call"
-    _WARNING_DETAILS = "message category filename lineno line".split()
-    def __init__(self, message, category, filename, lineno, line=None):
-        for attr in self._WARNING_DETAILS:
-            setattr(self, attr, locals()[attr])
-        self._category_name = category.__name__ if category else None
-
-    def __str__(self):
-        return ("{message : %r, category : %r, filename : %r, lineno : %s, "
-                    "line : %r}" % (self.message, self._category_name,
-                                    self.filename, self.lineno, self.line))
-
-class WarningRecorder(object):
-    "Records the result of any showwarning calls"
-    def __init__(self):
-        self.warnings = []
-        self._set_last(None)
-
-    def _showwarning(self, message, category, filename, lineno,
-                    file=None, line=None):
-        wm = WarningMessage(message, category, filename, lineno, line)
-        self.warnings.append(wm)
-        self._set_last(wm)
-
-    def _set_last(self, last_warning):
-        if last_warning is None:
-            for attr in WarningMessage._WARNING_DETAILS:
-                setattr(self, attr, None)
-        else:
-            for attr in WarningMessage._WARNING_DETAILS:
-                setattr(self, attr, getattr(last_warning, attr))
-
-    def reset(self):
-        self.warnings = []
-        self._set_last(None)
-
-    def __str__(self):
-        return '[%s]' % (', '.join(map(str, self.warnings)))
-
- at contextlib.contextmanager
 def catch_warning(module=warnings, record=True):
-    """Guard the warnings filter from being permanently changed and
-    optionally record the details of any warnings that are issued.
-
-    Use like this:
-
-        with catch_warning() as w:
-            warnings.warn("foo")
-            assert str(w.message) == "foo"
-    """
-    original_filters = module.filters
-    original_showwarning = module.showwarning
-    if record:
-        recorder = WarningRecorder()
-        module.showwarning = recorder._showwarning
-    else:
-        recorder = None
-    try:
-        # Replace the filters with a copy of the original
-        module.filters = module.filters[:]
-        yield recorder
-    finally:
-        module.showwarning = original_showwarning
-        module.filters = original_filters
+    return warnings.catch_warnings(record=record, module=module)
 
 
 class CleanImport(object):

Modified: python/branches/tlee-ast-optimize/Lib/test/test_unicode.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_unicode.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_unicode.py	Sun Sep  7 18:03:22 2008
@@ -1118,7 +1118,10 @@
         # when a string allocation fails with a MemoryError.
         # This used to crash the interpreter,
         # or leak references when the number was smaller.
-        alloc = lambda: u"a" * (sys.maxsize - 100)
+        charwidth = 4 if sys.maxunicode >= 0x10000 else 2
+        # Note: sys.maxsize is half of the actual max allocation because of
+        # the signedness of Py_ssize_t.
+        alloc = lambda: u"a" * (sys.maxsize // charwidth * 2)
         self.assertRaises(MemoryError, alloc)
         self.assertRaises(MemoryError, alloc)
 

Modified: python/branches/tlee-ast-optimize/Lib/test/test_urlparse.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_urlparse.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_urlparse.py	Sun Sep  7 18:03:22 2008
@@ -8,6 +8,23 @@
 RFC2396_BASE = "http://a/b/c/d;p?q"
 RFC3986_BASE = "http://a/b/c/d;p?q"
 
+# A list of test cases.  Each test case is a a two-tuple that contains
+# a string with the query and a dictionary with the expected result.
+
+parse_qsl_test_cases = [
+    ("", []),
+    ("&", []),
+    ("&&", []),
+    ("=", [('', '')]),
+    ("=a", [('', 'a')]),
+    ("a", [('a', '')]),
+    ("a=", [('a', '')]),
+    ("a=", [('a', '')]),
+    ("&a=b", [('a', 'b')]),
+    ("a=a+b&b=b+c", [('a', 'a b'), ('b', 'b c')]),
+    ("a=1&a=2", [('a', '1'), ('a', '2')]),
+]
+
 class UrlParseTestCase(unittest.TestCase):
 
     def checkRoundtrips(self, url, parsed, split):
@@ -61,6 +78,11 @@
         self.assertEqual(result3.hostname, result.hostname)
         self.assertEqual(result3.port,     result.port)
 
+    def test_qsl(self):
+        for orig, expect in parse_qsl_test_cases:
+            result = urlparse.parse_qsl(orig, keep_blank_values=True)
+            self.assertEqual(result, expect, "Error parsing %s" % repr(orig))
+
     def test_roundtrips(self):
         testcases = [
             ('file:///tmp/junk.txt',

Modified: python/branches/tlee-ast-optimize/Lib/test/test_warnings.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_warnings.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_warnings.py	Sun Sep  7 18:03:22 2008
@@ -79,20 +79,19 @@
                                 "FilterTests.test_error")
 
     def test_ignore(self):
-        with test_support.catch_warning(self.module) as w:
+        with test_support.catch_warning(module=self.module) as w:
             self.module.resetwarnings()
             self.module.filterwarnings("ignore", category=UserWarning)
             self.module.warn("FilterTests.test_ignore", UserWarning)
-            self.assert_(not w.message)
+            self.assertEquals(len(w), 0)
 
     def test_always(self):
-        with test_support.catch_warning(self.module) as w:
+        with test_support.catch_warning(module=self.module) as w:
             self.module.resetwarnings()
             self.module.filterwarnings("always", category=UserWarning)
             message = "FilterTests.test_always"
             self.module.warn(message, UserWarning)
             self.assert_(message, w.message)
-            w.message = None  # Reset.
             self.module.warn(message, UserWarning)
             self.assert_(w.message, message)
 
@@ -107,7 +106,7 @@
                     self.assertEquals(w.message, message)
                     w.reset()
                 elif x == 1:
-                    self.assert_(not w.message, "unexpected warning: " + str(w))
+                    self.assert_(not len(w), "unexpected warning: " + str(w))
                 else:
                     raise ValueError("loop variant unhandled")
 
@@ -120,7 +119,7 @@
             self.assertEquals(w.message, message)
             w.reset()
             self.module.warn(message, UserWarning)
-            self.assert_(not w.message, "unexpected message: " + str(w))
+            self.assert_(not len(w), "unexpected message: " + str(w))
 
     def test_once(self):
         with test_support.catch_warning(self.module) as w:
@@ -133,10 +132,10 @@
             w.reset()
             self.module.warn_explicit(message, UserWarning, "test_warnings.py",
                                     13)
-            self.assert_(not w.message)
+            self.assertEquals(len(w), 0)
             self.module.warn_explicit(message, UserWarning, "test_warnings2.py",
                                     42)
-            self.assert_(not w.message)
+            self.assertEquals(len(w), 0)
 
     def test_inheritance(self):
         with test_support.catch_warning(self.module) as w:
@@ -156,7 +155,7 @@
                 self.module.warn("FilterTests.test_ordering", UserWarning)
             except UserWarning:
                 self.fail("order handling for actions failed")
-            self.assert_(not w.message)
+            self.assertEquals(len(w), 0)
 
     def test_filterwarnings(self):
         # Test filterwarnings().
@@ -317,7 +316,6 @@
                             None, Warning, None, 1, registry=42)
 
 
-
 class CWarnTests(BaseTest, WarnTests):
     module = c_warnings
 
@@ -377,7 +375,7 @@
                 self.failUnlessEqual(w.message, message)
                 w.reset()
                 self.module.warn_explicit(message, UserWarning, "file", 42)
-                self.assert_(not w.message)
+                self.assertEquals(len(w), 0)
                 # Test the resetting of onceregistry.
                 self.module.onceregistry = {}
                 __warningregistry__ = {}
@@ -388,7 +386,7 @@
                 del self.module.onceregistry
                 __warningregistry__ = {}
                 self.module.warn_explicit(message, UserWarning, "file", 42)
-                self.failUnless(not w.message)
+                self.assertEquals(len(w), 0)
         finally:
             self.module.onceregistry = original_registry
 
@@ -489,45 +487,46 @@
 
 
 
-class WarningsSupportTests(object):
-    """Test the warning tools from test support module"""
+class CatchWarningTests(BaseTest):
 
-    def test_catch_warning_restore(self):
+    """Test catch_warnings()."""
+
+    def test_catch_warnings_restore(self):
         wmod = self.module
         orig_filters = wmod.filters
         orig_showwarning = wmod.showwarning
-        with test_support.catch_warning(wmod):
+        with wmod.catch_warnings(record=True, module=wmod):
             wmod.filters = wmod.showwarning = object()
         self.assert_(wmod.filters is orig_filters)
         self.assert_(wmod.showwarning is orig_showwarning)
-        with test_support.catch_warning(wmod, record=False):
+        with wmod.catch_warnings(module=wmod, record=False):
             wmod.filters = wmod.showwarning = object()
         self.assert_(wmod.filters is orig_filters)
         self.assert_(wmod.showwarning is orig_showwarning)
 
-    def test_catch_warning_recording(self):
+    def test_catch_warnings_recording(self):
         wmod = self.module
-        with test_support.catch_warning(wmod) as w:
-            self.assertEqual(w.warnings, [])
+        with wmod.catch_warnings(module=wmod, record=True) as w:
+            self.assertEqual(w, [])
+            self.assertRaises(AttributeError, getattr, w, 'message')
             wmod.simplefilter("always")
             wmod.warn("foo")
             self.assertEqual(str(w.message), "foo")
             wmod.warn("bar")
             self.assertEqual(str(w.message), "bar")
-            self.assertEqual(str(w.warnings[0].message), "foo")
-            self.assertEqual(str(w.warnings[1].message), "bar")
+            self.assertEqual(str(w[0].message), "foo")
+            self.assertEqual(str(w[1].message), "bar")
             w.reset()
-            self.assertEqual(w.warnings, [])
+            self.assertEqual(w, [])
         orig_showwarning = wmod.showwarning
-        with test_support.catch_warning(wmod, record=False) as w:
+        with wmod.catch_warnings(module=wmod, record=False) as w:
             self.assert_(w is None)
             self.assert_(wmod.showwarning is orig_showwarning)
 
-
-class CWarningsSupportTests(BaseTest, WarningsSupportTests):
+class CCatchWarningTests(CatchWarningTests):
     module = c_warnings
 
-class PyWarningsSupportTests(BaseTest, WarningsSupportTests):
+class PyCatchWarningTests(CatchWarningTests):
     module = py_warnings
 
 
@@ -539,14 +538,24 @@
     def bad_showwarning(message, category, filename, lineno, file=None):
         pass
 
+    @staticmethod
+    def ok_showwarning(*args):
+        pass
+
     def test_deprecation(self):
         # message, category, filename, lineno[, file[, line]]
         args = ("message", UserWarning, "file name", 42)
-        with test_support.catch_warning(self.module):
+        with test_support.catch_warning(module=self.module):
             self.module.filterwarnings("error", category=DeprecationWarning)
             self.module.showwarning = self.bad_showwarning
             self.assertRaises(DeprecationWarning, self.module.warn_explicit,
                                 *args)
+            self.module.showwarning = self.ok_showwarning
+            try:
+                self.module.warn_explicit(*args)
+            except DeprecationWarning as exc:
+                self.fail('showwarning(*args) should not trigger a '
+                            'DeprecationWarning')
 
 class CShowwarningDeprecationTests(ShowwarningDeprecationTests):
     module = c_warnings
@@ -559,16 +568,14 @@
 def test_main():
     py_warnings.onceregistry.clear()
     c_warnings.onceregistry.clear()
-    test_support.run_unittest(CFilterTests,
-                                PyFilterTests,
-                                CWarnTests,
-                                PyWarnTests,
+    test_support.run_unittest(CFilterTests, PyFilterTests,
+                                CWarnTests, PyWarnTests,
                                 CWCmdLineTests, PyWCmdLineTests,
                                 _WarningsTests,
                                 CWarningsDisplayTests, PyWarningsDisplayTests,
-                                CWarningsSupportTests, PyWarningsSupportTests,
+                                CCatchWarningTests, PyCatchWarningTests,
                                 CShowwarningDeprecationTests,
-                                PyShowwarningDeprecationTests,
+                                    PyShowwarningDeprecationTests,
                              )
 
 

Modified: python/branches/tlee-ast-optimize/Lib/threading.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/threading.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/threading.py	Sun Sep  7 18:03:22 2008
@@ -15,6 +15,17 @@
 from traceback import format_exc as _format_exc
 from collections import deque
 
+# Note regarding PEP 8 compliant aliases
+#  This threading model was originally inspired by Java, and inherited
+# the convention of camelCase function and method names from that
+# language. While those names are not in any imminent danger of being
+# deprecated, starting with Python 2.6, the module now provides a
+# PEP 8 compliant alias for any such method name.
+# Using the new PEP 8 compliant names also facilitates substitution
+# with the multiprocessing module, which doesn't provide the old
+# Java inspired names.
+
+
 # Rename some stuff so "from threading import *" is safe
 __all__ = ['activeCount', 'active_count', 'Condition', 'currentThread',
            'current_thread', 'enumerate', 'Event',
@@ -33,19 +44,6 @@
 warnings.filterwarnings('ignore', category=DeprecationWarning,
                         module='threading', message='sys.exc_clear')
 
-
-def _old_api(callable, old_name):
-    if not _sys.py3kwarning:
-        return callable
-    @wraps(callable)
-    def old(*args, **kwargs):
-        warnings.warnpy3k("{0}() is deprecated in favor of {1}()"
-                          .format(old_name, callable.__name__),
-                          stacklevel=3)
-        return callable(*args, **kwargs)
-    old.__name__ = old_name
-    return old
-
 # Debug support (adapted from ihooks.py).
 # All the major classes here derive from _Verbose.  We force that to
 # be a new-style class so that all the major classes here are new-style.
@@ -287,10 +285,10 @@
             except ValueError:
                 pass
 
-    def notify_all(self):
+    def notifyAll(self):
         self.notify(len(self.__waiters))
 
-    notifyAll = _old_api(notify_all, "notifyAll")
+    notify_all = notifyAll
 
 
 def Semaphore(*args, **kwargs):
@@ -368,10 +366,10 @@
         self.__cond = Condition(Lock())
         self.__flag = False
 
-    def is_set(self):
+    def isSet(self):
         return self.__flag
 
-    isSet = _old_api(is_set, "isSet")
+    is_set = isSet
 
     def set(self):
         self.__cond.acquire()
@@ -666,11 +664,11 @@
         assert self.__initialized, "Thread.__init__() not called"
         return self.__ident
 
-    def is_alive(self):
+    def isAlive(self):
         assert self.__initialized, "Thread.__init__() not called"
         return self.__started.is_set() and not self.__stopped
 
-    isAlive = _old_api(is_alive, "isAlive")
+    is_alive = isAlive
 
     @property
     def daemon(self):
@@ -686,23 +684,15 @@
         self.__daemonic = daemonic
 
     def isDaemon(self):
-        warnings.warnpy3k("isDaemon() is deprecated in favor of the " \
-                          "Thread.daemon property")
         return self.daemon
 
     def setDaemon(self, daemonic):
-        warnings.warnpy3k("setDaemon() is deprecated in favor of the " \
-                          "Thread.daemon property")
         self.daemon = daemonic
 
     def getName(self):
-        warnings.warnpy3k("getName() is deprecated in favor of the " \
-                          "Thread.name property")
         return self.name
 
     def setName(self, name):
-        warnings.warnpy3k("setName() is deprecated in favor of the " \
-                          "Thread.name property")
         self.name = name
 
 # The timer class was contributed by Itamar Shtull-Trauring
@@ -803,22 +793,22 @@
 
 # Global API functions
 
-def current_thread():
+def currentThread():
     try:
         return _active[_get_ident()]
     except KeyError:
         ##print "current_thread(): no current thread for", _get_ident()
         return _DummyThread()
 
-currentThread = _old_api(current_thread, "currentThread")
+current_thread = currentThread
 
-def active_count():
+def activeCount():
     _active_limbo_lock.acquire()
     count = len(_active) + len(_limbo)
     _active_limbo_lock.release()
     return count
 
-activeCount = _old_api(active_count, "activeCount")
+active_count = activeCount
 
 def enumerate():
     _active_limbo_lock.acquire()
@@ -857,9 +847,12 @@
     new_active = {}
     current = current_thread()
     with _active_limbo_lock:
-        for ident, thread in _active.iteritems():
+        for thread in _active.itervalues():
             if thread is current:
-                # There is only one active thread.
+                # There is only one active thread. We reset the ident to
+                # its new value since it can have changed.
+                ident = _get_ident()
+                thread._Thread__ident = ident
                 new_active[ident] = thread
             else:
                 # All the others are already stopped.

Modified: python/branches/tlee-ast-optimize/Lib/urlparse.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/urlparse.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/urlparse.py	Sun Sep  7 18:03:22 2008
@@ -5,7 +5,7 @@
 """
 
 __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
-           "urlsplit", "urlunsplit"]
+           "urlsplit", "urlunsplit", "parse_qs", "parse_qsl"]
 
 # A classification of schemes ('' means apply by default)
 uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
@@ -267,6 +267,92 @@
     else:
         return url, ''
 
+# unquote method for parse_qs and parse_qsl
+# Cannot use directly from urllib as it would create circular reference.
+# urllib uses urlparse methods ( urljoin)
+
+_hextochr = dict(('%02x' % i, chr(i)) for i in range(256))
+_hextochr.update(('%02X' % i, chr(i)) for i in range(256))
+
+def unquote(s):
+    """unquote('abc%20def') -> 'abc def'."""
+    res = s.split('%')
+    for i in xrange(1, len(res)):
+        item = res[i]
+        try:
+            res[i] = _hextochr[item[:2]] + item[2:]
+        except KeyError:
+            res[i] = '%' + item
+        except UnicodeDecodeError:
+            res[i] = unichr(int(item[:2], 16)) + item[2:]
+    return "".join(res)
+
+def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
+    """Parse a query given as a string argument.
+
+        Arguments:
+
+        qs: URL-encoded query string to be parsed
+
+        keep_blank_values: flag indicating whether blank values in
+            URL encoded queries should be treated as blank strings.
+            A true value indicates that blanks should be retained as
+            blank strings.  The default false value indicates that
+            blank values are to be ignored and treated as if they were
+            not included.
+
+        strict_parsing: flag indicating what to do with parsing errors.
+            If false (the default), errors are silently ignored.
+            If true, errors raise a ValueError exception.
+    """
+    dict = {}
+    for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
+        if name in dict:
+            dict[name].append(value)
+        else:
+            dict[name] = [value]
+    return dict
+
+def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
+    """Parse a query given as a string argument.
+
+    Arguments:
+
+    qs: URL-encoded query string to be parsed
+
+    keep_blank_values: flag indicating whether blank values in
+        URL encoded queries should be treated as blank strings.  A
+        true value indicates that blanks should be retained as blank
+        strings.  The default false value indicates that blank values
+        are to be ignored and treated as if they were  not included.
+
+    strict_parsing: flag indicating what to do with parsing errors. If
+        false (the default), errors are silently ignored. If true,
+        errors raise a ValueError exception.
+
+    Returns a list, as G-d intended.
+    """
+    pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
+    r = []
+    for name_value in pairs:
+        if not name_value and not strict_parsing:
+            continue
+        nv = name_value.split('=', 1)
+        if len(nv) != 2:
+            if strict_parsing:
+                raise ValueError, "bad query field: %r" % (name_value,)
+            # Handle case of a control-name with no equal sign
+            if keep_blank_values:
+                nv.append('')
+            else:
+                continue
+        if len(nv[1]) or keep_blank_values:
+            name = unquote(nv[0].replace('+', ' '))
+            value = unquote(nv[1].replace('+', ' '))
+            r.append((name, value))
+
+    return r
+
 
 test_input = """
       http://a/b/c/d

Modified: python/branches/tlee-ast-optimize/Lib/warnings.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/warnings.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/warnings.py	Sun Sep  7 18:03:22 2008
@@ -272,7 +272,8 @@
         fxn_code = showwarning.__func__.func_code
     if fxn_code:
         args = fxn_code.co_varnames[:fxn_code.co_argcount]
-        if 'line' not in args:
+        CO_VARARGS = 0x4
+        if 'line' not in args and not fxn_code.co_flags & CO_VARARGS:
             showwarning_msg = ("functions overriding warnings.showwarning() "
                                 "must support the 'line' argument")
             if message == showwarning_msg:
@@ -283,6 +284,85 @@
     showwarning(message, category, filename, lineno)
 
 
+class WarningMessage(object):
+
+    """Holds the result of a single showwarning() call."""
+
+    _WARNING_DETAILS = ("message", "category", "filename", "lineno", "file",
+                        "line")
+
+    def __init__(self, message, category, filename, lineno, file=None,
+                    line=None):
+        local_values = locals()
+        for attr in self._WARNING_DETAILS:
+            setattr(self, attr, local_values[attr])
+        self._category_name = category.__name__ if category else None
+
+    def __str__(self):
+        return ("{message : %r, category : %r, filename : %r, lineno : %s, "
+                    "line : %r}" % (self.message, self._category_name,
+                                    self.filename, self.lineno, self.line))
+
+
+class WarningsRecorder(list):
+
+    """Record the result of various showwarning() calls."""
+
+    # Explicitly stated arguments so as to not trigger DeprecationWarning
+    # about adding 'line'.
+    def showwarning(self, *args, **kwargs):
+        self.append(WarningMessage(*args, **kwargs))
+
+    def __getattr__(self, attr):
+        """Return attributes from the last caught warning, or raise
+        AttributeError."""
+        try:
+            return getattr(self[-1], attr)
+        except IndexError:
+            raise AttributeError("no recorded warning to read "
+                                    "{0!r} attribute from".format(attr))
+
+
+    def reset(self):
+        del self[:]
+
+
+class catch_warnings(object):
+
+    """Guard the warnings filter from being permanently changed and optionally
+    record the details of any warnings that are issued.
+
+    Context manager returns an instance of warnings.WarningRecorder which is a
+    list of WarningMessage instances. Attributes on WarningRecorder are
+    redirected to the last created WarningMessage instance.
+
+    """
+
+    def __init__(self, record=False, module=None):
+        """Specify whether to record warnings and if an alternative module
+        should be used other than sys.modules['warnings'].
+
+        For compatibility with Python 3.0, please consider all arguments to be
+        keyword-only.
+
+        """
+        self._recorder = WarningsRecorder() if record else None
+        self._module = sys.modules['warnings'] if module is None else module
+
+    def __enter__(self):
+        self._filters = self._module.filters
+        self._module.filters = self._filters[:]
+        self._showwarning = self._module.showwarning
+        if self._recorder is not None:
+            self._recorder.reset()  # In case the instance is being reused.
+            self._module.showwarning = self._recorder.showwarning
+        return self._recorder
+
+    def __exit__(self, *exc_info):
+        self._module.filters = self._filters
+        self._module.showwarning = self._showwarning
+
+
 # filters contains a sequence of filter 5-tuples
 # The components of the 5-tuple are:
 # - an action: error, ignore, always, default, module, or once

Modified: python/branches/tlee-ast-optimize/Lib/zipfile.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/zipfile.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/zipfile.py	Sun Sep  7 18:03:22 2008
@@ -163,6 +163,7 @@
         return endrec
 
     # Update the original endrec using data from the ZIP64 record
+    endrec[_ECD_SIGNATURE] = sig
     endrec[_ECD_DISK_NUMBER] = disk_num
     endrec[_ECD_DISK_START] = disk_dir
     endrec[_ECD_ENTRIES_THIS_DISK] = dircount
@@ -735,9 +736,8 @@
 
         # "concat" is zero, unless zip was concatenated to another file
         concat = endrec[_ECD_LOCATION] - size_cd - offset_cd
-        if endrec[_ECD_LOCATION] > ZIP64_LIMIT:
-            # If the offset of the "End of Central Dir" record requires Zip64
-            # extension structures, account for them
+        if endrec[_ECD_SIGNATURE] == stringEndArchive64:
+            # If Zip64 extension structures are present, account for them
             concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator)
 
         if self.debug > 2:

Modified: python/branches/tlee-ast-optimize/Makefile.pre.in
==============================================================================
--- python/branches/tlee-ast-optimize/Makefile.pre.in	(original)
+++ python/branches/tlee-ast-optimize/Makefile.pre.in	Sun Sep  7 18:03:22 2008
@@ -413,14 +413,14 @@
 
 libpython$(VERSION).so: $(LIBRARY_OBJS)
 	if test $(INSTSONAME) != $(LDLIBRARY); then \
-		$(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
+		$(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
 		$(LN) -f $(INSTSONAME) $@; \
 	else\
-		$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
+		$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
 	fi
 
 libpython$(VERSION).sl: $(LIBRARY_OBJS)
-	$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM)
+	$(LDSHARED) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
 
 # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
 # minimal framework (not including the Lib directory and such) in the current
@@ -454,8 +454,8 @@
 # for a shared core library; otherwise, this rule is a noop.
 $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
 	if test -n "$(DLLLIBRARY)"; then \
-		$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
-			$(LIBS) $(MODLIBS) $(SYSLIBS); \
+		$(LDSHARED) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
+			$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
 	else true; \
 	fi
 
@@ -1191,7 +1191,7 @@
 		-o -print
 
 # Perform some verification checks on any modified files.
-check:
+patchcheck:
 	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
 
 # Dependencies

Modified: python/branches/tlee-ast-optimize/Misc/ACKS
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/ACKS	(original)
+++ python/branches/tlee-ast-optimize/Misc/ACKS	Sun Sep  7 18:03:22 2008
@@ -122,6 +122,7 @@
 Michael Chermside
 Albert Chin-A-Young
 Adal Chiriliuc
+Matt Chisholm
 Tom Christiansen
 Vadim Chugunov
 David Cinege

Modified: python/branches/tlee-ast-optimize/Misc/NEWS
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/NEWS	(original)
+++ python/branches/tlee-ast-optimize/Misc/NEWS	Sun Sep  7 18:03:22 2008
@@ -12,7 +12,16 @@
 Core and Builtins
 -----------------
 
-- Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to 
+- Issue #3751: str.rpartition would perform a left-partition when called with
+  a unicode argument.
+
+- Issue #3683: Fix compilation when --without-threads is given.
+
+- Issue #3668: Fix a memory leak with the "s*" argument parser in
+  PyArg_ParseTuple and friends, which occurred when the argument for "s*"
+  was correctly parsed but parsing of subsequent arguments failed.
+
+- Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to
   match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
   mechanism. In the process, fix a bug where isinstance() and issubclass(),
   when given a tuple of classes as second argument, were looking up
@@ -36,6 +45,13 @@
 - Added warnings on the use of ``__getslice__``, ``__setslice__``, or
   ``__delslice__``.
 
+- Issue #3678: Correctly pass LDFLAGS and LDLAST to the linker on shared
+  library targets in the Makefile.
+
+- Issue #1204: The configure script now tests for additional libraries
+  that may be required when linking against readline.  This fixes issues
+  with x86_64 builds on some platforms (a few Linux flavors and OpenBSD).
+
 C-API
 -----
 
@@ -44,16 +60,74 @@
 Library
 -------
 
+- Issue #1638033: Cookie.Morsel gained the httponly attribute.
+
+- Issue #3535: zipfile couldn't read some zip files larger than 2GB.
+
+- Issue #3776: Deprecate the bsddb package for removal in 3.0.
+
+- Issue #3762: platform.architecture() fails if python is lanched via
+  its symbolic link.
+
+- Issue #3772: Fixed regression problem in StreamHandler.emit().
+
+- Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module
+  to the urlparse one.  Added a PendingDeprecationWarning in the old
+  module, it will be deprecated in the future.
+
+- Issue #2562: Fix distutils PKG-INFO writing logic to allow having
+  non-ascii characters and Unicode in setup.py meta-data.
+
+- Issue #3726: Allow spaces in separators in logging configuration files.
+
+- Issue #3719: platform.architecture() fails if there are spaces in the
+  path to the Python binary.
+
+- Issue 3602: Moved test.test_support.catch_warning() to
+  warnings.catch_warnings() along with some API cleanup. Expanding the tests
+  for catch_warnings() also led to an improvement in the raising of a
+  DeprecationWarning related to warnings.warn_explicit().
+
+- The deprecation warnings for the old camelCase threading API were removed.
+
+- logging: fixed lack of use of encoding attribute specified on a stream.
+
 - Silenced a trivial compiler warning in the sqlite module.
 
 - Fixed two format strings in the _collections module.
 
+- Issue #3703: _fileio.FileIO gave unhelpful error message when trying to open a
+  directory.
+
+- Issue #3708: os.urandom no longer goes into an infinite loop when passed a
+  non-integer floating point number.
+
+- Issue #3110: multiprocessing fails to compiel on solaris 10 due to missing
+  SEM_VALUE_MAX.
+
 Extension Modules
 -----------------
 
+- Issue #2975: When compiling several extension modules with Visual Studio 2008
+  from the same python interpreter, some environment variables would grow
+  without limit.
+
 - Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
   exploitation of poor argument checking.
 
+Tests
+-----
+
+- Issue #3796: Some tests functions were not enabled in test_float.
+
+- Issue #3768: Move test_py3kwarn over to the new API for catch_warnings().
+
+Build
+-----
+
+- Issue #3758: Rename the 'check' target to 'patchcheck' so as to not clash 
+  with GNU build target guidelines.
+
 
 What's New in Python 2.6 beta 3?
 ================================
@@ -484,8 +558,9 @@
 
 - Support for Windows 9x has been removed from the winsound module.
 
-- bsddb module updated to version 4.7.0.
-  http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.0
+- bsddb module updated to version 4.7.3pre2.
+  http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3. This
+  code should be compatible with Python 3.0.
 
 - Issue #2858: Fix potential memory corruption when
   bsddb.db.DBEnv.lock_get and other bsddb.db object constructors
@@ -2651,8 +2726,8 @@
 - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments
   were transposed.
 
-- Added support for linking the bsddb module against BerkeleyDB 4.5.x
-  and 4.6.x.
+- Added support for linking the bsddb module against BerkeleyDB 4.5.x,
+  4.6.x and 4.7.x.
 
 - Bug #1633621: if curses.resizeterm() or curses.resize_term() is
   called, update _curses.LINES, _curses.COLS, curses.LINES and

Modified: python/branches/tlee-ast-optimize/Modules/_bsddb.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_bsddb.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_bsddb.c	Sun Sep  7 18:03:22 2008
@@ -396,7 +396,11 @@
     }
     else if (!PyArg_Parse(obj, "s#", &dbt->data, &dbt->size)) {
         PyErr_SetString(PyExc_TypeError,
+#if (PY_VERSION_HEX < 0x03000000)
                         "Data values must be of type string or None.");
+#else
+                        "Data values must be of type bytes or None.");
+#endif
         return 0;
     }
     return 1;
@@ -435,7 +439,11 @@
         if (type == DB_RECNO || type == DB_QUEUE) {
             PyErr_SetString(
                 PyExc_TypeError,
+#if (PY_VERSION_HEX < 0x03000000)
                 "String keys not allowed for Recno and Queue DB's");
+#else
+                "Bytes keys not allowed for Recno and Queue DB's");
+#endif
             return 0;
         }
 
@@ -488,7 +496,11 @@
     }
     else {
         PyErr_Format(PyExc_TypeError,
+#if (PY_VERSION_HEX < 0x03000000)
                      "String or Integer object expected for key, %s found",
+#else
+                     "Bytes or Integer object expected for key, %s found",
+#endif
                      Py_TYPE(keyobj)->tp_name);
         return 0;
     }
@@ -573,11 +585,13 @@
     p=DummyString;
     assert(s==0);
   }
-  return Py_BuildValue("s#",p,s);
+  return PyBytes_FromStringAndSize(p, s);
 }
 
 static PyObject *BuildValue_SS(const void *p1,int s1,const void *p2,int s2)
 {
+PyObject *a, *b, *r;
+
   if (!p1) {
     p1=DummyString;
     assert(s1==0);
@@ -586,25 +600,59 @@
     p2=DummyString;
     assert(s2==0);
   }
-  return Py_BuildValue("s#s#",p1,s1,p2,s2);
+
+  if (!(a = PyBytes_FromStringAndSize(p1, s1))) {
+      return NULL;
+  }
+  if (!(b = PyBytes_FromStringAndSize(p2, s2))) {
+      Py_DECREF(a);
+      return NULL;
+  }
+
+#if (PY_VERSION_HEX >= 0x02040000)
+  r = PyTuple_Pack(2, a, b) ;
+#else
+  r = Py_BuildValue("OO", a, b);
+#endif
+  Py_DECREF(a);
+  Py_DECREF(b);
+  return r;
 }
 
 static PyObject *BuildValue_IS(int i,const void *p,int s)
 {
+  PyObject *a, *r;
+
   if (!p) {
     p=DummyString;
     assert(s==0);
   }
-  return Py_BuildValue("is#",i,p,s);
+
+  if (!(a = PyBytes_FromStringAndSize(p, s))) {
+      return NULL;
+  }
+
+  r = Py_BuildValue("iO", i, a);
+  Py_DECREF(a);
+  return r;
 }
 
-static PyObject *BuildValue_LS(long i,const void *p,int s)
+static PyObject *BuildValue_LS(long l,const void *p,int s)
 {
+  PyObject *a, *r;
+
   if (!p) {
     p=DummyString;
     assert(s==0);
   }
-  return Py_BuildValue("ls#",i,p,s);
+
+  if (!(a = PyBytes_FromStringAndSize(p, s))) {
+      return NULL;
+  }
+
+  r = Py_BuildValue("lO", l, a);
+  Py_DECREF(a);
+  return r;
 }
 
 
@@ -895,7 +943,7 @@
     self->btCompareCallback = NULL;
     self->primaryDBType = 0;
     Py_INCREF(Py_None);
-    self->private = Py_None;
+    self->private_obj = Py_None;
     self->in_weakreflist = NULL;
 
     /* keep a reference to our python DBEnv object */
@@ -967,7 +1015,7 @@
         Py_DECREF(self->btCompareCallback);
         self->btCompareCallback = NULL;
     }
-    Py_DECREF(self->private);
+    Py_DECREF(self->private_obj);
     PyObject_Del(self);
 }
 
@@ -1030,7 +1078,7 @@
     self->children_dbs = NULL;
     self->children_txns = NULL;
     Py_INCREF(Py_None);
-    self->private = Py_None;
+    self->private_obj = Py_None;
     Py_INCREF(Py_None);
     self->rep_transport = Py_None;
     self->in_weakreflist = NULL;
@@ -1045,7 +1093,7 @@
     }
     else {
         self->db_env->set_errcall(self->db_env, _db_errorCallback);
-        self->db_env->app_private=self;
+        self->db_env->app_private = self;
     }
     return self;
 }
@@ -1058,7 +1106,7 @@
 {
   PyObject *dummy;
 
-    if (self->db_env && !self->closed) {
+    if (self->db_env) {
       dummy=DBEnv_close_internal(self,0);
       Py_XDECREF(dummy);
     }
@@ -1069,7 +1117,7 @@
     if (self->in_weakreflist != NULL) {
         PyObject_ClearWeakRefs((PyObject *) self);
     }
-    Py_DECREF(self->private);
+    Py_DECREF(self->private_obj);
     Py_DECREF(self->rep_transport);
     PyObject_Del(self);
 }
@@ -1248,15 +1296,17 @@
 /* DB methods */
 
 static PyObject*
-DB_append(DBObject* self, PyObject* args)
+DB_append(DBObject* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* txnobj = NULL;
     PyObject* dataobj;
     db_recno_t recno;
     DBT key, data;
     DB_TXN *txn = NULL;
+    static char* kwnames[] = { "data", "txn", NULL };
 
-    if (!PyArg_UnpackTuple(args, "append", 1, 2, &dataobj, &txnobj))
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:append", kwnames,
+                                     &dataobj, &txnobj))
         return NULL;
 
     CHECK_DB_NOT_CLOSED(self);
@@ -1443,6 +1493,7 @@
     if (self->db != NULL) {
         /* Can be NULL if db is not in an environment */
         EXTRACT_FROM_DOUBLE_LINKED_LIST_MAYBE_NULL(self);
+
         if (self->txn) {
             EXTRACT_FROM_DOUBLE_LINKED_LIST_TXN(self);
             self->txn=NULL;
@@ -2168,7 +2219,12 @@
         return NULL;
     CHECK_DB_NOT_CLOSED(self);
 
+    EXTRACT_FROM_DOUBLE_LINKED_LIST_MAYBE_NULL(self);
+
+    MYDB_BEGIN_ALLOW_THREADS;
     err = self->db->remove(self->db, filename, database, flags);
+    MYDB_END_ALLOW_THREADS;
+
     self->db = NULL;
     RETURN_IF_ERR();
     RETURN_NONE();
@@ -2201,17 +2257,17 @@
 DB_get_private(DBObject* self)
 {
     /* We can give out the private field even if db is closed */
-    Py_INCREF(self->private);
-    return self->private;
+    Py_INCREF(self->private_obj);
+    return self->private_obj;
 }
 
 static PyObject*
-DB_set_private(DBObject* self, PyObject* private)
+DB_set_private(DBObject* self, PyObject* private_obj)
 {
     /* We can set the private field even if db is closed */
-    Py_DECREF(self->private);
-    Py_INCREF(private);
-    self->private = private;
+    Py_DECREF(self->private_obj);
+    Py_INCREF(private_obj);
+    self->private_obj = private_obj;
     RETURN_NONE();
 }
 
@@ -2990,16 +3046,19 @@
 
 
 static PyObject*
-DB_has_key(DBObject* self, PyObject* args)
+DB_has_key(DBObject* self, PyObject* args, PyObject* kwargs)
 {
     int err;
     PyObject* keyobj;
     DBT key, data;
     PyObject* txnobj = NULL;
     DB_TXN *txn = NULL;
+    static char* kwnames[] = {"key","txn", NULL};
 
-    if (!PyArg_UnpackTuple(args,"has_key", 1, 2, &keyobj, &txnobj))
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:has_key", kwnames,
+                &keyobj, &txnobj))
         return NULL;
+
     CHECK_DB_NOT_CLOSED(self);
     if (!make_key_dbt(self, keyobj, &key, NULL))
         return NULL;
@@ -3308,7 +3367,7 @@
     {
         PyErr_Clear();
         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:get",
-                                         &kwnames[1], 
+                                         &kwnames[1],
 					 &keyobj, &flags, &dlen, &doff))
         {
             PyErr_Clear();
@@ -3922,13 +3981,15 @@
           dummy=DB_close_internal(self->children_dbs,0);
           Py_XDECREF(dummy);
         }
+    }
 
+    self->closed = 1;
+    if (self->db_env) {
         MYDB_BEGIN_ALLOW_THREADS;
         err = self->db_env->close(self->db_env, flags);
         MYDB_END_ALLOW_THREADS;
         /* after calling DBEnv->close, regardless of error, this DBEnv
          * may not be accessed again (Berkeley DB docs). */
-        self->closed = 1;
         self->db_env = NULL;
         RETURN_IF_ERR();
     }
@@ -4920,17 +4981,17 @@
 DBEnv_get_private(DBEnvObject* self)
 {
     /* We can give out the private field even if dbenv is closed */
-    Py_INCREF(self->private);
-    return self->private;
+    Py_INCREF(self->private_obj);
+    return self->private_obj;
 }
 
 static PyObject*
-DBEnv_set_private(DBEnvObject* self, PyObject* private)
+DBEnv_set_private(DBEnvObject* self, PyObject* private_obj)
 {
     /* We can set the private field even if dbenv is closed */
-    Py_DECREF(self->private);
-    Py_INCREF(private);
-    self->private = private;
+    Py_DECREF(self->private_obj);
+    Py_INCREF(private_obj);
+    self->private_obj = private_obj;
     RETURN_NONE();
 }
 
@@ -5116,8 +5177,18 @@
             return Py_BuildValue("(iO)", err, Py_None);
             break;
         case DB_REP_NEWSITE :
-            return Py_BuildValue("(is#)", err, rec.data, rec.size);
-            break;
+            {
+                PyObject *tmp, *r;
+
+                if (!(tmp = PyBytes_FromStringAndSize(rec.data, rec.size))) {
+                    return NULL;
+                }
+
+                r = Py_BuildValue("(iO)", err, tmp);
+                Py_DECREF(tmp);
+                return r;
+                break;
+            }
 #if (DBVER >= 42)
         case DB_REP_NOTPERM :
         case DB_REP_ISPERM :
@@ -5136,6 +5207,7 @@
     DBEnvObject *dbenv;
     PyObject* rep_transport;
     PyObject* args;
+    PyObject *a, *b;
     PyObject* result = NULL;
     int ret=0;
 
@@ -5143,15 +5215,21 @@
     dbenv = (DBEnvObject *)db_env->app_private;
     rep_transport = dbenv->rep_transport;
 
+    /*
+    ** The errors in 'a' or 'b' are detected in "Py_BuildValue".
+    */
+    a = PyBytes_FromStringAndSize(control->data, control->size);
+    b = PyBytes_FromStringAndSize(rec->data, rec->size);
+
     args = Py_BuildValue(
 #if (PY_VERSION_HEX >= 0x02040000)
-            "(Os#s#(ll)iI)",
+            "(OOO(ll)iI)",
 #else
-            "(Os#s#(ll)ii)",
+            "(OOO(ll)ii)",
 #endif
             dbenv,
-            control->data, control->size,
-            rec->data, rec->size, lsn->file, lsn->offset, envid, flags);
+            a, b,
+            lsn->file, lsn->offset, envid, flags);
     if (args) {
         result = PyEval_CallObject(rep_transport, args);
     }
@@ -5160,6 +5238,8 @@
         PyErr_Print();
         ret = -1;
     }
+    Py_XDECREF(a);
+    Py_XDECREF(b);
     Py_XDECREF(args);
     Py_XDECREF(result);
     MYDB_END_BLOCK_THREADS;
@@ -6070,7 +6150,7 @@
     err = self->sequence->open(self->sequence, txn, &key, flags);
     MYDB_END_ALLOW_THREADS
 
-    CLEAR_DBT(key);
+    FREE_DBT(key);
     RETURN_IF_ERR();
 
     if (txn) {
@@ -6259,7 +6339,7 @@
 /* Method definition tables and type objects */
 
 static PyMethodDef DB_methods[] = {
-    {"append",          (PyCFunction)DB_append,         METH_VARARGS},
+    {"append",          (PyCFunction)DB_append,         METH_VARARGS|METH_KEYWORDS},
     {"associate",       (PyCFunction)DB_associate,      METH_VARARGS|METH_KEYWORDS},
     {"close",           (PyCFunction)DB_close,          METH_VARARGS},
     {"consume",         (PyCFunction)DB_consume,        METH_VARARGS|METH_KEYWORDS},
@@ -6275,7 +6355,7 @@
     {"get_type",        (PyCFunction)DB_get_type,       METH_NOARGS},
     {"join",            (PyCFunction)DB_join,           METH_VARARGS},
     {"key_range",       (PyCFunction)DB_key_range,      METH_VARARGS|METH_KEYWORDS},
-    {"has_key",         (PyCFunction)DB_has_key,        METH_VARARGS},
+    {"has_key",         (PyCFunction)DB_has_key,        METH_VARARGS|METH_KEYWORDS},
     {"items",           (PyCFunction)DB_items,          METH_VARARGS},
     {"keys",            (PyCFunction)DB_keys,           METH_VARARGS},
     {"open",            (PyCFunction)DB_open,           METH_VARARGS|METH_KEYWORDS},

Modified: python/branches/tlee-ast-optimize/Modules/_fileio.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_fileio.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_fileio.c	Sun Sep  7 18:03:22 2008
@@ -262,7 +262,7 @@
 #endif
 			self->fd = open(name, flags, 0666);
 		Py_END_ALLOW_THREADS
-		if (self->fd < 0 || dircheck(self) < 0) {
+		if (self->fd < 0) {
 #ifdef MS_WINDOWS
 			PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
 #else
@@ -270,6 +270,8 @@
 #endif
 			goto error;
 		}
+		if(dircheck(self) < 0)
+			goto error;
 	}
 
 	goto done;

Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h	(original)
+++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h	Sun Sep  7 18:03:22 2008
@@ -37,6 +37,17 @@
 #endif
 
 /*
+ * Issue 3110 - Solaris does not define SEM_VALUE_MAX
+ */
+#ifndef SEM_VALUE_MAX
+#  ifdef _SEM_VALUE_MAX
+#    define SEM_VALUE_MAX _SEM_VALUE_MAX
+#  else
+#    define SEM_VALUE_MAX INT_MAX
+#  endif
+#endif
+
+/*
  * Make sure Py_ssize_t available
  */
 

Modified: python/branches/tlee-ast-optimize/Modules/bsddb.h
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/bsddb.h	(original)
+++ python/branches/tlee-ast-optimize/Modules/bsddb.h	Sun Sep  7 18:03:22 2008
@@ -105,7 +105,7 @@
 #error "eek! DBVER can't handle minor versions > 9"
 #endif
 
-#define PY_BSDDB_VERSION "4.7.2devel9"
+#define PY_BSDDB_VERSION "4.7.3pre5"
 
 /* Python object definitions */
 
@@ -134,7 +134,7 @@
     PyObject*       event_notifyCallback;
     struct DBObject *children_dbs;
     struct DBTxnObject *children_txns;
-    PyObject        *private;
+    PyObject        *private_obj;
     PyObject        *rep_transport;
     PyObject        *in_weakreflist; /* List of weak references */
 } DBEnvObject;
@@ -159,7 +159,7 @@
     PyObject*       associateCallback;
     PyObject*       btCompareCallback;
     int             primaryDBType;
-    PyObject        *private;
+    PyObject        *private_obj;
     PyObject        *in_weakreflist; /* List of weak references */
 } DBObject;
 

Modified: python/branches/tlee-ast-optimize/Objects/cobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/cobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/cobject.c	Sun Sep  7 18:03:22 2008
@@ -9,13 +9,6 @@
 typedef void (*destructor1)(void *);
 typedef void (*destructor2)(void *, void*);
 
-typedef struct {
-    PyObject_HEAD
-    void *cobject;
-    void *desc;
-    void (*destructor)(void *);
-} PyCObject;
-
 PyObject *
 PyCObject_FromVoidPtr(void *cobj, void (*destr)(void *))
 {

Modified: python/branches/tlee-ast-optimize/Objects/stringobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/stringobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/stringobject.c	Sun Sep  7 18:03:22 2008
@@ -1638,7 +1638,7 @@
 	}
 #ifdef Py_USING_UNICODE
 	else if (PyUnicode_Check(sep_obj))
-		return PyUnicode_Partition((PyObject *) self, sep_obj);
+		return PyUnicode_RPartition((PyObject *) self, sep_obj);
 #endif
 	else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len))
 		return NULL;

Modified: python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj	Sun Sep  7 18:03:22 2008
@@ -362,6 +362,9 @@
 			RelativePath="..\..\Modules\cjkcodecs\_codecs_tw.c">
 		</File>
 		<File
+			RelativePath="..\..\Modules\_bytesio.c">
+		</File>
+		<File
 			RelativePath="..\..\Modules\_codecsmodule.c">
 		</File>
 		<File
@@ -380,7 +383,7 @@
 			RelativePath="..\..\Modules\_hotshot.c">
 		</File>
 		<File
-			RelativePath="..\..\Modules\json.c">
+			RelativePath="..\..\Modules\_json.c">
 		</File>
 		<File
 			RelativePath="..\..\Modules\_localemodule.c">

Modified: python/branches/tlee-ast-optimize/PC/VS7.1/readme.txt
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS7.1/readme.txt	(original)
+++ python/branches/tlee-ast-optimize/PC/VS7.1/readme.txt	Sun Sep  7 18:03:22 2008
@@ -58,8 +58,8 @@
 
 The following subprojects will generally NOT build out of the box.  They
 wrap code Python doesn't control, and you'll need to download the base
-packages first and unpack them into siblings of PCbuilds's parent
-directory; for example, if your PCbuild is  .......\dist\src\PCbuild\,
+packages first and unpack them into siblings of PC's parent
+directory; for example, if this directory is ....\dist\trunk\PC\VS7.1,
 unpack into new subdirectories of dist\.
 
 _tkinter
@@ -126,7 +126,7 @@
 
     A custom pre-link step in the bz2 project settings should manage to
     build bzip2-1.0.3\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is
-    linked in PCbuild\.
+    linked in VS7.1\.
     However, the bz2 project is not smart enough to remove anything under
     bzip2-1.0.3\ when you do a clean, so if you want to rebuild bzip2.lib
     you need to clean up bzip2-1.0.3\ by hand.
@@ -222,7 +222,7 @@
     svn export http://svn.python.org/projects/external/sqlite-source-3.3.4
     
     To use the extension module in a Python build tree, copy sqlite3.dll into
-    the PCbuild folder.
+    the VS7.1 folder.
 
 _ssl
     Python wrapper for the secure sockets library.
@@ -239,7 +239,7 @@
         http://www.activestate.com/Products/ActivePerl/
     as this is used by the OpenSSL build process.  Complain to them <wink>.
 
-    The MSVC project simply invokes PCBuild/build_ssl.py to perform
+    The MSVC project simply invokes build_ssl.py to perform
     the build.  This Python script locates and builds your OpenSSL
     installation, then invokes a simple makefile to build the final .pyd.
 
@@ -283,11 +283,11 @@
 Note that Microsoft have withdrawn the free MS Toolkit Compiler, so this can
 no longer be considered a supported option. The instructions are still
 correct, but you need to already have a copy of the compiler in order to use
-them. Microsoft now supply Visual C++ 2005 Express Edition for free, but this
+them. Microsoft now supply Visual C++ 2008 Express Edition for free, but this
 is NOT compatible with Visual C++ 7.1 (it uses a different C runtime), and so
 cannot be used to build a version of Python compatible with the standard
-python.org build. If you are interested in using Visual C++ 2005 Express
-Edition, however, you should look at the PCBuild8 directory.
+python.org build. If you are interested in using Visual C++ 2008 Express
+Edition, however, you should look at the PCBuild directory.
 
 Requirements
 
@@ -358,7 +358,7 @@
 
         nant -buildfile:python.build all
 
-    from within the PCBuild directory.
+    from within the VS7.1 directory.
 
 Extension modules
 

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj	Sun Sep  7 18:03:22 2008
@@ -42,7 +42,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -55,6 +56,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="$(bsddbDepLibs)"
 				BaseAddress="0x1e180000"
 			/>
 			<Tool
@@ -103,7 +105,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -166,7 +169,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -229,7 +233,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -292,7 +297,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -355,7 +361,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -418,7 +425,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -481,7 +489,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\db-4.4.20\build_win32,..\..\..\db-4.4.20\build_win32\.."
+				AdditionalIncludeDirectories="..\..\..\db-4.7.25.0\build_windows,..\..\..\db-4.7.25.0\build_windows\.."
+				PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -540,6 +549,914 @@
 				>
 			</File>
 		</Filter>
+		<Filter
+			Name="Berkeley DB 4.7.25 Source Files"
+			>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\crypto\aes_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_compact.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_compare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_conv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_curadj.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_cursor.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_delete.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_put.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_reclaim.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_recno.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_rsearch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_search.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_split.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_upgrade.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\bt_verify.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\btree\btree_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\crdel_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\crdel_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\crypto\crypto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_am.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_byteorder.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_cam.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_cds.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_conv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_dispatch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_dup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_err.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_getlong.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_idspace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_iface.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_join.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_log2.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_meta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_overflow.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_ovfl_vrfy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_pr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_reclaim.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_remove.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_ret.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_setid.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_setlsn.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\db_shash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_stati.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_truncate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_upg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_upg_opd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_vrfy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\db\db_vrfyutil.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbm\dbm.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbreg\dbreg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbreg\dbreg_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbreg\dbreg_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbreg\dbreg_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\dbreg\dbreg_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\dbt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_failchk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_file.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_globals.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_name.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_recover.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_register.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_sig.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\env\env_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\fileops\fileops_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\fileops\fop_basic.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\fileops\fop_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\fileops\fop_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_conv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_dup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_func.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_meta.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_page.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_reclaim.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_upgrade.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hash\hash_verify.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hmac\hmac.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hsearch\hsearch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_deadlock.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_failchk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_id.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_list.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_timer.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\lock\lock_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_archive.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_compare.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_debug.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_get.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_put.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\log\log_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\mkpath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_bh.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_fget.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_fmethod.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_fopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_fput.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_fset.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_mvcc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_register.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_resize.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_sync.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mp\mp_trickle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\crypto\mersenne\mt19937db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_failchk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\mutex\mut_win32.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\openflags.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_abort.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_abs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_addrinfo.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_alloc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_clock.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_cpu.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_ctime.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_dir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_errno.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_fid.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_flock.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_fsync.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_getenv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_handle.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_map.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\os_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_mkdir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_pid.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_rename.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_root.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_rpath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_rw.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_seek.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_stack.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_tmpdir.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_truncate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os\os_uid.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_unlink.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\os_windows\os_yield.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_conv.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_files.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_open.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_upgrade.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\qam\qam_verify.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_backup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_elect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_lease.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_record.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\rep\rep_verify.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_elect.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_msg.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_net.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_queue.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_sel.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\repmgr\repmgr_windows.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\crypto\rijndael\rijndael-alg-fst.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\crypto\rijndael\rijndael-api-fst.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\sequence\seq_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\sequence\sequence.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\hmac\sha1.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\clib\strsep.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_auto.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_chkpt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_failchk.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_method.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_rec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_recover.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_region.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_stat.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\txn\txn_util.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\util_cache.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\util_log.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\util_sig.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\xa\xa.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\xa\xa_db.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\xa\xa_map.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\db-4.7.25.0\build_windows\..\common\zerofill.c"
+				>
+			</File>
+		</Filter>
 	</Files>
 	<Globals>
 	</Globals>

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj	Sun Sep  7 18:03:22 2008
@@ -642,7 +642,7 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="ml64 /nologo /c /Fo &quot;$(IntDir)\win64.obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						CommandLine="ml64 /nologo /c /Zi /Fo &quot;$(IntDir)\win64.obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
 						Outputs="$(IntDir)\win64.obj"
 					/>
 				</FileConfiguration>

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_multiprocessing.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/_multiprocessing.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/_multiprocessing.vcproj	Sun Sep  7 18:03:22 2008
@@ -3,9 +3,10 @@
 	ProjectType="Visual C++"
 	Version="8.00"
 	Name="_multiprocessing"
-	ProjectGUID="{9E48B300-37D1-11DD-8C41-005056C00008}"
+	ProjectGUID="{9e48b300-37d1-11dd-8c41-005056c00008}"
 	RootNamespace="_multiprocessing"
 	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
 	>
 	<Platforms>
 		<Platform
@@ -75,18 +76,14 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
+			Name="Debug|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops"
+			InheritedPropertySheets=".\pyd_d.vsprops;.\x64.vsprops"
 			CharacterSet="0"
-			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -102,6 +99,7 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
@@ -139,16 +137,13 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="PGInstrument|Win32"
+			Name="Release|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\pginstrument.vsprops"
+			InheritedPropertySheets=".\pyd.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -203,16 +198,13 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="PGUpdate|Win32"
+			Name="Release|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\pgupdate.vsprops"
+			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -230,6 +222,7 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
@@ -267,17 +260,15 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="PGInstrument|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd_d.vsprops;.\x64.vsprops"
+			InheritedPropertySheets=".\pyd.vsprops;.\pginstrument.vsprops"
 			CharacterSet="0"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -293,7 +284,6 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
@@ -335,9 +325,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|x64"
+			Name="PGInstrument|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops"
+			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -373,6 +363,7 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="ws2_32.lib"
 				BaseAddress="0x1e1D0000"
+				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -397,9 +388,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="PGInstrument|x64"
+			Name="PGUpdate|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
+			InheritedPropertySheets=".\pyd.vsprops;.\pgupdate.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -417,7 +408,6 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
@@ -435,7 +425,6 @@
 				Name="VCLinkerTool"
 				AdditionalDependencies="ws2_32.lib"
 				BaseAddress="0x1e1D0000"
-				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -530,11 +519,11 @@
 			Name="Header Files"
 			>
 			<File
-				RelativePath="..\..\Modules\_multiprocessing\connection.h"
+				RelativePath="..\..\Modules\_multiprocessing\multiprocessing.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\Modules\_multiprocessing\multiprocessing.h"
+				RelativePath="..\..\Modules\_multiprocessing\connection.h"
 				>
 			</File>
 		</Filter>

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj	Sun Sep  7 18:03:22 2008
@@ -42,7 +42,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -104,7 +104,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -166,7 +166,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -229,7 +229,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -291,7 +291,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -354,7 +354,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -417,7 +417,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool
@@ -480,7 +480,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
 				PreprocessorDefinitions="MODULE_NAME=\&quot;sqlite3\&quot;"
 			/>
 			<Tool

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln	Sun Sep  7 18:03:22 2008
@@ -41,7 +41,6 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}"
 	ProjectSection(ProjectDependencies) = postProject
 		{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
-		{62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19}
 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
 	EndProjectSection
 EndProject
@@ -121,11 +120,6 @@
 		{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}"
-	ProjectSection(ProjectDependencies) = postProject
-		{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
 	ProjectSection(ProjectDependencies) = postProject
 		{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
@@ -510,22 +504,6 @@
 		{447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32
 		{447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64
 		{447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64
-		{62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64
 		{A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32
 		{A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops	Sun Sep  7 18:03:22 2008
@@ -50,11 +50,11 @@
 	/>
 	<UserMacro
 		Name="bsddbDir"
-		Value="$(bsddb44Dir)"
+		Value="$(bsddb47Dir)"
 	/>
 	<UserMacro
 		Name="bsddbDepLibs"
-		Value="$(bsddb44DepLibs)"
+		Value="$(bsddb47DepLibs)"
 	/>
 	<UserMacro
 		Name="bsddb44Dir"
@@ -65,20 +65,20 @@
 		Value=""
 	/>
 	<UserMacro
-		Name="bsddb45Dir"
-		Value="$(externalsDir)\db-4.5.20.x\build_windows"
+		Name="bsddb47Dir"
+		Value="$(externalsDir)\db-4.7.25.0\build_windows"
 	/>
 	<UserMacro
-		Name="bsddb45DepLibs"
+		Name="bsddb47DepLibs"
 		Value="ws2_32.lib"
 	/>
 	<UserMacro
 		Name="sqlite3Dir"
-		Value="$(externalsDir)\sqlite-source-3.3.4"
+		Value="$(externalsDir)\sqlite-3.5.9"
 	/>
 	<UserMacro
 		Name="bz2Dir"
-		Value="$(externalsDir)\bzip2-1.0.3"
+		Value="$(externalsDir)\bzip2-1.0.5"
 	/>
 	<UserMacro
 		Name="opensslDir"

Modified: python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj
==============================================================================
--- python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj	(original)
+++ python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj	Sun Sep  7 18:03:22 2008
@@ -42,7 +42,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -56,7 +57,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\$(ProjectName)_d.dll"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -104,7 +104,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -118,7 +119,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\$(ProjectName)_d.dll"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -166,7 +166,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -180,7 +181,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\$(ProjectName).dll"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -229,7 +229,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -243,7 +244,6 @@
 			<Tool
 				Name="VCLinkerTool"
 				OutputFile="$(OutDir)\$(ProjectName).dll"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -291,7 +291,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -304,7 +305,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -353,7 +354,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -366,7 +368,6 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -414,7 +415,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -427,7 +429,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
+				OutputFile="$(OutDir)\$(ProjectName).dll"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -476,7 +478,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\sqlite-source-3.3.4"
+				AdditionalIncludeDirectories="..\..\..\sqlite-3.5.9"
+				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -489,7 +492,6 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				ModuleDefinitionFile="..\..\..\sqlite-source-3.3.4\sqlite3.def"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -521,51 +523,11 @@
 			Name="Header Files"
 			>
 			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\btree.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\hash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\keywordhash.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\opcodes.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\os.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\os_common.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\pager.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\parse.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\sqlite3.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\sqliteInt.h"
+				RelativePath="..\..\..\sqlite-3.5.9\sqlite3.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbe.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbeInt.h"
+				RelativePath="..\..\..\sqlite-3.5.9\sqlite3ext.h"
 				>
 			</File>
 		</Filter>
@@ -573,167 +535,7 @@
 			Name="Source Files"
 			>
 			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\alter.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\analyze.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\attach.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\auth.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\btree.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\build.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\callback.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\complete.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\date.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\delete.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\expr.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\func.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\hash.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\insert.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\legacy.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\main.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\opcodes.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\os.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\os_unix.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\os_win.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\pager.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\parse.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\pragma.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\prepare.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\printf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\random.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\select.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\shell.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\table.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\tokenize.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\trigger.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\update.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\utf.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\util.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vacuum.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbe.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbeapi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbeaux.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbefifo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\vdbemem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\sqlite-source-3.3.4\where.c"
+				RelativePath="..\..\..\sqlite-3.5.9\sqlite3.c"
 				>
 			</File>
 		</Filter>

Modified: python/branches/tlee-ast-optimize/PCbuild/vs9to8.py
==============================================================================
--- python/branches/tlee-ast-optimize/PCbuild/vs9to8.py	(original)
+++ python/branches/tlee-ast-optimize/PCbuild/vs9to8.py	Sun Sep  7 18:03:22 2008
@@ -24,9 +24,9 @@
 
             # Bah. VS8.0 does not expand macros in file names.
             # Replace them here.
-            lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-source-3.3.4')
-            lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.4.20\\build_win32\\..')
-            lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.4.20\\build_win32')
+            lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-3.5.9')
+            lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.7.25.0\\build_windows\\..')
+            lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.7.25.0\\build_windows')
 
         with open(destname, 'wb') as fout:
             lines = lines.replace("\n", "\r\n")

Modified: python/branches/tlee-ast-optimize/Python/_warnings.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/_warnings.c	(original)
+++ python/branches/tlee-ast-optimize/Python/_warnings.c	Sun Sep  7 18:03:22 2008
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "code.h"  /* For DeprecationWarning about adding 'line'. */
 #include "frameobject.h"
 
 #define MODULE_NAME "_warnings"
@@ -416,11 +417,16 @@
                 /* A proper implementation of warnings.showwarning() should
                     have at least two default arguments. */
                 if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) {
-                    if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) {
-                        Py_DECREF(show_fxn);
-                        goto cleanup;
+	            PyCodeObject *code = (PyCodeObject *)
+						PyFunction_GetCode(check_fxn);
+		    if (!(code->co_flags & CO_VARARGS)) {
+		        if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) <
+				0) {
+                            Py_DECREF(show_fxn);
+                            goto cleanup;
+                        }
                     }
-                }
+		}
                 res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
                                                     filename, lineno_obj,
                                                     NULL);

Modified: python/branches/tlee-ast-optimize/Python/getargs.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/getargs.c	(original)
+++ python/branches/tlee-ast-optimize/Python/getargs.c	Sun Sep  7 18:03:22 2008
@@ -139,24 +139,35 @@
 
 /* Handle cleanup of allocated memory in case of exception */
 
+static void
+cleanup_ptr(void *ptr)
+{
+	PyMem_FREE(ptr);
+}
+
+static void
+cleanup_buffer(void *ptr)
+{
+	PyBuffer_Release((Py_buffer *) ptr);
+}
+
 static int
-addcleanup(void *ptr, PyObject **freelist)
+addcleanup(void *ptr, PyObject **freelist, void (*destr)(void *))
 {
 	PyObject *cobj;
 	if (!*freelist) {
 		*freelist = PyList_New(0);
 		if (!*freelist) {
-			PyMem_FREE(ptr);
+			destr(ptr);
 			return -1;
 		}
 	}
-	cobj = PyCObject_FromVoidPtr(ptr, NULL);
+	cobj = PyCObject_FromVoidPtr(ptr, destr);
 	if (!cobj) {
-		PyMem_FREE(ptr);
+		destr(ptr);
 		return -1;
 	}
 	if (PyList_Append(*freelist, cobj)) {
-                PyMem_FREE(ptr);
 		Py_DECREF(cobj);
 		return -1;
 	}
@@ -167,15 +178,15 @@
 static int
 cleanreturn(int retval, PyObject *freelist)
 {
-	if (freelist) {
-		if (retval == 0) {
-			Py_ssize_t len = PyList_GET_SIZE(freelist), i;
-			for (i = 0; i < len; i++)
-                                PyMem_FREE(PyCObject_AsVoidPtr(
-                                		PyList_GET_ITEM(freelist, i)));
-		}
-		Py_DECREF(freelist);
+	if (freelist && retval != 0) {
+		/* We were successful, reset the destructors so that they
+		   don't get called. */
+		Py_ssize_t len = PyList_GET_SIZE(freelist), i;
+		for (i = 0; i < len; i++)
+			((PyCObject *) PyList_GET_ITEM(freelist, i))
+				->destructor = NULL;
 	}
+	Py_XDECREF(freelist);
 	return retval;
 }
 
@@ -798,6 +809,11 @@
 				if (getbuffer(arg, p, &buf) < 0)
 					return converterr(buf, arg, msgbuf, bufsize);
 			}
+			if (addcleanup(p, freelist, cleanup_buffer)) {
+				return converterr(
+					"(cleanup problem)",
+					arg, msgbuf, bufsize);
+			}
 			format++;
 		} else if (*format == '#') {
 			void **p = (void **)va_arg(*p_va, char **);
@@ -875,6 +891,11 @@
 				if (getbuffer(arg, p, &buf) < 0)
 					return converterr(buf, arg, msgbuf, bufsize);
 			}
+			if (addcleanup(p, freelist, cleanup_buffer)) {
+				return converterr(
+					"(cleanup problem)",
+					arg, msgbuf, bufsize);
+			}
 			format++;
 		} else if (*format == '#') { /* any buffer-like object */
 			void **p = (void **)va_arg(*p_va, char **);
@@ -1051,7 +1072,7 @@
 						"(memory error)",
 						arg, msgbuf, bufsize);
 				}
-				if (addcleanup(*buffer, freelist)) {
+				if (addcleanup(*buffer, freelist, cleanup_ptr)) {
 					Py_DECREF(s);
 					return converterr(
 						"(cleanup problem)",
@@ -1096,7 +1117,7 @@
 				return converterr("(memory error)",
 						  arg, msgbuf, bufsize);
 			}
-			if (addcleanup(*buffer, freelist)) {
+			if (addcleanup(*buffer, freelist, cleanup_ptr)) {
 				Py_DECREF(s);
 				return converterr("(cleanup problem)",
 						arg, msgbuf, bufsize);
@@ -1214,6 +1235,11 @@
 				PyErr_Clear();
 				return converterr("read-write buffer", arg, msgbuf, bufsize);
 			}
+			if (addcleanup(p, freelist, cleanup_buffer)) {
+				return converterr(
+					"(cleanup problem)",
+					arg, msgbuf, bufsize);
+			}
 			if (!PyBuffer_IsContiguous((Py_buffer*)p, 'C'))
 				return converterr("contiguous buffer", arg, msgbuf, bufsize);
 			break;

Modified: python/branches/tlee-ast-optimize/Python/import.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/import.c	(original)
+++ python/branches/tlee-ast-optimize/Python/import.c	Sun Sep  7 18:03:22 2008
@@ -2049,7 +2049,7 @@
 	else {
 		PyErr_Clear();
 	}
-
+#ifdef WITH_THREAD
 	/* check the import lock
 	 * me might be -1 but I ignore the error here, the lock function
 	 * takes care of the problem */
@@ -2065,6 +2065,9 @@
 			     name);
 		return NULL;
 	}
+#else
+	return PyImport_ImportModule(name);
+#endif
 }
 
 /* Forward declarations for helper routines */

Modified: python/branches/tlee-ast-optimize/README
==============================================================================
--- python/branches/tlee-ast-optimize/README	(original)
+++ python/branches/tlee-ast-optimize/README	Sun Sep  7 18:03:22 2008
@@ -90,12 +90,6 @@
 primarily for documentation authors, translators, and people with special
 formatting requirements.
 
-Unfortunately, new-style classes (new in Python 2.2) have not yet been
-integrated into Python's standard documentation.  A collection of
-pointers to what has been written is at:
-
-    http://www.python.org/doc/newstyle.html
-
 
 Web sites
 ---------

Modified: python/branches/tlee-ast-optimize/Tools/scripts/2to3
==============================================================================
--- python/branches/tlee-ast-optimize/Tools/scripts/2to3	(original)
+++ python/branches/tlee-ast-optimize/Tools/scripts/2to3	Sun Sep  7 18:03:22 2008
@@ -1,7 +1,6 @@
 #!/usr/bin/env python
-from lib2to3 import refactor
+from lib2to3.main import main
 import sys
 import os
 
-fixers = os.path.join(os.path.dirname(refactor.__file__), "fixes")
-sys.exit(refactor.main(fixers))
+sys.exit(main("lib2to3.fixes"))

Modified: python/branches/tlee-ast-optimize/configure
==============================================================================
--- python/branches/tlee-ast-optimize/configure	(original)
+++ python/branches/tlee-ast-optimize/configure	Sun Sep  7 18:03:22 2008
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 65183 .
+# From configure.in Revision: 66283 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 2.6.
 #
@@ -22959,14 +22959,20 @@
 # save the value of LIBS so we don't actually link Python with readline
 LIBS_no_readline=$LIBS
 
-{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
-echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
-if test "${ac_cv_lib_readline_readline+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+# On some systems we need to link readline to a termcap compatible
+# library.  NOTE: Keep the precedence of listed libraries synchronised
+# with setup.py.
+py_cv_lib_readline=no
+{ echo "$as_me:$LINENO: checking how to link readline libs" >&5
+echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; }
+for py_libtermcap in "" ncursesw ncurses curses termcap; do
+  if test -z "$py_libtermcap"; then
+    READLINE_LIBS="-lreadline"
+  else
+    READLINE_LIBS="-lreadline -l$py_libtermcap"
+  fi
+  LIBS="$READLINE_LIBS $LIBS_no_readline"
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -23006,102 +23012,33 @@
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_readline_readline=yes
+  py_cv_lib_readline=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_readline_readline=no
+
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
-echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
-if test $ac_cv_lib_readline_readline = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBREADLINE 1
-_ACEOF
-
-  LIBS="-lreadline $LIBS"
-
-fi
-
-if test "$ac_cv_have_readline_readline" = no
-then
-
-{ echo "$as_me:$LINENO: checking for readline in -ltermcap" >&5
-echo $ECHO_N "checking for readline in -ltermcap... $ECHO_C" >&6; }
-if test "${ac_cv_lib_termcap_readline+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermcap  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char readline ();
-int
-main ()
-{
-return readline ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_termcap_readline=yes
+  if test $py_cv_lib_readline = yes; then
+    break
+  fi
+done
+# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
+#AC_SUBST([READLINE_LIBS])
+if test $py_cv_lib_readline = !yes; then
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5
+echo "${ECHO_T}$READLINE_LIBS" >&6; }
 
-	ac_cv_lib_termcap_readline=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_readline" >&5
-echo "${ECHO_T}$ac_cv_lib_termcap_readline" >&6; }
-if test $ac_cv_lib_termcap_readline = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBTERMCAP 1
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBREADLINE 1
 _ACEOF
 
-  LIBS="-ltermcap $LIBS"
-
-fi
-
 fi
 
 # check for readline 2.1
@@ -23111,7 +23048,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23239,7 +23176,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23310,7 +23247,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23381,7 +23318,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
+LIBS="-lreadline $READLINE_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF

Modified: python/branches/tlee-ast-optimize/configure.in
==============================================================================
--- python/branches/tlee-ast-optimize/configure.in	(original)
+++ python/branches/tlee-ast-optimize/configure.in	Sun Sep  7 18:03:22 2008
@@ -3324,16 +3324,40 @@
 # check where readline lives
 # save the value of LIBS so we don't actually link Python with readline
 LIBS_no_readline=$LIBS
-AC_CHECK_LIB(readline, readline)
-if test "$ac_cv_have_readline_readline" = no
-then
-  AC_CHECK_LIB(termcap, readline)
+
+# On some systems we need to link readline to a termcap compatible
+# library.  NOTE: Keep the precedence of listed libraries synchronised
+# with setup.py.
+py_cv_lib_readline=no
+AC_MSG_CHECKING([how to link readline libs])
+for py_libtermcap in "" ncursesw ncurses curses termcap; do
+  if test -z "$py_libtermcap"; then
+    READLINE_LIBS="-lreadline"
+  else
+    READLINE_LIBS="-lreadline -l$py_libtermcap"
+  fi
+  LIBS="$READLINE_LIBS $LIBS_no_readline"
+  AC_LINK_IFELSE(
+    [AC_LANG_CALL([],[readline])],
+    [py_cv_lib_readline=yes])
+  if test $py_cv_lib_readline = yes; then
+    break
+  fi
+done
+# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
+#AC_SUBST([READLINE_LIBS])
+if test $py_cv_lib_readline = !yes; then
+  AC_MSG_RESULT([none])
+else
+  AC_MSG_RESULT([$READLINE_LIBS])
+  AC_DEFINE(HAVE_LIBREADLINE, 1,
+    [Define if you have the readline library (-lreadline).])
 fi
 
 # check for readline 2.1
 AC_CHECK_LIB(readline, rl_callback_handler_install,
 	AC_DEFINE(HAVE_RL_CALLBACK, 1,
-        [Define if you have readline 2.1]), , )
+        [Define if you have readline 2.1]), ,$READLINE_LIBS)
 
 # check for readline 2.2
 AC_TRY_CPP([#include <readline/readline.h>],
@@ -3349,17 +3373,17 @@
 # check for readline 4.0
 AC_CHECK_LIB(readline, rl_pre_input_hook,
 	AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
-        [Define if you have readline 4.0]), , )
+        [Define if you have readline 4.0]), ,$READLINE_LIBS)
 
 # also in 4.0
 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
 	AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
-        [Define if you have readline 4.0]), , )
+        [Define if you have readline 4.0]), ,$READLINE_LIBS)
 
 # check for readline 4.2
 AC_CHECK_LIB(readline, rl_completion_matches,
 	AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
-        [Define if you have readline 4.2]), , )
+        [Define if you have readline 4.2]), ,$READLINE_LIBS)
 
 # also in readline 4.2
 AC_TRY_CPP([#include <readline/readline.h>],

Modified: python/branches/tlee-ast-optimize/pyconfig.h.in
==============================================================================
--- python/branches/tlee-ast-optimize/pyconfig.h.in	(original)
+++ python/branches/tlee-ast-optimize/pyconfig.h.in	Sun Sep  7 18:03:22 2008
@@ -366,9 +366,6 @@
 /* Define to 1 if you have the `resolv' library (-lresolv). */
 #undef HAVE_LIBRESOLV
 
-/* Define to 1 if you have the `termcap' library (-ltermcap). */
-#undef HAVE_LIBTERMCAP
-
 /* Define to 1 if you have the <libutil.h> header file. */
 #undef HAVE_LIBUTIL_H
 


More information about the Python-checkins mailing list