[Python-checkins] r66030 - in python/branches/tlee-ast-optimize: Demo/embed/Makefile Demo/parser/unparse.py Doc/bugs.rst Doc/c-api/object.rst Doc/c-api/typeobj.rst Doc/includes/mp_distributing.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/library/multiprocessing.rst Doc/library/symtable.rst Doc/library/threading.rst Doc/library/types.rst Doc/reference/expressions.rst Grammar/Grammar Include/object.h Include/patchlevel.h Include/pymath.h Lib/compiler/transformer.py Lib/cookielib.py Lib/csv.py Lib/ctypes/test/test_pointers.py Lib/ctypes/wintypes.py Lib/decimal.py Lib/distutils/__init__.py Lib/distutils/core.py Lib/distutils/cygwinccompiler.py Lib/dummy_thread.py Lib/filecmp.py Lib/hmac.py Lib/idlelib/idlever.py Lib/inspect.py Lib/io.py Lib/lib-tk/Tkinter.py Lib/lib2to3 Lib/lib2to3/refactor.py Lib/logging/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/forking.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/os.py Lib/shelve.py Lib/symtable.py Lib/test/test_bytes.py Lib/test/test_compiler.py Lib/test/test_dummy_threading.py Lib/test/test_fileio.py Lib/test/test_float.py Lib/test/test_grammar.py Lib/test/test_list.py Lib/test/test_multiprocessing.py Lib/test/test_os.py Lib/test/test_parser.py Lib/test/test_py3kwarn.py Lib/test/test_re.py Lib/test/test_smtplib.py Lib/test/test_socketserver.py Lib/test/test_ssl.py Lib/test/test_struct.py Lib/test/test_symtable.py Lib/test/test_threading.py Lib/test/test_unicode.py Lib/threading.py Lib/urllib2.py Lib/weakref.py Lib/zipfile.py Misc/NEWS Misc/RPM/python-2.6.spec Misc/build.sh Misc/valgrind-python.supp Modules/_collectionsmodule.c Modules/_ctypes/_ctypes.c Modules/_ctypes/stgdict.c Modules/_fileio.c Modules/_sqlite/row.c Modules/_testcapimodule.c Modules/cjkcodecs/multibytecodec.c Modules/imageop.c Modules/mmapmodule.c Modules/signalmodule.c Modules/symtablemodule.c Objects/bytearrayobject.c Objects/classobject.c Objects/floatobject.c Objects/obmalloc.c Objects/stringlib/find.h Objects/stringlib/formatter.h Objects/stringlib/string_format.h Objects/structseq.c Objects/typeobject.c Python/ast.c Python/bltinmodule.c Python/getargs.c Python/graminit.c Python/pythonrun.c README Tools/scripts/2to3 Tools/scripts/idle

thomas.lee python-checkins at python.org
Mon Aug 25 14:19:15 CEST 2008


Author: thomas.lee
Date: Mon Aug 25 14:19:12 2008
New Revision: 66030

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

................
  r65761 | antoine.pitrou | 2008-08-17 23:06:29 +1000 (Sun, 17 Aug 2008) | 3 lines
  
  fix ZipFile.testzip() to work with very large embedded files
................
  r65762 | hirokazu.yamamoto | 2008-08-17 23:10:46 +1000 (Sun, 17 Aug 2008) | 2 lines
  
  Backport r65661, r65760: Issue #3575: Incremental decoder's decode
  function now takes bytearray by using 's*' instead of 't#'.
................
  r65768 | antoine.pitrou | 2008-08-18 00:43:41 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  backport r65723: strengthen test_os.test_closerange
................
  r65773 | antoine.pitrou | 2008-08-18 03:01:49 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  #3556: test_raiseMemError consumes an insane amount of memory
................
  r65775 | benjamin.peterson | 2008-08-18 03:13:26 +1000 (Mon, 18 Aug 2008) | 5 lines
  
  get the symtable module back in working order
  - Fix broken functions
  - Add (hopefully) extensive tests
  - Modernize a little
................
  r65780 | antoine.pitrou | 2008-08-18 06:15:07 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  #3580: fix a failure in test_os
................
  r65782 | benjamin.peterson | 2008-08-18 06:33:45 +1000 (Mon, 18 Aug 2008) | 1 line
  
  set svn:executable on a script
................
  r65785 | amaury.forgeotdarc | 2008-08-18 07:05:18 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  Fix a refleak in bytearray.split and bytearray.rsplit, detected by 
     regrtest.py -R:: test_bytes
................
  r65787 | brett.cannon | 2008-08-18 08:10:11 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  Remove imports of 'warnings' that are no longer needed in dummy_thread,
  filecmp, and shelve.
................
  r65791 | brett.cannon | 2008-08-18 10:36:52 +1000 (Mon, 18 Aug 2008) | 2 lines
  
  Remove two unneeded imports in 'io'.
................
  r65793 | brett.cannon | 2008-08-18 10:41:11 +1000 (Mon, 18 Aug 2008) | 2 lines
  
  Remove an unneeded import of abc.ABCMeta from 'inspect'.
................
  r65795 | brett.cannon | 2008-08-18 10:46:22 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  Update __all__ for cookielib, csv, os, and urllib2 for objects imported into
  the module but exposed as part of the API.
................
  r65798 | benjamin.peterson | 2008-08-18 11:27:05 +1000 (Mon, 18 Aug 2008) | 1 line
  
  correct version
................
  r65802 | benjamin.peterson | 2008-08-18 12:01:21 +1000 (Mon, 18 Aug 2008) | 1 line
  
  follup to #3473: don't duplicate the reduce code
................
  r65803 | benjamin.peterson | 2008-08-18 12:12:23 +1000 (Mon, 18 Aug 2008) | 1 line
  
  add a test for reduce's move
................
  r65806 | marc-andre.lemburg | 2008-08-18 21:13:45 +1000 (Mon, 18 Aug 2008) | 3 lines
  
  Restore Python 2.3 compatibility and remove "with" usage.
................
  r65809 | nick.coghlan | 2008-08-18 22:42:46 +1000 (Mon, 18 Aug 2008) | 1 line
  
  Belated NEWS entry for r65642
................
  r65810 | nick.coghlan | 2008-08-18 23:14:22 +1000 (Mon, 18 Aug 2008) | 1 line
  
  Issue 2235: document PyObject_HashNotImplemented
................
  r65812 | nick.coghlan | 2008-08-18 23:32:19 +1000 (Mon, 18 Aug 2008) | 1 line
  
  Fix typo
................
  r65814 | eric.smith | 2008-08-19 00:27:38 +1000 (Tue, 19 Aug 2008) | 12 lines
  
  Backport of r63826.
  
  Optimization of str.format() for cases with str, unicode, int, long,
  and float arguments.  This gives about 30% speed improvement for the
  simplest (but most common) cases.  This patch skips the __format__
  dispatch, and also avoids creating an object to hold the format_spec.
  
  Unfortunately there's a complication in 2.6 with int, long, and float
  because they always expect str format_specs.  So in the unicode
  version of this optimization, just check for unicode objects.  int,
  float, long, and str can be added later, if needed.
................
  r65818 | benjamin.peterson | 2008-08-19 02:40:03 +1000 (Tue, 19 Aug 2008) | 4 lines
  
  change threading.getIdent to a property
  
  This is new in 2.6 so now need to worry about backwards compatibility :)
................
  r65822 | benjamin.peterson | 2008-08-19 03:45:09 +1000 (Tue, 19 Aug 2008) | 1 line
  
  backport threading property changes
................
  r65824 | benjamin.peterson | 2008-08-19 04:01:43 +1000 (Tue, 19 Aug 2008) | 1 line
  
  change a few uses of the threading APIs
................
  r65826 | benjamin.peterson | 2008-08-19 04:13:17 +1000 (Tue, 19 Aug 2008) | 1 line
  
  bring back the old API
................
  r65828 | benjamin.peterson | 2008-08-19 04:31:58 +1000 (Tue, 19 Aug 2008) | 1 line
  
  patch up multiprocessing until it's API can be changed too
................
  r65829 | benjamin.peterson | 2008-08-19 04:39:57 +1000 (Tue, 19 Aug 2008) | 1 line
  
  fix old API names in test_ssl
................
  r65834 | amaury.forgeotdarc | 2008-08-19 05:23:47 +1000 (Tue, 19 Aug 2008) | 4 lines
  
  #2234 distutils failed with mingw binutils 2.18.50.20080109.
  Be less strict when parsing these version numbers, 
  they don't necessarily follow the python numbering scheme.
................
  r65839 | benjamin.peterson | 2008-08-19 07:53:29 +1000 (Tue, 19 Aug 2008) | 4 lines
  
  add py3k warnings for old threading APIs
  
  they will still live in 3.0 but it can't hurt
................
  r65842 | benjamin.peterson | 2008-08-19 08:29:19 +1000 (Tue, 19 Aug 2008) | 1 line
  
  update the threading docs to account for recent changes
................
  r65846 | georg.brandl | 2008-08-19 09:09:49 +1000 (Tue, 19 Aug 2008) | 2 lines
  
  Fix grammar.
................
  r65855 | benjamin.peterson | 2008-08-20 02:41:34 +1000 (Wed, 20 Aug 2008) | 13 lines
  
  Merged revisions 65853-65854 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r65853 | benjamin.peterson | 2008-08-19 11:09:09 -0500 (Tue, 19 Aug 2008) | 1 line
    
    apply a patch for #3131. this solves the problem for the moment, but we should do some refactoring to get display logic out of RefactoringTool
  ........
    r65854 | benjamin.peterson | 2008-08-19 11:37:38 -0500 (Tue, 19 Aug 2008) | 1 line
    
    another quick fix to get lib2to3 to work
  ........
................
  r65859 | thomas.heller | 2008-08-20 03:47:13 +1000 (Wed, 20 Aug 2008) | 2 lines
  
  Fix strange character in the docstring.
................
  r65861 | benjamin.peterson | 2008-08-20 03:59:23 +1000 (Wed, 20 Aug 2008) | 1 line
  
  get unparse to at least unparse its self
................
  r65864 | jesse.noller | 2008-08-20 05:06:19 +1000 (Wed, 20 Aug 2008) | 2 lines
  
  issue3352: clean up the multiprocessing API to remove many get_/set_ methods and convert them to properties. Update the docs and the examples included.
................
  r65865 | benjamin.peterson | 2008-08-20 05:07:38 +1000 (Wed, 20 Aug 2008) | 1 line
  
  silence callable warning in hmac
................
  r65868 | thomas.heller | 2008-08-20 05:25:04 +1000 (Wed, 20 Aug 2008) | 3 lines
  
  Fix a regression introduced by rev. 63792: ctypes function pointers
  that are COM methods must have a boolean True value.
................
  r65869 | benjamin.peterson | 2008-08-20 05:27:53 +1000 (Wed, 20 Aug 2008) | 1 line
  
  fix a little typo
................
  r65870 | thomas.heller | 2008-08-20 05:40:23 +1000 (Wed, 20 Aug 2008) | 1 line
  
  COM method code is windows specific
................
  r65872 | benjamin.peterson | 2008-08-20 05:52:46 +1000 (Wed, 20 Aug 2008) | 1 line
  
  allow keyword args to be passed in after *args #3473
................
  r65874 | guido.van.rossum | 2008-08-20 06:13:02 +1000 (Wed, 20 Aug 2008) | 3 lines
  
  Hopeful fix for issue 1878: remove Py_TPFLAGS_HAVE_VERSION_TAG from
  Py_TPFLAGS_DEFAULT when not building the core.
................
  r65880 | guido.van.rossum | 2008-08-20 07:02:04 +1000 (Wed, 20 Aug 2008) | 2 lines
  
  Issue 1179: [CVE-2007-4965] Integer overflow in imageop module.
................
  r65882 | benjamin.peterson | 2008-08-20 07:07:15 +1000 (Wed, 20 Aug 2008) | 9 lines
  
  Merged revisions 65876 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r65876 | benjamin.peterson | 2008-08-19 15:54:52 -0500 (Tue, 19 Aug 2008) | 1 line
    
    apply a fix I think will help Windows
  ........
................
  r65885 | benjamin.peterson | 2008-08-20 08:06:11 +1000 (Wed, 20 Aug 2008) | 1 line
  
  check that the parser module can handle the new keyword syntax
................
  r65891 | amaury.forgeotdarc | 2008-08-20 10:08:47 +1000 (Wed, 20 Aug 2008) | 2 lines
  
  follow-up of issue3473: update the compiler package to recognize the new syntax.
................
  r65892 | benjamin.peterson | 2008-08-20 11:27:30 +1000 (Wed, 20 Aug 2008) | 1 line
  
  add a NEWS note for new args syntax
................
  r65893 | benjamin.peterson | 2008-08-20 11:42:01 +1000 (Wed, 20 Aug 2008) | 1 line
  
  deprecate some useless, noop methods in symtable
................
  r65894 | benjamin.peterson | 2008-08-20 11:44:45 +1000 (Wed, 20 Aug 2008) | 2 lines
  
  newSymbolTable is not public API
................
  r65898 | benjamin.peterson | 2008-08-20 12:15:42 +1000 (Wed, 20 Aug 2008) | 1 line
  
  fix silly errors of mine
................
  r65900 | hirokazu.yamamoto | 2008-08-20 14:13:28 +1000 (Wed, 20 Aug 2008) | 1 line
  
  fixed get_file_system in test_os.py ('path' is unicode on py3k and ansi on trunk)
................
  r65908 | hirokazu.yamamoto | 2008-08-20 23:14:07 +1000 (Wed, 20 Aug 2008) | 1 line
  
  Issue #3612: Added some missing basic types in ctypes.wintypes.
................
  r65910 | benjamin.peterson | 2008-08-21 00:07:59 +1000 (Thu, 21 Aug 2008) | 1 line
  
  fix up the multiprocessing docs a little
................
  r65912 | guido.van.rossum | 2008-08-21 00:57:20 +1000 (Thu, 21 Aug 2008) | 2 lines
  
  News for the imageop fix.
................
  r65914 | guido.van.rossum | 2008-08-21 01:01:50 +1000 (Thu, 21 Aug 2008) | 2 lines
  
  News for the tp_flags change.
................
  r65917 | hirokazu.yamamoto | 2008-08-21 02:15:28 +1000 (Thu, 21 Aug 2008) | 1 line
  
  Reverted r65900. See http://mail.python.org/pipermail/python-checkins/2008-August/073116.html
................
  r65922 | barry.warsaw | 2008-08-21 11:15:08 +1000 (Thu, 21 Aug 2008) | 2 lines
  
  Bump to 2.6b3.
................
  r65926 | barry.warsaw | 2008-08-21 12:12:56 +1000 (Thu, 21 Aug 2008) | 1 line
  
  done with the release
................
  r65958 | mark.dickinson | 2008-08-22 06:02:24 +1000 (Fri, 22 Aug 2008) | 5 lines
  
  Fix float.fromhex test to give additional information on failure.  This
  change is aimed at diagnosing issue 3633 (test_float fails on Solaris).
  
  Reviewed by Benjamin Peterson
................
  r65964 | mark.dickinson | 2008-08-22 07:38:38 +1000 (Fri, 22 Aug 2008) | 7 lines
  
  issue 3633: Solaris allows fullwidth Unicode digits in isxdigit, so
  rewrite float.fromhex to only allow ASCII hex digits on all platforms.
  (Tests for this are already present, but the test_float failures
  on Solaris hadn't been noticed before.)
  
  Reviewed by Antoine Pitrou.
................
  r65971 | robert.schuppenies | 2008-08-22 18:03:43 +1000 (Fri, 22 Aug 2008) | 2 lines
  
  Issue #1342811: Fixed broken patch. Reviewed by	benjamin.peterson.
................
  r65975 | christian.heimes | 2008-08-23 05:34:15 +1000 (Sat, 23 Aug 2008) | 1 line
  
  Changed type of numarenas from uint to size_t to silence a GCC warning on 64bit OSes. Reviewed by Benjamin Peterson.
................
  r65977 | christian.heimes | 2008-08-23 05:47:25 +1000 (Sat, 23 Aug 2008) | 3 lines
  
  Silenced compiler warning
  Objects/stringlib/find.h:97: warning: 'stringlib_contains_obj' defined but not used
  Reviewed by Benjamin Peterson
................
  r65978 | christian.heimes | 2008-08-23 05:55:54 +1000 (Sat, 23 Aug 2008) | 3 lines
  
  Silenced a compiler warning in the sqlite module
  Modules/_sqlite/row.c:187: warning: suggest parentheses around && within ||
  Reviewed by Benjamin Peterson
................
  r65980 | christian.heimes | 2008-08-23 06:10:27 +1000 (Sat, 23 Aug 2008) | 3 lines
  
  Fixed two format strings in the _collections module. For example
  Modules/_collectionsmodule.c:674: warning: format '%i' expects type 'int', but argument 2 has type 'Py_ssize_t'
  Reviewed by Benjamin Peterson
................
  r65982 | benjamin.peterson | 2008-08-23 06:43:48 +1000 (Sat, 23 Aug 2008) | 4 lines
  
  fix a few get_name() calls and turn then to .name 
  
  Reviewer: Christian Heimes
................
  r65984 | christian.heimes | 2008-08-23 07:23:47 +1000 (Sat, 23 Aug 2008) | 1 line
  
  d is the correct format string
................
  r65986 | mark.hammond | 2008-08-23 10:59:14 +1000 (Sat, 23 Aug 2008) | 2 lines
  
  Fix bug 3625: test issues on 64bit windows. r=pitrou
................
  r65995 | georg.brandl | 2008-08-24 01:15:31 +1000 (Sun, 24 Aug 2008) | 2 lines
  
  Small updates to types member docs, backport from r65994.
................
  r66000 | benjamin.peterson | 2008-08-24 06:27:43 +1000 (Sun, 24 Aug 2008) | 5 lines
  
  #3643 add a few more checks to _testcapi to prevent segfaults
  
  Author: Victor Stinner
  Reviewer: Benjamin Peterson
................
  r66004 | benjamin.peterson | 2008-08-24 07:40:15 +1000 (Sun, 24 Aug 2008) | 1 line
  
  fix warning
................
  r66006 | neal.norwitz | 2008-08-24 15:04:52 +1000 (Sun, 24 Aug 2008) | 25 lines
  
  Fix:
   * crashes on memory allocation failure found with failmalloc
   * memory leaks found with valgrind
   * compiler warnings in opt mode which would lead to invalid memory reads
   * problem using wrong name in decimal module reported by pychecker
  
  Update the valgrind suppressions file with new leaks that are small/one-time
  leaks we don't care about (ie, they are too hard to fix).
  
  TBR=barry
  TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes)
    in opt mode:
    valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
      ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \
                          -x test_logging test_ssl test_multiprocessing
    valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
      ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
    for i in `seq 1 4000` ; do
      LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \
          ./python -c pass
    done
  
  At least some of these fixes should probably be backported to 2.5.
................
  r66011 | neal.norwitz | 2008-08-25 03:27:43 +1000 (Mon, 25 Aug 2008) | 1 line
  
  Ignore a couple more tests that report leaks inconsistently.
................
  r66012 | neal.norwitz | 2008-08-25 03:29:53 +1000 (Mon, 25 Aug 2008) | 1 line
  
  Use the actual blacklist of leaky tests
................
  r66013 | benjamin.peterson | 2008-08-25 04:10:20 +1000 (Mon, 25 Aug 2008) | 4 lines
  
  generate py3k warnings on __getslice__, __delslice__, and __setslice__
  
  Reviewer: Brett Cannon
................
  r66014 | georg.brandl | 2008-08-25 04:11:07 +1000 (Mon, 25 Aug 2008) | 2 lines
  
  #3654: fix duplicate test method name. Review by Benjamin P.
................
  r66017 | benjamin.peterson | 2008-08-25 07:55:03 +1000 (Mon, 25 Aug 2008) | 1 line
  
  remove note about unimplemented feature
................
  r66018 | neal.norwitz | 2008-08-25 08:03:05 +1000 (Mon, 25 Aug 2008) | 6 lines
  
  #3662: Fix segfault introduced when fixing memory leaks.
  
  TESTED=./python -E -tt ./Lib/test/regrtest.py test_fileio
  R (approach from bug)=Amaury and Benjamin
................
  r66020 | brett.cannon | 2008-08-25 09:15:19 +1000 (Mon, 25 Aug 2008) | 1 line
  
  Clarify that some attributes/methods are listed somewhat separately because they are not part of the threading API.
................
  r66023 | neal.norwitz | 2008-08-25 11:50:24 +1000 (Mon, 25 Aug 2008) | 6 lines
  
  Fix problem reported by pychecker where AuthenticationError wasn't imported.
  Add some test coverage to this code.  More tests should be added (TODO added).
  
  R=Brett
  TESTED=./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
................
  r66026 | neal.norwitz | 2008-08-25 13:03:25 +1000 (Mon, 25 Aug 2008) | 6 lines
  
  Use bytes as return type from recv_bytes() methods.  Not sure why this only
  affects some buildbots.
  
  R=Brett
  TESTED=./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
................
  r66028 | neal.norwitz | 2008-08-25 13:52:40 +1000 (Mon, 25 Aug 2008) | 1 line
  
  Try to reduce the flakiness of this test
................


Modified:
   python/branches/tlee-ast-optimize/   (props changed)
   python/branches/tlee-ast-optimize/Demo/embed/Makefile
   python/branches/tlee-ast-optimize/Demo/parser/unparse.py
   python/branches/tlee-ast-optimize/Doc/bugs.rst
   python/branches/tlee-ast-optimize/Doc/c-api/object.rst
   python/branches/tlee-ast-optimize/Doc/c-api/typeobj.rst
   python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py
   python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py
   python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py
   python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py
   python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py
   python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst
   python/branches/tlee-ast-optimize/Doc/library/symtable.rst
   python/branches/tlee-ast-optimize/Doc/library/threading.rst
   python/branches/tlee-ast-optimize/Doc/library/types.rst
   python/branches/tlee-ast-optimize/Doc/reference/expressions.rst
   python/branches/tlee-ast-optimize/Grammar/Grammar
   python/branches/tlee-ast-optimize/Include/object.h
   python/branches/tlee-ast-optimize/Include/patchlevel.h
   python/branches/tlee-ast-optimize/Include/pymath.h
   python/branches/tlee-ast-optimize/Lib/compiler/transformer.py
   python/branches/tlee-ast-optimize/Lib/cookielib.py
   python/branches/tlee-ast-optimize/Lib/csv.py
   python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py
   python/branches/tlee-ast-optimize/Lib/ctypes/wintypes.py
   python/branches/tlee-ast-optimize/Lib/decimal.py
   python/branches/tlee-ast-optimize/Lib/distutils/__init__.py
   python/branches/tlee-ast-optimize/Lib/distutils/core.py
   python/branches/tlee-ast-optimize/Lib/distutils/cygwinccompiler.py
   python/branches/tlee-ast-optimize/Lib/dummy_thread.py
   python/branches/tlee-ast-optimize/Lib/filecmp.py
   python/branches/tlee-ast-optimize/Lib/hmac.py
   python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py
   python/branches/tlee-ast-optimize/Lib/inspect.py
   python/branches/tlee-ast-optimize/Lib/io.py
   python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py
   python/branches/tlee-ast-optimize/Lib/lib2to3/   (props changed)
   python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py
   python/branches/tlee-ast-optimize/Lib/logging/__init__.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py
   python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py
   python/branches/tlee-ast-optimize/Lib/os.py
   python/branches/tlee-ast-optimize/Lib/shelve.py
   python/branches/tlee-ast-optimize/Lib/symtable.py
   python/branches/tlee-ast-optimize/Lib/test/test_bytes.py
   python/branches/tlee-ast-optimize/Lib/test/test_compiler.py
   python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.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_grammar.py
   python/branches/tlee-ast-optimize/Lib/test/test_list.py
   python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py
   python/branches/tlee-ast-optimize/Lib/test/test_os.py
   python/branches/tlee-ast-optimize/Lib/test/test_parser.py
   python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py
   python/branches/tlee-ast-optimize/Lib/test/test_re.py
   python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py
   python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py
   python/branches/tlee-ast-optimize/Lib/test/test_ssl.py
   python/branches/tlee-ast-optimize/Lib/test/test_struct.py
   python/branches/tlee-ast-optimize/Lib/test/test_symtable.py
   python/branches/tlee-ast-optimize/Lib/test/test_threading.py
   python/branches/tlee-ast-optimize/Lib/test/test_unicode.py
   python/branches/tlee-ast-optimize/Lib/threading.py
   python/branches/tlee-ast-optimize/Lib/urllib2.py
   python/branches/tlee-ast-optimize/Lib/weakref.py
   python/branches/tlee-ast-optimize/Lib/zipfile.py
   python/branches/tlee-ast-optimize/Misc/NEWS
   python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec
   python/branches/tlee-ast-optimize/Misc/build.sh
   python/branches/tlee-ast-optimize/Misc/valgrind-python.supp
   python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c
   python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c
   python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c
   python/branches/tlee-ast-optimize/Modules/_fileio.c
   python/branches/tlee-ast-optimize/Modules/_sqlite/row.c
   python/branches/tlee-ast-optimize/Modules/_testcapimodule.c
   python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c
   python/branches/tlee-ast-optimize/Modules/imageop.c
   python/branches/tlee-ast-optimize/Modules/mmapmodule.c
   python/branches/tlee-ast-optimize/Modules/signalmodule.c
   python/branches/tlee-ast-optimize/Modules/symtablemodule.c
   python/branches/tlee-ast-optimize/Objects/bytearrayobject.c
   python/branches/tlee-ast-optimize/Objects/classobject.c
   python/branches/tlee-ast-optimize/Objects/floatobject.c
   python/branches/tlee-ast-optimize/Objects/obmalloc.c
   python/branches/tlee-ast-optimize/Objects/stringlib/find.h
   python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h
   python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h
   python/branches/tlee-ast-optimize/Objects/structseq.c
   python/branches/tlee-ast-optimize/Objects/typeobject.c
   python/branches/tlee-ast-optimize/Python/ast.c
   python/branches/tlee-ast-optimize/Python/bltinmodule.c
   python/branches/tlee-ast-optimize/Python/getargs.c
   python/branches/tlee-ast-optimize/Python/graminit.c
   python/branches/tlee-ast-optimize/Python/pythonrun.c
   python/branches/tlee-ast-optimize/README
   python/branches/tlee-ast-optimize/Tools/scripts/2to3
   python/branches/tlee-ast-optimize/Tools/scripts/idle   (props changed)

Modified: python/branches/tlee-ast-optimize/Demo/embed/Makefile
==============================================================================
--- python/branches/tlee-ast-optimize/Demo/embed/Makefile	(original)
+++ python/branches/tlee-ast-optimize/Demo/embed/Makefile	Mon Aug 25 14:19:12 2008
@@ -10,7 +10,7 @@
 srcdir=		../..
 
 # Python version
-VERSION=	2.5
+VERSION=	2.6
 
 # Compiler flags
 OPT=		-g

Modified: python/branches/tlee-ast-optimize/Demo/parser/unparse.py
==============================================================================
--- python/branches/tlee-ast-optimize/Demo/parser/unparse.py	(original)
+++ python/branches/tlee-ast-optimize/Demo/parser/unparse.py	Mon Aug 25 14:19:12 2008
@@ -196,7 +196,7 @@
         self.dispatch(t.finalbody)
         self.leave()
 
-    def _excepthandler(self, t):
+    def _ExceptHandler(self, t):
         self.fill("except")
         if t.type:
             self.write(" ")
@@ -223,7 +223,7 @@
 
     def _FunctionDef(self, t):
         self.write("\n")
-        for deco in t.decorators:
+        for deco in t.decorator_list:
             self.fill("@")
             self.dispatch(deco)
         self.fill("def "+t.name + "(")

Modified: python/branches/tlee-ast-optimize/Doc/bugs.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/bugs.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/bugs.rst	Mon Aug 25 14:19:12 2008
@@ -8,11 +8,7 @@
 stability.  In order to maintain this reputation, the developers would like to
 know of any deficiencies you find in Python.
 
-If you find errors in the documentation, please use either the "Add a comment"
-or the "Suggest a change" features of the relevant page in the most recent
-online documentation at http://docs.python.org/.
-
-All other bug reports should be submitted via the Python Bug Tracker
+Bug reports should be submitted via the Python Bug Tracker
 (http://bugs.python.org/).  The bug tracker offers a Web form which allows
 pertinent information to be entered and submitted to the developers.
 

Modified: python/branches/tlee-ast-optimize/Doc/c-api/object.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/c-api/object.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/c-api/object.rst	Mon Aug 25 14:19:12 2008
@@ -269,6 +269,16 @@
    This is the equivalent of the Python expression ``hash(o)``.
 
 
+.. cfunction:: long PyObject_HashNotImplemented(PyObject *o)
+
+   Set a TypeError indicating that ``type(o)`` is not hashable and return ``-1``.
+   This function receives special treatment when stored in a ``tp_hash`` slot,
+   allowing a type to explicitly indicate to the interpreter that it is not
+   hashable.
+
+   .. versionadded:: 2.6
+
+
 .. cfunction:: int PyObject_IsTrue(PyObject *o)
 
    Returns ``1`` if the object *o* is considered to be true, and ``0`` otherwise.

Modified: python/branches/tlee-ast-optimize/Doc/c-api/typeobj.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/c-api/typeobj.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/c-api/typeobj.rst	Mon Aug 25 14:19:12 2008
@@ -324,6 +324,14 @@
    error occurs during the computation of the hash value, the function should set
    an exception and return ``-1``.
 
+   This field can be set explicitly to :cfunc:`PyObject_HashNotImplemented` to
+   block inheritance of the hash method from a parent type. This is interpreted
+   as the equivalent of ``__hash__ = None`` at the Python level, causing
+   ``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note
+   that the converse is also true - setting ``__hash__ = None`` on a class at
+   the Python level will result in the ``tp_hash`` slot being set to
+   :cfunc:`PyObject_HashNotImplemented`.
+
    When this field is not set, two possibilities exist: if the :attr:`tp_compare`
    and :attr:`tp_richcompare` fields are both *NULL*, a default hash value based on
    the object's address is returned; otherwise, a :exc:`TypeError` is raised.

Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py	(original)
+++ python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py	Mon Aug 25 14:19:12 2008
@@ -152,7 +152,7 @@
 
 def LocalProcess(**kwds):
     p = Process(**kwds)
-    p.set_name('localhost/' + p.get_name())
+    p.set_name('localhost/' + p.name)
     return p
 
 class Cluster(managers.SyncManager):

Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py	(original)
+++ python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py	Mon Aug 25 14:19:12 2008
@@ -14,7 +14,7 @@
 def calculate(func, args):
     result = func(*args)
     return '%s says that %s%s = %s' % (
-        multiprocessing.current_process().get_name(),
+        multiprocessing.current_process().name,
         func.__name__, args, result
         )
 

Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py	(original)
+++ python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py	Mon Aug 25 14:19:12 2008
@@ -224,7 +224,7 @@
     p.start()
     p.join()
 
-    assert p.get_exitcode() == 0
+    assert p.exitcode == 0
 
 
 ####

Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py	(original)
+++ python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py	Mon Aug 25 14:19:12 2008
@@ -21,7 +21,7 @@
 
 
 def note(format, *args):
-    sys.stderr.write('[%s]\t%s\n' % (current_process().get_name(),format%args))
+    sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args))
 
 
 class RequestHandler(SimpleHTTPRequestHandler):

Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py	(original)
+++ python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py	Mon Aug 25 14:19:12 2008
@@ -29,7 +29,7 @@
 def calculate(func, args):
     result = func(*args)
     return '%s says that %s%s = %s' % \
-        (current_process().get_name(), func.__name__, args, result)
+        (current_process().name, func.__name__, args, result)
 
 #
 # Functions referenced by tasks

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	Mon Aug 25 14:19:12 2008
@@ -250,7 +250,7 @@
 
    The constructor should always be called with keyword arguments. *group*
    should always be ``None``; it exists solely for compatibility with
-   :class:`~threading.Thread`.  *target* is the callable object to be invoked by
+   :class:`threading.Thread`.  *target* is the callable object to be invoked by
    the :meth:`run()` method.  It defaults to ``None``, meaning nothing is
    called. *name* is the process name.  By default, a unique name is constructed
    of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\
@@ -292,13 +292,9 @@
       A process cannot join itself because this would cause a deadlock.  It is
       an error to attempt to join a process before it has been started.
 
-   .. method:: get_name()
+   .. attribute:: name
 
-      Return the process's name.
-
-   .. method:: set_name(name)
-
-      Set the process's name.
+      The process's name.
 
       The name is a string used for identification purposes only.  It has no
       semantics.  Multiple processes may be given the same name.  The initial
@@ -311,14 +307,10 @@
       Roughly, a process object is alive from the moment the :meth:`start`
       method returns until the child process terminates.
 
-   .. method:: is_daemon()
-
-      Return the process's daemon flag.
+   .. attribute:: daemon
 
-   .. method:: set_daemon(daemonic)
-
-      Set the process's daemon flag to the Boolean value *daemonic*.  This must
-      be called before :meth:`start` is called.
+      The process's daemon flag, a Boolean value.  This must be called before
+      :meth:`start` is called.
 
       The initial value is inherited from the creating process.
 
@@ -329,36 +321,33 @@
       Otherwise a daemonic process would leave its children orphaned if it gets
       terminated when its parent process exits.
 
-   In addition process objects also support the following methods:
+   In addition to the  :class:`Threading.Thread` API, :class:`Process` objects
+   also support the following attributes and methods:
 
-   .. method:: get_pid()
+   .. attribute:: pid
 
       Return the process ID.  Before the process is spawned, this will be
       ``None``.
 
-   .. method:: get_exit_code()
+   .. attribute:: exitcode
 
-      Return the child's exit code.  This will be ``None`` if the process has
-      not yet terminated.  A negative value *-N* indicates that the child was
-      terminated by signal *N*.
+      The child's exit code.  This will be ``None`` if the process has not yet
+      terminated.  A negative value *-N* indicates that the child was terminated
+      by signal *N*.
 
-   .. method:: get_auth_key()
+   .. attribute:: authkey
 
-      Return the process's authentication key (a byte string).
+      The process's authentication key (a byte string).
 
       When :mod:`multiprocessing` is initialized the main process is assigned a
       random string using :func:`os.random`.
 
       When a :class:`Process` object is created, it will inherit the
-      authentication key of its parent process, although this may be changed
-      using :meth:`set_auth_key` below.
+      authentication key of its parent process, although this may be changed by
+      setting :attr:`authkey` to another byte string.
 
       See :ref:`multiprocessing-auth-keys`.
 
-   .. method:: set_auth_key(authkey)
-
-      Set the process's authentication key which must be a byte string.
-
    .. method:: terminate()
 
       Terminate the process.  On Unix this is done using the ``SIGTERM`` signal;
@@ -377,8 +366,8 @@
          cause other processes to deadlock.
 
    Note that the :meth:`start`, :meth:`join`, :meth:`is_alive` and
-   :meth:`get_exit_code` methods should only be called by the process that
-   created the process object.
+   :attr:`exit_code` methods should only be called by the process that created
+   the process object.
 
    Example usage of some of the methods of :class:`Process`::
 
@@ -392,7 +381,7 @@
        >>> p.terminate()
        >>> print p, p.is_alive()
        <Process(Process-1, stopped[SIGTERM])> False
-       >>> p.get_exit_code() == -signal.SIGTERM
+       >>> p.exitcode == -signal.SIGTERM
        True
 
 
@@ -1077,7 +1066,7 @@
 
    *authkey* is the authentication key which will be used to check the validity
    of incoming connections to the server process.  If *authkey* is ``None`` then
-   ``current_process().get_auth_key()``.  Otherwise *authkey* is used and it
+   ``current_process().authkey``.  Otherwise *authkey* is used and it
    must be a string.
 
    .. method:: start()
@@ -1601,7 +1590,7 @@
 
    If *authentication* is ``True`` or *authkey* is a string then digest
    authentication is used.  The key used for authentication will be either
-   *authkey* or ``current_process().get_auth_key()`` if *authkey* is ``None``.
+   *authkey* or ``current_process().authkey)`` if *authkey* is ``None``.
    If authentication fails then :exc:`AuthenticationError` is raised.  See
    :ref:`multiprocessing-auth-keys`.
 
@@ -1634,7 +1623,7 @@
    otherwise it must be *None*.
 
    If *authkey* is ``None`` and *authenticate* is ``True`` then
-   ``current_process().get_auth_key()`` is used as the authentication key.  If
+   ``current_process().authkey`` is used as the authentication key.  If
    *authkey* is ``None`` and *authentication* is ``False`` then no
    authentication is done.  If authentication fails then
    :exc:`AuthenticationError` is raised.  See :ref:`multiprocessing-auth-keys`.
@@ -1750,7 +1739,7 @@
 **not** involve sending the key over the connection.)
 
 If authentication is requested but do authentication key is specified then the
-return value of ``current_process().get_auth_key`` is used (see
+return value of ``current_process().authkey`` is used (see
 :class:`~multiprocessing.Process`).  This value will automatically inherited by
 any :class:`~multiprocessing.Process` object that the current process creates.
 This means that (by default) all processes of a multi-process program will share

Modified: python/branches/tlee-ast-optimize/Doc/library/symtable.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/symtable.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/symtable.rst	Mon Aug 25 14:19:12 2008
@@ -144,15 +144,6 @@
 
       Return ``True`` if the symbol is global.
 
-   .. method:: is_vararg()
-
-      Return ``True`` if the symbol is a star arg (receives varargs).
-
-   .. method:: is_kewordarg()
-
-      Return ``True`` if the symbol is a two-star arg (receives keyword
-      arguments).
-
    .. method:: is_local()
 
       Return ``True`` if the symbol is local to its block.

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	Mon Aug 25 14:19:12 2008
@@ -14,8 +14,11 @@
 
 .. note::
 
-   In 3.x, names in ``camelCase`` have been renamed to their underscored
-   equivalents.  Both names are available in 2.6.
+   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.
 
 This module defines the following functions and objects:
 
@@ -553,19 +556,19 @@
 
 Once the thread's activity is started, the thread is considered 'alive'. It
 stops being alive when its :meth:`run` method terminates -- either normally, or
-by raising an unhandled exception.  The :meth:`isAlive` method tests whether the
+by raising an unhandled exception.  The :meth:`is_alive` method tests whether the
 thread is alive.
 
 Other threads can call a thread's :meth:`join` method.  This blocks the calling
 thread until the thread whose :meth:`join` method is called is terminated.
 
-A thread has a name.  The name can be passed to the constructor, set with the
-:meth:`set_name` method, and retrieved with the :meth:`get_name` method.
+A thread has a name.  The name can be passed to the constructor, and read or
+changed through the :attr:`name` attribute.
 
 A thread can be flagged as a "daemon thread".  The significance of this flag is
 that the entire Python program exits when only daemon threads are left.  The
-initial value is inherited from the creating thread.  The flag can be set with
-the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method.
+initial value is inherited from the creating thread.  The flag can be set
+through the :attr:`daemon` attribute.
 
 There is a "main thread" object; this corresponds to the initial thread of
 control in the Python program.  It is not a daemon thread.
@@ -645,28 +648,25 @@
    raises the same exception.
 
 
-.. method:: Thread.get_name()
-            Thread.getName()
+.. method:: Thread.getName()
+            Thread.setName()
 
-   Return the thread's name.
+   Old API for :attr:`~Thread.name`.
 
 
-.. method:: Thread.set_name(name)
-            Thread.setName(name)
+.. attribute:: Thread.name
 
-   Set the thread's name.
-
-   The name is a string used for identification purposes only. It has no semantics.
+   A string used for identification purposes only. It has no semantics.
    Multiple threads may be given the same name.  The initial name is set by the
    constructor.
 
 
-.. method:: Thread.get_ident()
+.. attribute:: Thread.ident
 
-   Return the 'thread identifier' of this thread or None if the thread has not
-   been started.  This is a nonzero integer.  See the :func:`thread.get_ident()`
+   The 'thread identifier' of this thread or ``None`` if the thread has not been
+   started.  This is a nonzero integer.  See the :func:`thread.get_ident()`
    function.  Thread identifiers may be recycled when a thread exits and another
-   thread is created.  The identifier is returned even after the thread has
+   thread is created.  The identifier is available even after the thread has
    exited.
 
    .. versionadded:: 2.6
@@ -682,17 +682,16 @@
    returns a list of all alive threads.
 
 
-.. method:: Thread.is_daemon()
-            Thread.isDaemon()
+.. method:: Thread.isDaemon()
+            Thread.setDaemon()
 
-   Return the thread's daemon flag.
+   Old API for :attr:`~Thread.daemon`.
 
 
-.. method:: Thread.set_daemon(daemonic)
-            Thread.setDaemon(daemonic)
+.. attribute:: Thread.daemon
 
-   Set the thread's daemon flag to the Boolean value *daemonic*. This must be
-   called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised.
+   The thread's daemon flag. This must be set before :meth:`start` is called,
+   otherwise :exc:`RuntimeError` is raised.
 
    The initial value is inherited from the creating thread.
 

Modified: python/branches/tlee-ast-optimize/Doc/library/types.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/types.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/library/types.rst	Mon Aug 25 14:19:12 2008
@@ -1,4 +1,3 @@
-
 :mod:`types` --- Names for built-in types
 =========================================
 
@@ -117,13 +116,10 @@
 
 
 .. data:: FunctionType
+          LambdaType
 
-   The type of user-defined functions and lambdas.
-
-
-.. data:: LambdaType
-
-   An alternate name for ``FunctionType``.
+   The type of user-defined functions and functions created by :keyword:`lambda`
+   expressions.
 
 
 .. data:: GeneratorType
@@ -143,7 +139,7 @@
 
 .. data:: ClassType
 
-   The type of user-defined classes.
+   The type of user-defined old-style classes.
 
 
 .. data:: InstanceType
@@ -162,13 +158,11 @@
 
 
 .. data:: BuiltinFunctionType
+          BuiltinMethodType
 
-   The type of built-in functions like :func:`len` or :func:`sys.exit`.
-
-
-.. data:: BuiltinMethodType
-
-   An alternate name for ``BuiltinFunction``.
+   The type of built-in functions like :func:`len` or :func:`sys.exit`, and
+   methods of built-in classes.  (Here, the term "built-in" means "written in
+   C".)
 
 
 .. data:: ModuleType

Modified: python/branches/tlee-ast-optimize/Doc/reference/expressions.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/reference/expressions.rst	(original)
+++ python/branches/tlee-ast-optimize/Doc/reference/expressions.rst	Mon Aug 25 14:19:12 2008
@@ -625,11 +625,11 @@
    call: `primary` "(" [`argument_list` [","]
        : | `expression` `genexpr_for`] ")"
    argument_list: `positional_arguments` ["," `keyword_arguments`]
-                : ["," "*" `expression`]
-                : ["," "**" `expression`]
+                :   ["," "*" `expression`] ["," `keyword_arguments`]
+                :   ["," "**" `expression`]
                 : | `keyword_arguments` ["," "*" `expression`]
-                : ["," "**" `expression`]
-                : | "*" `expression` ["," "**" `expression`]
+                :   ["," "**" `expression`]
+                : | "*" `expression` ["," "*" `expression`] ["," "**" `expression`]
                 : | "**" `expression`
    positional_arguments: `expression` ("," `expression`)*
    keyword_arguments: `keyword_item` ("," `keyword_item`)*
@@ -686,12 +686,13 @@
 
 If the syntax ``*expression`` appears in the function call, ``expression`` must
 evaluate to a sequence.  Elements from this sequence are treated as if they were
-additional positional arguments; if there are positional arguments *x1*,...,*xN*
-, and ``expression`` evaluates to a sequence *y1*,...,*yM*, this is equivalent
-to a call with M+N positional arguments *x1*,...,*xN*,*y1*,...,*yM*.
+additional positional arguments; if there are positional arguments *x1*,...,
+*xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*, this is
+equivalent to a call with M+N positional arguments *x1*, ..., *xN*, *y1*, ...,
+*yM*.
 
-A consequence of this is that although the ``*expression`` syntax appears
-*after* any keyword arguments, it is processed *before* the keyword arguments
+A consequence of this is that although the ``*expression`` syntax may appear
+*after* some keyword arguments, it is processed *before* the keyword arguments
 (and the ``**expression`` argument, if any -- see below).  So::
 
    >>> def f(a, b):

Modified: python/branches/tlee-ast-optimize/Grammar/Grammar
==============================================================================
--- python/branches/tlee-ast-optimize/Grammar/Grammar	(original)
+++ python/branches/tlee-ast-optimize/Grammar/Grammar	Mon Aug 25 14:19:12 2008
@@ -130,7 +130,9 @@
 
 classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
 
-arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test)
+arglist: (argument ',')* (argument [',']
+                         |'*' test (',' argument)* [',' '**' test] 
+                         |'**' test)
 argument: test [gen_for] | test '=' test  # Really [keyword '='] test
 
 list_iter: list_for | list_if

Modified: python/branches/tlee-ast-optimize/Include/object.h
==============================================================================
--- python/branches/tlee-ast-optimize/Include/object.h	(original)
+++ python/branches/tlee-ast-optimize/Include/object.h	Mon Aug 25 14:19:12 2008
@@ -162,10 +162,10 @@
 /* Py3k buffer interface */
 
 typedef struct bufferinfo {
-	void *buf;   
+	void *buf;
 	PyObject *obj;        /* borrowed reference */
         Py_ssize_t len;
-        Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be 
+        Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be
                                  pointed to by strides in simple case.*/
         int readonly;
         int ndim;
@@ -296,7 +296,7 @@
 	segcountproc bf_getsegcount;
 	charbufferproc bf_getcharbuffer;
         getbufferproc bf_getbuffer;
-	releasebufferproc bf_releasebuffer; 
+	releasebufferproc bf_releasebuffer;
 } PyBufferProcs;
 
 
@@ -530,6 +530,12 @@
 
 Code can use PyType_HasFeature(type_ob, flag_value) to test whether the
 given type object has a specified feature.
+
+NOTE: when building the core, Py_TPFLAGS_DEFAULT includes
+Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't.  This is so
+that extensions that modify tp_dict of their own types directly don't
+break, since this was allowed in 2.5.  In 3.0 they will have to
+manually remove this flag though!
 */
 
 /* PyBufferProcs contains bf_getcharbuffer */
@@ -606,7 +612,7 @@
 #define Py_TPFLAGS_BASE_EXC_SUBCLASS	(1L<<30)
 #define Py_TPFLAGS_TYPE_SUBCLASS	(1L<<31)
 
-#define Py_TPFLAGS_DEFAULT  ( \
+#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \
                              Py_TPFLAGS_HAVE_GETCHARBUFFER | \
                              Py_TPFLAGS_HAVE_SEQUENCE_IN | \
                              Py_TPFLAGS_HAVE_INPLACEOPS | \
@@ -616,8 +622,15 @@
                              Py_TPFLAGS_HAVE_CLASS | \
                              Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
                              Py_TPFLAGS_HAVE_INDEX | \
-                             Py_TPFLAGS_HAVE_VERSION_TAG | \
-                            0)
+                             0)
+#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \
+                                 Py_TPFLAGS_HAVE_VERSION_TAG)
+
+#ifdef Py_BUILD_CORE
+#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE
+#else
+#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL
+#endif
 
 #define PyType_HasFeature(t,f)  (((t)->tp_flags & (f)) != 0)
 #define PyType_FastSubclass(t,f)  PyType_HasFeature(t,f)

Modified: python/branches/tlee-ast-optimize/Include/patchlevel.h
==============================================================================
--- python/branches/tlee-ast-optimize/Include/patchlevel.h	(original)
+++ python/branches/tlee-ast-optimize/Include/patchlevel.h	Mon Aug 25 14:19:12 2008
@@ -24,10 +24,10 @@
 #define PY_MINOR_VERSION	6
 #define PY_MICRO_VERSION	0
 #define PY_RELEASE_LEVEL	PY_RELEASE_LEVEL_BETA
-#define PY_RELEASE_SERIAL	2
+#define PY_RELEASE_SERIAL	3
 
 /* Version as a string */
-#define PY_VERSION      	"2.6b2+"
+#define PY_VERSION      	"2.6b3+"
 /*--end constants--*/
 
 /* Subversion Revision number of this file (not of the repository) */

Modified: python/branches/tlee-ast-optimize/Include/pymath.h
==============================================================================
--- python/branches/tlee-ast-optimize/Include/pymath.h	(original)
+++ python/branches/tlee-ast-optimize/Include/pymath.h	Mon Aug 25 14:19:12 2008
@@ -19,7 +19,7 @@
  *Note: PC/pyconfig.h defines copysign as _copysign
  */
 #ifndef HAVE_COPYSIGN
-extern double copysign(doube, double);
+extern double copysign(double, double);
 #endif
 
 #ifndef HAVE_ACOSH

Modified: python/branches/tlee-ast-optimize/Lib/compiler/transformer.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/compiler/transformer.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/compiler/transformer.py	Mon Aug 25 14:19:12 2008
@@ -1222,12 +1222,27 @@
             return CallFunc(primaryNode, [], lineno=extractLineNo(nodelist))
         args = []
         kw = 0
+        star_node = dstar_node = None
         len_nodelist = len(nodelist)
-        for i in range(1, len_nodelist, 2):
+        i = 1
+        while i < len_nodelist:
             node = nodelist[i]
-            if node[0] == token.STAR or node[0] == token.DOUBLESTAR:
-                break
-            kw, result = self.com_argument(node, kw)
+
+            if node[0]==token.STAR:
+                if star_node is not None:
+                    raise SyntaxError, 'already have the varargs indentifier'
+                star_node = self.com_node(nodelist[i+1])
+                i = i + 3
+                continue
+            elif node[0]==token.DOUBLESTAR:
+                if dstar_node is not None:
+                    raise SyntaxError, 'already have the kwargs indentifier'
+                dstar_node = self.com_node(nodelist[i+1])
+                i = i + 3
+                continue
+
+            # positional or named parameters
+            kw, result = self.com_argument(node, kw, star_node)
 
             if len_nodelist != 2 and isinstance(result, GenExpr) \
                and len(node) == 3 and node[2][0] == symbol.gen_for:
@@ -1236,37 +1251,20 @@
                 raise SyntaxError, 'generator expression needs parenthesis'
 
             args.append(result)
-        else:
-            # No broken by star arg, so skip the last one we processed.
-            i = i + 1
-        if i < len_nodelist and nodelist[i][0] == token.COMMA:
-            # need to accept an application that looks like "f(a, b,)"
-            i = i + 1
-        star_node = dstar_node = None
-        while i < len_nodelist:
-            tok = nodelist[i]
-            ch = nodelist[i+1]
-            i = i + 3
-            if tok[0]==token.STAR:
-                if star_node is not None:
-                    raise SyntaxError, 'already have the varargs indentifier'
-                star_node = self.com_node(ch)
-            elif tok[0]==token.DOUBLESTAR:
-                if dstar_node is not None:
-                    raise SyntaxError, 'already have the kwargs indentifier'
-                dstar_node = self.com_node(ch)
-            else:
-                raise SyntaxError, 'unknown node type: %s' % tok
+            i = i + 2
+
         return CallFunc(primaryNode, args, star_node, dstar_node,
                         lineno=extractLineNo(nodelist))
 
-    def com_argument(self, nodelist, kw):
+    def com_argument(self, nodelist, kw, star_node):
         if len(nodelist) == 3 and nodelist[2][0] == symbol.gen_for:
             test = self.com_node(nodelist[1])
             return 0, self.com_generator_expression(test, nodelist[2])
         if len(nodelist) == 2:
             if kw:
                 raise SyntaxError, "non-keyword arg after keyword arg"
+            if star_node:
+                raise SyntaxError, "only named arguments may follow *expression"
             return 0, self.com_node(nodelist[1])
         result = self.com_node(nodelist[3])
         n = nodelist[1]

Modified: python/branches/tlee-ast-optimize/Lib/cookielib.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/cookielib.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/cookielib.py	Mon Aug 25 14:19:12 2008
@@ -26,7 +26,8 @@
 """
 
 __all__ = ['Cookie', 'CookieJar', 'CookiePolicy', 'DefaultCookiePolicy',
-           'FileCookieJar', 'LWPCookieJar', 'LoadError', 'MozillaCookieJar']
+           'FileCookieJar', 'LWPCookieJar', 'lwp_cookie_str', 'LoadError',
+           'MozillaCookieJar']
 
 import re, urlparse, copy, time, urllib
 try:

Modified: python/branches/tlee-ast-optimize/Lib/csv.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/csv.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/csv.py	Mon Aug 25 14:19:12 2008
@@ -18,7 +18,8 @@
     from StringIO import StringIO
 
 __all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
-            "Error", "Dialect", "excel", "excel_tab", "reader", "writer",
+            "Error", "Dialect", "__doc__", "excel", "excel_tab",
+            "field_size_limit", "reader", "writer",
             "register_dialect", "get_dialect", "list_dialects", "Sniffer",
             "unregister_dialect", "__version__", "DictReader", "DictWriter" ]
 

Modified: python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py	Mon Aug 25 14:19:12 2008
@@ -1,4 +1,4 @@
-import unittest
+import unittest, sys
 
 from ctypes import *
 import _ctypes_test
@@ -183,5 +183,10 @@
         self.failUnlessEqual(bool(CFUNCTYPE(None)(0)), False)
         self.failUnlessEqual(bool(CFUNCTYPE(None)(42)), True)
 
+        # COM methods are boolean True:
+        if sys.platform == "win32":
+            mth = WINFUNCTYPE(None)(42, "name", (), None)
+            self.failUnlessEqual(bool(mth), True)
+
 if __name__ == '__main__':
     unittest.main()

Modified: python/branches/tlee-ast-optimize/Lib/ctypes/wintypes.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/ctypes/wintypes.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/ctypes/wintypes.py	Mon Aug 25 14:19:12 2008
@@ -11,8 +11,10 @@
 
 WCHAR = c_wchar
 UINT = c_uint
+INT = c_int
 
 DOUBLE = c_double
+FLOAT = c_float
 
 BOOLEAN = BYTE
 BOOL = c_long
@@ -26,6 +28,9 @@
 ULONG = c_ulong
 LONG = c_long
 
+USHORT = c_ushort
+SHORT = c_short
+
 # in the windows header files, these are structures.
 _LARGE_INTEGER = LARGE_INTEGER = c_longlong
 _ULARGE_INTEGER = ULARGE_INTEGER = c_ulonglong
@@ -33,6 +38,7 @@
 LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p
 LPCWSTR = LPWSTR = c_wchar_p
 LPCSTR = LPSTR = c_char_p
+LPCVOID = LPVOID = c_void_p
 
 # WPARAM is defined as UINT_PTR (unsigned type)
 # LPARAM is defined as LONG_PTR (signed type)
@@ -161,18 +167,19 @@
                 ("cFileName", c_wchar * MAX_PATH),
                 ("cAlternateFileName", c_wchar * 14)]
 
-__all__ = ['ATOM', 'BOOL', 'BOOLEAN', 'BYTE', 'COLORREF', 'DOUBLE',
-           'DWORD', 'FILETIME', 'HACCEL', 'HANDLE', 'HBITMAP', 'HBRUSH',
+__all__ = ['ATOM', 'BOOL', 'BOOLEAN', 'BYTE', 'COLORREF', 'DOUBLE', 'DWORD',
+           'FILETIME', 'FLOAT', 'HACCEL', 'HANDLE', 'HBITMAP', 'HBRUSH',
            'HCOLORSPACE', 'HDC', 'HDESK', 'HDWP', 'HENHMETAFILE', 'HFONT',
            'HGDIOBJ', 'HGLOBAL', 'HHOOK', 'HICON', 'HINSTANCE', 'HKEY',
            'HKL', 'HLOCAL', 'HMENU', 'HMETAFILE', 'HMODULE', 'HMONITOR',
            'HPALETTE', 'HPEN', 'HRGN', 'HRSRC', 'HSTR', 'HTASK', 'HWINSTA',
-           'HWND', 'LANGID', 'LARGE_INTEGER', 'LCID', 'LCTYPE', 'LGRPID',
-           'LONG', 'LPARAM', 'LPCOLESTR', 'LPCSTR', 'LPCWSTR', 'LPOLESTR',
-           'LPSTR', 'LPWSTR', 'MAX_PATH', 'MSG', 'OLESTR', 'POINT',
-           'POINTL', 'RECT', 'RECTL', 'RGB', 'SC_HANDLE',
-           'SERVICE_STATUS_HANDLE', 'SIZE', 'SIZEL', 'SMALL_RECT', 'UINT',
-           'ULARGE_INTEGER', 'ULONG', 'VARIANT_BOOL', 'WCHAR',
-           'WIN32_FIND_DATAA', 'WIN32_FIND_DATAW', 'WORD', 'WPARAM', '_COORD',
-           '_FILETIME', '_LARGE_INTEGER', '_POINTL', '_RECTL', '_SMALL_RECT',
-           '_ULARGE_INTEGER', 'tagMSG', 'tagPOINT', 'tagRECT', 'tagSIZE']
+           'HWND', 'INT', 'LANGID', 'LARGE_INTEGER', 'LCID', 'LCTYPE',
+           'LGRPID', 'LONG', 'LPARAM', 'LPCOLESTR', 'LPCSTR', 'LPCVOID',
+           'LPCWSTR', 'LPOLESTR', 'LPSTR', 'LPVOID', 'LPWSTR', 'MAX_PATH',
+           'MSG', 'OLESTR', 'POINT', 'POINTL', 'RECT', 'RECTL', 'RGB',
+           'SC_HANDLE', 'SERVICE_STATUS_HANDLE', 'SHORT', 'SIZE', 'SIZEL',
+           'SMALL_RECT', 'UINT', 'ULARGE_INTEGER', 'ULONG', 'USHORT',
+           'VARIANT_BOOL', 'WCHAR', 'WIN32_FIND_DATAA', 'WIN32_FIND_DATAW',
+           'WORD', 'WPARAM', '_COORD', '_FILETIME', '_LARGE_INTEGER',
+           '_POINTL', '_RECTL', '_SMALL_RECT', '_ULARGE_INTEGER', 'tagMSG',
+           'tagPOINT', 'tagRECT', 'tagSIZE']

Modified: python/branches/tlee-ast-optimize/Lib/decimal.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/decimal.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/decimal.py	Mon Aug 25 14:19:12 2008
@@ -5061,7 +5061,7 @@
         log_tenpower = f*M # exact
     else:
         log_d = 0  # error < 2.31
-        log_tenpower = div_nearest(f, 10**-p) # error < 0.5
+        log_tenpower = _div_nearest(f, 10**-p) # error < 0.5
 
     return _div_nearest(log_tenpower+log_d, 100)
 

Modified: python/branches/tlee-ast-optimize/Lib/distutils/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/__init__.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/__init__.py	Mon Aug 25 14:19:12 2008
@@ -22,5 +22,5 @@
 #
 
 #--start constants--
-__version__ = "2.6b2"
+__version__ = "2.6b3"
 #--end constants--

Modified: python/branches/tlee-ast-optimize/Lib/distutils/core.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/core.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/core.py	Mon Aug 25 14:19:12 2008
@@ -218,8 +218,7 @@
             sys.argv[0] = script_name
             if script_args is not None:
                 sys.argv[1:] = script_args
-            with open(script_name, 'r') as file:
-                exec file.read() in g, l
+            exec open(script_name, 'r').read() in g, l
         finally:
             sys.argv = save_argv
             _setup_stop_after = None

Modified: python/branches/tlee-ast-optimize/Lib/distutils/cygwinccompiler.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/cygwinccompiler.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/cygwinccompiler.py	Mon Aug 25 14:19:12 2008
@@ -404,7 +404,7 @@
     """ Try to find out the versions of gcc, ld and dllwrap.
         If not possible it returns None for it.
     """
-    from distutils.version import StrictVersion
+    from distutils.version import LooseVersion
     from distutils.spawn import find_executable
     import re
 
@@ -415,7 +415,7 @@
         out.close()
         result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
         if result:
-            gcc_version = StrictVersion(result.group(1))
+            gcc_version = LooseVersion(result.group(1))
         else:
             gcc_version = None
     else:
@@ -427,7 +427,7 @@
         out.close()
         result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
         if result:
-            ld_version = StrictVersion(result.group(1))
+            ld_version = LooseVersion(result.group(1))
         else:
             ld_version = None
     else:
@@ -439,7 +439,7 @@
         out.close()
         result = re.search(' (\d+\.\d+(\.\d+)*)',out_string)
         if result:
-            dllwrap_version = StrictVersion(result.group(1))
+            dllwrap_version = LooseVersion(result.group(1))
         else:
             dllwrap_version = None
     else:

Modified: python/branches/tlee-ast-optimize/Lib/dummy_thread.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/dummy_thread.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/dummy_thread.py	Mon Aug 25 14:19:12 2008
@@ -17,7 +17,6 @@
            'interrupt_main', 'LockType']
 
 import traceback as _traceback
-import warnings
 
 class error(Exception):
     """Dummy implementation of thread.error."""

Modified: python/branches/tlee-ast-optimize/Lib/filecmp.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/filecmp.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/filecmp.py	Mon Aug 25 14:19:12 2008
@@ -11,7 +11,6 @@
 
 import os
 import stat
-import warnings
 from itertools import ifilter, ifilterfalse, imap, izip
 
 __all__ = ["cmp","dircmp","cmpfiles"]

Modified: python/branches/tlee-ast-optimize/Lib/hmac.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/hmac.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/hmac.py	Mon Aug 25 14:19:12 2008
@@ -41,7 +41,7 @@
             import hashlib
             digestmod = hashlib.md5
 
-        if callable(digestmod):
+        if hasattr(digestmod, '__call__'):
             self.digest_cons = digestmod
         else:
             self.digest_cons = lambda d='': digestmod.new(d)

Modified: python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py	Mon Aug 25 14:19:12 2008
@@ -1 +1 @@
-IDLE_VERSION = "2.6b2"
+IDLE_VERSION = "2.6b3"

Modified: python/branches/tlee-ast-optimize/Lib/inspect.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/inspect.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/inspect.py	Mon Aug 25 14:19:12 2008
@@ -38,7 +38,6 @@
 import imp
 import tokenize
 import linecache
-from abc import ABCMeta
 from operator import attrgetter
 from collections import namedtuple
 

Modified: python/branches/tlee-ast-optimize/Lib/io.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/io.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/io.py	Mon Aug 25 14:19:12 2008
@@ -59,10 +59,8 @@
 
 import os
 import abc
-import sys
 import codecs
 import _fileio
-import warnings
 import threading
 
 # open() uses st_blksize whenever we can

Modified: python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py	Mon Aug 25 14:19:12 2008
@@ -2662,11 +2662,13 @@
         if index2 is None:
             index2 = index1
         cmds = []
-        for i in range(self.index(index1), self.index(index2)+1):
-            if 'command' in self.entryconfig(i):
-                c = str(self.entrycget(i, 'command'))
-                if c in self._tclCommands:
-                    cmds.append(c)
+        (num_index1, num_index2) = (self.index(index1), self.index(index2))
+        if (num_index1 is not None) and (num_index2 is not None):
+            for i in range(num_index1, num_index2 + 1):
+                if 'command' in self.entryconfig(i):
+                    c = str(self.entrycget(i, 'command'))
+                    if c in self._tclCommands:
+                        cmds.append(c)
         self.tk.call(self._w, 'delete', index1, index2)
         for c in cmds:
             self.deletecommand(c)

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	Mon Aug 25 14:19:12 2008
@@ -172,9 +172,13 @@
           want a pre-order AST traversal, and post_order is the list that want
           post-order traversal.
         """
-        fixer_pkg = self.fixer_dir.replace(os.path.sep, ".")
+        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 = fixer_pkg.replace(os.path.altsep, ".")
+            fixer_pkg = self.fixer_dir.replace(os.path.altsep, ".")
         pre_order_fixers = []
         post_order_fixers = []
         fix_names = self.options.fix

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	Mon Aug 25 14:19:12 2008
@@ -262,7 +262,7 @@
         self.relativeCreated = (self.created - _startTime) * 1000
         if logThreads and thread:
             self.thread = thread.get_ident()
-            self.threadName = threading.current_thread().get_name()
+            self.threadName = threading.current_thread().name
         else:
             self.thread = None
             self.threadName = None

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py	Mon Aug 25 14:19:12 2008
@@ -17,7 +17,7 @@
 import itertools
 
 import _multiprocessing
-from multiprocessing import current_process
+from multiprocessing import current_process, AuthenticationError
 from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug
 from multiprocessing.forking import duplicate, close
 

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py	Mon Aug 25 14:19:12 2008
@@ -47,17 +47,18 @@
         self._parent._children[self] = None
         threading.Thread.start(self)
 
-    def get_exitcode(self):
+    @property
+    def exitcode(self):
         if self._start_called and not self.is_alive():
             return 0
         else:
             return None
 
     is_alive = threading.Thread.is_alive.im_func
-    get_name = threading.Thread.get_name.im_func
-    set_name = threading.Thread.set_name.im_func
-    is_daemon = threading.Thread.is_daemon.im_func
-    set_daemon = threading.Thread.set_daemon.im_func
+    get_name = threading.Thread.getName.im_func
+    set_name = threading.Thread.setName.im_func
+    is_daemon = threading.Thread.isDaemon.im_func
+    set_daemon = threading.Thread.setDaemon.im_func
 
 #
 #

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py	Mon Aug 25 14:19:12 2008
@@ -360,7 +360,7 @@
             sys_argv=sys.argv,
             log_to_stderr=_log_to_stderr,
             orig_dir=process.ORIGINAL_DIR,
-            authkey=process.current_process().get_authkey(),
+            authkey=process.current_process().authkey,
             )
 
         if _logger is not None:
@@ -407,7 +407,7 @@
     old_main_modules.append(sys.modules['__main__'])
 
     if 'name' in data:
-        process.current_process().set_name(data['name'])
+        process.current_process().name = data['name']
 
     if 'authkey' in data:
         process.current_process()._authkey = data['authkey']

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	Mon Aug 25 14:19:12 2008
@@ -154,7 +154,7 @@
                     except (OSError, IOError):
                         continue
                     t = threading.Thread(target=self.handle_request, args=(c,))
-                    t.set_daemon(True)
+                    t.daemon = True
                     t.start()
             except (KeyboardInterrupt, SystemExit):
                 pass
@@ -201,7 +201,7 @@
         Handle requests from the proxies in a particular process/thread
         '''
         util.debug('starting server thread to service %r',
-                   threading.current_thread().get_name())
+                   threading.current_thread().name)
 
         recv = conn.recv
         send = conn.send
@@ -251,7 +251,7 @@
 
             except EOFError:
                 util.debug('got EOF -- exiting thread serving %r',
-                           threading.current_thread().get_name())
+                           threading.current_thread().name)
                 sys.exit(0)
 
             except Exception:
@@ -264,7 +264,7 @@
                     send(('#UNSERIALIZABLE', repr(msg)))
             except Exception, e:
                 util.info('exception in thread serving %r',
-                        threading.current_thread().get_name())
+                        threading.current_thread().name)
                 util.info(' ... message was %r', msg)
                 util.info(' ... exception was %r', e)
                 conn.close()
@@ -386,7 +386,7 @@
         '''
         Spawn a new thread to serve this connection
         '''
-        threading.current_thread().set_name(name)
+        threading.current_thread().name = name
         c.send(('#RETURN', None))
         self.serve_client(c)
 
@@ -444,7 +444,7 @@
 
     def __init__(self, address=None, authkey=None, serializer='pickle'):
         if authkey is None:
-            authkey = current_process().get_authkey()
+            authkey = current_process().authkey
         self._address = address     # XXX not final address if eg ('', 0)
         self._authkey = AuthenticationString(authkey)
         self._state = State()
@@ -489,7 +489,7 @@
                   self._serializer, writer),
             )
         ident = ':'.join(str(i) for i in self._process._identity)
-        self._process.set_name(type(self).__name__  + '-' + ident)
+        self._process.name = type(self).__name__  + '-' + ident
         self._process.start()
 
         # get address of server
@@ -690,7 +690,7 @@
         elif self._manager is not None:
             self._authkey = self._manager._authkey
         else:
-            self._authkey = current_process().get_authkey()
+            self._authkey = current_process().authkey
 
         if incref:
             self._incref()
@@ -699,9 +699,9 @@
 
     def _connect(self):
         util.debug('making connection to manager')
-        name = current_process().get_name()
-        if threading.current_thread().get_name() != 'MainThread':
-            name += '|' + threading.current_thread().get_name()
+        name = current_process().name
+        if threading.current_thread().name != 'MainThread':
+            name += '|' + threading.current_thread().name
         conn = self._Client(self._token.address, authkey=self._authkey)
         dispatch(conn, None, 'accept_connection', (name,))
         self._tls.connection = conn
@@ -714,7 +714,7 @@
             conn = self._tls.connection
         except AttributeError:
             util.debug('thread %r does not own a connection',
-                       threading.current_thread().get_name())
+                       threading.current_thread().name)
             self._connect()
             conn = self._tls.connection
 
@@ -775,7 +775,7 @@
         # the process owns no more references to objects for this manager
         if not idset and hasattr(tls, 'connection'):
             util.debug('thread %r has no more proxies so closing conn',
-                       threading.current_thread().get_name())
+                       threading.current_thread().name)
             tls.connection.close()
             del tls.connection
 
@@ -880,7 +880,7 @@
     if authkey is None and manager is not None:
         authkey = manager._authkey
     if authkey is None:
-        authkey = current_process().get_authkey()
+        authkey = current_process().authkey
 
     ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed)
     proxy = ProxyType(token, serializer, manager=manager, authkey=authkey,

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py	Mon Aug 25 14:19:12 2008
@@ -99,15 +99,15 @@
                 args=(self._inqueue, self._outqueue, initializer, initargs)
                 )
             self._pool.append(w)
-            w.set_name(w.get_name().replace('Process', 'PoolWorker'))
-            w.set_daemon(True)
+            w.name = w.name.replace('Process', 'PoolWorker')
+            w.daemon = True
             w.start()
 
         self._task_handler = threading.Thread(
             target=Pool._handle_tasks,
             args=(self._taskqueue, self._quick_put, self._outqueue, self._pool)
             )
-        self._task_handler.set_daemon(True)
+        self._task_handler.daemon = True
         self._task_handler._state = RUN
         self._task_handler.start()
 
@@ -115,7 +115,7 @@
             target=Pool._handle_results,
             args=(self._outqueue, self._quick_get, self._cache)
             )
-        self._result_handler.set_daemon(True)
+        self._result_handler.daemon = True
         self._result_handler._state = RUN
         self._result_handler.start()
 

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py	Mon Aug 25 14:19:12 2008
@@ -132,45 +132,43 @@
         self._popen.poll()
         return self._popen.returncode is None
 
-    def get_name(self):
-        '''
-        Return name of process
-        '''
+    @property
+    def name(self):
         return self._name
 
-    def set_name(self, name):
-        '''
-        Set name of process
-        '''
+    @name.setter
+    def name(self, name):
         assert isinstance(name, str), 'name must be a string'
         self._name = name
 
-    def is_daemon(self):
+    @property
+    def daemon(self):
         '''
         Return whether process is a daemon
         '''
         return self._daemonic
 
-    def set_daemon(self, daemonic):
+    @daemon.setter
+    def daemon(self, daemonic):
         '''
         Set whether process is a daemon
         '''
         assert self._popen is None, 'process has already started'
         self._daemonic = daemonic
 
-    def get_authkey(self):
-        '''
-        Return authorization key of process
-        '''
+    @property
+    def authkey(self):
         return self._authkey
 
-    def set_authkey(self, authkey):
+    @authkey.setter
+    def authkey(self, authkey):
         '''
         Set authorization key of process
         '''
         self._authkey = AuthenticationString(authkey)
 
-    def get_exitcode(self):
+    @property
+    def exitcode(self):
         '''
         Return exit code of process or `None` if it has yet to stop
         '''
@@ -178,7 +176,8 @@
             return self._popen
         return self._popen.poll()
 
-    def get_ident(self):
+    @property
+    def ident(self):
         '''
         Return indentifier (PID) of process or `None` if it has yet to start
         '''
@@ -187,7 +186,7 @@
         else:
             return self._popen and self._popen.pid
 
-    pid = property(get_ident)
+    pid = ident
 
     def __repr__(self):
         if self is _current_process:
@@ -198,7 +197,7 @@
             status = 'initial'
         else:
             if self._popen.poll() is not None:
-                status = self.get_exitcode()
+                status = self.exitcode
             else:
                 status = 'started'
 
@@ -245,7 +244,7 @@
         except:
             exitcode = 1
             import traceback
-            sys.stderr.write('Process %s:\n' % self.get_name())
+            sys.stderr.write('Process %s:\n' % self.name)
             sys.stderr.flush()
             traceback.print_exc()
 

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py	Mon Aug 25 14:19:12 2008
@@ -155,7 +155,7 @@
                   self._wlock, self._writer.close),
             name='QueueFeederThread'
             )
-        self._thread.set_daemon(True)
+        self._thread.daemon = True
 
         debug('doing self._thread.start()')
         self._thread.start()

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py	Mon Aug 25 14:19:12 2008
@@ -81,9 +81,9 @@
         try:
             if _listener is None:
                 debug('starting listener and thread for sending handles')
-                _listener = Listener(authkey=current_process().get_authkey())
+                _listener = Listener(authkey=current_process().authkey)
                 t = threading.Thread(target=_serve)
-                t.set_daemon(True)
+                t.daemon = True
                 t.start()
         finally:
             _lock.release()
@@ -126,7 +126,7 @@
     if inherited:
         return handle
     sub_debug('rebuilding handle %d', handle)
-    conn = Client(address, authkey=current_process().get_authkey())
+    conn = Client(address, authkey=current_process().authkey)
     conn.send((handle, os.getpid()))
     new_handle = recv_handle(conn)
     conn.close()

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py	Mon Aug 25 14:19:12 2008
@@ -108,9 +108,9 @@
     def __repr__(self):
         try:
             if self._semlock._is_mine():
-                name = current_process().get_name()
-                if threading.current_thread().get_name() != 'MainThread':
-                    name += '|' + threading.current_thread().get_name()
+                name = current_process().name
+                if threading.current_thread().name != 'MainThread':
+                    name += '|' + threading.current_thread().name
             elif self._semlock._get_value() == 1:
                 name = 'None'
             elif self._semlock._count() > 0:
@@ -133,9 +133,9 @@
     def __repr__(self):
         try:
             if self._semlock._is_mine():
-                name = current_process().get_name()
-                if threading.current_thread().get_name() != 'MainThread':
-                    name += '|' + threading.current_thread().get_name()
+                name = current_process().name
+                if threading.current_thread().name != 'MainThread':
+                    name += '|' + threading.current_thread().name
                 count = self._semlock._count()
             elif self._semlock._get_value() == 1:
                 name, count = 'None', 0

Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py	Mon Aug 25 14:19:12 2008
@@ -273,11 +273,11 @@
 
     for p in active_children():
         if p._daemonic:
-            info('calling terminate() for daemon %s', p.get_name())
+            info('calling terminate() for daemon %s', p.name)
             p._popen.terminate()
 
     for p in active_children():
-        info('calling join() for process %s', p.get_name())
+        info('calling join() for process %s', p.name)
         p.join()
 
     debug('running the remaining "atexit" finalizers')

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	Mon Aug 25 14:19:12 2008
@@ -28,7 +28,7 @@
 _names = sys.builtin_module_names
 
 # Note:  more names are added to __all__ later.
-__all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep",
+__all__ = ["altsep", "curdir", "pardir", "sep", "extsep", "pathsep", "linesep",
            "defpath", "name", "path", "devnull",
            "SEEK_SET", "SEEK_CUR", "SEEK_END"]
 

Modified: python/branches/tlee-ast-optimize/Lib/shelve.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/shelve.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/shelve.py	Mon Aug 25 14:19:12 2008
@@ -69,7 +69,6 @@
     from StringIO import StringIO
 
 import UserDict
-import warnings
 
 __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"]
 

Modified: python/branches/tlee-ast-optimize/Lib/symtable.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/symtable.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/symtable.py	Mon Aug 25 14:19:12 2008
@@ -1,22 +1,21 @@
 """Interface to the compiler's internal symbol tables"""
 
 import _symtable
-from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \
-     DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \
-     DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND, \
-     OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC
+from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM,
+     DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC,
+     SCOPE_OFF, SCOPE_MASK, FREE, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
 
+import warnings
 import weakref
 
-__all__ = ["symtable", "SymbolTable", "newSymbolTable", "Class",
-           "Function", "Symbol"]
+__all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"]
 
 def symtable(code, filename, compile_type):
     raw = _symtable.symtable(code, filename, compile_type)
     for top in raw.itervalues():
         if top.name == 'top':
             break
-    return newSymbolTable(top, filename)
+    return _newSymbolTable(top, filename)
 
 class SymbolTableFactory:
     def __init__(self):
@@ -36,17 +35,11 @@
             obj = self.__memo[key] = self.new(table, filename)
         return obj
 
-newSymbolTable = SymbolTableFactory()
+_newSymbolTable = SymbolTableFactory()
 
-def is_free(flags):
-    if (flags & (USE | DEF_FREE)) \
-       and (flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)):
-        return True
-    if flags & DEF_FREE_CLASS:
-        return True
-    return False
 
-class SymbolTable:
+class SymbolTable(object):
+
     def __init__(self, raw_table, filename):
         self._table = raw_table
         self._filename = filename
@@ -59,10 +52,11 @@
             kind = "%s " % self.__class__.__name__
 
         if self._table.name == "global":
-            return "<%sSymbolTable for module %s>" % (kind, self._filename)
+            return "<{0}SymbolTable for module {1}>".format(kind, self._filename)
         else:
-            return "<%sSymbolTable for %s in %s>" % (kind, self._table.name,
-                                                     self._filename)
+            return "<{0}SymbolTable for {1} in {2}>".format(kind,
+                                                            self._table.name,
+                                                            self._filename)
 
     def get_type(self):
         if self._table.type == _symtable.TYPE_MODULE:
@@ -72,7 +66,7 @@
         if self._table.type == _symtable.TYPE_CLASS:
             return "class"
         assert self._table.type in (1, 2, 3), \
-               "unexpected type: %s" % self._table.type
+               "unexpected type: {0}".format(self._table.type)
 
     def get_id(self):
         return self._table.id
@@ -116,14 +110,15 @@
         return [self.lookup(ident) for ident in self.get_identifiers()]
 
     def __check_children(self, name):
-        return [newSymbolTable(st, self._filename)
+        return [_newSymbolTable(st, self._filename)
                 for st in self._table.children
                 if st.name == name]
 
     def get_children(self):
-        return [newSymbolTable(st, self._filename)
+        return [_newSymbolTable(st, self._filename)
                 for st in self._table.children]
 
+
 class Function(SymbolTable):
 
     # Default values for instance variables
@@ -148,15 +143,18 @@
 
     def get_globals(self):
         if self.__globals is None:
-            glob = DEF_GLOBAL | DEF_FREE_GLOBAL
-            self.__globals = self.__idents_matching(lambda x:x & glob)
+            glob = (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)
+            test = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) in glob
+            self.__globals = self.__idents_matching(test)
         return self.__globals
 
     def get_frees(self):
         if self.__frees is None:
+            is_free = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) == FREE
             self.__frees = self.__idents_matching(is_free)
         return self.__frees
 
+
 class Class(SymbolTable):
 
     __methods = None
@@ -169,14 +167,17 @@
             self.__methods = tuple(d)
         return self.__methods
 
-class Symbol:
+
+class Symbol(object):
+
     def __init__(self, name, flags, namespaces=None):
         self.__name = name
         self.__flags = flags
+        self.__scope = (flags >> SCOPE_OFF) & SCOPE_MASK # like PyST_GetScope()
         self.__namespaces = namespaces or ()
 
     def __repr__(self):
-        return "<symbol '%s'>" % self.__name
+        return "<symbol {0!r}>".format(self.__name)
 
     def get_name(self):
         return self.__name
@@ -188,25 +189,23 @@
         return bool(self.__flags & DEF_PARAM)
 
     def is_global(self):
-        return bool((self.__flags & DEF_GLOBAL)
-                    or (self.__flags & DEF_FREE_GLOBAL))
+        return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT))
 
     def is_vararg(self):
-        return bool(self.__flags & DEF_STAR)
+        warnings.warn("is_vararg() is obsolete and will be removed",
+                      DeprecationWarning, 2)
+        return False
 
     def is_keywordarg(self):
-        return bool(self.__flags & DEF_DOUBLESTAR)
+        warnings.warn("is_keywordarg() is obsolete and will be removed",
+                      DeprecationWarning, 2)
+        return False
 
     def is_local(self):
         return bool(self.__flags & DEF_BOUND)
 
     def is_free(self):
-        if (self.__flags & (USE | DEF_FREE)) \
-            and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)):
-            return True
-        if self.__flags & DEF_FREE_CLASS:
-            return True
-        return False
+        return bool(self.__scope == FREE)
 
     def is_imported(self):
         return bool(self.__flags & DEF_IMPORT)
@@ -215,7 +214,8 @@
         return bool(self.__flags & DEF_LOCAL)
 
     def is_in_tuple(self):
-        return bool(self.__flags & DEF_INTUPLE)
+        warnings.warn("is_in_tuple() is obsolete and will be removed",
+                      DeprecationWarning, 2)
 
     def is_namespace(self):
         """Returns true if name binding introduces new namespace.

Modified: python/branches/tlee-ast-optimize/Lib/test/test_bytes.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_bytes.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_bytes.py	Mon Aug 25 14:19:12 2008
@@ -213,7 +213,7 @@
             self.assertRaises(TypeError, lambda: 3.14 * b)
             # XXX Shouldn't bytes and bytearray agree on what to raise?
             self.assertRaises((OverflowError, MemoryError),
-                              lambda: b * sys.maxint)
+                              lambda: b * sys.maxsize)
 
     def test_repeat_1char(self):
         self.assertEqual(self.type2test(b'x')*100, self.type2test([ord('x')]*100))

Modified: python/branches/tlee-ast-optimize/Lib/test/test_compiler.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_compiler.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_compiler.py	Mon Aug 25 14:19:12 2008
@@ -64,6 +64,15 @@
     def testYieldExpr(self):
         compiler.compile("def g(): yield\n\n", "<string>", "exec")
 
+    def testKeywordAfterStarargs(self):
+        def f(*args, **kwargs):
+            self.assertEqual((args, kwargs), ((2,3), {'x': 1, 'y': 4}))
+        c = compiler.compile('f(x=1, *(2, 3), y=4)', '<string>', 'exec')
+        exec c in {'f': f}
+
+        self.assertRaises(SyntaxError, compiler.parse, "foo(a=1, b)")
+        self.assertRaises(SyntaxError, compiler.parse, "foo(1, *args, 3)")
+
     def testTryExceptFinally(self):
         # Test that except and finally clauses in one try stmt are recognized
         c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1",

Modified: python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py	Mon Aug 25 14:19:12 2008
@@ -16,7 +16,7 @@
             #delay = random.random() * 2
             delay = 0
             if test_support.verbose:
-                print 'task', self.get_name(), 'will run for', delay, 'sec'
+                print 'task', self.name, 'will run for', delay, 'sec'
             sema.acquire()
             mutex.acquire()
             running += 1
@@ -25,11 +25,11 @@
             mutex.release()
             time.sleep(delay)
             if test_support.verbose:
-                print 'task', self.get_name(), 'done'
+                print 'task', self.name, 'done'
             mutex.acquire()
             running -= 1
             if test_support.verbose:
-                print self.get_name(), 'is finished.', running, 'tasks are running'
+                print self.name, 'is finished.', running, 'tasks are running'
             mutex.release()
             sema.release()
 

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	Mon Aug 25 14:19:12 2008
@@ -227,6 +227,10 @@
             except:
                 pass
 
+    def testInvalidInit(self):
+        self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0)
+
+
 def test_main():
     # Historically, these tests have been sloppy about removing TESTFN.
     # So get rid of it no matter what.

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	Mon Aug 25 14:19:12 2008
@@ -417,7 +417,13 @@
             '0x1p0\0 0x1p0',  # embedded null byte is not end of string
             ]
         for x in invalid_inputs:
-            self.assertRaises(ValueError, fromHex, x)
+            try:
+                result = fromHex(x)
+            except ValueError:
+                pass
+            else:
+                self.fail('Expected float.fromhex(%r) to raise ValueError; '
+                          'got %r instead' % (x, result))
 
 
     def test_from_hex(self):

Modified: python/branches/tlee-ast-optimize/Lib/test/test_grammar.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_grammar.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_grammar.py	Mon Aug 25 14:19:12 2008
@@ -282,6 +282,14 @@
         def d32v((x,)): pass
         d32v((1,))
 
+        # keyword arguments after *arglist
+        def f(*args, **kwargs):
+            return args, kwargs
+        self.assertEquals(f(1, x=2, *[3, 4], y=5), ((1, 3, 4),
+                                                    {'x':2, 'y':5}))
+        self.assertRaises(SyntaxError, eval, "f(1, *(2,3), 4)")
+        self.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)")
+
         # Check ast errors in *args and *kwargs
         check_syntax_error(self, "f(*g(1=2))")
         check_syntax_error(self, "f(**g(1=2))")

Modified: python/branches/tlee-ast-optimize/Lib/test/test_list.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_list.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_list.py	Mon Aug 25 14:19:12 2008
@@ -15,7 +15,7 @@
         self.assertEqual(list(''), [])
         self.assertEqual(list('spam'), ['s', 'p', 'a', 'm'])
 
-        if sys.maxint == 0x7fffffff:
+        if sys.maxsize == 0x7fffffff:
             # This test can currently only work on 32-bit machines.
             # XXX If/when PySequence_Length() returns a ssize_t, it should be
             # XXX re-enabled.

Modified: python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py	Mon Aug 25 14:19:12 2008
@@ -119,22 +119,22 @@
             return
 
         current = self.current_process()
-        authkey = current.get_authkey()
+        authkey = current.authkey
 
         self.assertTrue(current.is_alive())
-        self.assertTrue(not current.is_daemon())
+        self.assertTrue(not current.daemon)
         self.assertTrue(isinstance(authkey, bytes))
         self.assertTrue(len(authkey) > 0)
-        self.assertEqual(current.get_ident(), os.getpid())
-        self.assertEqual(current.get_exitcode(), None)
+        self.assertEqual(current.ident, os.getpid())
+        self.assertEqual(current.exitcode, None)
 
     def _test(self, q, *args, **kwds):
         current = self.current_process()
         q.put(args)
         q.put(kwds)
-        q.put(current.get_name())
+        q.put(current.name)
         if self.TYPE != 'threads':
-            q.put(bytes(current.get_authkey()))
+            q.put(bytes(current.authkey))
             q.put(current.pid)
 
     def test_process(self):
@@ -146,33 +146,33 @@
         p = self.Process(
             target=self._test, args=args, kwargs=kwargs, name=name
             )
-        p.set_daemon(True)
+        p.daemon = True
         current = self.current_process()
 
         if self.TYPE != 'threads':
-            self.assertEquals(p.get_authkey(), current.get_authkey())
+            self.assertEquals(p.authkey, current.authkey)
         self.assertEquals(p.is_alive(), False)
-        self.assertEquals(p.is_daemon(), True)
+        self.assertEquals(p.daemon, True)
         self.assertTrue(p not in self.active_children())
         self.assertTrue(type(self.active_children()) is list)
-        self.assertEqual(p.get_exitcode(), None)
+        self.assertEqual(p.exitcode, None)
 
         p.start()
 
-        self.assertEquals(p.get_exitcode(), None)
+        self.assertEquals(p.exitcode, None)
         self.assertEquals(p.is_alive(), True)
         self.assertTrue(p in self.active_children())
 
         self.assertEquals(q.get(), args[1:])
         self.assertEquals(q.get(), kwargs)
-        self.assertEquals(q.get(), p.get_name())
+        self.assertEquals(q.get(), p.name)
         if self.TYPE != 'threads':
-            self.assertEquals(q.get(), current.get_authkey())
+            self.assertEquals(q.get(), current.authkey)
             self.assertEquals(q.get(), p.pid)
 
         p.join()
 
-        self.assertEquals(p.get_exitcode(), 0)
+        self.assertEquals(p.exitcode, 0)
         self.assertEquals(p.is_alive(), False)
         self.assertTrue(p not in self.active_children())
 
@@ -184,12 +184,12 @@
             return
 
         p = self.Process(target=self._test_terminate)
-        p.set_daemon(True)
+        p.daemon = True
         p.start()
 
         self.assertEqual(p.is_alive(), True)
         self.assertTrue(p in self.active_children())
-        self.assertEqual(p.get_exitcode(), None)
+        self.assertEqual(p.exitcode, None)
 
         p.terminate()
 
@@ -202,8 +202,8 @@
 
         p.join()
 
-        # XXX sometimes get p.get_exitcode() == 0 on Windows ...
-        #self.assertEqual(p.get_exitcode(), -signal.SIGTERM)
+        # XXX sometimes get p.exitcode == 0 on Windows ...
+        #self.assertEqual(p.exitcode, -signal.SIGTERM)
 
     def test_cpu_count(self):
         try:
@@ -330,7 +330,7 @@
             target=self._test_put,
             args=(queue, child_can_start, parent_can_continue)
             )
-        proc.set_daemon(True)
+        proc.daemon = True
         proc.start()
 
         self.assertEqual(queue_empty(queue), True)
@@ -396,7 +396,7 @@
             target=self._test_get,
             args=(queue, child_can_start, parent_can_continue)
             )
-        proc.set_daemon(True)
+        proc.daemon = True
         proc.start()
 
         self.assertEqual(queue_empty(queue), True)
@@ -619,11 +619,11 @@
         woken = self.Semaphore(0)
 
         p = self.Process(target=self.f, args=(cond, sleeping, woken))
-        p.set_daemon(True)
+        p.daemon = True
         p.start()
 
         p = threading.Thread(target=self.f, args=(cond, sleeping, woken))
-        p.set_daemon(True)
+        p.daemon = True
         p.start()
 
         # wait for both children to start sleeping
@@ -665,12 +665,12 @@
         for i in range(3):
             p = self.Process(target=self.f,
                              args=(cond, sleeping, woken, TIMEOUT1))
-            p.set_daemon(True)
+            p.daemon = True
             p.start()
 
             t = threading.Thread(target=self.f,
                                  args=(cond, sleeping, woken, TIMEOUT1))
-            t.set_daemon(True)
+            t.daemon = True
             t.start()
 
         # wait for them all to sleep
@@ -688,11 +688,11 @@
         # start some more threads/processes
         for i in range(3):
             p = self.Process(target=self.f, args=(cond, sleeping, woken))
-            p.set_daemon(True)
+            p.daemon = True
             p.start()
 
             t = threading.Thread(target=self.f, args=(cond, sleeping, woken))
-            t.set_daemon(True)
+            t.daemon = True
             t.start()
 
         # wait for them to all sleep
@@ -1185,7 +1185,7 @@
         conn, child_conn = self.Pipe()
 
         p = self.Process(target=self._echo, args=(child_conn,))
-        p.set_daemon(True)
+        p.daemon = True
         p.start()
 
         seq = [1, 2.25, None]
@@ -1334,7 +1334,7 @@
         for family in self.connection.families:
             l = self.connection.Listener(family=family)
             p = self.Process(target=self._test, args=(l.address,))
-            p.set_daemon(True)
+            p.daemon = True
             p.start()
             conn = l.accept()
             self.assertEqual(conn.recv(), 'hello')
@@ -1736,6 +1736,37 @@
 testcases_threads = create_test_cases(ThreadsMixin, type='threads')
 globals().update(testcases_threads)
 
+class OtherTest(unittest.TestCase):
+    # TODO: add more tests for deliver/answer challenge.
+    def test_deliver_challenge_auth_failure(self):
+        class _FakeConnection(object):
+            def recv_bytes(self, size):
+                return b'something bogus'
+            def send_bytes(self, data):
+                pass
+        self.assertRaises(multiprocessing.AuthenticationError,
+                          multiprocessing.connection.deliver_challenge,
+                          _FakeConnection(), b'abc')
+
+    def test_answer_challenge_auth_failure(self):
+        class _FakeConnection(object):
+            def __init__(self):
+                self.count = 0
+            def recv_bytes(self, size):
+                self.count += 1
+                if self.count == 1:
+                    return multiprocessing.connection.CHALLENGE
+                elif self.count == 2:
+                    return b'something bogus'
+                return b''
+            def send_bytes(self, data):
+                pass
+        self.assertRaises(multiprocessing.AuthenticationError,
+                          multiprocessing.connection.answer_challenge,
+                          _FakeConnection(), b'abc')
+
+testcases_other = [OtherTest]
+
 #
 #
 #
@@ -1764,7 +1795,8 @@
     testcases = (
         sorted(testcases_processes.values(), key=lambda tc:tc.__name__) +
         sorted(testcases_threads.values(), key=lambda tc:tc.__name__) +
-        sorted(testcases_manager.values(), key=lambda tc:tc.__name__)
+        sorted(testcases_manager.values(), key=lambda tc:tc.__name__) +
+        testcases_other
         )
 
     loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase

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	Mon Aug 25 14:19:12 2008
@@ -24,10 +24,28 @@
         self.assert_(os.access(test_support.TESTFN, os.W_OK))
 
     def test_closerange(self):
-        f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR)
+        first = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR)
+        # We must allocate two consecutive file descriptors, otherwise
+        # it will mess up other file descriptors (perhaps even the three
+        # standard ones).
+        second = os.dup(first)
+        try:
+            retries = 0
+            while second != first + 1:
+                os.close(first)
+                retries += 1
+                if retries > 10:
+                    # XXX test skipped
+                    print >> sys.stderr, (
+                        "couldn't allocate two consecutive fds, "
+                        "skipping test_closerange")
+                    return
+                first, second = second, os.dup(second)
+        finally:
+            os.close(second)
         # close a fd that is open, and one that isn't
-        os.closerange(f, f+2)
-        self.assertRaises(OSError, os.write, f, "a")
+        os.closerange(first, first + 2)
+        self.assertRaises(OSError, os.write, first, "a")
 
 
 class TemporaryFileTests(unittest.TestCase):
@@ -276,8 +294,7 @@
     # systems support centiseconds
     if sys.platform == 'win32':
         def get_file_system(path):
-            import os
-            root = os.path.splitdrive(os.path.realpath("."))[0] + '\\'
+            root = os.path.splitdrive(os.path.abspath(path))[0] + '\\'
             import ctypes
             kernel32 = ctypes.windll.kernel32
             buf = ctypes.create_string_buffer("", 100)
@@ -295,7 +312,7 @@
             try:
                 os.stat(r"c:\pagefile.sys")
             except WindowsError, e:
-                if e == 2: # file does not exist; cannot run test
+                if e.errno == 2: # file does not exist; cannot run test
                     return
                 self.fail("Could not stat pagefile.sys")
 

Modified: python/branches/tlee-ast-optimize/Lib/test/test_parser.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_parser.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_parser.py	Mon Aug 25 14:19:12 2008
@@ -66,6 +66,7 @@
         self.check_expr("foo(a, b, c, *args)")
         self.check_expr("foo(a, b, c, *args, **kw)")
         self.check_expr("foo(a, b, c, **kw)")
+        self.check_expr("foo(a, *args, keyword=23)")
         self.check_expr("foo + bar")
         self.check_expr("foo - bar")
         self.check_expr("foo * bar")

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	Mon Aug 25 14:19:12 2008
@@ -175,6 +175,28 @@
             with catch_warning() as w:
                 self.assertWarning(set(), w, expected)
 
+    def test_slice_methods(self):
+        class Spam(object):
+            def __getslice__(self, i, j): pass
+            def __setslice__(self, i, j, what): pass
+            def __delslice__(self, i, j): pass
+        class Egg:
+            def __getslice__(self, i, h): pass
+            def __setslice__(self, i, j, what): pass
+            def __delslice__(self, i, j): pass
+
+        expected = "in 3.x, __{0}slice__ has been removed; use __{0}item__"
+
+        for obj in (Spam(), Egg()):
+            with catch_warning() as w:
+                self.assertWarning(obj[1:2], w, expected.format('get'))
+                w.reset()
+                del obj[3:4]
+                self.assertWarning(None, w, expected.format('del'))
+                w.reset()
+                obj[4:5] = "eggs"
+                self.assertWarning(None, w, expected.format('set'))
+
     def test_tuple_parameter_unpacking(self):
         expected = "tuple parameter unpacking has been removed in 3.x"
         with catch_warning() as w:
@@ -250,6 +272,40 @@
                 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)
+
 
 
 class TestStdlibRemovals(unittest.TestCase):
@@ -340,6 +396,12 @@
                 func = getattr(commands, name)
                 self.assertRaises(DeprecationWarning, func, *([None]*arg_count))
 
+    def test_reduce_move(self):
+        from operator import add
+        with catch_warning(record=False):
+            warnings.filterwarnings("error", "reduce")
+            self.assertRaises(DeprecationWarning, reduce, add, range(10))
+
     def test_mutablestring_removal(self):
         # UserString.MutableString has been removed in 3.0.
         import UserString

Modified: python/branches/tlee-ast-optimize/Lib/test/test_re.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_re.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_re.py	Mon Aug 25 14:19:12 2008
@@ -370,10 +370,6 @@
         self.assertEqual(re.search(r"\d\D\w\W\s\S",
                                    "1aa! a", re.UNICODE).group(0), "1aa! a")
 
-    def test_ignore_case(self):
-        self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC")
-        self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC")
-
     def test_bigcharset(self):
         self.assertEqual(re.match(u"([\u2222\u2223])",
                                   u"\u2222").group(1), u"\u2222")
@@ -401,6 +397,8 @@
         self.assertEqual(re.match(r"(a)(?!\s(abc|a))", "a b").group(1), "a")
 
     def test_ignore_case(self):
+        self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC")
+        self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC")
         self.assertEqual(re.match(r"(a\s[^a])", "a b", re.I).group(1), "a b")
         self.assertEqual(re.match(r"(a\s[^a]*)", "a bb", re.I).group(1), "a bb")
         self.assertEqual(re.match(r"(a\s[abc])", "a b", re.I).group(1), "a b")

Modified: python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py	Mon Aug 25 14:19:12 2008
@@ -212,6 +212,10 @@
         m = 'A test message'
         smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
         smtp.sendmail('John', 'Sally', m)
+        # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor
+        # in asyncore.  This sleep might help, but should really be fixed
+        # properly by using an Event variable.
+        time.sleep(0.01)
         smtp.quit()
 
         self.client_evt.set()

Modified: python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py	Mon Aug 25 14:19:12 2008
@@ -139,7 +139,7 @@
             # Time between requests is short enough that we won't wake
             # up spuriously too many times.
             kwargs={'poll_interval':0.01})
-        t.set_daemon(True)  # In case this function raises.
+        t.daemon = True  # In case this function raises.
         t.start()
         if verbose: print "server running"
         for i in range(3):

Modified: python/branches/tlee-ast-optimize/Lib/test/test_ssl.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_ssl.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_ssl.py	Mon Aug 25 14:19:12 2008
@@ -200,7 +200,7 @@
                 self.sock.setblocking(1)
                 self.sslconn = None
                 threading.Thread.__init__(self)
-                self.setDaemon(True)
+                self.daemon = True
 
             def show_conn_details(self):
                 if self.server.certreqs == ssl.CERT_REQUIRED:
@@ -338,7 +338,7 @@
             self.port = test_support.bind_port(self.sock)
             self.active = False
             threading.Thread.__init__(self)
-            self.setDaemon(False)
+            self.daemon = True
 
         def start (self, flag=None):
             self.flag = flag
@@ -423,7 +423,7 @@
             self.server = self.EchoServer(certfile)
             self.port = self.server.port
             threading.Thread.__init__(self)
-            self.setDaemon(True)
+            self.daemon = True
 
         def __str__(self):
             return "<%s %s>" % (self.__class__.__name__, self.server)
@@ -567,7 +567,7 @@
             self.server = self.HTTPSServer(
                 (HOST, self.port), self.RootedHTTPRequestHandler, certfile)
             threading.Thread.__init__(self)
-            self.setDaemon(True)
+            self.daemon = True
 
         def __str__(self):
             return "<%s %s>" % (self.__class__.__name__, self.server)

Modified: python/branches/tlee-ast-optimize/Lib/test/test_struct.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_struct.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_struct.py	Mon Aug 25 14:19:12 2008
@@ -8,7 +8,7 @@
 
 import sys
 ISBIGENDIAN = sys.byteorder == "big"
-IS32BIT = sys.maxint == 0x7fffffff
+IS32BIT = sys.maxsize == 0x7fffffff
 del sys
 
 try:

Modified: python/branches/tlee-ast-optimize/Lib/test/test_symtable.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_symtable.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_symtable.py	Mon Aug 25 14:19:12 2008
@@ -1,31 +1,187 @@
-from test import test_support
-
+"""
+Test the API of the symtable module.
+"""
 import symtable
 import unittest
+import warnings
+
+from test import test_support
+
 
+TEST_CODE = """
+import sys
 
-## XXX
-## Test disabled because symtable module needs to be rewritten for new compiler
+glob = 42
 
-##vereq(symbols[0].name, "global")
-##vereq(len([ste for ste in symbols.values() if ste.name == "f"]), 1)
+class Mine:
+    instance_var = 24
+    def a_method(p1, p2):
+        pass
+
+def spam(a, b, *var, **kw):
+    global bar
+    bar = 47
+    x = 23
+    glob
+    def internal():
+        return x
+    return internal
+
+def foo():
+    exec 'm'
+    from sys import *
+
+def namespace_test(): pass
+def namespace_test(): pass
+"""
+
+
+def find_block(block, name):
+    for ch in block.get_children():
+        if ch.get_name() == name:
+            return ch
 
-### Bug tickler: SyntaxError file name correct whether error raised
-### while parsing or building symbol table.
-##def checkfilename(brokencode):
-##    try:
-##        _symtable.symtable(brokencode, "spam", "exec")
-##    except SyntaxError, e:
-##        vereq(e.filename, "spam")
-##    else:
-##        raise TestFailed("no SyntaxError for %r" % (brokencode,))
-##checkfilename("def f(x): foo)(")  # parse-time
-##checkfilename("def f(x): global x")  # symtable-build-time
 
 class SymtableTest(unittest.TestCase):
-    def test_invalid_args(self):
-        self.assertRaises(TypeError, symtable.symtable, "42")
-        self.assertRaises(ValueError, symtable.symtable, "42", "?", "")
+
+    with test_support.catch_warning(record=False):
+        # Ignore warnings about "from blank import *"
+        warnings.simplefilter("ignore", SyntaxWarning)
+        top = symtable.symtable(TEST_CODE, "?", "exec")
+    # These correspond to scopes in TEST_CODE
+    Mine = find_block(top, "Mine")
+    a_method = find_block(Mine, "a_method")
+    spam = find_block(top, "spam")
+    internal = find_block(spam, "internal")
+    foo = find_block(top, "foo")
+
+    def test_noops(self):
+        # Check methods that don't work. They should warn and return False.
+        def check(w, msg):
+            self.assertEqual(str(w.message), msg)
+        sym = self.top.lookup("glob")
+        with test_support.catch_warning() as w:
+            warnings.simplefilter("always", DeprecationWarning)
+            self.assertFalse(sym.is_vararg())
+            check(w, "is_vararg() is obsolete and will be removed")
+            w.reset()
+            self.assertFalse(sym.is_keywordarg())
+            check(w, "is_keywordarg() is obsolete and will be removed")
+            w.reset()
+            self.assertFalse(sym.is_in_tuple())
+            check(w, "is_in_tuple() is obsolete and will be removed")
+
+    def test_type(self):
+        self.assertEqual(self.top.get_type(), "module")
+        self.assertEqual(self.Mine.get_type(), "class")
+        self.assertEqual(self.a_method.get_type(), "function")
+        self.assertEqual(self.spam.get_type(), "function")
+        self.assertEqual(self.internal.get_type(), "function")
+
+    def test_optimized(self):
+        self.assertFalse(self.top.is_optimized())
+        self.assertFalse(self.top.has_exec())
+        self.assertFalse(self.top.has_import_star())
+
+        self.assertTrue(self.spam.is_optimized())
+
+        self.assertFalse(self.foo.is_optimized())
+        self.assertTrue(self.foo.has_exec())
+        self.assertTrue(self.foo.has_import_star())
+
+    def test_nested(self):
+        self.assertFalse(self.top.is_nested())
+        self.assertFalse(self.Mine.is_nested())
+        self.assertFalse(self.spam.is_nested())
+        self.assertTrue(self.internal.is_nested())
+
+    def test_children(self):
+        self.assertTrue(self.top.has_children())
+        self.assertTrue(self.Mine.has_children())
+        self.assertFalse(self.foo.has_children())
+
+    def test_lineno(self):
+        self.assertEqual(self.top.get_lineno(), 0)
+        self.assertEqual(self.spam.get_lineno(), 11)
+
+    def test_function_info(self):
+        func = self.spam
+        self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var"))
+        self.assertEqual(func.get_locals(),
+                         ("a", "b", "bar", "internal", "kw", "var", "x"))
+        self.assertEqual(func.get_globals(), ("bar", "glob"))
+        self.assertEqual(self.internal.get_frees(), ("x",))
+
+    def test_globals(self):
+        self.assertTrue(self.spam.lookup("glob").is_global())
+        self.assertTrue(self.spam.lookup("bar").is_global())
+        self.assertFalse(self.internal.lookup("x").is_global())
+        self.assertFalse(self.Mine.lookup("instance_var").is_global())
+
+    def test_local(self):
+        self.assertTrue(self.spam.lookup("x").is_local())
+        self.assertFalse(self.internal.lookup("x").is_local())
+
+    def test_referenced(self):
+        self.assertTrue(self.internal.lookup("x").is_referenced())
+        self.assertTrue(self.spam.lookup("internal").is_referenced())
+        self.assertFalse(self.spam.lookup("x").is_referenced())
+
+    def test_parameters(self):
+        for sym in ("a", "var", "kw"):
+            self.assertTrue(self.spam.lookup(sym).is_parameter())
+        self.assertFalse(self.spam.lookup("x").is_parameter())
+
+    def test_symbol_lookup(self):
+        self.assertEqual(len(self.top.get_identifiers()),
+                         len(self.top.get_symbols()))
+
+        self.assertRaises(KeyError, self.top.lookup, "not_here")
+
+    def test_namespaces(self):
+        self.assertTrue(self.top.lookup("Mine").is_namespace())
+        self.assertTrue(self.Mine.lookup("a_method").is_namespace())
+        self.assertTrue(self.top.lookup("spam").is_namespace())
+        self.assertTrue(self.spam.lookup("internal").is_namespace())
+        self.assertTrue(self.top.lookup("namespace_test").is_namespace())
+        self.assertFalse(self.spam.lookup("x").is_namespace())
+
+        self.assert_(self.top.lookup("spam").get_namespace() is self.spam)
+        ns_test = self.top.lookup("namespace_test")
+        self.assertEqual(len(ns_test.get_namespaces()), 2)
+        self.assertRaises(ValueError, ns_test.get_namespace)
+
+    def test_assigned(self):
+        self.assertTrue(self.spam.lookup("x").is_assigned())
+        self.assertTrue(self.spam.lookup("bar").is_assigned())
+        self.assertTrue(self.top.lookup("spam").is_assigned())
+        self.assertTrue(self.Mine.lookup("a_method").is_assigned())
+        self.assertFalse(self.internal.lookup("x").is_assigned())
+
+    def test_imported(self):
+        self.assertTrue(self.top.lookup("sys").is_imported())
+
+    def test_name(self):
+        self.assertEqual(self.top.get_name(), "top")
+        self.assertEqual(self.spam.get_name(), "spam")
+        self.assertEqual(self.spam.lookup("x").get_name(), "x")
+        self.assertEqual(self.Mine.get_name(), "Mine")
+
+    def test_class_info(self):
+        self.assertEqual(self.Mine.get_methods(), ('a_method',))
+
+    def test_filename_correct(self):
+        ### Bug tickler: SyntaxError file name correct whether error raised
+        ### while parsing or building symbol table.
+        def checkfilename(brokencode):
+            try:
+                symtable.symtable(brokencode, "spam", "exec")
+            except SyntaxError as e:
+                self.assertEqual(e.filename, "spam")
+            else:
+                self.fail("no SyntaxError for %r" % (brokencode,))
+        checkfilename("def f(x): foo)(")  # parse-time
+        checkfilename("def f(x): global x")  # symtable-build-time
 
     def test_eval(self):
         symbols = symtable.symtable("42", "?", "eval")

Modified: python/branches/tlee-ast-optimize/Lib/test/test_threading.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_threading.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_threading.py	Mon Aug 25 14:19:12 2008
@@ -34,7 +34,7 @@
         delay = random.random() / 10000.0
         if verbose:
             print 'task %s will run for %.1f usec' % (
-                self.get_name(), delay * 1e6)
+                self.name, delay * 1e6)
 
         with self.sema:
             with self.mutex:
@@ -45,14 +45,14 @@
 
             time.sleep(delay)
             if verbose:
-                print 'task', self.get_name(), 'done'
+                print 'task', self.name, 'done'
 
             with self.mutex:
                 self.nrunning.dec()
                 self.testcase.assert_(self.nrunning.get() >= 0)
                 if verbose:
                     print '%s is finished. %d tasks are running' % (
-                        self.get_name(), self.nrunning.get())
+                        self.name, self.nrunning.get())
 
 class ThreadTests(unittest.TestCase):
 
@@ -73,7 +73,7 @@
         for i in range(NUMTASKS):
             t = TestThread("<thread %d>"%i, self, sema, mutex, numrunning)
             threads.append(t)
-            self.failUnlessEqual(t.get_ident(), None)
+            self.failUnlessEqual(t.ident, None)
             self.assert_(re.match('<TestThread\(.*, initial\)>', repr(t)))
             t.start()
 
@@ -82,7 +82,7 @@
         for t in threads:
             t.join(NUMTASKS)
             self.assert_(not t.is_alive())
-            self.failIfEqual(t.get_ident(), 0)
+            self.failIfEqual(t.ident, 0)
             self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
         if verbose:
             print 'all tasks done'
@@ -172,7 +172,7 @@
                     worker_saw_exception.set()
 
         t = Worker()
-        t.set_daemon(True) # so if this fails, we don't hang Python at shutdown
+        t.daemon = True # so if this fails, we don't hang Python at shutdown
         t.start()
         if verbose:
             print "    started worker thread"
@@ -258,7 +258,7 @@
                 print 'program blocked; aborting'
                 os._exit(2)
             t = threading.Thread(target=killer)
-            t.set_daemon(True)
+            t.daemon = True
             t.start()
 
             # This is the trace function
@@ -435,7 +435,7 @@
     def test_daemonize_active_thread(self):
         thread = threading.Thread()
         thread.start()
-        self.assertRaises(RuntimeError, thread.set_daemon, True)
+        self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
 
 
 def test_main():

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	Mon Aug 25 14:19:12 2008
@@ -1118,14 +1118,9 @@
         # when a string allocation fails with a MemoryError.
         # This used to crash the interpreter,
         # or leak references when the number was smaller.
-        try:
-            u"a" * (sys.maxint // 2 - 100)
-        except MemoryError:
-            pass
-        try:
-            u"a" * (sys.maxint // 2 - 100)
-        except MemoryError:
-            pass
+        alloc = lambda: u"a" * (sys.maxsize - 100)
+        self.assertRaises(MemoryError, alloc)
+        self.assertRaises(MemoryError, alloc)
 
 def test_main():
     test_support.run_unittest(__name__)

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	Mon Aug 25 14:19:12 2008
@@ -39,7 +39,7 @@
         return callable
     @wraps(callable)
     def old(*args, **kwargs):
-        warnings.warnpy3k("In 3.x, {0} is renamed to {1}."
+        warnings.warnpy3k("{0}() is deprecated in favor of {1}()"
                           .format(old_name, callable.__name__),
                           stacklevel=3)
         return callable(*args, **kwargs)
@@ -67,7 +67,7 @@
             if self.__verbose:
                 format = format % args
                 format = "%s: %s\n" % (
-                    current_thread().get_name(), format)
+                    current_thread().name, format)
                 _sys.stderr.write(format)
 
 else:
@@ -110,7 +110,7 @@
         owner = self.__owner
         return "<%s(%s, %d)>" % (
                 self.__class__.__name__,
-                owner and owner.get_name(),
+                owner and owner.name,
                 self.__count)
 
     def acquire(self, blocking=1):
@@ -445,7 +445,7 @@
 
     def _set_daemon(self):
         # Overridden in _MainThread and _DummyThread
-        return current_thread().is_daemon()
+        return current_thread().daemon
 
     def __repr__(self):
         assert self.__initialized, "Thread.__init__() was not called"
@@ -534,7 +534,7 @@
                 # self.
                 if _sys:
                     _sys.stderr.write("Exception in thread %s:\n%s\n" %
-                                      (self.get_name(), _format_exc()))
+                                      (self.name, _format_exc()))
                 else:
                     # Do the best job possible w/o a huge amt. of code to
                     # approximate a traceback (code ideas from
@@ -542,7 +542,7 @@
                     exc_type, exc_value, exc_tb = self.__exc_info()
                     try:
                         print>>self.__stderr, (
-                            "Exception in thread " + self.get_name() +
+                            "Exception in thread " + self.name +
                             " (most likely raised during interpreter shutdown):")
                         print>>self.__stderr, (
                             "Traceback (most recent call last):")
@@ -651,19 +651,18 @@
         finally:
             self.__block.release()
 
-    def get_name(self):
+    @property
+    def name(self):
         assert self.__initialized, "Thread.__init__() not called"
         return self.__name
 
-    getName = _old_api(get_name, "getName")
-
-    def set_name(self, name):
+    @name.setter
+    def name(self, name):
         assert self.__initialized, "Thread.__init__() not called"
         self.__name = str(name)
 
-    setName = _old_api(set_name, "setName")
-
-    def get_ident(self):
+    @property
+    def ident(self):
         assert self.__initialized, "Thread.__init__() not called"
         return self.__ident
 
@@ -673,20 +672,38 @@
 
     isAlive = _old_api(is_alive, "isAlive")
 
-    def is_daemon(self):
+    @property
+    def daemon(self):
         assert self.__initialized, "Thread.__init__() not called"
         return self.__daemonic
 
-    isDaemon = _old_api(is_daemon, "isDaemon")
-
-    def set_daemon(self, daemonic):
+    @daemon.setter
+    def daemon(self, daemonic):
         if not self.__initialized:
             raise RuntimeError("Thread.__init__() not called")
         if self.__started.is_set():
             raise RuntimeError("cannot set daemon status of active thread");
         self.__daemonic = daemonic
 
-    setDaemon = _old_api(set_daemon, "setDaemon")
+    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
 
@@ -749,7 +766,7 @@
 
 def _pickSomeNonDaemonThread():
     for t in enumerate():
-        if not t.is_daemon() and t.is_alive():
+        if not t.daemon and t.is_alive():
             return t
     return None
 
@@ -905,7 +922,7 @@
             counter = 0
             while counter < self.quota:
                 counter = counter + 1
-                self.queue.put("%s.%d" % (self.get_name(), counter))
+                self.queue.put("%s.%d" % (self.name, counter))
                 _sleep(random() * 0.00001)
 
 
@@ -930,7 +947,7 @@
     P = []
     for i in range(NP):
         t = ProducerThread(Q, NI)
-        t.setName("Producer-%d" % (i+1))
+        t.name = ("Producer-%d" % (i+1))
         P.append(t)
     C = ConsumerThread(Q, NI*NP)
     for t in P:

Modified: python/branches/tlee-ast-optimize/Lib/urllib2.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/urllib2.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/urllib2.py	Mon Aug 25 14:19:12 2008
@@ -107,8 +107,8 @@
     from StringIO import StringIO
 
 from urllib import (unwrap, unquote, splittype, splithost, quote,
-     addinfourl, splitport, splitquery,
-     splitattr, ftpwrapper, noheaders, splituser, splitpasswd, splitvalue)
+     addinfourl, splitport,
+     splitattr, ftpwrapper, splituser, splitpasswd, splitvalue)
 
 # support for FileHandler, proxies via environment variables
 from urllib import localhost, url2pathname, getproxies

Modified: python/branches/tlee-ast-optimize/Lib/weakref.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/weakref.py	(original)
+++ python/branches/tlee-ast-optimize/Lib/weakref.py	Mon Aug 25 14:19:12 2008
@@ -26,7 +26,7 @@
 ProxyTypes = (ProxyType, CallableProxyType)
 
 __all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs",
-           "WeakKeyDictionary", "ReferenceType", "ProxyType",
+           "WeakKeyDictionary", "ReferenceError", "ReferenceType", "ProxyType",
            "CallableProxyType", "ProxyTypes", "WeakValueDictionary"]
 
 

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	Mon Aug 25 14:19:12 2008
@@ -807,9 +807,14 @@
 
     def testzip(self):
         """Read all the files and check the CRC."""
+        chunk_size = 2 ** 20
         for zinfo in self.filelist:
             try:
-                self.read(zinfo.filename)       # Check CRC-32
+                # Read by chunks, to avoid an OverflowError or a
+                # MemoryError with very large embedded files.
+                f = self.open(zinfo.filename, "r")
+                while f.read(chunk_size):     # Check CRC-32
+                    pass
             except BadZipfile:
                 return zinfo.filename
 

Modified: python/branches/tlee-ast-optimize/Misc/NEWS
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/NEWS	(original)
+++ python/branches/tlee-ast-optimize/Misc/NEWS	Mon Aug 25 14:19:12 2008
@@ -4,14 +4,67 @@
 
 (editors: check NEWS.help for information about editing NEWS using ReST.)
 
+What's New in Python 2.6 release candidate 1?
+=============================================
+
+*Release date: XX-XXX-2008*
+
+Core and Builtins
+-----------------
+
+- Fix crashes on memory allocation failure found with failmalloc.
+
+- Fix memory leaks found with valgrind and update suppressions file.
+
+- Fix compiler warnings in opt mode which would lead to invalid memory reads.
+
+- Fix problem using wrong name in decimal module reported by pychecker.
+
+- Issue #3642: Changed type of numarenas from uint to size_t
+  in order to silence a compilier warning on 64bit OSes.
+
+- Silenced another compiler warning about a used but not defined
+  function 'stringlib_contains_obj'.
+
+- Added warnings on the use of ``__getslice__``, ``__setslice__``, or
+  ``__delslice__``.
+
+Library
+-------
+
+- Silenced a trivial compiler warning in the sqlite module.
+
+- Fixed two format strings in the _collections module.
+
+Extension Modules
+-----------------
+
+- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by
+  exploitation of poor argument checking.
+
+
 What's New in Python 2.6 beta 3?
 ================================
 
-*Release date: XX-Aug-2008*
+*Release date: 20-Aug-2008*
 
 Core and Builtins
 -----------------
 
+- Issue #1878: Remove Py_TPFLAGS_HAVE_VERSION_TAG from
+  Py_TPFLAGS_DEFAULT when not building the core.  This means 3rd party
+  extensions do not automatically benefit from the class attribute
+  cache; they will have to explicitly add Py_TPFLAGS_HAVE_VERSION_TAG
+  to their tp_flags field if they care.  This is a backwards
+  compatibility feature; in 3.0, all types will use the cache by
+  default.
+
+- Keyword arguments can now follow starred arguments. (``f(a, *args,
+  keyword=23)`` is now valid syntax.)
+
+- ctypes function pointers that are COM methods have a boolean True
+  value again.
+
 - Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
   by denying s# to parse objects that have a releasebuffer procedure,
   and introducing s*.
@@ -48,6 +101,34 @@
 Library
 -------
 
+- Issue #3612: Added some missing basic types in ctypes.wintypes.
+
+- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of
+  symtable.Symbol have been deprecated for removal in 3.0 and the next release.
+
+- Issue #2234: distutils failed for some versions of the cygwin compiler. The
+  version reported by these tools does not necessarily follow the python
+  version numbering scheme, so the module is less strict when parsing it.
+
+- Issue #2235: Added Py3k warnings for types which will become unhashable
+  under the stricter __hash__ inheritance rules in 3.0. Several types
+  which did not meet the rules for hash invariants and were already
+  unhashable in 3.0 have now been explicitly flagged as unhashable in
+  2.6 as well (collections.Mapping, collections.Set, unittest.TestSuite,
+  xml.dom.minidom.NamedNodeMap, numbers.Number, UserList.UserList)
+
+- Update __all__ for cookielib, csv, os, urllib2, and weakref to include things
+  imported into the module but exposed as part of the module's API.
+
+- Remove an unneeded import of abc.ABCMeta from 'inspect'.
+
+- Remove unneeded imports of 'sys' and 'warnings' from 'io'.
+
+- Remove unneeded imports of 'warnings' from shelve, filecmp, and dummy_thread.
+
+- Issue #3575: Incremental decoder's decode function now takes bytearray
+  by using 's*' instead of 't#'.
+
 - Issue #2222: Fixed reference leak when occured os.rename()
   fails unicode conversion on 2nd parameter. (windows only)
 
@@ -147,6 +228,9 @@
 Documentation
 -------------
 
+- Issue #2235: the C API function PyObject_HashNotImplemented and its
+  interaction with the tp_hash slot (added in 2.6b2) are now documented
+
 - Issue #643841: The language reference now provides more detailed
   coverage of the lookup process for special methods. The disclaimers
   regarding lack of coverage of new-style classes have also been
@@ -368,6 +452,7 @@
 
 Extension Modules
 -----------------
+- Issue #1179: [CVE-2007-4965] Integer overflow in imageop module.
 
 - Issue #3116:  marshal.dumps() had quadratic behavior for strings > 32Mb.
 
@@ -400,7 +485,7 @@
 
 - Issue #2870: cmathmodule.c compile error.
 
-- Added a threading.Thread.getIdent() method.
+- Added a threading.Thread.ident property.
 
 Library
 -------
@@ -643,7 +728,8 @@
 - The bundled OSX-specific copy of libbffi is now in sync with the version
   shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms.
 
-- The threading module gained alias for names that are removed in 3.x.
+- The threading module gained aliases for names that will be removed in the
+  3.x series.
 
 Build
 -----

Modified: python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec	(original)
+++ python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec	Mon Aug 25 14:19:12 2008
@@ -34,7 +34,7 @@
 
 %define name python
 #--start constants--
-%define version 2.6b2
+%define version 2.6b3
 %define libver 2.6
 #--end constants--
 %define release 1pydotorg

Modified: python/branches/tlee-ast-optimize/Misc/build.sh
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/build.sh	(original)
+++ python/branches/tlee-ast-optimize/Misc/build.sh	Mon Aug 25 14:19:12 2008
@@ -67,7 +67,7 @@
 # Note: test_XXX (none currently) really leak, but are disabled
 # so we don't send spam.  Any test which really leaks should only 
 # be listed here if there are also test cases under Lib/test/leakers.
-LEAKY_TESTS="test_(asynchat|cmd_line|popen2|socket|smtplib|sys|threadsignals|urllib2_localnet|httpservers)"
+LEAKY_TESTS="test_(asynchat|cmd_line|docxmlrpc|dumbdbm|file|ftplib|httpservers|imaplib|popen2|socket|smtplib|sys|telnetlib|threadedtempfile|threading|threadsignals|urllib2_localnet|xmlrpc)"
 
 # Skip these tests altogether when looking for leaks.  These tests
 # do not need to be stored above in LEAKY_TESTS too.

Modified: python/branches/tlee-ast-optimize/Misc/valgrind-python.supp
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/valgrind-python.supp	(original)
+++ python/branches/tlee-ast-optimize/Misc/valgrind-python.supp	Mon Aug 25 14:19:12 2008
@@ -47,6 +47,39 @@
 #
 
 {
+   Suppress leaking the GIL.  Happens once per process, see comment in ceval.c.
+   Memcheck:Leak
+   fun:malloc
+   fun:PyThread_allocate_lock
+   fun:PyEval_InitThreads
+}
+
+{
+   Suppress leaking the GIL after a fork.
+   Memcheck:Leak
+   fun:malloc
+   fun:PyThread_allocate_lock
+   fun:PyEval_ReInitThreads
+}
+
+{
+   Suppress leaking the autoTLSkey.  This looks like it shouldn't leak though.
+   Memcheck:Leak
+   fun:malloc
+   fun:PyThread_create_key
+   fun:_PyGILState_Init
+   fun:Py_InitializeEx
+   fun:Py_Main
+}
+
+{
+   Hmmm, is this a real leak or like the GIL?
+   Memcheck:Leak
+   fun:malloc
+   fun:PyThread_ReInitTLS
+}
+
+{
    Handle PyMalloc confusing valgrind (possibly leaked)
    Memcheck:Leak
    fun:realloc

Modified: python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c	Mon Aug 25 14:19:12 2008
@@ -670,7 +670,7 @@
 		return NULL;
 	}
 	if (((dequeobject *)deque)->maxlen != -1)
-		fmt = PyString_FromFormat("deque(%%r, maxlen=%i)", 
+		fmt = PyString_FromFormat("deque(%%r, maxlen=%" PY_FORMAT_SIZE_T "d)", 
 					((dequeobject *)deque)->maxlen);
 	else
 		fmt = PyString_FromString("deque(%r)");  
@@ -733,7 +733,7 @@
 	if (((dequeobject *)deque)->maxlen == -1)
 		fputs("])", fp);
 	else
-		fprintf(fp, "], maxlen=%d)", ((dequeobject *)deque)->maxlen);
+		fprintf(fp, "], maxlen=%" PY_FORMAT_SIZE_T "d)", ((dequeobject *)deque)->maxlen);
 	Py_END_ALLOW_THREADS
 	return 0;
 }

Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c	Mon Aug 25 14:19:12 2008
@@ -3938,12 +3938,16 @@
 }
 
 static int
-Pointer_nonzero(CDataObject *self)
+CFuncPtr_nonzero(CFuncPtrObject *self)
 {
-	return *(void **)self->b_ptr != NULL;
+	return ((*(void **)self->b_ptr != NULL)
+#ifdef MS_WIN32
+		|| (self->index != 0)
+#endif
+		);
 }
 
-static PyNumberMethods Pointer_as_number = {
+static PyNumberMethods CFuncPtr_as_number = {
 	0, /* nb_add */
 	0, /* nb_subtract */
 	0, /* nb_multiply */
@@ -3954,7 +3958,7 @@
 	0, /* nb_negative */
 	0, /* nb_positive */
 	0, /* nb_absolute */
-	(inquiry)Pointer_nonzero, /* nb_nonzero */
+	(inquiry)CFuncPtr_nonzero, /* nb_nonzero */
 };
 
 PyTypeObject CFuncPtr_Type = {
@@ -3968,7 +3972,7 @@
 	0,					/* tp_setattr */
 	0,					/* tp_compare */
 	(reprfunc)CFuncPtr_repr,		/* tp_repr */
-	&Pointer_as_number,			/* tp_as_number */
+	&CFuncPtr_as_number,			/* tp_as_number */
 	0,					/* tp_as_sequence */
 	0,					/* tp_as_mapping */
 	0,					/* tp_hash */
@@ -5176,6 +5180,26 @@
 	Pointer_subscript,
 };
 
+static int
+Pointer_nonzero(CDataObject *self)
+{
+	return (*(void **)self->b_ptr != NULL);
+}
+
+static PyNumberMethods Pointer_as_number = {
+	0, /* nb_add */
+	0, /* nb_subtract */
+	0, /* nb_multiply */
+	0, /* nb_divide */
+	0, /* nb_remainder */
+	0, /* nb_divmod */
+	0, /* nb_power */
+	0, /* nb_negative */
+	0, /* nb_positive */
+	0, /* nb_absolute */
+	(inquiry)Pointer_nonzero, /* nb_nonzero */
+};
+
 PyTypeObject Pointer_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes._Pointer",

Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c	Mon Aug 25 14:19:12 2008
@@ -416,6 +416,7 @@
 		ffi_ofs = 0;
 	}
 
+	assert(stgdict->format == NULL);
 	if (isStruct && !isPacked) {
 		stgdict->format = alloc_format_string(NULL, "T{");
 	} else {
@@ -539,7 +540,9 @@
 #undef realdict
 
 	if (isStruct && !isPacked) {
+		char *ptr = stgdict->format;
 		stgdict->format = alloc_format_string(stgdict->format, "}");
+		PyMem_Free(ptr);
 		if (stgdict->format == NULL)
 			return -1;
 	}

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	Mon Aug 25 14:19:12 2008
@@ -175,7 +175,7 @@
 						 kwlist,
 						 Py_FileSystemDefaultEncoding,
 						 &name, &mode, &closefd))
-			goto error;
+			return -1;
 	    }
 	}
 
@@ -278,6 +278,7 @@
 	ret = -1;
 
  done:
+	PyMem_Free(name);
 	return ret;
 }
 

Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/row.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_sqlite/row.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_sqlite/row.c	Mon Aug 25 14:19:12 2008
@@ -183,8 +183,8 @@
     if (PyType_IsSubtype(Py_TYPE(_other), &pysqlite_RowType)) {
 	pysqlite_Row *other = (pysqlite_Row *)_other;
 	PyObject *res = PyObject_RichCompare(self->description, other->description, opid);
-	if (opid == Py_EQ && res == Py_True
-	    || opid == Py_NE && res == Py_False) {
+	if ((opid == Py_EQ && res == Py_True)
+	    || (opid == Py_NE && res == Py_False)) {
 	    Py_DECREF(res);
 	    return PyObject_RichCompare(self->data, other->data, opid);
 	}

Modified: python/branches/tlee-ast-optimize/Modules/_testcapimodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_testcapimodule.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/_testcapimodule.c	Mon Aug 25 14:19:12 2008
@@ -600,6 +600,10 @@
 	if (!PyArg_ParseTuple(args, "Oi:raise_exception",
 			      &exc, &num_args))
 		return NULL;
+	if (!PyExceptionClass_Check(exc)) {
+		PyErr_Format(PyExc_TypeError, "an exception class is required");
+		return NULL;
+	}
 
 	exc_args = PyTuple_New(num_args);
 	if (exc_args == NULL)
@@ -628,14 +632,17 @@
  */
 static PyThread_type_lock thread_done = NULL;
 
-static void
+static int
 _make_call(void *callable)
 {
 	PyObject *rc;
+	int success;
 	PyGILState_STATE s = PyGILState_Ensure();
 	rc = PyObject_CallFunction((PyObject *)callable, "");
+	success = (rc != NULL);
 	Py_XDECREF(rc);
 	PyGILState_Release(s);
+	return success;
 }
 
 /* Same thing, but releases `thread_done` when it returns.  This variant
@@ -652,10 +659,17 @@
 test_thread_state(PyObject *self, PyObject *args)
 {
 	PyObject *fn;
+	int success = 1;
 
 	if (!PyArg_ParseTuple(args, "O:test_thread_state", &fn))
 		return NULL;
 
+	if (!PyCallable_Check(fn)) {
+		PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
+			fn->ob_type->tp_name);
+		return NULL;
+	}
+
 	/* Ensure Python is set up for threading */
 	PyEval_InitThreads();
 	thread_done = PyThread_allocate_lock();
@@ -666,10 +680,10 @@
 	/* Start a new thread with our callback. */
 	PyThread_start_new_thread(_make_call_from_thread, fn);
 	/* Make the callback with the thread lock held by this thread */
-	_make_call(fn);
+	success &= _make_call(fn);
 	/* Do it all again, but this time with the thread-lock released */
 	Py_BEGIN_ALLOW_THREADS
-	_make_call(fn);
+	success &= _make_call(fn);
 	PyThread_acquire_lock(thread_done, 1);  /* wait for thread to finish */
 	Py_END_ALLOW_THREADS
 
@@ -679,7 +693,7 @@
 	*/
 	Py_BEGIN_ALLOW_THREADS
 	PyThread_start_new_thread(_make_call_from_thread, fn);
-	_make_call(fn);
+	success &= _make_call(fn);
 	PyThread_acquire_lock(thread_done, 1);  /* wait for thread to finish */
 	Py_END_ALLOW_THREADS
 
@@ -687,6 +701,8 @@
 	PyThread_release_lock(thread_done);
 
 	PyThread_free_lock(thread_done);
+	if (!success)
+		return NULL;
 	Py_RETURN_NONE;
 }
 #endif

Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c	Mon Aug 25 14:19:12 2008
@@ -600,18 +600,24 @@
 	MultibyteCodec_State state;
 	MultibyteDecodeBuffer buf;
 	PyObject *errorcb;
+	Py_buffer pdata;
 	const char *data, *errors = NULL;
 	Py_ssize_t datalen, finalsize;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|z:decode",
-				codeckwarglist, &data, &datalen, &errors))
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|z:decode",
+				codeckwarglist, &pdata, &errors))
 		return NULL;
+	data = pdata.buf;
+	datalen = pdata.len;
 
 	errorcb = internal_error_callback(errors);
-	if (errorcb == NULL)
+	if (errorcb == NULL) {
+		PyBuffer_Release(&pdata);
 		return NULL;
+	}
 
 	if (datalen == 0) {
+		PyBuffer_Release(&pdata);
 		ERROR_DECREF(errorcb);
 		return make_tuple(PyUnicode_FromUnicode(NULL, 0), 0);
 	}
@@ -651,11 +657,13 @@
 		if (PyUnicode_Resize(&buf.outobj, finalsize) == -1)
 			goto errorexit;
 
+	PyBuffer_Release(&pdata);
 	Py_XDECREF(buf.excobj);
 	ERROR_DECREF(errorcb);
 	return make_tuple(buf.outobj, datalen);
 
 errorexit:
+	PyBuffer_Release(&pdata);
 	ERROR_DECREF(errorcb);
 	Py_XDECREF(buf.excobj);
 	Py_XDECREF(buf.outobj);
@@ -1018,12 +1026,15 @@
 {
 	MultibyteDecodeBuffer buf;
 	char *data, *wdata = NULL;
+	Py_buffer pdata;
 	Py_ssize_t wsize, finalsize = 0, size, origpending;
 	int final = 0;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "t#|i:decode",
-			incrementalkwarglist, &data, &size, &final))
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i:decode",
+			incrementalkwarglist, &pdata, &final))
 		return NULL;
+	data = pdata.buf;
+	size = pdata.len;
 
 	buf.outobj = buf.excobj = NULL;
 	origpending = self->pendingsize;
@@ -1072,12 +1083,14 @@
 		if (PyUnicode_Resize(&buf.outobj, finalsize) == -1)
 			goto errorexit;
 
+	PyBuffer_Release(&pdata);
 	if (wdata != data)
 		PyMem_Del(wdata);
 	Py_XDECREF(buf.excobj);
 	return buf.outobj;
 
 errorexit:
+	PyBuffer_Release(&pdata);
 	if (wdata != NULL && wdata != data)
 		PyMem_Del(wdata);
 	Py_XDECREF(buf.excobj);

Modified: python/branches/tlee-ast-optimize/Modules/imageop.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/imageop.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/imageop.c	Mon Aug 25 14:19:12 2008
@@ -78,7 +78,7 @@
 	char *cp, *ncp;
 	short *nsp;
 	Py_Int32 *nlp;
-	int len, size, x, y, newx1, newx2, newy1, newy2;
+	int len, size, x, y, newx1, newx2, newy1, newy2, nlen;
 	int ix, iy, xstep, ystep;
 	PyObject *rv;
 
@@ -90,13 +90,19 @@
 		PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
 		return 0;
 	}
-	if ( len != size*x*y ) {
+	if (( len != size*x*y ) ||
+            ( size != ((len / x) / y) )) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
 	xstep = (newx1 < newx2)? 1 : -1;
 	ystep = (newy1 < newy2)? 1 : -1;
     
+        nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size;
+        if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	rv = PyString_FromStringAndSize(NULL,
 			     (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size);
 	if ( rv == 0 )
@@ -132,7 +138,7 @@
 	char *cp, *ncp;
 	short *nsp;
 	Py_Int32 *nlp;
-	int len, size, x, y, newx, newy;
+	int len, size, x, y, newx, newy, nlen;
 	int ix, iy;
 	int oix, oiy;
 	PyObject *rv;
@@ -145,12 +151,18 @@
 		PyErr_SetString(ImageopError, "Size should be 1, 2 or 4");
 		return 0;
 	}
-	if ( len != size*x*y ) {
+	if ( ( len != size*x*y ) ||
+             ( size != ((len / x) / y) ) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
+        nlen = newx*newy*size;
+	if ( size != ((nlen / newx) / newy) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
     
-	rv = PyString_FromStringAndSize(NULL, newx*newy*size);
+	rv = PyString_FromStringAndSize(NULL, nlen);
 	if ( rv == 0 )
 		return 0;
 	ncp = (char *)PyString_AsString(rv);
@@ -190,7 +202,8 @@
 		PyErr_SetString(ImageopError, "Size should be 1 or 4");
 		return 0;
 	}
-	if ( maxx*maxy*width != len ) {
+	if ( ( maxx*maxy*width != len ) ||
+             ( maxx != ((len / maxy) / width) ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -240,7 +253,8 @@
 	if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) )
 		return 0;
 
-	if ( x*y != len ) {
+	if ( ( x*y != len ) ||
+             ( x != len / y ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -281,7 +295,8 @@
 	if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
 		return 0;
 
-	if ( x*y != len ) {
+	if ( ( x*y != len ) ||
+             ( x != len / y ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -320,7 +335,8 @@
 	if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
 		return 0;
 
-	if ( x*y != len ) {
+	if ( ( x*y != len ) ||
+             ( x != len / y ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -358,7 +374,8 @@
 	if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
 		return 0;
 
-	if ( x*y != len ) {
+	if ( ( x*y != len ) ||
+             ( x != len / y ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -404,7 +421,8 @@
 	if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) )
 		return 0;
 
-	if ( x*y != len ) {
+	if ( ( x*y != len ) ||
+             ( x != len / y ) ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
@@ -443,7 +461,11 @@
 	if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) )
 		return 0;
 
-	nlen = x*y;
+        nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( (nlen+7)/8 != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
@@ -481,6 +503,10 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( (nlen+3)/4 != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
@@ -517,6 +543,10 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( (nlen+1)/2 != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
@@ -554,6 +584,10 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( nlen*4 != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
@@ -598,10 +632,19 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( nlen != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
+	
+	if ( nlen / x != y || nlen > INT_MAX / 4) {
+		PyErr_SetString(ImageopError, "Image is too large");
+		return 0;
+	}
     
 	rv = PyString_FromStringAndSize(NULL, nlen*4);
 	if ( rv == 0 )
@@ -648,6 +691,10 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( nlen*4 != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
@@ -693,10 +740,19 @@
 		return 0;
 
 	nlen = x*y;
+	if ( x != (nlen / y) ) {
+		PyErr_SetString(ImageopError, "String has incorrect length");
+		return 0;
+	}
 	if ( nlen != len ) {
 		PyErr_SetString(ImageopError, "String has incorrect length");
 		return 0;
 	}
+	
+	if ( nlen / x != y || nlen > INT_MAX / 4) {
+		PyErr_SetString(ImageopError, "Image is too large");
+		return 0;
+	}
     
 	rv = PyString_FromStringAndSize(NULL, nlen*4);
 	if ( rv == 0 )

Modified: python/branches/tlee-ast-optimize/Modules/mmapmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/mmapmodule.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/mmapmodule.c	Mon Aug 25 14:19:12 2008
@@ -992,7 +992,7 @@
 will be the current size of the file when mmap is called.\n\
 flags specifies the nature of the mapping. MAP_PRIVATE creates a\n\
 private copy-on-write mapping, so changes to the contents of the mmap\n\
-object will be private to this process, and MAP_SHARED`creates a mapping\n\
+object will be private to this process, and MAP_SHARED creates a mapping\n\
 that's shared with all other processes mapping the same areas of the file.\n\
 The default value is MAP_SHARED.\n\
 \n\

Modified: python/branches/tlee-ast-optimize/Modules/signalmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/signalmodule.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/signalmodule.c	Mon Aug 25 14:19:12 2008
@@ -784,7 +784,8 @@
 #if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
     ItimerError = PyErr_NewException("signal.ItimerError", 
          PyExc_IOError, NULL);
-    PyDict_SetItemString(d, "ItimerError", ItimerError);
+    if (ItimerError != NULL)
+    	PyDict_SetItemString(d, "ItimerError", ItimerError);
 #endif
 
         if (!PyErr_Occurred())

Modified: python/branches/tlee-ast-optimize/Modules/symtablemodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/symtablemodule.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/symtablemodule.c	Mon Aug 25 14:19:12 2008
@@ -81,4 +81,7 @@
 	PyModule_AddIntConstant(m, "GLOBAL_IMPLICIT", GLOBAL_IMPLICIT);
 	PyModule_AddIntConstant(m, "FREE", FREE);
 	PyModule_AddIntConstant(m, "CELL", CELL);
+
+	PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFF);
+	PyModule_AddIntConstant(m, "SCOPE_MASK", SCOPE_MASK);
 }

Modified: python/branches/tlee-ast-optimize/Objects/bytearrayobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/bytearrayobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/bytearrayobject.c	Mon Aug 25 14:19:12 2008
@@ -1098,6 +1098,7 @@
 #define STRINGLIB_EMPTY nullbytes
 #define STRINGLIB_CHECK_EXACT PyByteArray_CheckExact
 #define STRINGLIB_MUTABLE 1
+#define FROM_BYTEARRAY 1
 
 #include "stringlib/fastsearch.h"
 #include "stringlib/count.h"
@@ -2295,8 +2296,11 @@
         PyBuffer_Release(&vsub);
         return NULL;
     }
-    if (n == 1)
-        return split_char(s, len, sub[0], maxsplit);
+    if (n == 1) {
+        list = split_char(s, len, sub[0], maxsplit);
+        PyBuffer_Release(&vsub);
+        return list;
+    }
 
     list = PyList_New(PREALLOC_SIZE(maxsplit));
     if (list == NULL) {
@@ -2527,8 +2531,11 @@
         PyBuffer_Release(&vsub);
         return NULL;
     }
-    else if (n == 1)
-        return rsplit_char(s, len, sub[0], maxsplit);
+    else if (n == 1) {
+        list = rsplit_char(s, len, sub[0], maxsplit);
+        PyBuffer_Release(&vsub);
+        return list;
+    }
 
     list = PyList_New(PREALLOC_SIZE(maxsplit));
     if (list == NULL) {

Modified: python/branches/tlee-ast-optimize/Objects/classobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/classobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/classobject.c	Mon Aug 25 14:19:12 2008
@@ -1174,8 +1174,15 @@
 		if (func == NULL)
 			return NULL;
 		arg = Py_BuildValue("(N)", _PySlice_FromIndices(i, j));
-	} else
+	}
+	else {
+		if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; "
+				   "use __getitem__", 1) < 0) {
+			Py_DECREF(func);
+			return NULL;
+		}
 		arg = Py_BuildValue("(nn)", i, j);
+	}
 
 	if (arg == NULL) {
 		Py_DECREF(func);
@@ -1257,8 +1264,15 @@
 
 			arg = Py_BuildValue("(N)",
 					    _PySlice_FromIndices(i, j));
-		} else
+		}
+		else {
+			if (PyErr_WarnPy3k("in 3.x, __delslice__ has been "
+				            "removed; use __delitem__", 1) < 0) {
+				Py_DECREF(func);
+				return -1;
+			}
 			arg = Py_BuildValue("(nn)", i, j);
+		}
 	}
 	else {
 		if (setslicestr == NULL) {
@@ -1284,8 +1298,15 @@
 
 			arg = Py_BuildValue("(NO)",
 					    _PySlice_FromIndices(i, j), value);
-		} else
+		}
+		else {
+			if (PyErr_WarnPy3k("in 3.x, __setslice__ has been "
+					   "removed; use __setitem__", 1) < 0) {
+				Py_DECREF(func);
+				return -1;
+			}
 			arg = Py_BuildValue("(nnO)", i, j, value);
+		}
 	}
 	if (arg == NULL) {
 		Py_DECREF(func);

Modified: python/branches/tlee-ast-optimize/Objects/floatobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/floatobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/floatobject.c	Mon Aug 25 14:19:12 2008
@@ -1126,7 +1126,6 @@
 static int
 hex_from_char(char c) {
 	int x;
-	assert(isxdigit(c));
 	switch(c) {
 	case '0':
 		x = 0;
@@ -1355,12 +1354,12 @@
 
 	/* coefficient: <integer> [. <fraction>] */
 	coeff_start = s;
-	while (isxdigit(*s))
+	while (hex_from_char(*s) >= 0)
 		s++;
 	s_store = s;
 	if (*s == '.') {
 		s++;
-		while (isxdigit(*s))
+		while (hex_from_char(*s) >= 0)
 			s++;
 		coeff_end = s-1;
 	}
@@ -1382,10 +1381,10 @@
 		exp_start = s;
 		if (*s == '-' || *s == '+')
 			s++;
-		if (!isdigit(*s))
+		if (!('0' <= *s && *s <= '9'))
 			goto parse_error;
 		s++;
-		while (isdigit(*s))
+		while ('0' <= *s && *s <= '9')
 			s++;
 		exp = strtol(exp_start, NULL, 10);
 	}

Modified: python/branches/tlee-ast-optimize/Objects/obmalloc.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/obmalloc.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/obmalloc.c	Mon Aug 25 14:19:12 2008
@@ -517,7 +517,7 @@
 #endif
 	if (unused_arena_objects == NULL) {
 		uint i;
-		uint numarenas;
+		size_t numarenas;
 		size_t nbytes;
 
 		/* Double the number of arena objects on each allocation.

Modified: python/branches/tlee-ast-optimize/Objects/stringlib/find.h
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/stringlib/find.h	(original)
+++ python/branches/tlee-ast-optimize/Objects/stringlib/find.h	Mon Aug 25 14:19:12 2008
@@ -90,7 +90,7 @@
     return stringlib_rfind(str + start, end - start, sub, sub_len, start);
 }
 
-#ifdef STRINGLIB_STR
+#if defined(STRINGLIB_STR) && !defined(FROM_BYTEARRAY)
 
 Py_LOCAL_INLINE(int)
 stringlib_contains_obj(PyObject* str, PyObject* sub)

Modified: python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h	(original)
+++ python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h	Mon Aug 25 14:19:12 2008
@@ -641,7 +641,10 @@
 	    /* We know this can't fail, since we've already
 	       reserved enough space. */
 	    STRINGLIB_CHAR *pstart = p + n_leading_chars;
-	    int r = STRINGLIB_GROUPING(pstart, n_digits, n_digits,
+#ifndef NDEBUG
+	    int r =
+#endif
+		STRINGLIB_GROUPING(pstart, n_digits, n_digits,
 			   spec.n_total+n_grouping_chars-n_leading_chars,
 			   NULL, 0);
 	    assert(r);

Modified: python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h	(original)
+++ python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h	Mon Aug 25 14:19:12 2008
@@ -483,13 +483,49 @@
 {
     int ok = 0;
     PyObject *result = NULL;
+    PyObject *format_spec_object = NULL;
+    PyObject *(*formatter)(PyObject *, STRINGLIB_CHAR *, Py_ssize_t) = NULL;
+    STRINGLIB_CHAR* format_spec_start = format_spec->ptr ?
+	    format_spec->ptr : NULL;
+    Py_ssize_t format_spec_len = format_spec->ptr ?
+	    format_spec->end - format_spec->ptr : 0;
+
+    /* If we know the type exactly, skip the lookup of __format__ and just
+       call the formatter directly. */
+#if STRINGLIB_IS_UNICODE
+    if (PyUnicode_CheckExact(fieldobj))
+	formatter = _PyUnicode_FormatAdvanced;
+    /* Unfortunately, there's a problem with checking for int, long,
+       and float here.  If we're being included as unicode, their
+       formatters expect string format_spec args.  For now, just skip
+       this optimization for unicode.  This could be fixed, but it's a
+       hassle. */
+#else
+    if (PyString_CheckExact(fieldobj))
+	formatter = _PyBytes_FormatAdvanced;
+    else if (PyInt_CheckExact(fieldobj))
+	formatter =_PyInt_FormatAdvanced;
+    else if (PyLong_CheckExact(fieldobj))
+	formatter =_PyLong_FormatAdvanced;
+    else if (PyFloat_CheckExact(fieldobj))
+	formatter = _PyFloat_FormatAdvanced;
+#endif
 
-    /* we need to create an object out of the pointers we have */
-    PyObject *format_spec_object = SubString_new_object_or_empty(format_spec);
-    if (format_spec_object == NULL)
-        goto done;
+    if (formatter) {
+	/* we know exactly which formatter will be called when __format__ is
+	   looked up, so call it directly, instead. */
+	result = formatter(fieldobj, format_spec_start, format_spec_len);
+    }
+    else {
+	/* We need to create an object out of the pointers we have, because
+	   __format__ takes a string/unicode object for format_spec. */
+	format_spec_object = STRINGLIB_NEW(format_spec_start,
+					   format_spec_len);
+	if (format_spec_object == NULL)
+	    goto done;
 
-    result = PyObject_Format(fieldobj, format_spec_object);
+	result = PyObject_Format(fieldobj, format_spec_object);
+    }
     if (result == NULL)
         goto done;
 
@@ -512,7 +548,7 @@
     ok = output_data(output,
                      STRINGLIB_STR(result), STRINGLIB_LEN(result));
 done:
-    Py_DECREF(format_spec_object);
+    Py_XDECREF(format_spec_object);
     Py_XDECREF(result);
     return ok;
 }

Modified: python/branches/tlee-ast-optimize/Objects/structseq.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/structseq.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/structseq.c	Mon Aug 25 14:19:12 2008
@@ -32,6 +32,8 @@
 	PyStructSequence *obj;
 
 	obj = PyObject_New(PyStructSequence, type);
+	if (obj == NULL)
+		return NULL;
 	Py_SIZE(obj) = VISIBLE_SIZE_TP(type);
 
 	return (PyObject*) obj;
@@ -522,10 +524,16 @@
 	Py_INCREF(type);
 
 	dict = type->tp_dict;
-	PyDict_SetItemString(dict, visible_length_key, 
-		       PyInt_FromLong((long) desc->n_in_sequence));
-	PyDict_SetItemString(dict, real_length_key, 
-		       PyInt_FromLong((long) n_members));
-	PyDict_SetItemString(dict, unnamed_fields_key, 
-		       PyInt_FromLong((long) n_unnamed_members));
+#define SET_DICT_FROM_INT(key, value)				\
+	do {							\
+		PyObject *v = PyInt_FromLong((long) value);	\
+		if (v != NULL) {				\
+			PyDict_SetItemString(dict, key, v);	\
+			Py_DECREF(v);				\
+		}						\
+	} while (0)
+
+	SET_DICT_FROM_INT(visible_length_key, desc->n_in_sequence);
+	SET_DICT_FROM_INT(real_length_key, n_members);
+	SET_DICT_FROM_INT(unnamed_fields_key, n_unnamed_members);
 }

Modified: python/branches/tlee-ast-optimize/Objects/typeobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/typeobject.c	(original)
+++ python/branches/tlee-ast-optimize/Objects/typeobject.c	Mon Aug 25 14:19:12 2008
@@ -4897,7 +4897,17 @@
 	return NULL;
 }
 
-SLOT2(slot_sq_slice, "__getslice__", Py_ssize_t, Py_ssize_t, "nn")
+static PyObject*
+slot_sq_slice(PyObject *self, Py_ssize_t i, Py_ssize_t j)
+{
+	static PyObject *getslice_str;
+	
+	if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; "
+			    "use __getitem__", 1) < 0)
+		return NULL;
+	return call_method(self, "__getslice__", &getslice_str,
+		"nn", i, j);
+}
 
 static int
 slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value)
@@ -4922,13 +4932,21 @@
 {
 	PyObject *res;
 	static PyObject *delslice_str, *setslice_str;
-
-	if (value == NULL)
+	
+	if (value == NULL) {
+		if (PyErr_WarnPy3k("in 3.x, __delslice__ has been removed; "
+				   "use __delitem__", 1) < 0)
+			return -1;
 		res = call_method(self, "__delslice__", &delslice_str,
 				  "(nn)", i, j);
-	else
+	}
+	else {
+		if (PyErr_WarnPy3k("in 3.x, __setslice__ has been removed; "
+					"use __setitem__", 1) < 0)
+			return -1;		
 		res = call_method(self, "__setslice__", &setslice_str,
-				  "(nnO)", i, j, value);
+			  "(nnO)", i, j, value);
+	}
 	if (res == NULL)
 		return -1;
 	Py_DECREF(res);

Modified: python/branches/tlee-ast-optimize/Python/ast.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/ast.c	(original)
+++ python/branches/tlee-ast-optimize/Python/ast.c	Mon Aug 25 14:19:12 2008
@@ -1898,6 +1898,11 @@
                               "non-keyword arg after keyword arg");
                     return NULL;
                 }
+                if (vararg) {
+                    ast_error(CHILD(ch, 0),
+                              "only named arguments may follow *expression");
+                    return NULL;
+                }
                 e = ast_for_expr(c, CHILD(ch, 0));
                 if (!e)
                     return NULL;

Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/bltinmodule.c	(original)
+++ python/branches/tlee-ast-optimize/Python/bltinmodule.c	Mon Aug 25 14:19:12 2008
@@ -2044,68 +2044,22 @@
 static PyObject *
 builtin_reduce(PyObject *self, PyObject *args)
 {
-	PyObject *seq, *func, *result = NULL, *it;
+	static PyObject *functools_reduce = NULL;
 
 	if (PyErr_WarnPy3k("reduce() not supported in 3.x; "
 			   "use functools.reduce()", 1) < 0)
 		return NULL;
 
-	if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
-		return NULL;
-	if (result != NULL)
-		Py_INCREF(result);
-
-	it = PyObject_GetIter(seq);
-	if (it == NULL) {
-		PyErr_SetString(PyExc_TypeError,
-		    "reduce() arg 2 must support iteration");
-		Py_XDECREF(result);
-		return NULL;
-	}
-
-	if ((args = PyTuple_New(2)) == NULL)
-		goto Fail;
-
-	for (;;) {
-		PyObject *op2;
-
-		if (args->ob_refcnt > 1) {
-			Py_DECREF(args);
-			if ((args = PyTuple_New(2)) == NULL)
-				goto Fail;
-		}
-
-		op2 = PyIter_Next(it);
-		if (op2 == NULL) {
-			if (PyErr_Occurred())
-				goto Fail;
- 			break;
-		}
-
-		if (result == NULL)
-			result = op2;
-		else {
-			PyTuple_SetItem(args, 0, result);
-			PyTuple_SetItem(args, 1, op2);
-			if ((result = PyEval_CallObject(func, args)) == NULL)
-				goto Fail;
-		}
+	if (functools_reduce == NULL) {
+		PyObject *functools = PyImport_ImportModule("functools");
+		if (functools == NULL)
+			return NULL;
+		functools_reduce = PyObject_GetAttrString(functools, "reduce");
+		Py_DECREF(functools);
+		if (functools_reduce == NULL)
+			return NULL;
 	}
-
-	Py_DECREF(args);
-
-	if (result == NULL)
-		PyErr_SetString(PyExc_TypeError,
-			   "reduce() of empty sequence with no initial value");
-
-	Py_DECREF(it);
-	return result;
-
-Fail:
-	Py_XDECREF(args);
-	Py_XDECREF(result);
-	Py_DECREF(it);
-	return NULL;
+	return PyObject_Call(functools_reduce, args, NULL);
 }
 
 PyDoc_STRVAR(reduce_doc,

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	Mon Aug 25 14:19:12 2008
@@ -1312,7 +1312,7 @@
 }
 
 static int
-getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
+getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
 {
 	void *buf;
 	Py_ssize_t count;
@@ -1322,8 +1322,10 @@
 		return -1;
 	}
 	if (pb->bf_getbuffer) {
-		if (pb->bf_getbuffer(arg, view, 0) < 0)
+		if (pb->bf_getbuffer(arg, view, 0) < 0) {
+			*errmsg = "convertible to a buffer";
 			return -1;
+		}
 		if (!PyBuffer_IsContiguous(view, 'C')) {
 			*errmsg = "contiguous buffer";
 			return -1;
@@ -1332,8 +1334,10 @@
 	}
 
 	count = convertbuffer(arg, &buf, errmsg);
-	if (count < 0)
+	if (count < 0) {
+		*errmsg = "convertible to a buffer";
 		return count;
+	}
 	PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
 	return 0;
 }

Modified: python/branches/tlee-ast-optimize/Python/graminit.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/graminit.c	(original)
+++ python/branches/tlee-ast-optimize/Python/graminit.c	Mon Aug 25 14:19:12 2008
@@ -1609,7 +1609,8 @@
 static arc arcs_74_6[1] = {
 	{0, 6},
 };
-static arc arcs_74_7[1] = {
+static arc arcs_74_7[2] = {
+	{162, 5},
 	{31, 3},
 };
 static state states_74[8] = {
@@ -1620,7 +1621,7 @@
 	{4, arcs_74_4},
 	{2, arcs_74_5},
 	{1, arcs_74_6},
-	{1, arcs_74_7},
+	{2, arcs_74_7},
 };
 static arc arcs_75_0[1] = {
 	{28, 1},

Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/pythonrun.c	(original)
+++ python/branches/tlee-ast-optimize/Python/pythonrun.c	Mon Aug 25 14:19:12 2008
@@ -134,8 +134,8 @@
 	PyThreadState *tstate;
 	PyObject *bimod, *sysmod;
 	char *p;
-	char *icodeset; /* On Windows, input codeset may theoretically 
-			   differ from output codeset. */
+	char *icodeset = NULL; /* On Windows, input codeset may theoretically 
+			          differ from output codeset. */
 	char *codeset = NULL;
 	char *errors = NULL;
 	int free_codeset = 0;

Modified: python/branches/tlee-ast-optimize/README
==============================================================================
--- python/branches/tlee-ast-optimize/README	(original)
+++ python/branches/tlee-ast-optimize/README	Mon Aug 25 14:19:12 2008
@@ -1,4 +1,4 @@
-This is Python version 2.6 beta 2
+This is Python version 2.6 beta 3
 =================================
 
 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008

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	Mon Aug 25 14:19:12 2008
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 from lib2to3 import refactor
 import sys
+import os
 
-sys.exit(refactor.main("lib2to3/fixes"))
+fixers = os.path.join(os.path.dirname(refactor.__file__), "fixes")
+sys.exit(refactor.main(fixers))


More information about the Python-checkins mailing list