[Python-checkins] r53607 - in python/branches/bcannon-objcap: Doc/api/concrete.tex Doc/commontex/license.tex Doc/dist/dist.tex Doc/howto/TODO Doc/howto/curses.tex Doc/howto/doanddont.tex Doc/howto/regex.tex Doc/lib/libexcs.tex Doc/lib/libimageop.tex Doc/lib/liblogging.tex Doc/lib/libmailbox.tex Doc/lib/librandom.tex Doc/lib/libsets.tex Doc/lib/libsmtplib.tex Doc/lib/libsocket.tex Doc/lib/libstruct.tex Doc/lib/libtest.tex Doc/lib/libtime.tex Doc/ref/ref3.tex Doc/ref/ref4.tex Doc/tut/tut.tex Doc/whatsnew/whatsnew26.tex Include/Python-ast.h Lib/BaseHTTPServer.py Lib/CGIHTTPServer.py Lib/_strptime.py Lib/compiler/pycodegen.py Lib/compiler/transformer.py Lib/cookielib.py Lib/ctypes/__init__.py Lib/ctypes/test/test_win32.py Lib/ctypes/util.py Lib/ctypes/wintypes.py Lib/dumbdbm.py Lib/dummy_thread.py Lib/dummy_threading.py Lib/email/charset.py Lib/encodings/aliases.py Lib/ftplib.py Lib/httplib.py Lib/idlelib/CodeContext.py Lib/idlelib/EditorWindow.py Lib/lib-tk/tkSimpleDialog.py Lib/logging/handlers.py Lib/mailbox.py Lib/ntpath.py Lib/pdb.py Lib/platform.py Lib/pty.py Lib/pydoc.py Lib/random.py Lib/rfc822.py Lib/sets.py Lib/smtplib.py Lib/socket.py Lib/sqlite3/dbapi2.py Lib/sqlite3/test/factory.py Lib/sqlite3/test/regression.py Lib/sqlite3/test/types.py Lib/subprocess.py Lib/tarfile.py Lib/test/crashers/weakref_in_del.py Lib/test/output/test_new Lib/test/output/test_popen Lib/test/output/test_resource Lib/test/test___all__.py Lib/test/test_array.py Lib/test/test_cfgparser.py Lib/test/test_compiler.py Lib/test/test_deque.py Lib/test/test_dumbdbm.py Lib/test/test_exceptions.py Lib/test/test_gzip.py Lib/test/test_itertools.py Lib/test/test_mailbox.py Lib/test/test_new.py Lib/test/test_ntpath.py Lib/test/test_old_mailbox.py Lib/test/test_optparse.py Lib/test/test_pep352.py Lib/test/test_popen.py Lib/test/test_posixpath.py Lib/test/test_pty.py Lib/test/test_random.py Lib/test/test_resource.py Lib/test/test_set.py Lib/test/test_sets.py Lib/test/test_socket.py Lib/test/test_strptime.py Lib/test/test_struct.py Lib/test/test_subprocess.py Lib/test/test_support.py Lib/test/test_urllib2net.py Lib/test/test_uu.py Lib/test/test_weakref.py Lib/urllib.py Lib/urllib2.py Makefile.pre.in Misc/ACKS Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/_ctypes_test.c Modules/_ctypes/cfield.c Modules/_ctypes/libffi_msvc/ffi.c Modules/_randommodule.c Modules/_sqlite/cache.c Modules/_sqlite/cache.h Modules/_sqlite/connection.c Modules/_sqlite/connection.h Modules/_sqlite/cursor.c Modules/_sqlite/cursor.h Modules/_sqlite/microprotocols.c Modules/_sqlite/microprotocols.h Modules/_sqlite/module.c Modules/_sqlite/module.h Modules/_sqlite/prepare_protocol.c Modules/_sqlite/prepare_protocol.h Modules/_sqlite/row.c Modules/_sqlite/row.h Modules/_sqlite/statement.c Modules/_sqlite/statement.h Modules/_sqlite/util.c Modules/_sqlite/util.h Modules/_struct.c Modules/arraymodule.c Modules/collectionsmodule.c Modules/itertoolsmodule.c Modules/posixmodule.c Modules/socketmodule.c Objects/fileobject.c Objects/intobject.c Objects/setobject.c Objects/typeobject.c Objects/weakrefobject.c PCbuild/_bsddb.vcproj PCbuild/_elementtree.vcproj PCbuild/_msi.vcproj PCbuild/_socket.vcproj PCbuild/_sqlite3.vcproj PCbuild/_ssl.mak PCbuild/_testcapi.vcproj PCbuild/_tkinter.vcproj PCbuild/build_ssl.py PCbuild/bz2.vcproj PCbuild/pyexpat.vcproj PCbuild/python.vcproj PCbuild/pythoncore.vcproj PCbuild/pythonw.vcproj PCbuild/select.vcproj PCbuild/unicodedata.vcproj PCbuild/winsound.vcproj Parser/asdl_c.py Python/ceval.c Python/pythonrun.c Python/sysmodule.c Python/traceback.c Tools/msi/uuids.py Tools/pybench/pybench.py configure configure.in pyconfig.h.in

brett.cannon python-checkins at python.org
Wed Jan 31 23:25:24 CET 2007


Author: brett.cannon
Date: Wed Jan 31 23:24:58 2007
New Revision: 53607

Removed:
   python/branches/bcannon-objcap/Lib/test/output/test_new
   python/branches/bcannon-objcap/Lib/test/output/test_popen
   python/branches/bcannon-objcap/Lib/test/output/test_resource
Modified:
   python/branches/bcannon-objcap/   (props changed)
   python/branches/bcannon-objcap/Doc/api/concrete.tex
   python/branches/bcannon-objcap/Doc/commontex/license.tex
   python/branches/bcannon-objcap/Doc/dist/dist.tex
   python/branches/bcannon-objcap/Doc/howto/TODO
   python/branches/bcannon-objcap/Doc/howto/curses.tex
   python/branches/bcannon-objcap/Doc/howto/doanddont.tex
   python/branches/bcannon-objcap/Doc/howto/regex.tex
   python/branches/bcannon-objcap/Doc/lib/libexcs.tex
   python/branches/bcannon-objcap/Doc/lib/libimageop.tex
   python/branches/bcannon-objcap/Doc/lib/liblogging.tex
   python/branches/bcannon-objcap/Doc/lib/libmailbox.tex
   python/branches/bcannon-objcap/Doc/lib/librandom.tex
   python/branches/bcannon-objcap/Doc/lib/libsets.tex
   python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex
   python/branches/bcannon-objcap/Doc/lib/libsocket.tex
   python/branches/bcannon-objcap/Doc/lib/libstruct.tex
   python/branches/bcannon-objcap/Doc/lib/libtest.tex
   python/branches/bcannon-objcap/Doc/lib/libtime.tex
   python/branches/bcannon-objcap/Doc/ref/ref3.tex
   python/branches/bcannon-objcap/Doc/ref/ref4.tex
   python/branches/bcannon-objcap/Doc/tut/tut.tex
   python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex
   python/branches/bcannon-objcap/Include/Python-ast.h
   python/branches/bcannon-objcap/Lib/BaseHTTPServer.py
   python/branches/bcannon-objcap/Lib/CGIHTTPServer.py
   python/branches/bcannon-objcap/Lib/_strptime.py
   python/branches/bcannon-objcap/Lib/compiler/pycodegen.py
   python/branches/bcannon-objcap/Lib/compiler/transformer.py
   python/branches/bcannon-objcap/Lib/cookielib.py
   python/branches/bcannon-objcap/Lib/ctypes/__init__.py
   python/branches/bcannon-objcap/Lib/ctypes/test/test_win32.py
   python/branches/bcannon-objcap/Lib/ctypes/util.py
   python/branches/bcannon-objcap/Lib/ctypes/wintypes.py
   python/branches/bcannon-objcap/Lib/dumbdbm.py
   python/branches/bcannon-objcap/Lib/dummy_thread.py
   python/branches/bcannon-objcap/Lib/dummy_threading.py
   python/branches/bcannon-objcap/Lib/email/charset.py
   python/branches/bcannon-objcap/Lib/encodings/aliases.py
   python/branches/bcannon-objcap/Lib/ftplib.py
   python/branches/bcannon-objcap/Lib/httplib.py
   python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py
   python/branches/bcannon-objcap/Lib/idlelib/EditorWindow.py
   python/branches/bcannon-objcap/Lib/lib-tk/tkSimpleDialog.py
   python/branches/bcannon-objcap/Lib/logging/handlers.py
   python/branches/bcannon-objcap/Lib/mailbox.py
   python/branches/bcannon-objcap/Lib/ntpath.py
   python/branches/bcannon-objcap/Lib/pdb.py
   python/branches/bcannon-objcap/Lib/platform.py
   python/branches/bcannon-objcap/Lib/pty.py
   python/branches/bcannon-objcap/Lib/pydoc.py
   python/branches/bcannon-objcap/Lib/random.py
   python/branches/bcannon-objcap/Lib/rfc822.py
   python/branches/bcannon-objcap/Lib/sets.py
   python/branches/bcannon-objcap/Lib/smtplib.py
   python/branches/bcannon-objcap/Lib/socket.py
   python/branches/bcannon-objcap/Lib/sqlite3/dbapi2.py
   python/branches/bcannon-objcap/Lib/sqlite3/test/factory.py
   python/branches/bcannon-objcap/Lib/sqlite3/test/regression.py
   python/branches/bcannon-objcap/Lib/sqlite3/test/types.py
   python/branches/bcannon-objcap/Lib/subprocess.py
   python/branches/bcannon-objcap/Lib/tarfile.py
   python/branches/bcannon-objcap/Lib/test/crashers/weakref_in_del.py
   python/branches/bcannon-objcap/Lib/test/test___all__.py
   python/branches/bcannon-objcap/Lib/test/test_array.py
   python/branches/bcannon-objcap/Lib/test/test_cfgparser.py
   python/branches/bcannon-objcap/Lib/test/test_compiler.py
   python/branches/bcannon-objcap/Lib/test/test_deque.py
   python/branches/bcannon-objcap/Lib/test/test_dumbdbm.py
   python/branches/bcannon-objcap/Lib/test/test_exceptions.py
   python/branches/bcannon-objcap/Lib/test/test_gzip.py
   python/branches/bcannon-objcap/Lib/test/test_itertools.py
   python/branches/bcannon-objcap/Lib/test/test_mailbox.py
   python/branches/bcannon-objcap/Lib/test/test_new.py
   python/branches/bcannon-objcap/Lib/test/test_ntpath.py
   python/branches/bcannon-objcap/Lib/test/test_old_mailbox.py
   python/branches/bcannon-objcap/Lib/test/test_optparse.py
   python/branches/bcannon-objcap/Lib/test/test_pep352.py
   python/branches/bcannon-objcap/Lib/test/test_popen.py
   python/branches/bcannon-objcap/Lib/test/test_posixpath.py
   python/branches/bcannon-objcap/Lib/test/test_pty.py
   python/branches/bcannon-objcap/Lib/test/test_random.py
   python/branches/bcannon-objcap/Lib/test/test_resource.py
   python/branches/bcannon-objcap/Lib/test/test_set.py
   python/branches/bcannon-objcap/Lib/test/test_sets.py
   python/branches/bcannon-objcap/Lib/test/test_socket.py
   python/branches/bcannon-objcap/Lib/test/test_strptime.py
   python/branches/bcannon-objcap/Lib/test/test_struct.py
   python/branches/bcannon-objcap/Lib/test/test_subprocess.py
   python/branches/bcannon-objcap/Lib/test/test_support.py
   python/branches/bcannon-objcap/Lib/test/test_urllib2net.py
   python/branches/bcannon-objcap/Lib/test/test_uu.py
   python/branches/bcannon-objcap/Lib/test/test_weakref.py
   python/branches/bcannon-objcap/Lib/urllib.py
   python/branches/bcannon-objcap/Lib/urllib2.py
   python/branches/bcannon-objcap/Makefile.pre.in
   python/branches/bcannon-objcap/Misc/ACKS
   python/branches/bcannon-objcap/Misc/NEWS
   python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c
   python/branches/bcannon-objcap/Modules/_ctypes/_ctypes_test.c
   python/branches/bcannon-objcap/Modules/_ctypes/cfield.c
   python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffi.c
   python/branches/bcannon-objcap/Modules/_randommodule.c
   python/branches/bcannon-objcap/Modules/_sqlite/cache.c
   python/branches/bcannon-objcap/Modules/_sqlite/cache.h
   python/branches/bcannon-objcap/Modules/_sqlite/connection.c
   python/branches/bcannon-objcap/Modules/_sqlite/connection.h
   python/branches/bcannon-objcap/Modules/_sqlite/cursor.c
   python/branches/bcannon-objcap/Modules/_sqlite/cursor.h
   python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.c
   python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.h
   python/branches/bcannon-objcap/Modules/_sqlite/module.c
   python/branches/bcannon-objcap/Modules/_sqlite/module.h
   python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.c
   python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.h
   python/branches/bcannon-objcap/Modules/_sqlite/row.c
   python/branches/bcannon-objcap/Modules/_sqlite/row.h
   python/branches/bcannon-objcap/Modules/_sqlite/statement.c
   python/branches/bcannon-objcap/Modules/_sqlite/statement.h
   python/branches/bcannon-objcap/Modules/_sqlite/util.c
   python/branches/bcannon-objcap/Modules/_sqlite/util.h
   python/branches/bcannon-objcap/Modules/_struct.c
   python/branches/bcannon-objcap/Modules/arraymodule.c
   python/branches/bcannon-objcap/Modules/collectionsmodule.c
   python/branches/bcannon-objcap/Modules/itertoolsmodule.c
   python/branches/bcannon-objcap/Modules/posixmodule.c
   python/branches/bcannon-objcap/Modules/socketmodule.c
   python/branches/bcannon-objcap/Objects/fileobject.c
   python/branches/bcannon-objcap/Objects/intobject.c
   python/branches/bcannon-objcap/Objects/setobject.c
   python/branches/bcannon-objcap/Objects/typeobject.c
   python/branches/bcannon-objcap/Objects/weakrefobject.c
   python/branches/bcannon-objcap/PCbuild/_bsddb.vcproj
   python/branches/bcannon-objcap/PCbuild/_elementtree.vcproj
   python/branches/bcannon-objcap/PCbuild/_msi.vcproj
   python/branches/bcannon-objcap/PCbuild/_socket.vcproj
   python/branches/bcannon-objcap/PCbuild/_sqlite3.vcproj
   python/branches/bcannon-objcap/PCbuild/_ssl.mak
   python/branches/bcannon-objcap/PCbuild/_testcapi.vcproj
   python/branches/bcannon-objcap/PCbuild/_tkinter.vcproj
   python/branches/bcannon-objcap/PCbuild/build_ssl.py
   python/branches/bcannon-objcap/PCbuild/bz2.vcproj
   python/branches/bcannon-objcap/PCbuild/pyexpat.vcproj
   python/branches/bcannon-objcap/PCbuild/python.vcproj
   python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj
   python/branches/bcannon-objcap/PCbuild/pythonw.vcproj
   python/branches/bcannon-objcap/PCbuild/select.vcproj
   python/branches/bcannon-objcap/PCbuild/unicodedata.vcproj
   python/branches/bcannon-objcap/PCbuild/winsound.vcproj
   python/branches/bcannon-objcap/Parser/asdl_c.py
   python/branches/bcannon-objcap/Python/ceval.c
   python/branches/bcannon-objcap/Python/pythonrun.c
   python/branches/bcannon-objcap/Python/sysmodule.c
   python/branches/bcannon-objcap/Python/traceback.c
   python/branches/bcannon-objcap/Tools/msi/uuids.py
   python/branches/bcannon-objcap/Tools/pybench/pybench.py
   python/branches/bcannon-objcap/configure
   python/branches/bcannon-objcap/configure.in
   python/branches/bcannon-objcap/pyconfig.h.in
Log:
Merged revisions 53324-53606 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r53340 | gustavo.niemeyer | 2007-01-10 08:13:40 -0800 (Wed, 10 Jan 2007) | 3 lines
  
  Mention in the int() docstring that a base zero has meaning, as
  stated in http://docs.python.org/lib/built-in-funcs.html as well.
........
  r53341 | gustavo.niemeyer | 2007-01-10 08:15:48 -0800 (Wed, 10 Jan 2007) | 2 lines
  
  Minor change in int() docstring for proper spacing.
........
  r53358 | thomas.heller | 2007-01-10 12:12:13 -0800 (Wed, 10 Jan 2007) | 1 line
  
  Change the ctypes version number to "1.1.0".
........
  r53361 | thomas.heller | 2007-01-10 12:51:19 -0800 (Wed, 10 Jan 2007) | 1 line
  
  Must change the version number in the _ctypes extension as well.
........
  r53362 | guido.van.rossum | 2007-01-10 15:12:56 -0800 (Wed, 10 Jan 2007) | 3 lines
  
  Fix the signature of log_error().  (A subclass that did the right thing
  was getting complaints from pychecker.)
........
  r53370 | matthias.klose | 2007-01-11 02:26:31 -0800 (Thu, 11 Jan 2007) | 2 lines
  
  - Make the documentation match the code and the docstring
........
  r53375 | matthias.klose | 2007-01-11 03:44:04 -0800 (Thu, 11 Jan 2007) | 2 lines
  
  - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092).
........
  r53381 | raymond.hettinger | 2007-01-11 10:22:55 -0800 (Thu, 11 Jan 2007) | 1 line
  
  SF #1486663 -- Allow keyword args in subclasses of set() and frozenset().
........
  r53388 | thomas.heller | 2007-01-11 13:18:56 -0800 (Thu, 11 Jan 2007) | 4 lines
  
  Fixes for 64-bit Windows: In ctypes.wintypes, correct the definitions
  of HANDLE, WPARAM, LPARAM data types.  Make parameterless foreign
  function calls work.
........
  r53390 | thomas.heller | 2007-01-11 13:23:12 -0800 (Thu, 11 Jan 2007) | 2 lines
  
  Correct the comments: the code is right.
........
  r53393 | brett.cannon | 2007-01-11 23:27:52 -0800 (Thu, 11 Jan 2007) | 3 lines
  
  Fix error where the end of a funcdesc environment was accidentally moved too
  far down.
........
  r53397 | anthony.baxter | 2007-01-12 01:35:56 -0800 (Fri, 12 Jan 2007) | 3 lines
  
  add parsetok.h as a dependency - previously, changing this file doesn't
  cause the right files to be rebuilt.
........
  r53401 | thomas.heller | 2007-01-12 12:08:19 -0800 (Fri, 12 Jan 2007) | 3 lines
  
  Avoid warnings in the test suite because ctypes.wintypes cannot be
  imported on non-windows systems.
........
  r53402 | thomas.heller | 2007-01-12 12:17:34 -0800 (Fri, 12 Jan 2007) | 6 lines
  
  patch #1610795: BSD version of ctypes.util.find_library, by Martin
  Kammerhofer.
  
  release25-maint backport candidate, but the release manager has to
  decide.
........
  r53403 | thomas.heller | 2007-01-12 12:21:53 -0800 (Fri, 12 Jan 2007) | 3 lines
  
  patch #1610795: BSD version of ctypes.util.find_library, by Martin
  Kammerhofer.
........
  r53406 | brett.cannon | 2007-01-12 16:29:49 -0800 (Fri, 12 Jan 2007) | 2 lines
  
  Deprecate the sets module.
........
  r53407 | georg.brandl | 2007-01-13 04:31:51 -0800 (Sat, 13 Jan 2007) | 3 lines
  
  Fix typo.
........
  r53409 | marc-andre.lemburg | 2007-01-13 13:00:08 -0800 (Sat, 13 Jan 2007) | 16 lines
  
  Bump version number and change copyright year.
  
  Add new API linux_distribution() which supports reading the full distribution
  name and also knows how to parse LSB-style release files.
  
  Redirect the old dist() API to the new API (using the short distribution name
  taken from the release file filename).
  
  Add branch and revision to _sys_version().
  
  Add work-around for Cygwin to libc_ver().
  
  Add support for IronPython (thanks for Anthony Baxter) and make 
  Jython support more robust.
........
  r53410 | neal.norwitz | 2007-01-13 13:22:37 -0800 (Sat, 13 Jan 2007) | 1 line
  
  Fix grammar in docstrings
........
  r53411 | marc-andre.lemburg | 2007-01-13 14:32:21 -0800 (Sat, 13 Jan 2007) | 9 lines
  
  Add parameter sys_version to _sys_version().
  
  Change the cache for _sys_version() to take the parameter into account.
  
  Add support for parsing the IronPython 1.0.1 sys.version value - even
  though it still returns '1.0.0'; the version string no longer includes
  the patch level.
........
  r53412 | peter.astrand | 2007-01-13 14:35:35 -0800 (Sat, 13 Jan 2007) | 1 line
  
  Fix for bug #1634343: allow specifying empty arguments on Windows
........
  r53414 | marc-andre.lemburg | 2007-01-13 14:59:36 -0800 (Sat, 13 Jan 2007) | 14 lines
  
  Add Python implementation to the machine details.
  
  Pretty-print the Python version used for running PyBench.
  
  Let the user know when calibration has finished.
  
  [ 1563844 ] pybench support for IronPython:
  
  Simplify Unicode version detection.
  
  Make garbage collection and check interval settings optional if
  the Python implementation doesn't support thess (e.g. IronPython).
........
  r53415 | marc-andre.lemburg | 2007-01-13 15:13:54 -0800 (Sat, 13 Jan 2007) | 5 lines
  
  Use defaults if sys.executable isn't set (e.g. on Jython).
  
  This change allows running PyBench under Jython.
........
  r53416 | marc-andre.lemburg | 2007-01-13 15:15:33 -0800 (Sat, 13 Jan 2007) | 3 lines
  
  Jython doesn't have sys.setcheckinterval() - ignore it in that case.
........
  r53420 | gerhard.haering | 2007-01-13 17:43:50 -0800 (Sat, 13 Jan 2007) | 29 lines
  
  Merged changes from standalone version 2.3.3. This should probably all be
  merged into the 2.5 maintenance branch:
  
  - self->statement was not checked while fetching data, which could
    lead to crashes if you used the pysqlite API in unusual ways.
    Closing the cursor and continuing to fetch data was enough.
  
  - Converters are stored in a converters dictionary. The converter name
    is uppercased first. The old upper-casing algorithm was wrong and
    was replaced by a simple call to the Python string's upper() method
    instead.
  
  -Applied patch by Glyph Lefkowitz that fixes the problem with
   subsequent SQLITE_SCHEMA errors.
  
  - Improvement to the row type: rows can now be iterated over and have a keys()
    method. This improves compatibility with both tuple and dict a lot.
  
  - A bugfix for the subsecond resolution in timestamps.
  
  - Corrected the way the flags PARSE_DECLTYPES and PARSE_COLNAMES are
    checked for. Now they work as documented.
  
  - gcc on Linux sucks. It exports all symbols by default in shared
    libraries, so if symbols are not unique it can lead to problems with
    symbol lookup.  pysqlite used to crash under Apache when mod_cache
    was enabled because both modules had the symbol cache_init. I fixed
    this by applying the prefix pysqlite_ almost everywhere. Sigh.
........
  r53423 | guido.van.rossum | 2007-01-13 19:46:33 -0800 (Sat, 13 Jan 2007) | 2 lines
  
  Remove a dependency of this test on $COLUMNS.
........
  r53425 | ka-ping.yee | 2007-01-13 20:25:15 -0800 (Sat, 13 Jan 2007) | 3 lines
  
  Handle old-style instances more gracefully (display documentation on
  the relevant class instead of documentation on <type 'instance'>).
........
  r53434 | guido.van.rossum | 2007-01-14 09:03:32 -0800 (Sun, 14 Jan 2007) | 3 lines
  
  Patch #1635058 by Mark Roberts: ensure that htonl and friends never accept or
  return negative numbers, per the underlying C implementation.
........
  r53440 | vinay.sajip | 2007-01-14 13:49:59 -0800 (Sun, 14 Jan 2007) | 1 line
  
  Added WatchedFileHandler (based on SF patch #1598415)
........
  r53441 | vinay.sajip | 2007-01-14 13:50:50 -0800 (Sun, 14 Jan 2007) | 1 line
  
  Added documentation for WatchedFileHandler (based on SF patch #1598415)
........
  r53442 | guido.van.rossum | 2007-01-14 16:02:35 -0800 (Sun, 14 Jan 2007) | 2 lines
  
  Doc patch matching r53434 (htonl etc. now always take/return positive ints).
........
  r53454 | brett.cannon | 2007-01-15 11:12:08 -0800 (Mon, 15 Jan 2007) | 3 lines
  
  Add a note for strptime that just because strftime supports some extra
  directive that is not documented that strptime will as well.
........
  r53458 | vinay.sajip | 2007-01-16 01:50:07 -0800 (Tue, 16 Jan 2007) | 1 line
  
  Updated rotating file handlers to use _open().
........
  r53459 | marc-andre.lemburg | 2007-01-16 05:03:06 -0800 (Tue, 16 Jan 2007) | 2 lines
  
  Add news items for the recent pybench and platform changes.
........
  r53460 | sjoerd.mullender | 2007-01-16 08:42:38 -0800 (Tue, 16 Jan 2007) | 4 lines
  
  Fixed ntpath.expandvars to not replace references to non-existing
  variables with nothing.  Also added tests.
  This fixes bug #494589.
........
  r53464 | neal.norwitz | 2007-01-16 22:23:51 -0800 (Tue, 16 Jan 2007) | 1 line
  
  Give Calvin Spealman access for python-dev summaries.
........
  r53465 | neal.norwitz | 2007-01-17 00:37:26 -0800 (Wed, 17 Jan 2007) | 1 line
  
  Remove Calvin since he only has access to the website currently.
........
  r53466 | thomas.heller | 2007-01-17 01:40:34 -0800 (Wed, 17 Jan 2007) | 2 lines
  
  Replace C++ comments with C comments.
........
  r53472 | andrew.kuchling | 2007-01-17 11:55:06 -0800 (Wed, 17 Jan 2007) | 1 line
  
  [Part of bug #1599254] Add suggestion to Mailbox docs to use Maildir, and warn user to lock/unlock mailboxes when modifying them
........
  r53475 | georg.brandl | 2007-01-17 13:09:04 -0800 (Wed, 17 Jan 2007) | 2 lines
  
  Bug #1637967: missing //= operator in list.
........
  r53477 | georg.brandl | 2007-01-17 13:19:58 -0800 (Wed, 17 Jan 2007) | 2 lines
  
  Bug #1629125: fix wrong data type (int -> Py_ssize_t) in PyDict_Next docs.
........
  r53481 | neal.norwitz | 2007-01-17 21:40:58 -0800 (Wed, 17 Jan 2007) | 1 line
  
  Try reverting part of r53145 that seems to cause the Windows buildbots to fail in test_uu.UUFileTest.test_encode
........
  r53482 | fred.drake | 2007-01-17 21:42:30 -0800 (Wed, 17 Jan 2007) | 1 line
  
  add missing version entry
........
  r53483 | neal.norwitz | 2007-01-17 22:20:55 -0800 (Wed, 17 Jan 2007) | 7 lines
  
  This test doesn't pass on Windows.  The cause seems to be that chmod
  doesn't support the same funcationality as on Unix.  I'm not sure if
  this fix is the best (or if it will even work)--it's a test to see
  if the buildbots start passing again.
  
  It might be better to not even run this test if it's windows (or non-posix).
........
  r53488 | neal.norwitz | 2007-01-18 21:53:33 -0800 (Thu, 18 Jan 2007) | 1 line
  
  SF #1635217, Fix unbalanced paren
........
  r53489 | martin.v.loewis | 2007-01-18 22:42:22 -0800 (Thu, 18 Jan 2007) | 3 lines
  
  Prefix AST symbols with _Py_. Fixes #1637022.
  Will backport.
........
  r53497 | martin.v.loewis | 2007-01-19 10:01:38 -0800 (Fri, 19 Jan 2007) | 2 lines
  
  Add UUIDs for 2.5.1 and 2.5.2
........
  r53499 | raymond.hettinger | 2007-01-19 10:07:18 -0800 (Fri, 19 Jan 2007) | 1 line
  
  SF# 1635892:  Fix docs for betavariate's input parameters .
........
  r53503 | martin.v.loewis | 2007-01-20 06:05:39 -0800 (Sat, 20 Jan 2007) | 2 lines
  
  Merge 53501 and 53502 from 25 branch:
  Add /GS- for AMD64 and Itanium builds where missing.
........
  r53504 | walter.doerwald | 2007-01-20 09:28:31 -0800 (Sat, 20 Jan 2007) | 2 lines
  
  Port test_resource.py to unittest.
........
  r53505 | walter.doerwald | 2007-01-20 10:19:33 -0800 (Sat, 20 Jan 2007) | 2 lines
  
  Add argument tests an calls of resource.getrusage().
........
  r53506 | walter.doerwald | 2007-01-20 11:03:17 -0800 (Sat, 20 Jan 2007) | 2 lines
  
  resource.RUSAGE_BOTH might not exist.
........
  r53507 | walter.doerwald | 2007-01-20 15:07:28 -0800 (Sat, 20 Jan 2007) | 2 lines
  
  Port test_new.py to unittest.
........
  r53508 | martin.v.loewis | 2007-01-21 01:33:07 -0800 (Sun, 21 Jan 2007) | 2 lines
  
  Patch #1610575: Add support for _Bool to struct.
........
  r53509 | georg.brandl | 2007-01-21 02:28:43 -0800 (Sun, 21 Jan 2007) | 3 lines
  
  Bug #1486663: don't reject keyword arguments for subclasses of builtin
  types.
........
  r53511 | georg.brandl | 2007-01-21 02:35:10 -0800 (Sun, 21 Jan 2007) | 2 lines
  
  Patch #1627441: close sockets properly in urllib2.
........
  r53517 | georg.brandl | 2007-01-22 11:40:21 -0800 (Mon, 22 Jan 2007) | 3 lines
  
  Use new email module names (#1637162, #1637159, #1637157).
........
  r53518 | andrew.kuchling | 2007-01-22 12:26:40 -0800 (Mon, 22 Jan 2007) | 1 line
  
  Improve pattern used for mbox 'From' lines; add a simple test
........
  r53519 | andrew.kuchling | 2007-01-22 12:27:50 -0800 (Mon, 22 Jan 2007) | 1 line
  
  Make comment match the code
........
  r53522 | georg.brandl | 2007-01-22 13:10:33 -0800 (Mon, 22 Jan 2007) | 2 lines
  
  Bug #1249573: fix rfc822.parsedate not accepting a certain date format
........
  r53524 | georg.brandl | 2007-01-22 13:23:41 -0800 (Mon, 22 Jan 2007) | 2 lines
  
  Bug #1627316: handle error in condition/ignore pdb commands more gracefully.
........
  r53526 | lars.gustaebel | 2007-01-23 03:17:33 -0800 (Tue, 23 Jan 2007) | 4 lines
  
  Patch #1507247: tarfile.py: use current umask for intermediate
  directories.
........
  r53527 | thomas.wouters | 2007-01-23 05:42:00 -0800 (Tue, 23 Jan 2007) | 13 lines
  
  
  SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomize
  
  When running the interpreter in an environment that would cause it to set
  stdout/stderr/stdin's encoding, having a sitecustomize that would replace
  them with something other than PyFile objects would crash the interpreter.
  Fix it by simply ignoring the encoding-setting for non-files.
  
  This could do with a test, but I can think of no maintainable and portable
  way to test this bug, short of adding a sitecustomize.py to the buildsystem
  and have it always run with it (hmmm....)
........
  r53528 | thomas.wouters | 2007-01-23 05:50:49 -0800 (Tue, 23 Jan 2007) | 4 lines
  
  
  Add news entry about last checkin (oops.)
........
  r53531 | martin.v.loewis | 2007-01-23 13:11:47 -0800 (Tue, 23 Jan 2007) | 4 lines
  
  Make PyTraceBack_Here use the current thread, not the
  frame's thread state. Fixes #1579370.
  Will backport.
........
  r53535 | brett.cannon | 2007-01-23 15:21:22 -0800 (Tue, 23 Jan 2007) | 5 lines
  
  Fix crasher for when an object's __del__ creates a new weakref to itself.
  Patch only fixes new-style classes; classic classes still buggy.
  
  Closes bug #1377858.  Already backported.
........
  r53536 | walter.doerwald | 2007-01-23 16:42:19 -0800 (Tue, 23 Jan 2007) | 2 lines
  
  Port test_popen.py to unittest.
........
  r53545 | andrew.kuchling | 2007-01-24 12:06:41 -0800 (Wed, 24 Jan 2007) | 1 line
  
  Strengthen warning about using lock()
........
  r53556 | thomas.heller | 2007-01-25 10:34:14 -0800 (Thu, 25 Jan 2007) | 3 lines
  
  Fix for #1643874: When calling SysAllocString, create a PyCObject
  which will eventually call SysFreeString to free the BSTR resource.
........
  r53563 | andrew.kuchling | 2007-01-25 12:02:13 -0800 (Thu, 25 Jan 2007) | 1 line
  
  Add item
........
  r53564 | brett.cannon | 2007-01-25 12:22:02 -0800 (Thu, 25 Jan 2007) | 8 lines
  
  Fix time.strptime's %U support.  Basically rewrote the algorithm to be more
  generic so that one only has to shift certain values based on whether the week
  was specified to start on Monday or Sunday.  Cut out a lot of edge case code
  compared to the previous version.  Also broke algorithm out into its own
  function (that is private to the module).
  
  Fixes bug #1643943 (thanks Biran Nahas for the report).
........
  r53570 | brett.cannon | 2007-01-25 15:30:39 -0800 (Thu, 25 Jan 2007) | 4 lines
  
  Remove specific mention of my name and email address from modules.  Not really
  needed and all bug reports should go to the bug tracker, not directly to me.
  Plus I am not the only person to have edited these files at this point.
........
  r53573 | fred.drake | 2007-01-26 08:28:44 -0800 (Fri, 26 Jan 2007) | 1 line
  
  fix typo (extraneous ")")
........
  r53575 | georg.brandl | 2007-01-27 09:43:02 -0800 (Sat, 27 Jan 2007) | 4 lines
  
  Patch #1638243: the compiler package is now able to correctly compile
  a with statement; previously, executing code containing a with statement
  compiled by the compiler package crashed the interpreter.
........
  r53578 | georg.brandl | 2007-01-27 09:59:42 -0800 (Sat, 27 Jan 2007) | 3 lines
  
  Patch #1634778: add missing encoding aliases for iso8859_15 and
  iso8859_16.
........
  r53579 | georg.brandl | 2007-01-27 11:38:50 -0800 (Sat, 27 Jan 2007) | 2 lines
  
  Bug #1645944: os.access now returns bool but docstring is not updated
........
  r53590 | brett.cannon | 2007-01-28 12:58:00 -0800 (Sun, 28 Jan 2007) | 2 lines
  
  Use the thread lock's context manager instead of a try/finally statement.
........
  r53591 | brett.cannon | 2007-01-28 20:41:44 -0800 (Sun, 28 Jan 2007) | 2 lines
  
  Add a test for slicing an exception.
........
  r53594 | andrew.kuchling | 2007-01-29 12:21:43 -0800 (Mon, 29 Jan 2007) | 1 line
  
  Minor edits to the curses HOWTO
........
  r53596 | andrew.kuchling | 2007-01-29 12:55:40 -0800 (Mon, 29 Jan 2007) | 1 line
  
  Various minor edits
........
  r53597 | andrew.kuchling | 2007-01-29 13:28:48 -0800 (Mon, 29 Jan 2007) | 1 line
  
  More edits
........
  r53601 | tim.peters | 2007-01-29 19:03:46 -0800 (Mon, 29 Jan 2007) | 2 lines
  
  Whitespace normalization.
........
  r53603 | georg.brandl | 2007-01-30 12:21:30 -0800 (Tue, 30 Jan 2007) | 2 lines
  
  Bug #1648191: typo in docs.
........
  r53605 | brett.cannon | 2007-01-30 13:34:36 -0800 (Tue, 30 Jan 2007) | 8 lines
  
  No more raising of string exceptions!
  
  The next step of PEP 352 (for 2.6) causes raising a string exception to trigger
  a TypeError.  Trying to catch a string exception raises a DeprecationWarning.
  References to string exceptions has been removed from the docs since they are
  now just an error.
........


Modified: python/branches/bcannon-objcap/Doc/api/concrete.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/api/concrete.tex	(original)
+++ python/branches/bcannon-objcap/Doc/api/concrete.tex	Wed Jan 31 23:24:58 2007
@@ -2082,7 +2082,7 @@
 
 \begin{verbatim}
 PyObject *key, *value;
-int pos = 0;
+Py_ssize_t pos = 0;
 
 while (PyDict_Next(self->dict, &pos, &key, &value)) {
     /* do something interesting with the values... */
@@ -2097,7 +2097,7 @@
 
 \begin{verbatim}
 PyObject *key, *value;
-int pos = 0;
+Py_ssize_t pos = 0;
 
 while (PyDict_Next(self->dict, &pos, &key, &value)) {
     int i = PyInt_AS_LONG(value) + 1;

Modified: python/branches/bcannon-objcap/Doc/commontex/license.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/commontex/license.tex	(original)
+++ python/branches/bcannon-objcap/Doc/commontex/license.tex	Wed Jan 31 23:24:58 2007
@@ -50,6 +50,7 @@
   \linev{2.4.1}{2.4}{2005}{PSF}{yes}
   \linev{2.4.2}{2.4.1}{2005}{PSF}{yes}
   \linev{2.4.3}{2.4.2}{2006}{PSF}{yes}
+  \linev{2.4.4}{2.4.3}{2006}{PSF}{yes}
   \linev{2.5}{2.4}{2006}{PSF}{yes}
 \end{tablev}
 

Modified: python/branches/bcannon-objcap/Doc/dist/dist.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/dist/dist.tex	(original)
+++ python/branches/bcannon-objcap/Doc/dist/dist.tex	Wed Jan 31 23:24:58 2007
@@ -692,7 +692,7 @@
 
 \begin{tableii}{l|l}{code}{Provides Expression}{Explanation}
   \lineii{mypkg}      {Provide \code{mypkg}, using the distribution version}
-  \lineii{mypkg (1.1} {Provide \code{mypkg} version 1.1, regardless of the
+  \lineii{mypkg (1.1)} {Provide \code{mypkg} version 1.1, regardless of the
                        distribution version}
 \end{tableii}
 

Modified: python/branches/bcannon-objcap/Doc/howto/TODO
==============================================================================
--- python/branches/bcannon-objcap/Doc/howto/TODO	(original)
+++ python/branches/bcannon-objcap/Doc/howto/TODO	Wed Jan 31 23:24:58 2007
@@ -1,7 +1,7 @@
 
 Short-term tasks:
-  Quick revision pass to make HOWTOs match the current state of Python:
-curses doanddont regex sockets sorting
+  Quick revision pass to make HOWTOs match the current state of Python
+doanddont regex sockets
 
 Medium-term tasks:
  Revisit the regex howto.  

Modified: python/branches/bcannon-objcap/Doc/howto/curses.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/howto/curses.tex	(original)
+++ python/branches/bcannon-objcap/Doc/howto/curses.tex	Wed Jan 31 23:24:58 2007
@@ -2,7 +2,7 @@
 
 \title{Curses Programming with Python}
 
-\release{2.01}
+\release{2.02}
 
 \author{A.M. Kuchling, Eric S. Raymond}
 \authoraddress{\email{amk at amk.ca}, \email{esr at thyrsus.com}}
@@ -147,10 +147,10 @@
 
 In Python you can avoid these complications and make debugging much
 easier by importing the module \module{curses.wrapper}.  It supplies a
-function \function{wrapper} that takes a hook argument.  It does the
+\function{wrapper()} function that takes a callable.  It does the
 initializations described above, and also initializes colors if color
-support is present.  It then runs your hook, and then finally
-deinitializes appropriately.  The hook is called inside a try-catch
+support is present.  It then runs your provided callable and finally
+deinitializes appropriately.  The callable is called inside a try-catch
 clause which catches exceptions, performs curses deinitialization, and
 then passes the exception upwards.  Thus, your terminal won't be left
 in a funny state on exception.
@@ -159,7 +159,7 @@
 
 Windows are the basic abstraction in curses.  A window object
 represents a rectangular area of the screen, and supports various
- methods to display text, erase it, allow the user to input strings,
+methods to display text, erase it, allow the user to input strings,
 and so forth.
 
 The \code{stdscr} object returned by the \function{initscr()} function
@@ -223,14 +223,14 @@
 
 The \function{refresh()} call displays a section of the pad in the
 rectangle extending from coordinate (5,5) to coordinate (20,75) on the
-screen;the upper left corner of the displayed section is coordinate
+screen; the upper left corner of the displayed section is coordinate
 (0,0) on the pad.  Beyond that difference, pads are exactly like
 ordinary windows and support the same methods.
 
 If you have multiple windows and pads on screen there is a more
 efficient way to go, which will prevent annoying screen flicker at
-refresh time.  Use the methods \method{noutrefresh()} and/or
-\method{noutrefresh()} of each window to update the data structure
+refresh time.  Use the \method{noutrefresh()} method
+of each window to update the data structure
 representing the desired state of the screen; then change the physical
 screen to match the desired state in one go with the function
 \function{doupdate()}.  The normal \method{refresh()} method calls
@@ -254,9 +254,9 @@
 
 \begin{tableii}{|c|l|}{textrm}{Form}{Description}
 \lineii{\var{str} or \var{ch}}{Display the string \var{str} or
-character \var{ch}}
+character \var{ch} at the current position}
 \lineii{\var{str} or \var{ch}, \var{attr}}{Display the string \var{str} or
-character \var{ch}, using attribute \var{attr}}
+character \var{ch}, using attribute \var{attr} at the current position}
 \lineii{\var{y}, \var{x}, \var{str} or \var{ch}}
 {Move to position \var{y,x} within the window, and display \var{str}
 or \var{ch}}
@@ -271,7 +271,7 @@
 
 The \function{addstr()} function takes a Python string as the value to
 be displayed, while the \function{addch()} functions take a character,
-which can be either a Python string of length 1, or an integer.  If
+which can be either a Python string of length 1 or an integer.  If
 it's a string, you're limited to displaying characters between 0 and
 255.  SVr4 curses provides constants for extension characters; these
 constants are integers greater than 255.  For example,
@@ -331,15 +331,15 @@
 provide it, The most common such terminal is probably the Linux
 console, followed by color xterms.
 
-To use color, you must call the \function{start_color()} function
-soon after calling \function{initscr()}, to initialize the default
-color set (the \function{curses.wrapper.wrapper()} function does this
+To use color, you must call the \function{start_color()} function soon
+after calling \function{initscr()}, to initialize the default color
+set (the \function{curses.wrapper.wrapper()} function does this
 automatically).  Once that's done, the \function{has_colors()}
 function returns TRUE if the terminal in use can actually display
-color.  (Note from AMK:  curses uses the American spelling
-'color', instead of the Canadian/British spelling 'colour'.  If you're
-like me, you'll have to resign yourself to misspelling it for the sake
-of these functions.)
+color.  (Note: curses uses the American spelling 'color', instead of
+the Canadian/British spelling 'colour'.  If you're used to the British
+spelling, you'll have to resign yourself to misspelling it for the
+sake of these functions.)
 
 The curses library maintains a finite number of color pairs,
 containing a foreground (or text) color and a background color.  You
@@ -400,18 +400,19 @@
 lack.
 
 The most common way to get input to a window is to use its
-\method{getch()} method. that pauses, and waits for the user to hit
-a key, displaying it if \function{echo()} has been called earlier.
-You can optionally specify a coordinate to which the cursor should be
-moved before pausing.
+\method{getch()} method.  \method{getch()} pauses and waits for the
+user to hit a key, displaying it if \function{echo()} has been called
+earlier.  You can optionally specify a coordinate to which the cursor
+should be moved before pausing.
 
 It's possible to change this behavior with the method
 \method{nodelay()}. After \method{nodelay(1)}, \method{getch()} for
-the window becomes non-blocking and returns ERR (-1) when no input is
-ready.  There's also a \function{halfdelay()} function, which can be
-used to (in effect) set a timer on each \method{getch()}; if no input
-becomes available within the number of milliseconds specified as the
-argument to \function{halfdelay()}, curses throws an exception.
+the window becomes non-blocking and returns \code{curses.ERR} (a value
+of -1) when no input is ready.  There's also a \function{halfdelay()}
+function, which can be used to (in effect) set a timer on each
+\method{getch()}; if no input becomes available within the number of
+milliseconds specified as the argument to \function{halfdelay()},
+curses raises an exception.
 
 The \method{getch()} method returns an integer; if it's between 0 and
 255, it represents the ASCII code of the key pressed.  Values greater

Modified: python/branches/bcannon-objcap/Doc/howto/doanddont.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/howto/doanddont.tex	(original)
+++ python/branches/bcannon-objcap/Doc/howto/doanddont.tex	Wed Jan 31 23:24:58 2007
@@ -32,7 +32,7 @@
 \subsubsection{Inside Function Definitions}
 
 \code{from module import *} is {\em invalid} inside function definitions.
-While many versions of Python do no check for the invalidity, it does not
+While many versions of Python do not check for the invalidity, it does not
 make it more valid, no more then having a smart lawyer makes a man innocent.
 Do not use it like that ever. Even in versions where it was accepted, it made
 the function execution slower, because the compiler could not be certain

Modified: python/branches/bcannon-objcap/Doc/howto/regex.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/howto/regex.tex	(original)
+++ python/branches/bcannon-objcap/Doc/howto/regex.tex	Wed Jan 31 23:24:58 2007
@@ -34,17 +34,18 @@
 The \module{re} module was added in Python 1.5, and provides
 Perl-style regular expression patterns.  Earlier versions of Python
 came with the \module{regex} module, which provided Emacs-style
-patterns.  \module{regex} module was removed in Python 2.5.
+patterns.  The \module{regex} module was removed completely in Python 2.5.
 
-Regular expressions (or REs) are essentially a tiny, highly
-specialized programming language embedded inside Python and made
-available through the \module{re} module.  Using this little language,
-you specify the rules for the set of possible strings that you want to
-match; this set might contain English sentences, or e-mail addresses,
-or TeX commands, or anything you like.  You can then ask questions
-such as ``Does this string match the pattern?'', or ``Is there a match
-for the pattern anywhere in this string?''.  You can also use REs to
-modify a string or to split it apart in various ways.
+Regular expressions (called REs, or regexes, or regex patterns) are
+essentially a tiny, highly specialized programming language embedded
+inside Python and made available through the \module{re} module.
+Using this little language, you specify the rules for the set of
+possible strings that you want to match; this set might contain
+English sentences, or e-mail addresses, or TeX commands, or anything
+you like.  You can then ask questions such as ``Does this string match
+the pattern?'', or ``Is there a match for the pattern anywhere in this
+string?''.  You can also use REs to modify a string or to split it
+apart in various ways.
 
 Regular expression patterns are compiled into a series of bytecodes
 which are then executed by a matching engine written in C.  For
@@ -80,11 +81,12 @@
 would let this RE match \samp{Test} or \samp{TEST} as well; more
 about this later.)  
 
-There are exceptions to this rule; some characters are
-special, and don't match themselves.  Instead, they signal that some
-out-of-the-ordinary thing should be matched, or they affect other
-portions of the RE by repeating them.  Much of this document is
-devoted to discussing various metacharacters and what they do.
+There are exceptions to this rule; some characters are special
+\dfn{metacharacters}, and don't match themselves.  Instead, they
+signal that some out-of-the-ordinary thing should be matched, or they
+affect other portions of the RE by repeating them or changing their
+meaning.  Much of this document is devoted to discussing various
+metacharacters and what they do.
 
 Here's a complete list of the metacharacters; their meanings will be
 discussed in the rest of this HOWTO.
@@ -111,9 +113,10 @@
 usually a metacharacter, but inside a character class it's stripped of
 its special nature.
 
-You can match the characters not within a range by \dfn{complementing}
-the set.  This is indicated by including a \character{\^} as the first
-character of the class; \character{\^} elsewhere will simply match the
+You can match the characters not listed within the class by
+\dfn{complementing} the set.  This is indicated by including a
+\character{\^} as the first character of the class; \character{\^}
+outside a character class will simply match the
 \character{\^} character.  For example, \verb|[^5]| will match any
 character except \character{5}.
 
@@ -176,7 +179,7 @@
 For example, \regexp{ca*t} will match \samp{ct} (0 \samp{a}
 characters), \samp{cat} (1 \samp{a}), \samp{caaat} (3 \samp{a}
 characters), and so forth.  The RE engine has various internal
-limitations stemming from the size of C's \code{int} type, that will
+limitations stemming from the size of C's \code{int} type that will
 prevent it from matching over 2 billion \samp{a} characters; you
 probably don't have enough memory to construct a string that large, so
 you shouldn't run into that limit.
@@ -238,9 +241,9 @@
 
 You can omit either \var{m} or \var{n}; in that case, a reasonable
 value is assumed for the missing value.  Omitting \var{m} is
-interpreted as a lower limit of 0, while omitting \var{n} results in  an
-upper bound of infinity --- actually, the 2 billion limit mentioned
-earlier, but that might as well be infinity.  
+interpreted as a lower limit of 0, while omitting \var{n} results in
+an upper bound of infinity --- actually, the upper bound is the
+2-billion limit mentioned earlier, but that might as well be infinity.
 
 Readers of a reductionist bent may notice that the three other qualifiers
 can all be expressed using this notation.  \regexp{\{0,\}} is the same
@@ -285,7 +288,7 @@
 no need to bloat the language specification by including them.)
 Instead, the \module{re} module is simply a C extension module
 included with Python, just like the \module{socket} or \module{zlib}
-module.
+modules.
 
 Putting REs in strings keeps the Python language simpler, but has one
 disadvantage which is the topic of the next section.
@@ -326,7 +329,7 @@
 a string literal prefixed with \character{r}, so \code{r"\e n"} is a
 two-character string containing \character{\e} and \character{n},
 while \code{"\e n"} is a one-character string containing a newline.
-Frequently regular expressions will be expressed in Python
+Regular expressions will often be written in Python
 code using this raw string notation.  
 
 \begin{tableii}{c|c}{code}{Regular String}{Raw string}
@@ -368,9 +371,9 @@
 \file{redemo.py} can be quite useful when trying to debug a
 complicated RE.  Phil Schwartz's
 \ulink{Kodos}{http://www.phil-schwartz.com/kodos.spy} is also an interactive
-tool for developing and testing RE patterns.  This HOWTO will use the
-standard Python interpreter for its examples.
+tool for developing and testing RE patterns.  
 
+This HOWTO uses the standard Python interpreter for its examples.
 First, run the Python interpreter, import the \module{re} module, and
 compile a RE:
 
@@ -401,7 +404,7 @@
 later use.
 
 \begin{verbatim}
->>> m = p.match( 'tempo')
+>>> m = p.match('tempo')
 >>> print m
 <_sre.SRE_Match object at 80c4f68>
 \end{verbatim}
@@ -472,9 +475,9 @@
 \end{verbatim}
 
 \method{findall()} has to create the entire list before it can be
-returned as the result.  In Python 2.2, the \method{finditer()} method
-is also available, returning a sequence of \class{MatchObject} instances 
-as an iterator.
+returned as the result.  The \method{finditer()} method returns a
+sequence of \class{MatchObject} instances as an
+iterator.\footnote{Introduced in Python 2.2.2.}
 
 \begin{verbatim}
 >>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')
@@ -491,13 +494,13 @@
 
 \subsection{Module-Level Functions}
 
-You don't have to produce a \class{RegexObject} and call its methods;
+You don't have to create a \class{RegexObject} and call its methods;
 the \module{re} module also provides top-level functions called
-\function{match()}, \function{search()}, \function{sub()}, and so
-forth.  These functions take the same arguments as the corresponding
-\class{RegexObject} method, with the RE string added as the first
-argument, and still return either \code{None} or a \class{MatchObject}
-instance.
+\function{match()}, \function{search()}, \function{findall()},
+\function{sub()}, and so forth.  These functions take the same
+arguments as the corresponding \class{RegexObject} method, with the RE
+string added as the first argument, and still return either
+\code{None} or a \class{MatchObject} instance.
 
 \begin{verbatim}
 >>> print re.match(r'From\s+', 'Fromage amk')
@@ -514,7 +517,7 @@
 Should you use these module-level functions, or should you get the
 \class{RegexObject} and call its methods yourself?  That choice
 depends on how frequently the RE will be used, and on your personal
-coding style.  If a RE is being used at only one point in the code,
+coding style.  If the RE is being used at only one point in the code,
 then the module functions are probably more convenient.  If a program
 contains a lot of regular expressions, or re-uses the same ones in
 several locations, then it might be worthwhile to collect all the
@@ -537,7 +540,7 @@
 
 Compilation flags let you modify some aspects of how regular
 expressions work.  Flags are available in the \module{re} module under
-two names, a long name such as \constant{IGNORECASE}, and a short,
+two names, a long name such as \constant{IGNORECASE} and a short,
 one-letter form such as \constant{I}.  (If you're familiar with Perl's
 pattern modifiers, the one-letter forms use the same letters; the
 short form of \constant{re.VERBOSE} is \constant{re.X}, for example.)
@@ -617,7 +620,7 @@
 format them.  When this flag has been specified, whitespace within the
 RE string is ignored, except when the whitespace is in a character
 class or preceded by an unescaped backslash; this lets you organize
-and indent the RE more clearly.  It also enables you to put comments
+and indent the RE more clearly.  This flag also lets you put comments
 within a RE that will be ignored by the engine; comments are marked by
 a \character{\#} that's neither in a character class or preceded by an
 unescaped backslash.
@@ -629,18 +632,19 @@
 charref = re.compile(r"""
  &[#]		     # Start of a numeric entity reference
  (
-   [0-9]+[^0-9]      # Decimal form
-   | 0[0-7]+[^0-7]   # Octal form
-   | x[0-9a-fA-F]+[^0-9a-fA-F] # Hexadecimal form
+     0[0-7]+         # Octal form
+   | [0-9]+          # Decimal form
+   | x[0-9a-fA-F]+   # Hexadecimal form
  )
+ ;                   # Trailing semicolon
 """, re.VERBOSE)
 \end{verbatim}
 
 Without the verbose setting, the RE would look like this:
 \begin{verbatim}
-charref = re.compile("&#([0-9]+[^0-9]"
-                     "|0[0-7]+[^0-7]"
-                     "|x[0-9a-fA-F]+[^0-9a-fA-F])")
+charref = re.compile("&#(0[0-7]+"
+                     "|[0-9]+"
+                     "|x[0-9a-fA-F]+);")
 \end{verbatim}
 
 In the above example, Python's automatic concatenation of string
@@ -722,12 +726,12 @@
 
 \item[\regexp{\e A}] Matches only at the start of the string.  When
 not in \constant{MULTILINE} mode, \regexp{\e A} and \regexp{\^} are
-effectively the same.  In \constant{MULTILINE} mode, however, they're
-different; \regexp{\e A} still matches only at the beginning of the
+effectively the same.  In \constant{MULTILINE} mode, they're
+different: \regexp{\e A} still matches only at the beginning of the
 string, but \regexp{\^} may match at any location inside the string
 that follows a newline character.
 
-\item[\regexp{\e Z}]Matches only at the end of the string.  
+\item[\regexp{\e Z}] Matches only at the end of the string.  
 
 \item[\regexp{\e b}] Word boundary.  
 This is a zero-width assertion that matches only at the
@@ -782,14 +786,23 @@
 strings by writing a RE divided into several subgroups which
 match different components of interest.  For example, an RFC-822
 header line is divided into a header name and a value, separated by a
-\character{:}.  This can be handled by writing a regular expression
+\character{:}, like this:
+
+\begin{verbatim}
+From: author at example.com
+User-Agent: Thunderbird 1.5.0.9 (X11/20061227)
+MIME-Version: 1.0
+To: editor at example.com
+\end{verbatim}
+
+This can be handled by writing a regular expression
 which matches an entire header line, and has one group which matches the
 header name, and another group which matches the header's value.
 
 Groups are marked by the \character{(}, \character{)} metacharacters.
 \character{(} and \character{)} have much the same meaning as they do
 in mathematical expressions; they group together the expressions
-contained inside them. For example, you can repeat the contents of a
+contained inside them, and you can repeat the contents of a
 group with a repeating qualifier, such as \regexp{*}, \regexp{+},
 \regexp{?}, or \regexp{\{\var{m},\var{n}\}}.  For example,
 \regexp{(ab)*} will match zero or more repetitions of \samp{ab}.
@@ -881,12 +894,13 @@
 syntax for regular expression extensions, so we'll look at that first.
 
 Perl 5 added several additional features to standard regular
-expressions, and the Python \module{re} module supports most of them.
-It would have been difficult to choose new single-keystroke
-metacharacters or new special sequences beginning with \samp{\e} to
-represent the new features without making Perl's regular expressions
-confusingly different from standard REs.  If you chose \samp{\&} as a
-new metacharacter, for example, old expressions would be assuming that
+expressions, and the Python \module{re} module supports most of them.  
+It would have been difficult to choose new
+single-keystroke metacharacters or new special sequences beginning
+with \samp{\e} to represent the new features without making Perl's
+regular expressions confusingly different from standard REs.  If you
+chose \samp{\&} as a new metacharacter, for example, old expressions
+would be assuming that
 \samp{\&} was a regular character and wouldn't have escaped it by
 writing \regexp{\e \&} or \regexp{[\&]}.  
 
@@ -913,15 +927,15 @@
 to the features that simplify working with groups in complex REs.
 Since groups are numbered from left to right and a complex expression
 may use many groups, it can become difficult to keep track of the
-correct numbering, and modifying such a complex RE is annoying.
-Insert a new group near the beginning, and you change the numbers of
+correct numbering.  Modifying such a complex RE is annoying, too:
+insert a new group near the beginning and you change the numbers of
 everything that follows it.
 
-First, sometimes you'll want to use a group to collect a part of a
-regular expression, but aren't interested in retrieving the group's
-contents.  You can make this fact explicit by using a non-capturing
-group: \regexp{(?:...)}, where you can put any other regular
-expression inside the parentheses.  
+Sometimes you'll want to use a group to collect a part of a regular
+expression, but aren't interested in retrieving the group's contents.
+You can make this fact explicit by using a non-capturing group:
+\regexp{(?:...)}, where you can replace the \regexp{...}
+with any other regular expression.
 
 \begin{verbatim}
 >>> m = re.match("([abc])+", "abc")
@@ -937,23 +951,23 @@
 capturing group; you can put anything inside it, repeat it with a
 repetition metacharacter such as \samp{*}, and nest it within other
 groups (capturing or non-capturing).  \regexp{(?:...)} is particularly
-useful when modifying an existing group, since you can add new groups
+useful when modifying an existing pattern, since you can add new groups
 without changing how all the other groups are numbered.  It should be
 mentioned that there's no performance difference in searching between
 capturing and non-capturing groups; neither form is any faster than
 the other.
 
-The second, and more significant, feature is named groups; instead of
+A more significant feature is named groups: instead of
 referring to them by numbers, groups can be referenced by a name.
 
 The syntax for a named group is one of the Python-specific extensions:
 \regexp{(?P<\var{name}>...)}.  \var{name} is, obviously, the name of
-the group.  Except for associating a name with a group, named groups
-also behave identically to capturing groups.  The \class{MatchObject}
-methods that deal with capturing groups all accept either integers, to
-refer to groups by number, or a string containing the group name.
-Named groups are still given numbers, so you can retrieve information
-about a group in two ways:
+the group.  Named groups also behave exactly like capturing groups,
+and additionally associate a name with a group.  The
+\class{MatchObject} methods that deal with capturing groups all accept
+either integers that refer to the group by number or strings that
+contain the desired group's name.  Named groups are still given
+numbers, so you can retrieve information about a group in two ways:
 
 \begin{verbatim}
 >>> p = re.compile(r'(?P<word>\b\w+\b)')
@@ -980,11 +994,11 @@
 It's obviously much easier to retrieve \code{m.group('zonem')},
 instead of having to remember to retrieve group 9.
 
-Since the syntax for backreferences, in an expression like
-\regexp{(...)\e 1}, refers to the number of the group there's
+The syntax for backreferences in an expression such as
+\regexp{(...)\e 1} refers to the number of the group.  There's
 naturally a variant that uses the group name instead of the number.
-This is also a Python extension: \regexp{(?P=\var{name})} indicates
-that the contents of the group called \var{name} should again be found
+This is another Python extension: \regexp{(?P=\var{name})} indicates
+that the contents of the group called \var{name} should again be matched
 at the current point.  The regular expression for finding doubled
 words, \regexp{(\e b\e w+)\e s+\e 1} can also be written as
 \regexp{(?P<word>\e b\e w+)\e s+(?P=word)}:
@@ -1014,11 +1028,11 @@
 \emph{doesn't} match at the current position in the string.
 \end{itemize}
 
-An example will help make this concrete by demonstrating a case
-where a lookahead is useful.  Consider a simple pattern to match a
-filename and split it apart into a base name and an extension,
-separated by a \samp{.}.  For example, in \samp{news.rc}, \samp{news}
-is the base name, and \samp{rc} is the filename's extension.  
+To make this concrete, let's look at a case where a lookahead is
+useful.  Consider a simple pattern to match a filename and split it
+apart into a base name and an extension, separated by a \samp{.}.  For
+example, in \samp{news.rc}, \samp{news} is the base name, and
+\samp{rc} is the filename's extension.
 
 The pattern to match this is quite simple: 
 
@@ -1065,12 +1079,12 @@
 exclude both \samp{bat} and \samp{exe} as extensions, the pattern
 would get even more complicated and confusing.
 
-A negative lookahead cuts through all this:
+A negative lookahead cuts through all this confusion:
 
 \regexp{.*[.](?!bat\$).*\$}
 % $
 
-The lookahead means: if the expression \regexp{bat} doesn't match at
+The negative lookahead means: if the expression \regexp{bat} doesn't match at
 this point, try the rest of the pattern; if \regexp{bat\$} does match,
 the whole pattern will fail.  The trailing \regexp{\$} is required to
 ensure that something like \samp{sample.batch}, where the extension
@@ -1087,7 +1101,7 @@
 \section{Modifying Strings}
 
 Up to this point, we've simply performed searches against a static
-string.  Regular expressions are also commonly used to modify a string
+string.  Regular expressions are also commonly used to modify strings
 in various ways, using the following \class{RegexObject} methods:
 
 \begin{tableii}{c|l}{code}{Method/Attribute}{Purpose}

Modified: python/branches/bcannon-objcap/Doc/lib/libexcs.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libexcs.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libexcs.tex	Wed Jan 31 23:24:58 2007
@@ -10,22 +10,6 @@
 provided in the built-in namespace as well as the \module{exceptions}
 module.
 
-\begin{notice}
-In past versions of Python string exceptions were supported.  In
-Python 1.5 and newer versions, all standard exceptions have been
-converted to class objects and users are encouraged to do the same.
-String exceptions will raise a \code{DeprecationWarning} in Python 2.5 and
-newer.
-In future versions, support for string exceptions will be removed.
-
-Two distinct string objects with the same value are considered different
-exceptions.  This is done to force programmers to use exception names
-rather than their string value when specifying exception handlers.
-The string value of all built-in exceptions is their name, but this is
-not a requirement for user-defined exceptions or exceptions defined by
-library modules.
-\end{notice}
-
 For class exceptions, in a \keyword{try}\stindex{try} statement with
 an \keyword{except}\stindex{except} clause that mentions a particular
 class, that clause also handles any exception classes derived from

Modified: python/branches/bcannon-objcap/Doc/lib/libimageop.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libimageop.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libimageop.tex	Wed Jan 31 23:24:58 2007
@@ -19,7 +19,7 @@
 
 
 \begin{funcdesc}{crop}{image, psize, width, height, x0, y0, x1, y1}
-Return the selected part of \var{image}, which should by
+Return the selected part of \var{image}, which should be
 \var{width} by \var{height} in size and consist of pixels of
 \var{psize} bytes. \var{x0}, \var{y0}, \var{x1} and \var{y1} are like
 the \function{gl.lrectread()} parameters, i.e.\ the boundary is

Modified: python/branches/bcannon-objcap/Doc/lib/liblogging.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/liblogging.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/liblogging.tex	Wed Jan 31 23:24:58 2007
@@ -989,10 +989,11 @@
 package, sends logging output to a disk file.  It inherits the output
 functionality from \class{StreamHandler}.
 
-\begin{classdesc}{FileHandler}{filename\optional{, mode}}
+\begin{classdesc}{FileHandler}{filename\optional{, mode\optional{, encoding}}}
 Returns a new instance of the \class{FileHandler} class. The specified
 file is opened and used as the stream for logging. If \var{mode} is
-not specified, \constant{'a'} is used. By default, the file grows
+not specified, \constant{'a'} is used.  If \var{encoding} is not \var{None},
+it is used to open the file with that encoding.  By default, the file grows
 indefinitely.
 \end{classdesc}
 
@@ -1004,6 +1005,41 @@
 Outputs the record to the file.
 \end{methoddesc}
 
+\subsubsection{WatchedFileHandler}
+
+\versionadded{2.6}
+The \class{WatchedFileHandler} class, located in the \module{logging.handlers}
+module, is a \class{FileHandler} which watches the file it is logging to.
+If the file changes, it is closed and reopened using the file name.
+
+A file change can happen because of usage of programs such as \var{newsyslog}
+and \var{logrotate} which perform log file rotation. This handler, intended
+for use under Unix/Linux, watches the file to see if it has changed since the
+last emit. (A file is deemed to have changed if its device or inode have
+changed.) If the file has changed, the old file stream is closed, and the file
+opened to get a new stream.
+
+This handler is not appropriate for use under Windows, because under Windows
+open log files cannot be moved or renamed - logging opens the files with
+exclusive locks - and so there is no need for such a handler. Furthermore,
+\var{ST_INO} is not supported under Windows; \function{stat()} always returns
+zero for this value.
+
+\begin{classdesc}{WatchedFileHandler}{filename\optional{,mode\optional{,
+                                      encoding}}}
+Returns a new instance of the \class{WatchedFileHandler} class. The specified
+file is opened and used as the stream for logging. If \var{mode} is
+not specified, \constant{'a'} is used.  If \var{encoding} is not \var{None},
+it is used to open the file with that encoding.  By default, the file grows
+indefinitely.
+\end{classdesc}
+
+\begin{methoddesc}{emit}{record}
+Outputs the record to the file, but first checks to see if the file has
+changed. If it has, the existing stream is flushed and closed and the file
+opened again, before outputting the record to the file.
+\end{methoddesc}
+
 \subsubsection{RotatingFileHandler}
 
 The \class{RotatingFileHandler} class, located in the \module{logging.handlers}

Modified: python/branches/bcannon-objcap/Doc/lib/libmailbox.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libmailbox.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libmailbox.tex	Wed Jan 31 23:24:58 2007
@@ -25,22 +25,29 @@
 A mailbox, which may be inspected and modified.
 \end{classdesc*}
 
+The \class{Mailbox} class defines an interface and
+is not intended to be instantiated.  Instead, format-specific
+subclasses should inherit from \class{Mailbox} and your code
+should instantiate a particular subclass.
+
 The \class{Mailbox} interface is dictionary-like, with small keys
-corresponding to messages. Keys are issued by the \class{Mailbox} instance
-with which they will be used and are only meaningful to that \class{Mailbox}
-instance. A key continues to identify a message even if the corresponding
-message is modified, such as by replacing it with another message. Messages may
-be added to a \class{Mailbox} instance using the set-like method
-\method{add()} and removed using a \code{del} statement or the set-like methods
-\method{remove()} and \method{discard()}.
+corresponding to messages. Keys are issued by the \class{Mailbox}
+instance with which they will be used and are only meaningful to that
+\class{Mailbox} instance. A key continues to identify a message even
+if the corresponding message is modified, such as by replacing it with
+another message.
+
+Messages may be added to a \class{Mailbox} instance using the set-like
+method \method{add()} and removed using a \code{del} statement or the
+set-like methods \method{remove()} and \method{discard()}.
 
 \class{Mailbox} interface semantics differ from dictionary semantics in some
-noteworthy ways. Each time a message is requested, a new representation
-(typically a \class{Message} instance) is generated, based upon the current
-state of the mailbox. Similarly, when a message is added to a \class{Mailbox}
-instance, the provided message representation's contents are copied. In neither
-case is a reference to the message representation kept by the \class{Mailbox}
-instance.
+noteworthy ways. Each time a message is requested, a new
+representation (typically a \class{Message} instance) is generated
+based upon the current state of the mailbox. Similarly, when a message
+is added to a \class{Mailbox} instance, the provided message
+representation's contents are copied. In neither case is a reference
+to the message representation kept by the \class{Mailbox} instance.
 
 The default \class{Mailbox} iterator iterates over message representations, not
 keys as the default dictionary iterator does. Moreover, modification of a
@@ -51,9 +58,18 @@
 \exception{KeyError} exception if the corresponding message is subsequently
 removed.
 
-\class{Mailbox} itself is intended to define an interface and to be inherited
-from by format-specific subclasses but is not intended to be instantiated.
-Instead, you should instantiate a subclass.
+\begin{notice}[warning]
+Be very cautious when modifying mailboxes that might be
+simultaneously changed by some other process.  The safest mailbox
+format to use for such tasks is Maildir; try to avoid using
+single-file formats such as mbox for concurrent writing.  If you're
+modifying a mailbox, you
+\emph{must} lock it by calling the \method{lock()} and
+\method{unlock()} methods \emph{before} reading any messages in the file
+or making any changes by adding or deleting a message.  Failing to
+lock the mailbox runs the risk of losing messages or corrupting the entire
+mailbox.
+\end{notice}
 
 \class{Mailbox} instances have the following methods:
 
@@ -202,15 +218,16 @@
 
 \begin{methoddesc}{flush}{}
 Write any pending changes to the filesystem. For some \class{Mailbox}
-subclasses, changes are always written immediately and this method does
-nothing.
+subclasses, changes are always written immediately and \method{flush()} does
+nothing, but you should still make a habit of calling this method.
 \end{methoddesc}
 
 \begin{methoddesc}{lock}{}
 Acquire an exclusive advisory lock on the mailbox so that other processes know
 not to modify it. An \exception{ExternalClashError} is raised if the lock is
 not available. The particular locking mechanisms used depend upon the mailbox
-format.
+format.  You should \emph{always} lock the mailbox before making any 
+modifications to its contents.
 \end{methoddesc}
 
 \begin{methoddesc}{unlock}{}
@@ -1373,36 +1390,55 @@
 \begin{verbatim}
 import mailbox
 destination = mailbox.MH('~/Mail')
+destination.lock()
 for message in mailbox.Babyl('~/RMAIL'):
     destination.add(MHMessage(message))
+destination.flush()
+destination.unlock()
 \end{verbatim}
 
-An example of sorting mail from numerous mailing lists, being careful to avoid
-mail corruption due to concurrent modification by other programs, mail loss due
-to interruption of the program, or premature termination due to malformed
-messages in the mailbox:
+This example sorts mail from several mailing lists into different
+mailboxes, being careful to avoid mail corruption due to concurrent
+modification by other programs, mail loss due to interruption of the
+program, or premature termination due to malformed messages in the
+mailbox:
 
 \begin{verbatim}
 import mailbox
 import email.Errors
+
 list_names = ('python-list', 'python-dev', 'python-bugs')
+
 boxes = dict((name, mailbox.mbox('~/email/%s' % name)) for name in list_names)
-inbox = mailbox.Maildir('~/Maildir', None)
+inbox = mailbox.Maildir('~/Maildir', factory=None)
+
 for key in inbox.iterkeys():
     try:
         message = inbox[key]
     except email.Errors.MessageParseError:
         continue                # The message is malformed. Just leave it.
+
     for name in list_names:
         list_id = message['list-id']
         if list_id and name in list_id:
+            # Get mailbox to use
             box = boxes[name]
+
+            # Write copy to disk before removing original.
+            # If there's a crash, you might duplicate a message, but
+            # that's better than losing a message completely.
             box.lock()
             box.add(message)
-            box.flush()         # Write copy to disk before removing original.
+            box.flush()         
             box.unlock()
+
+            # Remove original message
+            inbox.lock()
             inbox.discard(key)
+            inbox.flush()
+            inbox.unlock()
             break               # Found destination, so stop looking.
+
 for box in boxes.itervalues():
     box.close()
 \end{verbatim}

Modified: python/branches/bcannon-objcap/Doc/lib/librandom.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/librandom.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/librandom.tex	Wed Jan 31 23:24:58 2007
@@ -185,7 +185,7 @@
 
 \begin{funcdesc}{betavariate}{alpha, beta}
   Beta distribution.  Conditions on the parameters are
-  \code{\var{alpha} > -1} and \code{\var{beta} > -1}.
+  \code{\var{alpha} > 0} and \code{\var{beta} > 0}.
   Returned values range between 0 and 1.
 \end{funcdesc}
 

Modified: python/branches/bcannon-objcap/Doc/lib/libsets.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libsets.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libsets.tex	Wed Jan 31 23:24:58 2007
@@ -9,6 +9,8 @@
 \sectionauthor{Raymond D. Hettinger}{python at rcn.com}
 
 \versionadded{2.3}
+\deprecated{2.6}{The built-in \code{set}/\code{frozenset} types replace this
+module.}
 
 The \module{sets} module provides classes for constructing and manipulating
 unordered collections of unique elements.  Common uses include membership

Modified: python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libsmtplib.tex	Wed Jan 31 23:24:58 2007
@@ -185,7 +185,7 @@
     The server didn't reply properly to the \samp{HELO} greeting.
   \item[\exception{SMTPAuthenticationError}]
     The server didn't accept the username/password combination.
-  \item[\exception{SMTPError}]
+  \item[\exception{SMTPException}]
     No suitable authentication method was found.
 \end{description}
 \end{methoddesc}

Modified: python/branches/bcannon-objcap/Doc/lib/libsocket.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libsocket.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libsocket.tex	Wed Jan 31 23:24:58 2007
@@ -331,25 +331,25 @@
 \end{funcdesc}
 
 \begin{funcdesc}{ntohl}{x}
-Convert 32-bit integers from network to host byte order.  On machines
+Convert 32-bit positive integers from network to host byte order.  On machines
 where the host byte order is the same as network byte order, this is a
 no-op; otherwise, it performs a 4-byte swap operation.
 \end{funcdesc}
 
 \begin{funcdesc}{ntohs}{x}
-Convert 16-bit integers from network to host byte order.  On machines
+Convert 16-bit positive integers from network to host byte order.  On machines
 where the host byte order is the same as network byte order, this is a
 no-op; otherwise, it performs a 2-byte swap operation.
 \end{funcdesc}
 
 \begin{funcdesc}{htonl}{x}
-Convert 32-bit integers from host to network byte order.  On machines
+Convert 32-bit positive integers from host to network byte order.  On machines
 where the host byte order is the same as network byte order, this is a
 no-op; otherwise, it performs a 4-byte swap operation.
 \end{funcdesc}
 
 \begin{funcdesc}{htons}{x}
-Convert 16-bit integers from host to network byte order.  On machines
+Convert 16-bit positive integers from host to network byte order.  On machines
 where the host byte order is the same as network byte order, this is a
 no-op; otherwise, it performs a 2-byte swap operation.
 \end{funcdesc}

Modified: python/branches/bcannon-objcap/Doc/lib/libstruct.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libstruct.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libstruct.tex	Wed Jan 31 23:24:58 2007
@@ -50,14 +50,15 @@
   \lineiv{c}{\ctype{char}}{string of length 1}{}
   \lineiv{b}{\ctype{signed char}}{integer}{}
   \lineiv{B}{\ctype{unsigned char}}{integer}{}
+  \lineiv{t}{\ctype{_Bool}}{bool}{(1)}
   \lineiv{h}{\ctype{short}}{integer}{}
   \lineiv{H}{\ctype{unsigned short}}{integer}{}
   \lineiv{i}{\ctype{int}}{integer}{}
   \lineiv{I}{\ctype{unsigned int}}{long}{}
   \lineiv{l}{\ctype{long}}{integer}{}
   \lineiv{L}{\ctype{unsigned long}}{long}{}
-  \lineiv{q}{\ctype{long long}}{long}{(1)}
-  \lineiv{Q}{\ctype{unsigned long long}}{long}{(1)}
+  \lineiv{q}{\ctype{long long}}{long}{(2)}
+  \lineiv{Q}{\ctype{unsigned long long}}{long}{(2)}
   \lineiv{f}{\ctype{float}}{float}{}
   \lineiv{d}{\ctype{double}}{float}{}
   \lineiv{s}{\ctype{char[]}}{string}{}
@@ -70,6 +71,11 @@
 
 \begin{description}
 \item[(1)]
+  The \character{t} conversion code corresponds to the \ctype{_Bool} type
+  defined by C99. If this type is not available, it is simulated using a
+  \ctype{char}. In standard mode, it is always represented by one byte.
+  \versionadded{2.6}
+\item[(2)]
   The \character{q} and \character{Q} conversion codes are available in
   native mode only if the platform C compiler supports C \ctype{long long},
   or, on Windows, \ctype{__int64}.  They are always available in standard
@@ -118,6 +124,12 @@
 meaning a Python long integer will be used to hold the pointer; other
 platforms use 32-bit pointers and will use a Python integer.
 
+For the \character{t} format character, the return value is either
+\constant{True} or \constant{False}. When packing, the truth value
+of the argument object is used. Either 0 or 1 in the native or standard
+bool representation will be packed, and any non-zero value will be True
+when unpacking.
+
 By default, C numbers are represented in the machine's native format
 and byte order, and properly aligned by skipping pad bytes if
 necessary (according to the rules used by the C compiler).
@@ -151,6 +163,7 @@
 \ctype{long long} (\ctype{__int64} on Windows) is 8 bytes;
 \ctype{float} and \ctype{double} are 32-bit and 64-bit
 IEEE floating point numbers, respectively.
+\ctype{_Bool} is 1 byte.
 
 Note the difference between \character{@} and \character{=}: both use
 native byte order, but the size and alignment of the latter is

Modified: python/branches/bcannon-objcap/Doc/lib/libtest.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libtest.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libtest.tex	Wed Jan 31 23:24:58 2007
@@ -281,6 +281,7 @@
 The optional argument \var{testclass} accepts one of the test classes in the
 suite so as to print out more detailed information on where the testing suite
 originated from.
+\end{funcdesc}
 
 The \module{test.test_support} module defines the following classes:
 
@@ -299,4 +300,3 @@
 Temporarily unset the environment variable \code{envvar}.
 \end{methoddesc}
 
-\end{funcdesc}

Modified: python/branches/bcannon-objcap/Doc/lib/libtime.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/lib/libtime.tex	(original)
+++ python/branches/bcannon-objcap/Doc/lib/libtime.tex	Wed Jan 31 23:24:58 2007
@@ -324,6 +324,12 @@
 it is platform-specific except for recognizing UTC and GMT which are
 always known (and are considered to be non-daylight savings
 timezones).
+
+Only the directives specified in the documentation are supported.  Because
+\code{strftime()} is implemented per platform it can sometimes offer more
+directives than those listed.  But \code{strptime()} is independent of any
+platform and thus does not necessarily support all directives available that
+are not documented as supported.
 \end{funcdesc}
 
 \begin{datadesc}{struct_time}

Modified: python/branches/bcannon-objcap/Doc/ref/ref3.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/ref/ref3.tex	(original)
+++ python/branches/bcannon-objcap/Doc/ref/ref3.tex	Wed Jan 31 23:24:58 2007
@@ -1999,8 +1999,8 @@
 \methodline[numeric object]{__ixor__}{self, other}
 \methodline[numeric object]{__ior__}{self, other}
 These methods are called to implement the augmented arithmetic
-operations (\code{+=}, \code{-=}, \code{*=}, \code{/=}, \code{\%=},
-\code{**=}, \code{<<=}, \code{>>=}, \code{\&=},
+operations (\code{+=}, \code{-=}, \code{*=}, \code{/=}, \code{//=},
+\code{\%=}, \code{**=}, \code{<<=}, \code{>>=}, \code{\&=},
 \code{\textasciicircum=}, \code{|=}).  These methods should attempt to do the
 operation in-place (modifying \var{self}) and return the result (which
 could be, but does not have to be, \var{self}).  If a specific method

Modified: python/branches/bcannon-objcap/Doc/ref/ref4.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/ref/ref4.tex	(original)
+++ python/branches/bcannon-objcap/Doc/ref/ref4.tex	Wed Jan 31 23:24:58 2007
@@ -203,10 +203,6 @@
 value can be raised along with the identifying string which can be
 passed to the handler.
 
-\deprecated{2.5}{String exceptions should not be used in new code.
-They will not be supported in a future version of Python.  Old code
-should be rewritten to use class exceptions instead.}
-
 \begin{notice}[warning]
 Messages to exceptions are not part of the Python API.  Their contents may
 change from one version of Python to the next without warning and should not

Modified: python/branches/bcannon-objcap/Doc/tut/tut.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/tut/tut.tex	(original)
+++ python/branches/bcannon-objcap/Doc/tut/tut.tex	Wed Jan 31 23:24:58 2007
@@ -2015,7 +2015,7 @@
 
 There is a way to remove an item from a list given its index instead
 of its value: the \keyword{del} statement.  This differs from the
-\method{pop()}) method which returns a value.  The \keyword{del}
+\method{pop()} method which returns a value.  The \keyword{del}
 statement can also be used to remove slices from a list or clear the
 entire list (which we did earlier by assignment of an empty list to
 the slice).  For example:

Modified: python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex
==============================================================================
--- python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex	(original)
+++ python/branches/bcannon-objcap/Doc/whatsnew/whatsnew26.tex	Wed Jan 31 23:24:58 2007
@@ -72,6 +72,12 @@
 This class supports an interface identical to the existing \class{SMTP} 
 class. (Contributed by Monty Taylor.)
 
+\item The \module{test.test_support} module now contains a
+\function{EnvironmentVarGuard} context manager that 
+supports temporarily changing environment variables and 
+automatically restores them to their old values.
+(Contributed by Brett Cannon.)
+
 \end{itemize}
 
 

Modified: python/branches/bcannon-objcap/Include/Python-ast.h
==============================================================================
--- python/branches/bcannon-objcap/Include/Python-ast.h	(original)
+++ python/branches/bcannon-objcap/Include/Python-ast.h	Wed Jan 31 23:24:58 2007
@@ -349,95 +349,153 @@
 };
 
 
-mod_ty Module(asdl_seq * body, PyArena *arena);
-mod_ty Interactive(asdl_seq * body, PyArena *arena);
-mod_ty Expression(expr_ty body, PyArena *arena);
-mod_ty Suite(asdl_seq * body, PyArena *arena);
-stmt_ty FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
-                    asdl_seq * decorators, int lineno, int col_offset, PyArena
-                    *arena);
-stmt_ty ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int
-                 lineno, int col_offset, PyArena *arena);
-stmt_ty Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
-stmt_ty Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena);
-stmt_ty Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset,
-               PyArena *arena);
-stmt_ty AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno,
-                  int col_offset, PyArena *arena);
-stmt_ty Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int
-              col_offset, PyArena *arena);
-stmt_ty For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse,
-            int lineno, int col_offset, PyArena *arena);
-stmt_ty While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
-              col_offset, PyArena *arena);
-stmt_ty If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int
-           col_offset, PyArena *arena);
-stmt_ty With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int
-             lineno, int col_offset, PyArena *arena);
-stmt_ty Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int
-              col_offset, PyArena *arena);
-stmt_ty TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int
-                  lineno, int col_offset, PyArena *arena);
-stmt_ty TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int
+#define Module(a0, a1) _Py_Module(a0, a1)
+mod_ty _Py_Module(asdl_seq * body, PyArena *arena);
+#define Interactive(a0, a1) _Py_Interactive(a0, a1)
+mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena);
+#define Expression(a0, a1) _Py_Expression(a0, a1)
+mod_ty _Py_Expression(expr_ty body, PyArena *arena);
+#define Suite(a0, a1) _Py_Suite(a0, a1)
+mod_ty _Py_Suite(asdl_seq * body, PyArena *arena);
+#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6)
+stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body,
+                        asdl_seq * decorators, int lineno, int col_offset,
+                        PyArena *arena);
+#define ClassDef(a0, a1, a2, a3, a4, a5) _Py_ClassDef(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, int
+                     lineno, int col_offset, PyArena *arena);
+#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3)
+stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena);
+#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3)
+stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena
+                   *arena);
+#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4)
+stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int
                    col_offset, PyArena *arena);
-stmt_ty Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena
-               *arena);
-stmt_ty Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
-stmt_ty ImportFrom(identifier module, asdl_seq * names, int level, int lineno,
-                   int col_offset, PyArena *arena);
-stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int
-             col_offset, PyArena *arena);
-stmt_ty Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
-stmt_ty Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
-stmt_ty Pass(int lineno, int col_offset, PyArena *arena);
-stmt_ty Break(int lineno, int col_offset, PyArena *arena);
-stmt_ty Continue(int lineno, int col_offset, PyArena *arena);
-expr_ty BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
-               PyArena *arena);
-expr_ty BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
-              col_offset, PyArena *arena);
-expr_ty UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
-                PyArena *arena);
-expr_ty Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
-               PyArena *arena);
-expr_ty IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
-              col_offset, PyArena *arena);
-expr_ty Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset,
-             PyArena *arena);
-expr_ty ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
+#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int
+                      lineno, int col_offset, PyArena *arena);
+#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int
+                  col_offset, PyArena *arena);
+#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6)
+stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq *
+                orelse, int lineno, int col_offset, PyArena *arena);
+#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
+                  int col_offset, PyArena *arena);
+#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno,
+               int col_offset, PyArena *arena);
+#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body,
+                 int lineno, int col_offset, PyArena *arena);
+#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int
+                  col_offset, PyArena *arena);
+#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse,
+                      int lineno, int col_offset, PyArena *arena);
+#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4)
+stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int
+                       col_offset, PyArena *arena);
+#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4)
+stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset,
+                   PyArena *arena);
+#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3)
+stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena
+                   *arena);
+#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int
+                       lineno, int col_offset, PyArena *arena);
+#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5)
+stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int
+                 col_offset, PyArena *arena);
+#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3)
+stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena
+                   *arena);
+#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3)
+stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
+#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2)
+stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena);
+#define Break(a0, a1, a2) _Py_Break(a0, a1, a2)
+stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena);
+#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2)
+stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena);
+#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4)
+expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset,
+                   PyArena *arena);
+#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int
+                  col_offset, PyArena *arena);
+#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4)
+expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset,
+                    PyArena *arena);
+#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4)
+expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset,
+                   PyArena *arena);
+#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int
+                  col_offset, PyArena *arena);
+#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4)
+expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int
                  col_offset, PyArena *arena);
-expr_ty GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
+#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4)
+expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int
                      col_offset, PyArena *arena);
-expr_ty Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
-expr_ty Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int
-                lineno, int col_offset, PyArena *arena);
-expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
-             starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
-             *arena);
-expr_ty Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
-expr_ty Num(object n, int lineno, int col_offset, PyArena *arena);
-expr_ty Str(string s, int lineno, int col_offset, PyArena *arena);
-expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
-                  lineno, int col_offset, PyArena *arena);
-expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
-                  lineno, int col_offset, PyArena *arena);
-expr_ty Name(identifier id, expr_context_ty ctx, int lineno, int col_offset,
-             PyArena *arena);
-expr_ty List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset,
-             PyArena *arena);
-expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset,
-              PyArena *arena);
-slice_ty Ellipsis(PyArena *arena);
-slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
-slice_ty ExtSlice(asdl_seq * dims, PyArena *arena);
-slice_ty Index(expr_ty value, PyArena *arena);
-comprehension_ty comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs,
-                               PyArena *arena);
-excepthandler_ty excepthandler(expr_ty type, expr_ty name, asdl_seq * body, int
-                               lineno, int col_offset, PyArena *arena);
-arguments_ty arguments(asdl_seq * args, identifier vararg, identifier kwarg,
-                       asdl_seq * defaults, PyArena *arena);
-keyword_ty keyword(identifier arg, expr_ty value, PyArena *arena);
-alias_ty alias(identifier name, identifier asname, PyArena *arena);
+#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4)
+expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int
+                         col_offset, PyArena *arena);
+#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
+expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena);
+#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators,
+                    int lineno, int col_offset, PyArena *arena);
+#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7)
+expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
+                 starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
+                 *arena);
+#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3)
+expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
+#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3)
+expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
+#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
+expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
+#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
+                      lineno, int col_offset, PyArena *arena);
+#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int
+                      lineno, int col_offset, PyArena *arena);
+#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4)
+expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int
+                 col_offset, PyArena *arena);
+#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4)
+expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int
+                 col_offset, PyArena *arena);
+#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4)
+expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int
+                  col_offset, PyArena *arena);
+#define Ellipsis(a0) _Py_Ellipsis(a0)
+slice_ty _Py_Ellipsis(PyArena *arena);
+#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3)
+slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena);
+#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1)
+slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena);
+#define Index(a0, a1) _Py_Index(a0, a1)
+slice_ty _Py_Index(expr_ty value, PyArena *arena);
+#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3)
+comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq *
+                                   ifs, PyArena *arena);
+#define excepthandler(a0, a1, a2, a3, a4, a5) _Py_excepthandler(a0, a1, a2, a3, a4, a5)
+excepthandler_ty _Py_excepthandler(expr_ty type, expr_ty name, asdl_seq * body,
+                                   int lineno, int col_offset, PyArena *arena);
+#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4)
+arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier
+                           kwarg, asdl_seq * defaults, PyArena *arena);
+#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2)
+keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena);
+#define alias(a0, a1, a2) _Py_alias(a0, a1, a2)
+alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena);
 
 PyObject* PyAST_mod2obj(mod_ty t);

Modified: python/branches/bcannon-objcap/Lib/BaseHTTPServer.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/BaseHTTPServer.py	(original)
+++ python/branches/bcannon-objcap/Lib/BaseHTTPServer.py	Wed Jan 31 23:24:58 2007
@@ -396,7 +396,7 @@
         self.log_message('"%s" %s %s',
                          self.requestline, str(code), str(size))
 
-    def log_error(self, *args):
+    def log_error(self, format, *args):
         """Log an error.
 
         This is called when a request cannot be fulfilled.  By
@@ -408,7 +408,7 @@
 
         """
 
-        self.log_message(*args)
+        self.log_message(format, *args)
 
     def log_message(self, format, *args):
         """Log an arbitrary message.

Modified: python/branches/bcannon-objcap/Lib/CGIHTTPServer.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/CGIHTTPServer.py	(original)
+++ python/branches/bcannon-objcap/Lib/CGIHTTPServer.py	Wed Jan 31 23:24:58 2007
@@ -107,7 +107,7 @@
         """Execute a CGI script."""
         path = self.path
         dir, rest = self.cgi_info
-        
+
         i = path.find('/', len(dir) + 1)
         while i >= 0:
             nextdir = path[:i]

Modified: python/branches/bcannon-objcap/Lib/_strptime.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/_strptime.py	(original)
+++ python/branches/bcannon-objcap/Lib/_strptime.py	Wed Jan 31 23:24:58 2007
@@ -22,9 +22,6 @@
 except:
     from dummy_thread import allocate_lock as _thread_allocate_lock
 
-__author__ = "Brett Cannon"
-__email__ = "brett at python.org"
-
 __all__ = ['strptime']
 
 def _getlang():
@@ -273,11 +270,31 @@
 _CACHE_MAX_SIZE = 5 # Max number of regexes stored in _regex_cache
 _regex_cache = {}
 
+def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):
+    """Calculate the Julian day based on the year, week of the year, and day of
+    the week, with week_start_day representing whether the week of the year
+    assumes the week starts on Sunday or Monday (6 or 0)."""
+    first_weekday = datetime_date(year, 1, 1).weekday()
+    # If we are dealing with the %U directive (week starts on Sunday), it's
+    # easier to just shift the view to Sunday being the first day of the
+    # week.
+    if not week_starts_Mon:
+        first_weekday = (first_weekday + 1) % 7
+        day_of_week = (day_of_week + 1) % 7
+    # Need to watch out for a week 0 (when the first day of the year is not
+    # the same as that specified by %U or %W).
+    week_0_length = (7 - first_weekday) % 7
+    if week_of_year == 0:
+        return 1 + day_of_week - first_weekday
+    else:
+        days_to_week = week_0_length + (7 * (week_of_year - 1))
+        return 1 + days_to_week + day_of_week
+
+
 def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
     """Return a time struct based on the input string and the format string."""
     global _TimeRE_cache, _regex_cache
-    _cache_lock.acquire()
-    try:
+    with _cache_lock:
         time_re = _TimeRE_cache
         locale_time = time_re.locale_time
         if _getlang() != locale_time.lang:
@@ -302,8 +319,6 @@
             except IndexError:
                 raise ValueError("stray %% in format '%s'" % format)
             _regex_cache[format] = format_regex
-    finally:
-        _cache_lock.release()
     found = format_regex.match(data_string)
     if not found:
         raise ValueError("time data %r does not match format %r" %
@@ -385,10 +400,10 @@
         elif group_key in ('U', 'W'):
             week_of_year = int(found_dict[group_key])
             if group_key == 'U':
-                # U starts week on Sunday
+                # U starts week on Sunday.
                 week_of_year_start = 6
             else:
-                # W starts week on Monday
+                # W starts week on Monday.
                 week_of_year_start = 0
         elif group_key == 'Z':
             # Since -1 is default value only need to worry about setting tz if
@@ -406,42 +421,20 @@
                         tz = value
                         break
     # If we know the week of the year and what day of that week, we can figure
-    # out the Julian day of the year
-    # Calculations below assume 0 is a Monday
+    # out the Julian day of the year.
     if julian == -1 and week_of_year != -1 and weekday != -1:
-        # Calculate how many days in week 0
-        first_weekday = datetime_date(year, 1, 1).weekday()
-        preceeding_days = 7 - first_weekday
-        if preceeding_days == 7:
-            preceeding_days = 0
-        # Adjust for U directive so that calculations are not dependent on
-        # directive used to figure out week of year
-        if weekday == 6 and week_of_year_start == 6:
-            week_of_year -= 1
-        # If a year starts and ends on a Monday but a week is specified to
-        # start on a Sunday we need to up the week to counter-balance the fact
-        # that with %W that first Monday starts week 1 while with %U that is
-        # week 0 and thus shifts everything by a week
-        if weekday == 0 and first_weekday == 0 and week_of_year_start == 6:
-            week_of_year += 1
-        # If in week 0, then just figure out how many days from Jan 1 to day of
-        # week specified, else calculate by multiplying week of year by 7,
-        # adding in days in week 0, and the number of days from Monday to the
-        # day of the week
-        if week_of_year == 0:
-            julian = 1 + weekday - first_weekday
-        else:
-            days_to_week = preceeding_days + (7 * (week_of_year - 1))
-            julian = 1 + days_to_week + weekday
+        week_starts_Mon = True if week_of_year_start == 0 else False
+        julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
+                                            week_starts_Mon)
     # Cannot pre-calculate datetime_date() since can change in Julian
-    #calculation and thus could have different value for the day of the week
-    #calculation
+    # calculation and thus could have different value for the day of the week
+    # calculation.
     if julian == -1:
         # Need to add 1 to result since first day of the year is 1, not 0.
         julian = datetime_date(year, month, day).toordinal() - \
                   datetime_date(year, 1, 1).toordinal() + 1
     else:  # Assume that if they bothered to include Julian day it will
-           #be accurate
+           # be accurate.
         datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal())
         year = datetime_result.year
         month = datetime_result.month

Modified: python/branches/bcannon-objcap/Lib/compiler/pycodegen.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/compiler/pycodegen.py	(original)
+++ python/branches/bcannon-objcap/Lib/compiler/pycodegen.py	Wed Jan 31 23:24:58 2007
@@ -849,6 +849,8 @@
         self.emit('LOAD_CONST', None)
         self.nextBlock(final)
         self.setups.push((END_FINALLY, final))
+        self._implicitNameOp('LOAD', exitvar)
+        self._implicitNameOp('DELETE', exitvar)
         self.emit('WITH_CLEANUP')
         self.emit('END_FINALLY')
         self.setups.pop()

Modified: python/branches/bcannon-objcap/Lib/compiler/transformer.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/compiler/transformer.py	(original)
+++ python/branches/bcannon-objcap/Lib/compiler/transformer.py	Wed Jan 31 23:24:58 2007
@@ -960,7 +960,7 @@
         if nodelist[2][0] == token.COLON:
             var = None
         else:
-            var = self.com_node(nodelist[2])
+            var = self.com_assign(nodelist[2][2], OP_ASSIGN)
         return With(expr, var, body, lineno=nodelist[0][2])
 
     def com_with_var(self, nodelist):

Modified: python/branches/bcannon-objcap/Lib/cookielib.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/cookielib.py	(original)
+++ python/branches/bcannon-objcap/Lib/cookielib.py	Wed Jan 31 23:24:58 2007
@@ -1318,26 +1318,26 @@
         self._cookies_lock.acquire()
         try:
 
-           self._policy._now = self._now = int(time.time())
+            self._policy._now = self._now = int(time.time())
+
+            cookies = self._cookies_for_request(request)
 
-           cookies = self._cookies_for_request(request)
+            attrs = self._cookie_attrs(cookies)
+            if attrs:
+                if not request.has_header("Cookie"):
+                    request.add_unredirected_header(
+                        "Cookie", "; ".join(attrs))
+
+            # if necessary, advertise that we know RFC 2965
+            if (self._policy.rfc2965 and not self._policy.hide_cookie2 and
+                not request.has_header("Cookie2")):
+                for cookie in cookies:
+                    if cookie.version != 1:
+                        request.add_unredirected_header("Cookie2", '$Version="1"')
+                        break
 
-           attrs = self._cookie_attrs(cookies)
-           if attrs:
-               if not request.has_header("Cookie"):
-                   request.add_unredirected_header(
-                       "Cookie", "; ".join(attrs))
-
-           # if necessary, advertise that we know RFC 2965
-           if (self._policy.rfc2965 and not self._policy.hide_cookie2 and
-               not request.has_header("Cookie2")):
-               for cookie in cookies:
-                   if cookie.version != 1:
-                       request.add_unredirected_header("Cookie2", '$Version="1"')
-                       break
-   
         finally:
-           self._cookies_lock.release()
+            self._cookies_lock.release()
 
         self.clear_expired_cookies()
 
@@ -1609,7 +1609,7 @@
 
             if self._policy.set_ok(cookie, request):
                 self.set_cookie(cookie)
-         
+
 
         finally:
             self._cookies_lock.release()
@@ -1632,14 +1632,14 @@
         _debug("extract_cookies: %s", response.info())
         self._cookies_lock.acquire()
         try:
-           self._policy._now = self._now = int(time.time())
+            self._policy._now = self._now = int(time.time())
 
-           for cookie in self.make_cookies(response, request):
-               if self._policy.set_ok(cookie, request):
-                   _debug(" setting cookie: %s", cookie)
-                   self.set_cookie(cookie)
+            for cookie in self.make_cookies(response, request):
+                if self._policy.set_ok(cookie, request):
+                    _debug(" setting cookie: %s", cookie)
+                    self.set_cookie(cookie)
         finally:
-           self._cookies_lock.release()
+            self._cookies_lock.release()
 
     def clear(self, domain=None, path=None, name=None):
         """Clear some cookies.
@@ -1677,11 +1677,11 @@
         """
         self._cookies_lock.acquire()
         try:
-           for cookie in self:
-               if cookie.discard:
-                   self.clear(cookie.domain, cookie.path, cookie.name)
+            for cookie in self:
+                if cookie.discard:
+                    self.clear(cookie.domain, cookie.path, cookie.name)
         finally:
-           self._cookies_lock.release()
+            self._cookies_lock.release()
 
     def clear_expired_cookies(self):
         """Discard all expired cookies.
@@ -1695,12 +1695,12 @@
         """
         self._cookies_lock.acquire()
         try:
-           now = time.time()
-           for cookie in self:
-               if cookie.is_expired(now):
-                   self.clear(cookie.domain, cookie.path, cookie.name)
+            now = time.time()
+            for cookie in self:
+                if cookie.is_expired(now):
+                    self.clear(cookie.domain, cookie.path, cookie.name)
         finally:
-           self._cookies_lock.release()
+            self._cookies_lock.release()
 
     def __iter__(self):
         return deepvalues(self._cookies)
@@ -1774,16 +1774,16 @@
         self._cookies_lock.acquire()
         try:
 
-           old_state = copy.deepcopy(self._cookies)
-           self._cookies = {}
-           try:
-               self.load(filename, ignore_discard, ignore_expires)
-           except (LoadError, IOError):
-               self._cookies = old_state
-               raise
+            old_state = copy.deepcopy(self._cookies)
+            self._cookies = {}
+            try:
+                self.load(filename, ignore_discard, ignore_expires)
+            except (LoadError, IOError):
+                self._cookies = old_state
+                raise
 
         finally:
-           self._cookies_lock.release()
+            self._cookies_lock.release()
 
 from _LWPCookieJar import LWPCookieJar, lwp_cookie_str
 from _MozillaCookieJar import MozillaCookieJar

Modified: python/branches/bcannon-objcap/Lib/ctypes/__init__.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ctypes/__init__.py	(original)
+++ python/branches/bcannon-objcap/Lib/ctypes/__init__.py	Wed Jan 31 23:24:58 2007
@@ -5,7 +5,7 @@
 
 import os as _os, sys as _sys
 
-__version__ = "1.0.1"
+__version__ = "1.1.0"
 
 from _ctypes import Union, Structure, Array
 from _ctypes import _Pointer

Modified: python/branches/bcannon-objcap/Lib/ctypes/test/test_win32.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ctypes/test/test_win32.py	(original)
+++ python/branches/bcannon-objcap/Lib/ctypes/test/test_win32.py	Wed Jan 31 23:24:58 2007
@@ -32,12 +32,32 @@
             # or wrong calling convention
             self.assertRaises(ValueError, IsWindow, None)
 
+if sys.platform == "win32":
+    class FunctionCallTestCase(unittest.TestCase):
+
         if is_resource_enabled("SEH"):
             def test_SEH(self):
-                # Call functions with invalid arguments, and make sure that access violations
-                # are trapped and raise an exception.
+                # Call functions with invalid arguments, and make sure
+                # that access violations are trapped and raise an
+                # exception.
                 self.assertRaises(WindowsError, windll.kernel32.GetModuleHandleA, 32)
 
+        def test_noargs(self):
+            # This is a special case on win32 x64
+            windll.user32.GetDesktopWindow()
+
+    class TestWintypes(unittest.TestCase):
+        def test_HWND(self):
+            from ctypes import wintypes
+            self.failUnlessEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
+
+        def test_PARAM(self):
+            from ctypes import wintypes
+            self.failUnlessEqual(sizeof(wintypes.WPARAM),
+                                 sizeof(c_void_p))
+            self.failUnlessEqual(sizeof(wintypes.LPARAM),
+                                 sizeof(c_void_p))
+
 class Structures(unittest.TestCase):
 
     def test_struct_by_value(self):

Modified: python/branches/bcannon-objcap/Lib/ctypes/util.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ctypes/util.py	(original)
+++ python/branches/bcannon-objcap/Lib/ctypes/util.py	Wed Jan 31 23:24:58 2007
@@ -46,24 +46,17 @@
     import re, tempfile, errno
 
     def _findLib_gcc(name):
-        expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name
+        expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
         fdout, ccout = tempfile.mkstemp()
         os.close(fdout)
-        cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \
+        cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; else CC=cc; fi;' \
               '$CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name
         try:
-            fdout, outfile =  tempfile.mkstemp()
-            os.close(fdout)
-            fd = os.popen(cmd)
-            trace = fd.read()
-            err = fd.close()
+            f = os.popen(cmd)
+            trace = f.read()
+            f.close()
         finally:
             try:
-                os.unlink(outfile)
-            except OSError, e:
-                if e.errno != errno.ENOENT:
-                    raise
-            try:
                 os.unlink(ccout)
             except OSError, e:
                 if e.errno != errno.ENOENT:
@@ -73,29 +66,58 @@
             return None
         return res.group(0)
 
-    def _findLib_ld(name):
-        expr = '/[^\(\)\s]*lib%s\.[^\(\)\s]*' % name
-        res = re.search(expr, os.popen('/sbin/ldconfig -p 2>/dev/null').read())
-        if not res:
-            # Hm, this works only for libs needed by the python executable.
-            cmd = 'ldd %s 2>/dev/null' % sys.executable
-            res = re.search(expr, os.popen(cmd).read())
-            if not res:
-                return None
-        return res.group(0)
-
     def _get_soname(f):
+        # assuming GNU binutils / ELF
+        if not f:
+            return None
         cmd = "objdump -p -j .dynamic 2>/dev/null " + f
         res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
         if not res:
             return None
         return res.group(1)
 
-    def find_library(name):
-        lib = _findLib_ld(name) or _findLib_gcc(name)
-        if not lib:
-            return None
-        return _get_soname(lib)
+    if (sys.platform.startswith("freebsd")
+        or sys.platform.startswith("openbsd")
+        or sys.platform.startswith("dragonfly")):
+
+        def _num_version(libname):
+            # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ]
+            parts = libname.split(".")
+            nums = []
+            try:
+                while parts:
+                    nums.insert(0, int(parts.pop()))
+            except ValueError:
+                pass
+            return nums or [ sys.maxint ]
+
+        def find_library(name):
+            ename = re.escape(name)
+            expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename)
+            res = re.findall(expr,
+                             os.popen('/sbin/ldconfig -r 2>/dev/null').read())
+            if not res:
+                return _get_soname(_findLib_gcc(name))
+            res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
+            return res[-1]
+
+    else:
+
+        def _findLib_ldconfig(name):
+            # XXX assuming GLIBC's ldconfig (with option -p)
+            expr = r'/[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
+            res = re.search(expr,
+                            os.popen('/sbin/ldconfig -p 2>/dev/null').read())
+            if not res:
+                # Hm, this works only for libs needed by the python executable.
+                cmd = 'ldd %s 2>/dev/null' % sys.executable
+                res = re.search(expr, os.popen(cmd).read())
+                if not res:
+                    return None
+            return res.group(0)
+
+        def find_library(name):
+            return _get_soname(_findLib_ldconfig(name) or _findLib_gcc(name))
 
 ################################################################
 # test code

Modified: python/branches/bcannon-objcap/Lib/ctypes/wintypes.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ctypes/wintypes.py	(original)
+++ python/branches/bcannon-objcap/Lib/ctypes/wintypes.py	Wed Jan 31 23:24:58 2007
@@ -34,8 +34,14 @@
 LPCWSTR = LPWSTR = c_wchar_p
 LPCSTR = LPSTR = c_char_p
 
-WPARAM = c_uint
-LPARAM = c_long
+# WPARAM is defined as UINT_PTR (unsigned type)
+# LPARAM is defined as LONG_PTR (signed type)
+if sizeof(c_long) == sizeof(c_void_p):
+    WPARAM = c_ulong
+    LPARAM = c_long
+elif sizeof(c_longlong) == sizeof(c_void_p):
+    WPARAM = c_ulonglong
+    LPARAM = c_longlong
 
 ATOM = WORD
 LANGID = WORD
@@ -48,7 +54,7 @@
 
 ################################################################
 # HANDLE types
-HANDLE = c_ulong # in the header files: void *
+HANDLE = c_void_p # in the header files: void *
 
 HACCEL = HANDLE
 HBITMAP = HANDLE

Modified: python/branches/bcannon-objcap/Lib/dumbdbm.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/dumbdbm.py	(original)
+++ python/branches/bcannon-objcap/Lib/dumbdbm.py	Wed Jan 31 23:24:58 2007
@@ -246,5 +246,5 @@
     else:
         # Turn off any bits that are set in the umask
         mode = mode & (~um)
-        
+
     return _Database(file, mode)

Modified: python/branches/bcannon-objcap/Lib/dummy_thread.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/dummy_thread.py	(original)
+++ python/branches/bcannon-objcap/Lib/dummy_thread.py	Wed Jan 31 23:24:58 2007
@@ -11,11 +11,8 @@
         import dummy_thread as thread
 
 """
-__author__ = "Brett Cannon"
-__email__ = "brett at python.org"
-
-# Exports only things specified by thread documentation
-# (skipping obsolete synonyms allocate(), start_new(), exit_thread())
+# Exports only things specified by thread documentation;
+# skipping obsolete synonyms allocate(), start_new(), exit_thread().
 __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock',
            'interrupt_main', 'LockType']
 

Modified: python/branches/bcannon-objcap/Lib/dummy_threading.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/dummy_threading.py	(original)
+++ python/branches/bcannon-objcap/Lib/dummy_threading.py	Wed Jan 31 23:24:58 2007
@@ -5,11 +5,6 @@
 directly imported it would have made all subsequent imports succeed
 regardless of whether ``thread`` was available which is not desired.
 
-:Author: Brett Cannon
-:Contact: brett at python.org
-
-XXX: Try to get rid of ``_dummy_threading``.
-
 """
 from sys import modules as sys_modules
 

Modified: python/branches/bcannon-objcap/Lib/email/charset.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/email/charset.py	(original)
+++ python/branches/bcannon-objcap/Lib/email/charset.py	Wed Jan 31 23:24:58 2007
@@ -46,6 +46,7 @@
     'iso-8859-13': (QP,        QP,      None),
     'iso-8859-14': (QP,        QP,      None),
     'iso-8859-15': (QP,        QP,      None),
+    'iso-8859-16': (QP,        QP,      None),
     'windows-1252':(QP,        QP,      None),
     'viscii':      (QP,        QP,      None),
     'us-ascii':    (None,      None,    None),
@@ -81,6 +82,8 @@
     'latin-8': 'iso-8859-14',
     'latin_9': 'iso-8859-15',
     'latin-9': 'iso-8859-15',
+    'latin_10':'iso-8859-16',
+    'latin-10':'iso-8859-16',
     'cp949':   'ks_c_5601-1987',
     'euc_jp':  'euc-jp',
     'euc_kr':  'euc-kr',

Modified: python/branches/bcannon-objcap/Lib/encodings/aliases.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/encodings/aliases.py	(original)
+++ python/branches/bcannon-objcap/Lib/encodings/aliases.py	Wed Jan 31 23:24:58 2007
@@ -301,6 +301,8 @@
 
     # iso8859_13 codec
     'iso_8859_13'        : 'iso8859_13',
+    'l7'                 : 'iso8859_13',
+    'latin7'             : 'iso8859_13',
 
     # iso8859_14 codec
     'iso_8859_14'        : 'iso8859_14',
@@ -312,6 +314,8 @@
 
     # iso8859_15 codec
     'iso_8859_15'        : 'iso8859_15',
+    'l9'                 : 'iso8859_15',
+    'latin9'             : 'iso8859_15',
 
     # iso8859_16 codec
     'iso_8859_16'        : 'iso8859_16',

Modified: python/branches/bcannon-objcap/Lib/ftplib.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ftplib.py	(original)
+++ python/branches/bcannon-objcap/Lib/ftplib.py	Wed Jan 31 23:24:58 2007
@@ -332,7 +332,7 @@
             # 1xx or error messages for LIST), so we just discard
             # this response.
             if resp[0] == '2':
-               resp = self.getresp()
+                resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
         else:
@@ -342,7 +342,7 @@
             resp = self.sendcmd(cmd)
             # See above.
             if resp[0] == '2':
-               resp = self.getresp()
+                resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
             conn, sockaddr = sock.accept()

Modified: python/branches/bcannon-objcap/Lib/httplib.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/httplib.py	(original)
+++ python/branches/bcannon-objcap/Lib/httplib.py	Wed Jan 31 23:24:58 2007
@@ -899,7 +899,7 @@
                 except (AttributeError, OSError):
                     # Don't send a length if this failed
                     if self.debuglevel > 0: print "Cannot stat!!"
-                    
+
             if thelen is not None:
                 self.putheader('Content-Length',thelen)
         for hdr, value in headers.iteritems():

Modified: python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py	(original)
+++ python/branches/bcannon-objcap/Lib/idlelib/CodeContext.py	Wed Jan 31 23:24:58 2007
@@ -71,7 +71,7 @@
             #
             # To avoid possible errors, all references to the inner workings
             # of Tk are executed inside try/except blocks.
-            
+
             widgets_for_width_calc = self.editwin.text, self.editwin.text_frame
 
             # calculate the required vertical padding
@@ -113,7 +113,7 @@
             # above it.
             self.label.pack(side="top", fill="x", expand=False,
                             before=self.editwin.text_frame)
-            
+
         else:
             self.label.destroy()
             self.label = None

Modified: python/branches/bcannon-objcap/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/idlelib/EditorWindow.py	(original)
+++ python/branches/bcannon-objcap/Lib/idlelib/EditorWindow.py	Wed Jan 31 23:24:58 2007
@@ -819,7 +819,7 @@
 
     def close(self):
         reply = self.maybesave()
-        if reply != "cancel":
+        if str(reply) != "cancel":
             self._close()
         return reply
 

Modified: python/branches/bcannon-objcap/Lib/lib-tk/tkSimpleDialog.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/lib-tk/tkSimpleDialog.py	(original)
+++ python/branches/bcannon-objcap/Lib/lib-tk/tkSimpleDialog.py	Wed Jan 31 23:24:58 2007
@@ -50,9 +50,9 @@
         # If the master is not viewable, don't
         # make the child transient, or else it
         # would be opened withdrawn
-        if parent.winfo_viewable():  
+        if parent.winfo_viewable():
             self.transient(parent)
- 
+
         if title:
             self.title(title)
 

Modified: python/branches/bcannon-objcap/Lib/logging/handlers.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/logging/handlers.py	(original)
+++ python/branches/bcannon-objcap/Lib/logging/handlers.py	Wed Jan 31 23:24:58 2007
@@ -1,4 +1,4 @@
-# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted,
@@ -22,12 +22,13 @@
 Should work under Python versions >= 1.5.2, except that source line
 information is not available unless 'sys._getframe()' is.
 
-Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
 
 To use, simply 'import logging' and log away!
 """
 
 import sys, logging, socket, types, os, string, cPickle, struct, time, glob
+from stat import ST_DEV, ST_INO
 
 try:
     import codecs
@@ -130,10 +131,8 @@
                 os.remove(dfn)
             os.rename(self.baseFilename, dfn)
             #print "%s -> %s" % (self.baseFilename, dfn)
-        if self.encoding:
-            self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
-        else:
-            self.stream = open(self.baseFilename, 'w')
+        self.mode = 'w'
+        self.stream = self._open()
 
     def shouldRollover(self, record):
         """
@@ -276,12 +275,58 @@
                 s.sort()
                 os.remove(s[0])
         #print "%s -> %s" % (self.baseFilename, dfn)
-        if self.encoding:
-            self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
-        else:
-            self.stream = open(self.baseFilename, 'w')
+        self.mode = 'w'
+        self.stream = self._open()
         self.rolloverAt = self.rolloverAt + self.interval
 
+class WatchedFileHandler(logging.FileHandler):
+    """
+    A handler for logging to a file, which watches the file
+    to see if it has changed while in use. This can happen because of
+    usage of programs such as newsyslog and logrotate which perform
+    log file rotation. This handler, intended for use under Unix,
+    watches the file to see if it has changed since the last emit.
+    (A file has changed if its device or inode have changed.)
+    If it has changed, the old file stream is closed, and the file
+    opened to get a new stream.
+
+    This handler is not appropriate for use under Windows, because
+    under Windows open files cannot be moved or renamed - logging
+    opens the files with exclusive locks - and so there is no need
+    for such a handler. Furthermore, ST_INO is not supported under
+    Windows; stat always returns zero for this value.
+
+    This handler is based on a suggestion and patch by Chad J.
+    Schroeder.
+    """
+    def __init__(self, filename, mode='a', encoding=None):
+        logging.FileHandler.__init__(self, filename, mode, encoding)
+        stat = os.stat(self.baseFilename)
+        self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
+
+    def emit(self, record):
+        """
+        Emit a record.
+
+        First check if the underlying file has changed, and if it
+        has, close the old stream and reopen the file to get the
+        current stream.
+        """
+        if not os.path.exists(self.baseFilename):
+            stat = None
+            changed = 1
+        else:
+            stat = os.stat(self.baseFilename)
+            changed = (stat[ST_DEV] != self.dev) or (stat[ST_INO] != self.ino)
+        if changed:
+            self.stream.flush()
+            self.stream.close()
+            self.stream = self._open()
+            if stat is None:
+                stat = os.stat(self.baseFilename)
+            self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
+        logging.FileHandler.emit(self, record)
+
 class SocketHandler(logging.Handler):
     """
     A handler class which writes logging records, in pickle format, to
@@ -733,7 +778,7 @@
         try:
             import smtplib
             try:
-                from email.Utils import formatdate
+                from email.utils import formatdate
             except ImportError:
                 formatdate = self.date_time
             port = self.mailport

Modified: python/branches/bcannon-objcap/Lib/mailbox.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/mailbox.py	(original)
+++ python/branches/bcannon-objcap/Lib/mailbox.py	Wed Jan 31 23:24:58 2007
@@ -16,8 +16,8 @@
 import errno
 import copy
 import email
-import email.Message
-import email.Generator
+import email.message
+import email.generator
 import rfc822
 import StringIO
 try:
@@ -196,9 +196,9 @@
         # To get native line endings on disk, the user-friendly \n line endings
         # used in strings and by email.Message are translated here.
         """Dump message contents to target file."""
-        if isinstance(message, email.Message.Message):
+        if isinstance(message, email.message.Message):
             buffer = StringIO.StringIO()
-            gen = email.Generator.Generator(buffer, mangle_from_, 0)
+            gen = email.generator.Generator(buffer, mangle_from_, 0)
             gen.flatten(message)
             buffer.seek(0)
             target.write(buffer.read().replace('\n', os.linesep))
@@ -572,7 +572,7 @@
         # already have been generated (and presumably has been modified
         # by adding or deleting an item).
         assert self._toc is not None
-        
+
         # Check length of self._file; if it's changed, some other process
         # has modified the mailbox since we scanned it.
         self._file.seek(0, 2)
@@ -581,7 +581,7 @@
             raise ExternalClashError('Size of mailbox file changed '
                                      '(expected %i, found %i)' %
                                      (self._file_length, cur_len))
-        
+
         new_file = _create_temporary(self._path)
         try:
             new_toc = {}
@@ -707,7 +707,7 @@
                 message = ''
         elif isinstance(message, _mboxMMDFMessage):
             from_line = 'From ' + message.get_from()
-        elif isinstance(message, email.Message.Message):
+        elif isinstance(message, email.message.Message):
             from_line = message.get_unixfrom()  # May be None.
         if from_line is None:
             from_line = 'From MAILER-DAEMON %s' % time.asctime(time.gmtime())
@@ -1222,7 +1222,7 @@
         self._next_key = len(self._toc)
         self._file.seek(0, 2)
         self._file_length = self._file.tell()
-        
+
     def _pre_mailbox_hook(self, f):
         """Called before writing the mailbox to file f."""
         f.write('BABYL OPTIONS:%sVersion: 5%sLabels:%s%s\037' %
@@ -1257,9 +1257,9 @@
             self._file.write(os.linesep)
         else:
             self._file.write('1,,' + os.linesep)
-        if isinstance(message, email.Message.Message):
+        if isinstance(message, email.message.Message):
             orig_buffer = StringIO.StringIO()
-            orig_generator = email.Generator.Generator(orig_buffer, False, 0)
+            orig_generator = email.generator.Generator(orig_buffer, False, 0)
             orig_generator.flatten(message)
             orig_buffer.seek(0)
             while True:
@@ -1270,7 +1270,7 @@
             self._file.write('*** EOOH ***' + os.linesep)
             if isinstance(message, BabylMessage):
                 vis_buffer = StringIO.StringIO()
-                vis_generator = email.Generator.Generator(vis_buffer, False, 0)
+                vis_generator = email.generator.Generator(vis_buffer, False, 0)
                 vis_generator.flatten(message.get_visible())
                 while True:
                     line = vis_buffer.readline()
@@ -1326,12 +1326,12 @@
         return (start, stop)
 
 
-class Message(email.Message.Message):
+class Message(email.message.Message):
     """Message with mailbox-format-specific properties."""
 
     def __init__(self, message=None):
         """Initialize a Message instance."""
-        if isinstance(message, email.Message.Message):
+        if isinstance(message, email.message.Message):
             self._become_message(copy.deepcopy(message))
             if isinstance(message, Message):
                 message._explain_to(self)
@@ -1340,7 +1340,7 @@
         elif hasattr(message, "read"):
             self._become_message(email.message_from_file(message))
         elif message is None:
-            email.Message.Message.__init__(self)
+            email.message.Message.__init__(self)
         else:
             raise TypeError('Invalid message type: %s' % type(message))
 
@@ -1471,7 +1471,7 @@
     def __init__(self, message=None):
         """Initialize an mboxMMDFMessage instance."""
         self.set_from('MAILER-DAEMON', True)
-        if isinstance(message, email.Message.Message):
+        if isinstance(message, email.message.Message):
             unixfrom = message.get_unixfrom()
             if unixfrom is not None and unixfrom.startswith('From '):
                 self.set_from(unixfrom[5:])
@@ -1993,10 +1993,12 @@
     # that the two characters preceding "From " are \n\n or the beginning of
     # the file.  Fixing this would require a more extensive rewrite than is
     # necessary.  For convenience, we've added a PortableUnixMailbox class
-    # which uses the more lenient _fromlinepattern regular expression.
+    # which does no checking of the format of the 'From' line.
 
-    _fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \
-                       r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$"
+    _fromlinepattern = (r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
+                        r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
+                        r"[^\s]*\s*"
+                        "$")
     _regexp = None
 
     def _strict_isrealfromline(self, line):

Modified: python/branches/bcannon-objcap/Lib/ntpath.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/ntpath.py	(original)
+++ python/branches/bcannon-objcap/Lib/ntpath.py	Wed Jan 31 23:24:58 2007
@@ -344,8 +344,10 @@
                     var = path[:index]
                     if var in os.environ:
                         res = res + os.environ[var]
+                    else:
+                        res = res + '${' + var + '}'
                 except ValueError:
-                    res = res + path
+                    res = res + '${' + path
                     index = pathlen - 1
             else:
                 var = ''
@@ -357,8 +359,10 @@
                     c = path[index:index + 1]
                 if var in os.environ:
                     res = res + os.environ[var]
+                else:
+                    res = res + '$' + var
                 if c != '':
-                    res = res + c
+                    index = index - 1
         else:
             res = res + c
         index = index + 1

Modified: python/branches/bcannon-objcap/Lib/pdb.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/pdb.py	(original)
+++ python/branches/bcannon-objcap/Lib/pdb.py	Wed Jan 31 23:24:58 2007
@@ -474,7 +474,12 @@
     def do_condition(self, arg):
         # arg is breakpoint number and condition
         args = arg.split(' ', 1)
-        bpnum = int(args[0].strip())
+        try:
+            bpnum = int(args[0].strip())
+        except ValueError:
+            # something went wrong
+            print >>self.stdout, \
+                'Breakpoint index %r is not a number' % args[0]
         try:
             cond = args[1]
         except:
@@ -489,7 +494,12 @@
     def do_ignore(self,arg):
         """arg is bp number followed by ignore count."""
         args = arg.split()
-        bpnum = int(args[0].strip())
+        try:
+            bpnum = int(args[0].strip())
+        except ValueError:
+            # something went wrong
+            print >>self.stdout, \
+                'Breakpoint index %r is not a number' % args[0]
         try:
             count = int(args[1].strip())
         except:

Modified: python/branches/bcannon-objcap/Lib/platform.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/platform.py	(original)
+++ python/branches/bcannon-objcap/Lib/platform.py	Wed Jan 31 23:24:58 2007
@@ -28,12 +28,15 @@
 #      Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg
 #      Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark
 #      Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support),
-#      Colin Kong, Trent Mick, Guido van Rossum
+#      Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter
 #
 #    History:
 #
 #    <see CVS and SVN checkin messages for history>
 #
+#    1.0.6 - added linux_distribution()
+#    1.0.5 - fixed Java support to allow running the module on Jython
+#    1.0.4 - added IronPython support
 #    1.0.3 - added normalization of Windows system name
 #    1.0.2 - added more Windows support
 #    1.0.1 - reformatted to make doc.py happy
@@ -88,7 +91,7 @@
 
 __copyright__ = """
     Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal at lemburg.com
-    Copyright (c) 2000-2003, eGenix.com Software GmbH; mailto:info at egenix.com
+    Copyright (c) 2000-2007, eGenix.com Software GmbH; mailto:info at egenix.com
 
     Permission to use, copy, modify, and distribute this software and its
     documentation for any purpose and without fee or royalty is hereby granted,
@@ -107,7 +110,7 @@
 
 """
 
-__version__ = '1.0.4'
+__version__ = '1.0.6'
 
 import sys,string,os,re
 
@@ -136,6 +139,11 @@
         The file is read and scanned in chunks of chunksize bytes.
 
     """
+    if hasattr(os.path, 'realpath'):
+        # Python 2.2 introduced os.path.realpath(); it is used
+        # here to work around problems with Cygwin not being
+        # able to open symlinks for reading
+        executable = os.path.realpath(executable)
     f = open(executable,'rb')
     binary = f.read(chunksize)
     pos = 0
@@ -218,14 +226,69 @@
     return distname,version,id
 
 _release_filename = re.compile(r'(\w+)[-_](release|version)')
-_release_version = re.compile(r'([\d.]+)[^(]*(?:\((.+)\))?')
+_lsb_release_version = re.compile(r'(.+)'
+                                   ' release '
+                                   '([\d.]+)'
+                                   '[^(]*(?:\((.+)\))?')
+_release_version = re.compile(r'([^0-9]+)'
+                               '(?: release )?'
+                               '([\d.]+)'
+                               '[^(]*(?:\((.+)\))?')
+
+# See also http://www.novell.com/coolsolutions/feature/11251.html
+# and http://linuxmafia.com/faq/Admin/release-files.html
+# and http://data.linux-ntfs.org/rpm/whichrpm
+# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html
+
+_supported_dists = ('SuSE', 'debian', 'fedora', 'redhat', 'centos',
+                    'mandrake', 'rocks', 'slackware', 'yellowdog',
+                    'gentoo', 'UnitedLinux')
+
+def _parse_release_file(firstline):
+
+    # Parse the first line
+    m = _lsb_release_version.match(firstline)
+    if m is not None:
+        # LSB format: "distro release x.x (codename)"
+        return tuple(m.groups())
+
+    # Pre-LSB format: "distro x.x (codename)"
+    m = _release_version.match(firstline)
+    if m is not None:
+        return tuple(m.groups())
+
+    # Unkown format... take the first two words
+    l = string.split(string.strip(firstline))
+    if l:
+        version = l[0]
+        if len(l) > 1:
+            id = l[1]
+        else:
+            id = ''
+    return '', version, id
 
-# Note:In supported_dists below we need 'fedora' before 'redhat' as in
-# Fedora redhat-release is a link to fedora-release.
+def _test_parse_release_file():
 
-def dist(distname='',version='',id='',
+    for input, output in (
+        # Examples of release file contents:
+        ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64'))
+        ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64'))
+        ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586'))
+        ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux'))
+        ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche'))
+        ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike'))
+        ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant'))
+        ('CentOS release 4', ('CentOS', '4', None))
+        ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia'))
+        ):
+        parsed = _parse_release_file(input)
+        if parsed != output:
+            print (input, parsed)
 
-         supported_dists=('SuSE', 'debian', 'fedora', 'redhat', 'mandrake')):
+def linux_distribution(distname='', version='', id='',
+
+                       supported_dists=_supported_dists,
+                       full_distribution_name=1):
 
     """ Tries to determine the name of the Linux OS distribution name.
 
@@ -233,6 +296,15 @@
         /etc and then reverts to _dist_try_harder() in case no
         suitable files are found.
 
+        supported_dists may be given to define the set of Linux
+        distributions to look for. It defaults to a list of currently
+        supported Linux distributions identified by their release file
+        name.
+
+        If full_distribution_name is true (default), the full
+        distribution read from the OS is returned. Otherwise the short
+        name taken from supported_dists is used.
+
         Returns a tuple (distname,version,id) which default to the
         args given as parameters.
 
@@ -242,33 +314,50 @@
     except os.error:
         # Probably not a Unix system
         return distname,version,id
+    etc.sort()
     for file in etc:
         m = _release_filename.match(file)
-        if m:
+        if m is not None:
             _distname,dummy = m.groups()
             if _distname in supported_dists:
                 distname = _distname
                 break
     else:
         return _dist_try_harder(distname,version,id)
-    f = open('/etc/'+file,'r')
+
+    # Read the first line
+    f = open('/etc/'+file, 'r')
     firstline = f.readline()
     f.close()
-    m = _release_version.search(firstline)
-    if m:
-        _version,_id = m.groups()
-        if _version:
-            version = _version
-        if _id:
-            id = _id
-    else:
-        # Unkown format... take the first two words
-        l = string.split(string.strip(firstline))
-        if l:
-            version = l[0]
-            if len(l) > 1:
-                id = l[1]
-    return distname,version,id
+    _distname, _version, _id = _parse_release_file(firstline)
+
+    if _distname and full_distribution_name:
+        distname = _distname
+    if _version:
+        version = _version
+    if _id:
+        id = _id
+    return distname, version, id
+
+# To maintain backwards compatibility:
+
+def dist(distname='',version='',id='',
+
+         supported_dists=_supported_dists):
+
+    """ Tries to determine the name of the Linux OS distribution name.
+
+        The function first looks for a distribution release file in
+        /etc and then reverts to _dist_try_harder() in case no
+        suitable files are found.
+
+        Returns a tuple (distname,version,id) which default to the
+        args given as parameters.
+
+    """
+    return linux_distribution(distname, version, id,
+                              supported_dists=supported_dists,
+                              full_distribution_name=0)
 
 class _popen:
 
@@ -357,7 +446,7 @@
     else:
         return popen(cmd,mode,bufsize)
 
-def _norm_version(version,build=''):
+def _norm_version(version, build=''):
 
     """ Normalize the version and build strings and return a single
         version string using the format major.minor.build (or patchlevel).
@@ -378,7 +467,7 @@
                          '.*'
                          'Version ([\d.]+))')
 
-def _syscmd_ver(system='',release='',version='',
+def _syscmd_ver(system='', release='', version='',
 
                supported_platforms=('win32','win16','dos','os2')):
 
@@ -418,7 +507,7 @@
     # Parse the output
     info = string.strip(info)
     m = _ver_output.match(info)
-    if m:
+    if m is not None:
         system,release,version = m.groups()
         # Strip trailing dots from version and release
         if release[-1] == '.':
@@ -615,8 +704,11 @@
 
     from java.lang import System
     try:
-        return System.getProperty(name)
-    except:
+        value = System.getProperty(name)
+        if value is None:
+            return default
+        return value
+    except AttributeError:
         return default
 
 def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
@@ -637,20 +729,20 @@
     except ImportError:
         return release,vendor,vminfo,osinfo
 
-    vendor = _java_getprop('java.vendor',vendor)
-    release = _java_getprop('java.version',release)
-    vm_name,vm_release,vm_vendor = vminfo
-    vm_name = _java_getprop('java.vm.name',vm_name)
-    vm_vendor = _java_getprop('java.vm.vendor',vm_vendor)
-    vm_release = _java_getprop('java.vm.version',vm_release)
-    vminfo = vm_name,vm_release,vm_vendor
-    os_name,os_version,os_arch = osinfo
-    os_arch = _java_getprop('java.os.arch',os_arch)
-    os_name = _java_getprop('java.os.name',os_name)
-    os_version = _java_getprop('java.os.version',os_version)
-    osinfo = os_name,os_version,os_arch
+    vendor = _java_getprop('java.vendor', vendor)
+    release = _java_getprop('java.version', release)
+    vm_name, vm_release, vm_vendor = vminfo
+    vm_name = _java_getprop('java.vm.name', vm_name)
+    vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)
+    vm_release = _java_getprop('java.vm.version', vm_release)
+    vminfo = vm_name, vm_release, vm_vendor
+    os_name, os_version, os_arch = osinfo
+    os_arch = _java_getprop('java.os.arch', os_arch)
+    os_name = _java_getprop('java.os.name', os_name)
+    os_version = _java_getprop('java.os.version', os_version)
+    osinfo = os_name, os_version, os_arch
 
-    return release,vendor,vminfo,osinfo
+    return release, vendor, vminfo, osinfo
 
 ### System name aliasing
 
@@ -716,7 +808,7 @@
     # Format the platform string
     platform = string.join(
         map(string.strip,
-            filter(len,args)),
+            filter(len, args)),
         '-')
 
     # Cleanup some possible filename obstacles...
@@ -871,7 +963,10 @@
         bits = str(size*8) + 'bit'
 
     # Get data from the 'file' system command
-    output = _syscmd_file(executable,'')
+    if executable:
+        output = _syscmd_file(executable, '')
+    else:
+        output = ''
 
     if not output and \
        executable == sys.executable:
@@ -960,6 +1055,10 @@
             release,version,csd,ptype = win32_ver()
             if release and version:
                 use_syscmd_ver = 0
+            # XXX Should try to parse the PROCESSOR_* environment variables
+            # available on Win XP and later; see
+            # http://support.microsoft.com/kb/888731 and
+            # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
 
         # Try the 'ver' system command available on some
         # platforms
@@ -1092,36 +1191,136 @@
 
 ### Various APIs for extracting information from sys.version
 
-_sys_version_parser = re.compile(r'([\w.+]+)\s*'
-                                  '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
-                                  '\[([^\]]+)\]?')
-_sys_version_cache = None
+_sys_version_parser = re.compile(
+    r'([\w.+]+)\s*'
+    '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
+    '\[([^\]]+)\]?')
+
+_jython_sys_version_parser = re.compile(
+    r'([\d\.]+)')
+
+_ironpython_sys_version_parser = re.compile(
+    r'IronPython\s*'
+    '([\d\.]+)'
+    '(?: \(([\d\.]+)\))?'
+    ' on (.NET [\d\.]+)')
+
+_sys_version_cache = {}
 
-def _sys_version():
+def _sys_version(sys_version=None):
 
     """ Returns a parsed version of Python's sys.version as tuple
-        (version, buildno, builddate, compiler) referring to the Python
-        version, build number, build date/time as string and the compiler
-        identification string.
+       (name, version, branch, revision, buildno, builddate, compiler)
+       referring to the Python implementation name, version, branch,
+       revision, build number, build date/time as string and the compiler
+       identification string.
 
         Note that unlike the Python sys.version, the returned value
         for the Python version will always include the patchlevel (it
         defaults to '.0').
 
+        The function returns empty strings for tuple entries that
+        cannot be determined.
+
+        sys_version may be given to parse an alternative version
+        string, e.g. if the version was read from a different Python
+        interpreter.
+
     """
-    global _sys_version_cache
+    # Get the Python version
+    if sys_version is None:
+        sys_version = sys.version
+
+    # Try the cache first
+    result = _sys_version_cache.get(sys_version, None)
+    if result is not None:
+        return result
+
+    # Parse it
+    if sys_version[:10] == 'IronPython':
+        # IronPython
+        name = 'IronPython'
+        match = _ironpython_sys_version_parser.match(sys_version)
+        if match is None:
+            raise ValueError(
+                'failed to parse IronPython sys.version: %s' %
+                repr(sys_version))
+        version, alt_version, compiler = match.groups()
+        branch = ''
+        revision = ''
+        buildno = ''
+        builddate = ''
+
+    elif sys.platform[:4] == 'java':
+        # Jython
+        name = 'Jython'
+        match = _jython_sys_version_parser.match(sys_version)
+        if match is None:
+            raise ValueError(
+                'failed to parse Jython sys.version: %s' %
+                repr(sys_version))
+        version, = match.groups()
+        branch = ''
+        revision = ''
+        compiler = sys.platform
+        buildno = ''
+        builddate = ''
+
+    else:
+        # CPython
+        match = _sys_version_parser.match(sys_version)
+        if match is None:
+            raise ValueError(
+                'failed to parse CPython sys.version: %s' %
+                repr(sys_version))
+        version, buildno, builddate, buildtime, compiler = \
+              match.groups()
+        if hasattr(sys, 'subversion'):
+            # sys.subversion was added in Python 2.5
+            name, branch, revision = sys.subversion
+        else:
+            name = 'CPython'
+            branch = ''
+            revision = ''
+        builddate = builddate + ' ' + buildtime
 
-    if _sys_version_cache is not None:
-        return _sys_version_cache
-    version, buildno, builddate, buildtime, compiler = \
-             _sys_version_parser.match(sys.version).groups()
-    builddate = builddate + ' ' + buildtime
+    # Add the patchlevel version if missing
     l = string.split(version, '.')
     if len(l) == 2:
         l.append('0')
         version = string.join(l, '.')
-    _sys_version_cache = (version, buildno, builddate, compiler)
-    return _sys_version_cache
+
+    # Build and cache the result
+    result = (name, version, branch, revision, buildno, builddate, compiler)
+    _sys_version_cache[sys_version] = result
+    return result
+
+def _test_sys_version():
+
+    _sys_version_cache.clear()
+    for input, output in (
+        ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
+         ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
+        ('IronPython 1.0.60816 on .NET 2.0.50727.42',
+         ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
+        ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
+         ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
+        ):
+        parsed = _sys_version(input)
+        if parsed != output:
+            print (input, parsed)
+
+def python_implementation():
+
+    """ Returns a string identifying the Python implementation.
+
+        Currently, the following implementations are identified:
+        'CPython' (C implementation of Python),
+        'IronPython' (.NET implementation of Python),
+        'Jython' (Java implementation of Python).
+
+    """
+    return _sys_version()[0]
 
 def python_version():
 
@@ -1131,7 +1330,9 @@
         will always include the patchlevel (it defaults to 0).
 
     """
-    return _sys_version()[0]
+    if hasattr(sys, 'version_info'):
+        return '%i.%i.%i' % sys.version_info[:3]
+    return _sys_version()[1]
 
 def python_version_tuple():
 
@@ -1142,7 +1343,36 @@
         will always include the patchlevel (it defaults to 0).
 
     """
-    return string.split(_sys_version()[0], '.')
+    if hasattr(sys, 'version_info'):
+        return sys.version_info[:3]
+    return tuple(string.split(_sys_version()[1], '.'))
+
+def python_branch():
+
+    """ Returns a string identifying the Python implementation
+        branch.
+
+        For CPython this is the Subversion branch from which the
+        Python binary was built.
+
+        If not available, an empty string is returned.
+
+    """
+
+    return _sys_version()[2]
+
+def python_revision():
+
+    """ Returns a string identifying the Python implementation
+        revision.
+
+        For CPython this is the Subversion revision from which the
+        Python binary was built.
+
+        If not available, an empty string is returned.
+
+    """
+    return _sys_version()[3]
 
 def python_build():
 
@@ -1150,7 +1380,7 @@
         build number and date as strings.
 
     """
-    return _sys_version()[1:3]
+    return _sys_version()[4:6]
 
 def python_compiler():
 
@@ -1158,7 +1388,7 @@
         Python.
 
     """
-    return _sys_version()[3]
+    return _sys_version()[6]
 
 ### The Opus Magnum of platform strings :-)
 
@@ -1219,7 +1449,7 @@
     elif system == 'Java':
         # Java platforms
         r,v,vminfo,(os_name,os_version,os_arch) = java_ver()
-        if terse:
+        if terse or not os_name:
             platform = _platform(system,release,version)
         else:
             platform = _platform(system,release,version,

Modified: python/branches/bcannon-objcap/Lib/pty.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/pty.py	(original)
+++ python/branches/bcannon-objcap/Lib/pty.py	Wed Jan 31 23:24:58 2007
@@ -123,7 +123,7 @@
         os.close(tmp_fd)
     else:
         os.close(slave_fd)
-        
+
     # Parent and child process.
     return pid, master_fd
 

Modified: python/branches/bcannon-objcap/Lib/pydoc.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/pydoc.py	(original)
+++ python/branches/bcannon-objcap/Lib/pydoc.py	Wed Jan 31 23:24:58 2007
@@ -1448,6 +1448,9 @@
 text = TextDoc()
 html = HTMLDoc()
 
+class _OldStyleClass: pass
+_OLD_INSTANCE_TYPE = type(_OldStyleClass())
+
 def resolve(thing, forceload=0):
     """Given an object or a path to an object, get the object and its name."""
     if isinstance(thing, str):
@@ -1468,12 +1471,16 @@
             desc += ' in ' + name[:name.rfind('.')]
         elif module and module is not object:
             desc += ' in module ' + module.__name__
-        if not (inspect.ismodule(object) or
-                inspect.isclass(object) or
-                inspect.isroutine(object) or
-                inspect.isgetsetdescriptor(object) or
-                inspect.ismemberdescriptor(object) or
-                isinstance(object, property)):
+        if type(object) is _OLD_INSTANCE_TYPE:
+            # If the passed object is an instance of an old-style class,
+            # document its available methods instead of its value.
+            object = object.__class__
+        elif not (inspect.ismodule(object) or
+                  inspect.isclass(object) or
+                  inspect.isroutine(object) or
+                  inspect.isgetsetdescriptor(object) or
+                  inspect.ismemberdescriptor(object) or
+                  isinstance(object, property)):
             # If the passed object is a piece of data or an instance,
             # document its available methods instead of its value.
             object = type(object)

Modified: python/branches/bcannon-objcap/Lib/random.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/random.py	(original)
+++ python/branches/bcannon-objcap/Lib/random.py	Wed Jan 31 23:24:58 2007
@@ -569,7 +569,7 @@
     def betavariate(self, alpha, beta):
         """Beta distribution.
 
-        Conditions on the parameters are alpha > -1 and beta} > -1.
+        Conditions on the parameters are alpha > 0 and beta > 0.
         Returned values range between 0 and 1.
 
         """

Modified: python/branches/bcannon-objcap/Lib/rfc822.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/rfc822.py	(original)
+++ python/branches/bcannon-objcap/Lib/rfc822.py	Wed Jan 31 23:24:58 2007
@@ -854,6 +854,11 @@
     if data[0][-1] in (',', '.') or data[0].lower() in _daynames:
         # There's a dayname here. Skip it
         del data[0]
+    else:
+        # no space after the "weekday,"?
+        i = data[0].rfind(',')
+        if i >= 0:
+            data[0] = data[0][i+1:]
     if len(data) == 3: # RFC 850 date, deprecated
         stuff = data[0].split('-')
         if len(stuff) == 3:

Modified: python/branches/bcannon-objcap/Lib/sets.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/sets.py	(original)
+++ python/branches/bcannon-objcap/Lib/sets.py	Wed Jan 31 23:24:58 2007
@@ -80,6 +80,10 @@
 
 __all__ = ['BaseSet', 'Set', 'ImmutableSet']
 
+import warnings
+warnings.warn("the sets module is deprecated", DeprecationWarning,
+                stacklevel=2)
+
 class BaseSet(object):
     """Common base class for mutable and immutable sets."""
 

Modified: python/branches/bcannon-objcap/Lib/smtplib.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/smtplib.py	(original)
+++ python/branches/bcannon-objcap/Lib/smtplib.py	Wed Jan 31 23:24:58 2007
@@ -43,10 +43,10 @@
 
 import socket
 import re
-import email.Utils
+import email.utils
 import base64
 import hmac
-from email.base64MIME import encode as encode_base64
+from email.base64mime import encode as encode_base64
 from sys import stderr
 
 __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException",
@@ -172,7 +172,7 @@
     """
     m = (None, None)
     try:
-        m = email.Utils.parseaddr(addr)[1]
+        m = email.utils.parseaddr(addr)[1]
     except AttributeError:
         pass
     if m == (None, None): # Indicates parse failure or AttributeError

Modified: python/branches/bcannon-objcap/Lib/socket.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/socket.py	(original)
+++ python/branches/bcannon-objcap/Lib/socket.py	Wed Jan 31 23:24:58 2007
@@ -204,9 +204,10 @@
 
     __slots__ = ["mode", "bufsize", "softspace",
                  # "closed" is a property, see below
-                 "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf"]
+                 "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf",
+                 "_close"]
 
-    def __init__(self, sock, mode='rb', bufsize=-1):
+    def __init__(self, sock, mode='rb', bufsize=-1, close=False):
         self._sock = sock
         self.mode = mode # Not actually used in this version
         if bufsize < 0:
@@ -222,6 +223,7 @@
         self._wbufsize = bufsize
         self._rbuf = "" # A string
         self._wbuf = [] # A list of strings
+        self._close = close
 
     def _getclosed(self):
         return self._sock is None
@@ -232,6 +234,8 @@
             if self._sock:
                 self.flush()
         finally:
+            if self._close:
+                self._sock.close()
             self._sock = None
 
     def __del__(self):

Modified: python/branches/bcannon-objcap/Lib/sqlite3/dbapi2.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/sqlite3/dbapi2.py	(original)
+++ python/branches/bcannon-objcap/Lib/sqlite3/dbapi2.py	Wed Jan 31 23:24:58 2007
@@ -68,7 +68,7 @@
         timepart_full = timepart.split(".")
         hours, minutes, seconds = map(int, timepart_full[0].split(":"))
         if len(timepart_full) == 2:
-            microseconds = int(float("0." + timepart_full[1]) * 1000000)
+            microseconds = int(timepart_full[1])
         else:
             microseconds = 0
 

Modified: python/branches/bcannon-objcap/Lib/sqlite3/test/factory.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/sqlite3/test/factory.py	(original)
+++ python/branches/bcannon-objcap/Lib/sqlite3/test/factory.py	Wed Jan 31 23:24:58 2007
@@ -91,7 +91,7 @@
                                    list),
                         "row is not instance of list")
 
-    def CheckSqliteRow(self):
+    def CheckSqliteRowIndex(self):
         self.con.row_factory = sqlite.Row
         row = self.con.execute("select 1 as a, 2 as b").fetchone()
         self.failUnless(isinstance(row,
@@ -110,6 +110,27 @@
         self.failUnless(col1 == 1, "by index: wrong result for column 0")
         self.failUnless(col2 == 2, "by index: wrong result for column 1")
 
+    def CheckSqliteRowIter(self):
+        """Checks if the row object is iterable"""
+        self.con.row_factory = sqlite.Row
+        row = self.con.execute("select 1 as a, 2 as b").fetchone()
+        for col in row:
+            pass
+
+    def CheckSqliteRowAsTuple(self):
+        """Checks if the row object can be converted to a tuple"""
+        self.con.row_factory = sqlite.Row
+        row = self.con.execute("select 1 as a, 2 as b").fetchone()
+        t = tuple(row)
+
+    def CheckSqliteRowAsDict(self):
+        """Checks if the row object can be correctly converted to a dictionary"""
+        self.con.row_factory = sqlite.Row
+        row = self.con.execute("select 1 as a, 2 as b").fetchone()
+        d = dict(row)
+        self.failUnlessEqual(d["a"], row["a"])
+        self.failUnlessEqual(d["b"], row["b"])
+
     def tearDown(self):
         self.con.close()
 

Modified: python/branches/bcannon-objcap/Lib/sqlite3/test/regression.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/sqlite3/test/regression.py	(original)
+++ python/branches/bcannon-objcap/Lib/sqlite3/test/regression.py	Wed Jan 31 23:24:58 2007
@@ -69,6 +69,16 @@
         cur.execute('select 1 as "foo baz"')
         self.failUnlessEqual(cur.description[0][0], "foo baz")
 
+    def CheckStatementAvailable(self):
+        # pysqlite up to 2.3.2 crashed on this, because the active statement handle was not checked
+        # before trying to fetch data from it. close() destroys the active statement ...
+        con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES)
+        cur = con.cursor()
+        cur.execute("select 4 union select 5")
+        cur.close()
+        cur.fetchone()
+        cur.fetchone()
+
 def suite():
     regression_suite = unittest.makeSuite(RegressionTests, "Check")
     return unittest.TestSuite((regression_suite,))

Modified: python/branches/bcannon-objcap/Lib/sqlite3/test/types.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/sqlite3/test/types.py	(original)
+++ python/branches/bcannon-objcap/Lib/sqlite3/test/types.py	Wed Jan 31 23:24:58 2007
@@ -106,6 +106,7 @@
         # and implement two custom ones
         sqlite.converters["BOOL"] = lambda x: bool(int(x))
         sqlite.converters["FOO"] = DeclTypesTests.Foo
+        sqlite.converters["WRONG"] = lambda x: "WRONG"
 
     def tearDown(self):
         del sqlite.converters["FLOAT"]
@@ -117,7 +118,7 @@
     def CheckString(self):
         # default
         self.cur.execute("insert into test(s) values (?)", ("foo",))
-        self.cur.execute("select s from test")
+        self.cur.execute('select s as "s [WRONG]" from test')
         row = self.cur.fetchone()
         self.failUnlessEqual(row[0], "foo")
 
@@ -204,26 +205,32 @@
 
 class ColNamesTests(unittest.TestCase):
     def setUp(self):
-        self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES|sqlite.PARSE_DECLTYPES)
+        self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
         self.cur = self.con.cursor()
         self.cur.execute("create table test(x foo)")
 
         sqlite.converters["FOO"] = lambda x: "[%s]" % x
         sqlite.converters["BAR"] = lambda x: "<%s>" % x
         sqlite.converters["EXC"] = lambda x: 5/0
+        sqlite.converters["B1B1"] = lambda x: "MARKER"
 
     def tearDown(self):
         del sqlite.converters["FOO"]
         del sqlite.converters["BAR"]
         del sqlite.converters["EXC"]
+        del sqlite.converters["B1B1"]
         self.cur.close()
         self.con.close()
 
-    def CheckDeclType(self):
+    def CheckDeclTypeNotUsed(self):
+        """
+        Assures that the declared type is not used when PARSE_DECLTYPES
+        is not set.
+        """
         self.cur.execute("insert into test(x) values (?)", ("xxx",))
         self.cur.execute("select x from test")
         val = self.cur.fetchone()[0]
-        self.failUnlessEqual(val, "[xxx]")
+        self.failUnlessEqual(val, "xxx")
 
     def CheckNone(self):
         self.cur.execute("insert into test(x) values (?)", (None,))
@@ -241,6 +248,11 @@
         # whitespace should be stripped.
         self.failUnlessEqual(self.cur.description[0][0], "x")
 
+    def CheckCaseInConverterName(self):
+        self.cur.execute("""select 'other' as "x [b1b1]\"""")
+        val = self.cur.fetchone()[0]
+        self.failUnlessEqual(val, "MARKER")
+
     def CheckCursorDescriptionNoRow(self):
         """
         cursor.description should at least provide the column name(s), even if
@@ -334,6 +346,13 @@
         ts2 = self.cur.fetchone()[0]
         self.failUnlessEqual(ts, ts2)
 
+    def CheckDateTimeSubSecondsFloatingPoint(self):
+        ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
+        self.cur.execute("insert into test(ts) values (?)", (ts,))
+        self.cur.execute("select ts from test")
+        ts2 = self.cur.fetchone()[0]
+        self.failUnlessEqual(ts, ts2)
+
 def suite():
     sqlite_type_suite = unittest.makeSuite(SqliteTypeTests, "Check")
     decltypes_type_suite = unittest.makeSuite(DeclTypesTests, "Check")

Modified: python/branches/bcannon-objcap/Lib/subprocess.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/subprocess.py	(original)
+++ python/branches/bcannon-objcap/Lib/subprocess.py	Wed Jan 31 23:24:58 2007
@@ -499,7 +499,7 @@
         if result:
             result.append(' ')
 
-        needquote = (" " in arg) or ("\t" in arg)
+        needquote = (" " in arg) or ("\t" in arg) or arg == ""
         if needquote:
             result.append('"')
 
@@ -1120,7 +1120,7 @@
                     # we can write up to PIPE_BUF bytes without risk
                     # blocking.  POSIX defines PIPE_BUF >= 512
                     bytes_written = os.write(self.stdin.fileno(), buffer(input, input_offset, 512))
-                    input_offset += bytes_written 
+                    input_offset += bytes_written
                     if input_offset >= len(input):
                         self.stdin.close()
                         write_set.remove(self.stdin)

Modified: python/branches/bcannon-objcap/Lib/tarfile.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/tarfile.py	(original)
+++ python/branches/bcannon-objcap/Lib/tarfile.py	Wed Jan 31 23:24:58 2007
@@ -1632,19 +1632,7 @@
         # Create all upper directories.
         upperdirs = os.path.dirname(targetpath)
         if upperdirs and not os.path.exists(upperdirs):
-            ti = TarInfo()
-            ti.name  = upperdirs
-            ti.type  = DIRTYPE
-            ti.mode  = 0777
-            ti.mtime = tarinfo.mtime
-            ti.uid   = tarinfo.uid
-            ti.gid   = tarinfo.gid
-            ti.uname = tarinfo.uname
-            ti.gname = tarinfo.gname
-            try:
-                self._extract_member(ti, ti.name)
-            except:
-                pass
+            os.makedirs(upperdirs)
 
         if tarinfo.islnk() or tarinfo.issym():
             self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))

Modified: python/branches/bcannon-objcap/Lib/test/crashers/weakref_in_del.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/crashers/weakref_in_del.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/crashers/weakref_in_del.py	Wed Jan 31 23:24:58 2007
@@ -1,11 +1,12 @@
 import weakref
 
 # http://python.org/sf/1377858
+# Fixed for new-style classes in 2.5c1.
 
 ref = None
 
 def test_weakref_in_del():
-    class Target(object):
+    class Target():
         def __del__(self):
             global ref
             ref = weakref.ref(self)

Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_new
==============================================================================
--- /python/branches/bcannon-objcap/Lib/test/output/test_new	Wed Jan 31 23:24:58 2007
+++ (empty file)
@@ -1,6 +0,0 @@
-test_new
-new.module()
-new.classobj()
-new.instance()
-new.instancemethod()
-new.function()

Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_popen
==============================================================================
--- /python/branches/bcannon-objcap/Lib/test/output/test_popen	Wed Jan 31 23:24:58 2007
+++ (empty file)
@@ -1,3 +0,0 @@
-test_popen
-Test popen:
-popen seemed to process the command-line correctly

Deleted: /python/branches/bcannon-objcap/Lib/test/output/test_resource
==============================================================================
--- /python/branches/bcannon-objcap/Lib/test/output/test_resource	Wed Jan 31 23:24:58 2007
+++ (empty file)
@@ -1,2 +0,0 @@
-test_resource
-True

Modified: python/branches/bcannon-objcap/Lib/test/test___all__.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test___all__.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test___all__.py	Wed Jan 31 23:24:58 2007
@@ -9,6 +9,8 @@
                         "the gopherlib module is deprecated",
                         DeprecationWarning,
                         "<string>")
+warnings.filterwarnings("ignore", "the sets module is deprecated",
+                        DeprecationWarning, "<string>")
 
 class AllTest(unittest.TestCase):
 

Modified: python/branches/bcannon-objcap/Lib/test/test_array.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_array.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_array.py	Wed Jan 31 23:24:58 2007
@@ -12,6 +12,10 @@
 class ArraySubclass(array.array):
     pass
 
+class ArraySubclassWithKwargs(array.array):
+    def __init__(self, typecode, newarg=None):
+        array.array.__init__(typecode)
+
 tests = [] # list to accumulate all tests
 typecodes = "cubBhHiIlLfd"
 
@@ -683,6 +687,9 @@
                 b = array.array('B', range(64))
             self.assertEqual(rc, sys.getrefcount(10))
 
+    def test_subclass_with_kwargs(self):
+        # SF bug #1486663 -- this used to erroneously raise a TypeError
+        ArraySubclassWithKwargs('b', newarg=1)
 
 
 class StringTest(BaseTest):

Modified: python/branches/bcannon-objcap/Lib/test/test_cfgparser.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_cfgparser.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_cfgparser.py	Wed Jan 31 23:24:58 2007
@@ -15,7 +15,7 @@
         result = self.data.keys()
         result.sort()
         return result
-    
+
     def values(self):
         result = self.items()
         return [i[1] for i in values]
@@ -446,12 +446,12 @@
                         "o2=3\n"
                         "o1=4\n"
                         "[a]\n"
-                        "k=v\n")        
+                        "k=v\n")
         output = StringIO.StringIO()
         self.cf.write(output)
         self.assertEquals(output.getvalue(),
                           "[a]\n"
-                          "k = v\n\n"       
+                          "k = v\n\n"
                           "[b]\n"
                           "o1 = 4\n"
                           "o2 = 3\n"

Modified: python/branches/bcannon-objcap/Lib/test/test_compiler.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_compiler.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_compiler.py	Wed Jan 31 23:24:58 2007
@@ -7,6 +7,12 @@
 # How much time in seconds can pass before we print a 'Still working' message.
 _PRINT_WORKING_MSG_INTERVAL = 5 * 60
 
+class TrivialContext(object):
+    def __enter__(self):
+        return self
+    def __exit__(self, *exc_info):
+        pass
+
 class CompilerTest(unittest.TestCase):
 
     def testCompileLibrary(self):
@@ -123,6 +129,31 @@
                              'eval')
         self.assertEquals(eval(c), [(0, 3), (1, 3), (2, 3)])
 
+    def testWith(self):
+        # SF bug 1638243
+        c = compiler.compile('from __future__ import with_statement\n'
+                             'def f():\n'
+                             '    with TrivialContext():\n'
+                             '        return 1\n'
+                             'result = f()',
+                             '<string>',
+                             'exec' )
+        dct = {'TrivialContext': TrivialContext}
+        exec c in dct
+        self.assertEquals(dct.get('result'), 1)
+
+    def testWithAss(self):
+        c = compiler.compile('from __future__ import with_statement\n'
+                             'def f():\n'
+                             '    with TrivialContext() as tc:\n'
+                             '        return 1\n'
+                             'result = f()',
+                             '<string>',
+                             'exec' )
+        dct = {'TrivialContext': TrivialContext}
+        exec c in dct
+        self.assertEquals(dct.get('result'), 1)
+
 
 NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard)
 

Modified: python/branches/bcannon-objcap/Lib/test/test_deque.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_deque.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_deque.py	Wed Jan 31 23:24:58 2007
@@ -486,6 +486,16 @@
         d1 == d2   # not clear if this is supposed to be True or False,
                    # but it used to give a SystemError
 
+
+class SubclassWithKwargs(deque):
+    def __init__(self, newarg=1):
+        deque.__init__(self)
+
+class TestSubclassWithKwargs(unittest.TestCase):
+    def test_subclass_with_kwargs(self):
+        # SF bug #1486663 -- this used to erroneously raise a TypeError
+        SubclassWithKwargs(newarg=1)
+
 #==============================================================================
 
 libreftest = """
@@ -599,6 +609,7 @@
         TestBasic,
         TestVariousIteratorArgs,
         TestSubclass,
+        TestSubclassWithKwargs,
     )
 
     test_support.run_unittest(*test_classes)

Modified: python/branches/bcannon-objcap/Lib/test/test_dumbdbm.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_dumbdbm.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_dumbdbm.py	Wed Jan 31 23:24:58 2007
@@ -49,13 +49,19 @@
             f.close()
         finally:
             os.umask(old_umask)
-            
+
+        expected_mode = 0635
+        if os.name != 'posix':
+            # Windows only supports setting the read-only attribute.
+            # This shouldn't fail, but doesn't work like Unix either.
+            expected_mode = 0666
+
         import stat
         st = os.stat(_fname + '.dat')
-        self.assertEqual(stat.S_IMODE(st.st_mode), 0635)
+        self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
         st = os.stat(_fname + '.dir')
-        self.assertEqual(stat.S_IMODE(st.st_mode), 0635)
-        
+        self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode)
+
     def test_close_twice(self):
         f = dumbdbm.open(_fname)
         f['a'] = 'b'

Modified: python/branches/bcannon-objcap/Lib/test/test_exceptions.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_exceptions.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_exceptions.py	Wed Jan 31 23:24:58 2007
@@ -296,6 +296,13 @@
                                               'pickled "%r", attribute "%s' %
                                               (e, checkArgName))
 
+    def testSlicing(self):
+        # Test that you can slice an exception directly instead of requiring
+        # going through the 'args' attribute.
+        args = (1, 2, 3)
+        exc = BaseException(*args)
+        self.failUnlessEqual(exc[:], args)
+
     def testKeywordArgs(self):
         # test that builtin exception don't take keyword args,
         # but user-defined subclasses can if they want

Modified: python/branches/bcannon-objcap/Lib/test/test_gzip.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_gzip.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_gzip.py	Wed Jan 31 23:24:58 2007
@@ -138,7 +138,7 @@
         y = f.read(10)
         f.close()
         self.assertEquals(y, data1[20:30])
-        
+
     def test_seek_write(self):
         # Try seek, write test
         f = gzip.GzipFile(self.filename, 'w')

Modified: python/branches/bcannon-objcap/Lib/test/test_itertools.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_itertools.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_itertools.py	Wed Jan 31 23:24:58 2007
@@ -740,6 +740,21 @@
         self.assertRaises(AssertionError, list, cycle(gen1()))
         self.assertEqual(hist, [0,1])
 
+class SubclassWithKwargsTest(unittest.TestCase):
+    def test_keywords_in_subclass(self):
+        # count is not subclassable...
+        for cls in (repeat, izip, ifilter, ifilterfalse, chain, imap,
+                    starmap, islice, takewhile, dropwhile, cycle):
+            class Subclass(cls):
+                def __init__(self, newarg=None, *args):
+                    cls.__init__(self, *args)
+            try:
+                Subclass(newarg=1)
+            except TypeError, err:
+                # we expect type errors because of wrong argument count
+                self.failIf("does not take keyword arguments" in err.args[0])
+
+
 libreftest = """ Doctest for examples in the library reference: libitertools.tex
 
 
@@ -934,7 +949,8 @@
 
 def test_main(verbose=None):
     test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC,
-                    RegressionTests, LengthTransparency)
+                    RegressionTests, LengthTransparency,
+                    SubclassWithKwargsTest)
     test_support.run_unittest(*test_classes)
 
     # verify reference counting

Modified: python/branches/bcannon-objcap/Lib/test/test_mailbox.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_mailbox.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_mailbox.py	Wed Jan 31 23:24:58 2007
@@ -4,7 +4,7 @@
 import stat
 import socket
 import email
-import email.Message
+import email.message
 import rfc822
 import re
 import StringIO
@@ -22,7 +22,7 @@
 
     def _check_sample(self, msg):
         # Inspect a mailbox.Message representation of the sample message
-        self.assert_(isinstance(msg, email.Message.Message))
+        self.assert_(isinstance(msg, email.message.Message))
         self.assert_(isinstance(msg, mailbox.Message))
         for key, value in _sample_headers.iteritems():
             self.assert_(value in msg.get_all(key))
@@ -30,7 +30,7 @@
         self.assert_(len(msg.get_payload()) == len(_sample_payloads))
         for i, payload in enumerate(_sample_payloads):
             part = msg.get_payload(i)
-            self.assert_(isinstance(part, email.Message.Message))
+            self.assert_(isinstance(part, email.message.Message))
             self.assert_(not isinstance(part, mailbox.Message))
             self.assert_(part.get_payload() == payload)
 
@@ -681,11 +681,11 @@
         box = self._factory(self._path, factory=dummy_factory)
         folder = box.add_folder('folder1')
         self.assert_(folder._factory is dummy_factory)
-        
+
         folder1_alias = box.get_folder('folder1')
         self.assert_(folder1_alias._factory is dummy_factory)
 
-        
+
 
 class _TestMboxMMDF(TestMailbox):
 
@@ -805,7 +805,7 @@
         def dummy_factory (s):
             return None
         self._box = self._factory(self._path, dummy_factory)
-        
+
         new_folder = self._box.add_folder('foo.bar')
         folder0 = self._box.get_folder('foo.bar')
         folder0.add(self._template % 'bar')
@@ -901,7 +901,7 @@
         self.assert_(self._box.get_sequences() ==
                      {'foo':[1, 2, 3, 4, 5],
                       'unseen':[1], 'bar':[3], 'replied':[3]})
-        
+
     def _get_lock_path(self):
         return os.path.join(self._path, '.mh_sequences.lock')
 
@@ -946,7 +946,7 @@
         self._delete_recursively(self._path)
 
     def test_initialize_with_eMM(self):
-        # Initialize based on email.Message.Message instance
+        # Initialize based on email.message.Message instance
         eMM = email.message_from_string(_sample_message)
         msg = self._factory(eMM)
         self._post_initialize_hook(msg)
@@ -972,7 +972,7 @@
         # Initialize without arguments
         msg = self._factory()
         self._post_initialize_hook(msg)
-        self.assert_(isinstance(msg, email.Message.Message))
+        self.assert_(isinstance(msg, email.message.Message))
         self.assert_(isinstance(msg, mailbox.Message))
         self.assert_(isinstance(msg, self._factory))
         self.assert_(msg.keys() == [])
@@ -999,7 +999,7 @@
                        mailbox.BabylMessage, mailbox.MMDFMessage):
             other_msg = class_()
             msg._explain_to(other_msg)
-        other_msg = email.Message.Message()
+        other_msg = email.message.Message()
         self.assertRaises(TypeError, lambda: msg._explain_to(other_msg))
 
     def _post_initialize_hook(self, msg):
@@ -1739,11 +1739,11 @@
 
     def test_unix_mbox(self):
         ### should be better!
-        import email.Parser
+        import email.parser
         fname = self.createMessage("cur", True)
         n = 0
         for msg in mailbox.PortableUnixMailbox(open(fname),
-                                               email.Parser.Parser().parse):
+                                               email.parser.Parser().parse):
             n += 1
             self.assertEqual(msg["subject"], "Simple Test")
             self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE))

Modified: python/branches/bcannon-objcap/Lib/test/test_new.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_new.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_new.py	Wed Jan 31 23:24:58 2007
@@ -1,115 +1,54 @@
-from test.test_support import verbose, verify, TestFailed
-import sys
-import new
-
-class Eggs:
-    def get_yolks(self):
-        return self.yolks
-
-print 'new.module()'
-m = new.module('Spam')
-if verbose:
-    print m
-m.Eggs = Eggs
-sys.modules['Spam'] = m
-import Spam
-
-def get_more_yolks(self):
-    return self.yolks + 3
-
-print 'new.classobj()'
-C = new.classobj('Spam', (Spam.Eggs,), {'get_more_yolks': get_more_yolks})
-if verbose:
-    print C
-print 'new.instance()'
-c = new.instance(C, {'yolks': 3})
-if verbose:
-    print c
-o = new.instance(C)
-verify(o.__dict__ == {},
-       "new __dict__ should be empty")
-del o
-o = new.instance(C, None)
-verify(o.__dict__ == {},
-       "new __dict__ should be empty")
-del o
-
-def break_yolks(self):
-    self.yolks = self.yolks - 2
-print 'new.instancemethod()'
-im = new.instancemethod(break_yolks, c, C)
-if verbose:
-    print im
-
-verify(c.get_yolks() == 3 and c.get_more_yolks() == 6,
-       'Broken call of hand-crafted class instance')
-im()
-verify(c.get_yolks() == 1 and c.get_more_yolks() == 4,
-       'Broken call of hand-crafted instance method')
-
-im = new.instancemethod(break_yolks, c)
-im()
-verify(c.get_yolks() == -1)
-try:
-    new.instancemethod(break_yolks, None)
-except TypeError:
-    pass
-else:
-    raise TestFailed, "dangerous instance method creation allowed"
-
-# Verify that instancemethod() doesn't allow keyword args
-try:
-    new.instancemethod(break_yolks, c, kw=1)
-except TypeError:
-    pass
-else:
-    raise TestFailed, "instancemethod shouldn't accept keyword args"
-
-# It's unclear what the semantics should be for a code object compiled at
-# module scope, but bound and run in a function.  In CPython, `c' is global
-# (by accident?) while in Jython, `c' is local.  The intent of the test
-# clearly is to make `c' global, so let's be explicit about it.
-codestr = '''
-global c
-a = 1
-b = 2
-c = a + b
-'''
-
-ccode = compile(codestr, '<string>', 'exec')
-# Jython doesn't have a __builtins__, so use a portable alternative
-import __builtin__
-g = {'c': 0, '__builtins__': __builtin__}
-# this test could be more robust
-print 'new.function()'
-func = new.function(ccode, g)
-if verbose:
-    print func
-func()
-verify(g['c'] == 3,
-       'Could not create a proper function object')
-
-# test the various extended flavors of function.new
-def f(x):
-    def g(y):
-        return x + y
-    return g
-g = f(4)
-new.function(f.func_code, {}, "blah")
-g2 = new.function(g.func_code, {}, "blah", (2,), g.func_closure)
-verify(g2() == 6)
-g3 = new.function(g.func_code, {}, "blah", None, g.func_closure)
-verify(g3(5) == 9)
-def test_closure(func, closure, exc):
-    try:
-        new.function(func.func_code, {}, "", None, closure)
-    except exc:
-        pass
-    else:
-        print "corrupt closure accepted"
-
-test_closure(g, None, TypeError) # invalid closure
-test_closure(g, (1,), TypeError) # non-cell in closure
-test_closure(g, (1, 1), ValueError) # closure is wrong size
-test_closure(f, g.func_closure, ValueError) # no closure needed
+import unittest
+from test import test_support
+import sys, new
+
+class NewTest(unittest.TestCase):
+    def test_spam(self):
+        class Eggs:
+            def get_yolks(self):
+                return self.yolks
+
+        m = new.module('Spam')
+        m.Eggs = Eggs
+        sys.modules['Spam'] = m
+        import Spam
+
+        def get_more_yolks(self):
+            return self.yolks + 3
+
+        # new.classobj()
+        C = new.classobj('Spam', (Spam.Eggs,), {'get_more_yolks': get_more_yolks})
+
+        # new.instance()
+        c = new.instance(C, {'yolks': 3})
+
+        o = new.instance(C)
+        self.assertEqual(o.__dict__, {}, "new __dict__ should be empty")
+        del o
+        o = new.instance(C, None)
+        self.assertEqual(o.__dict__, {}, "new __dict__ should be empty")
+        del o
+
+        def break_yolks(self):
+            self.yolks = self.yolks - 2
+
+        # new.instancemethod()
+        im = new.instancemethod(break_yolks, c, C)
+
+        self.assertEqual(c.get_yolks(), 3,
+            'Broken call of hand-crafted class instance')
+        self.assertEqual(c.get_more_yolks(), 6,
+            'Broken call of hand-crafted class instance')
+
+        im()
+        self.assertEqual(c.get_yolks(), 1,
+            'Broken call of hand-crafted instance method')
+        self.assertEqual(c.get_more_yolks(), 4,
+            'Broken call of hand-crafted instance method')
+
+        im = new.instancemethod(break_yolks, c)
+        im()
+        self.assertEqual(c.get_yolks(), -1)
 
+        # Verify that dangerous instance method creation is forbidden
+        self.assertRaises(TypeError, new.instancemethod, break_yolks, None)

Modified: python/branches/bcannon-objcap/Lib/test/test_ntpath.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_ntpath.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_ntpath.py	Wed Jan 31 23:24:58 2007
@@ -115,6 +115,28 @@
 tester("ntpath.normpath('C:////a/b')", r'C:\a\b')
 tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b')
 
+oldenv = os.environ.copy()
+try:
+    os.environ.clear()
+    os.environ["foo"] = "bar"
+    os.environ["{foo"] = "baz1"
+    os.environ["{foo}"] = "baz2"
+    tester('ntpath.expandvars("foo")', "foo")
+    tester('ntpath.expandvars("$foo bar")', "bar bar")
+    tester('ntpath.expandvars("${foo}bar")', "barbar")
+    tester('ntpath.expandvars("$[foo]bar")', "$[foo]bar")
+    tester('ntpath.expandvars("$bar bar")', "$bar bar")
+    tester('ntpath.expandvars("$?bar")', "$?bar")
+    tester('ntpath.expandvars("${foo}bar")', "barbar")
+    tester('ntpath.expandvars("$foo}bar")', "bar}bar")
+    tester('ntpath.expandvars("${foo")', "${foo")
+    tester('ntpath.expandvars("${{foo}}")', "baz1}")
+    tester('ntpath.expandvars("$foo$foo")', "barbar")
+    tester('ntpath.expandvars("$bar$bar")', "$bar$bar")
+finally:
+    os.environ.clear()
+    os.environ.update(oldenv)
+
 # ntpath.abspath() can only be used on a system with the "nt" module
 # (reasonably), so we protect this test with "import nt".  This allows
 # the rest of the tests for the ntpath module to be run to completion

Modified: python/branches/bcannon-objcap/Lib/test/test_old_mailbox.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_old_mailbox.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_old_mailbox.py	Wed Jan 31 23:24:58 2007
@@ -109,11 +109,44 @@
             self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE))
         self.assertEqual(n, 1)
 
+class MboxTestCase(unittest.TestCase):
+    def setUp(self):
+        # create a new maildir mailbox to work with:
+        self._path = test_support.TESTFN
+
+    def tearDown(self):
+        os.unlink(self._path)
+
+    def test_from_regex (self):
+        # Testing new regex from bug #1633678
+        f = open(self._path, 'w')
+        f.write("""From fred at example.com Mon May 31 13:24:50 2004 +0200
+Subject: message 1
+
+body1
+From fred at example.com Mon May 31 13:24:50 2004 -0200
+Subject: message 2
+
+body2
+From fred at example.com Mon May 31 13:24:50 2004
+Subject: message 3
+
+body3
+From fred at example.com Mon May 31 13:24:50 2004
+Subject: message 4
+
+body4
+""")
+        f.close()
+        box = mailbox.UnixMailbox(open(self._path, 'r'))
+        self.assert_(len(list(iter(box))) == 4)
+
+
     # XXX We still need more tests!
 
 
 def test_main():
-    test_support.run_unittest(MaildirTestCase)
+    test_support.run_unittest(MaildirTestCase, MboxTestCase)
 
 
 if __name__ == "__main__":

Modified: python/branches/bcannon-objcap/Lib/test/test_optparse.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_optparse.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_optparse.py	Wed Jan 31 23:24:58 2007
@@ -1500,8 +1500,16 @@
         self.assertHelpEquals(_expected_help_long_opts_first)
 
     def test_help_title_formatter(self):
-        self.parser.formatter = TitledHelpFormatter()
-        self.assertHelpEquals(_expected_help_title_formatter)
+        save = os.environ.get("COLUMNS")
+        try:
+            os.environ["COLUMNS"] = "80"
+            self.parser.formatter = TitledHelpFormatter()
+            self.assertHelpEquals(_expected_help_title_formatter)
+        finally:
+            if save is not None:
+                os.environ["COLUMNS"] = save
+            else:
+                del os.environ["COLUMNS"]
 
     def test_wrap_columns(self):
         # Ensure that wrapping respects $COLUMNS environment variable.

Modified: python/branches/bcannon-objcap/Lib/test/test_pep352.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_pep352.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_pep352.py	Wed Jan 31 23:24:58 2007
@@ -2,7 +2,7 @@
 import __builtin__
 import exceptions
 import warnings
-from test.test_support import run_unittest
+from test.test_support import run_unittest, guard_warnings_filter
 import os
 from platform import system as platform_system
 
@@ -113,13 +113,8 @@
 
     """Test usage of exceptions"""
 
-    def setUp(self):
-        self._filters = warnings.filters[:]
-
-    def tearDown(self):
-        warnings.filters = self._filters[:]
-
     def test_raise_classic(self):
+        # Raising a classic class is okay (for now).
         class ClassicClass:
             pass
         try:
@@ -136,6 +131,10 @@
             self.fail("unable to raise class class instance")
 
     def test_raise_new_style_non_exception(self):
+        # You cannot raise a new-style class that does not inherit from
+        # BaseException; the ability was not possible until BaseException's
+        # introduction so no need to support new-style objects that do not
+        # inherit from it.
         class NewStyleClass(object):
             pass
         try:
@@ -143,35 +142,52 @@
         except TypeError:
             pass
         except:
-            self.fail("unable to raise new-style class")
+            self.fail("able to raise new-style class")
         try:
             raise NewStyleClass()
         except TypeError:
             pass
         except:
-            self.fail("unable to raise new-style class instance")
+            self.fail("able to raise new-style class instance")
 
     def test_raise_string(self):
-        warnings.resetwarnings()
-        warnings.filterwarnings("error")
+        # Raising a string raises TypeError.
         try:
             raise "spam"
-        except DeprecationWarning:
+        except TypeError:
             pass
         except:
-            self.fail("raising a string did not cause a DeprecationWarning")
+            self.fail("was able to raise a string exception")
 
     def test_catch_string(self):
-        # Test will be pertinent when catching exceptions raises a
-        #   DeprecationWarning
-        warnings.filterwarnings("ignore", "raising")
-        str_exc = "spam"
-        try:
-            raise str_exc
-        except str_exc:
-            pass
-        except:
-            self.fail("catching a string exception failed")
+        # Catching a string should trigger a DeprecationWarning.
+        with guard_warnings_filter():
+            warnings.resetwarnings()
+            warnings.filterwarnings("error")
+            str_exc = "spam"
+            try:
+                try:
+                    raise StandardError
+                except str_exc:
+                    pass
+            except DeprecationWarning:
+                pass
+            except StandardError:
+                self.fail("catching a string exception did not raise "
+                            "DeprecationWarning")
+            # Make sure that even if the string exception is listed in a tuple
+            # that a warning is raised.
+            try:
+                try:
+                    raise StandardError
+                except (AssertionError, str_exc):
+                    pass
+            except DeprecationWarning:
+                pass
+            except StandardError:
+                self.fail("catching a string exception specified in a tuple did "
+                            "not raise DeprecationWarning")
+
 
 def test_main():
     run_unittest(ExceptionClassTests, UsageTests)

Modified: python/branches/bcannon-objcap/Lib/test/test_popen.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_popen.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_popen.py	Wed Jan 31 23:24:58 2007
@@ -4,10 +4,9 @@
   Particularly useful for platforms that fake popen.
 """
 
-import os
-import sys
-from test.test_support import TestSkipped, reap_children
-from os import popen
+import unittest
+from test import test_support
+import os, sys
 
 # Test that command-lines get down as we expect.
 # To do this we execute:
@@ -17,24 +16,32 @@
 python = sys.executable
 if ' ' in python:
     python = '"' + python + '"'     # quote embedded space for cmdline
-def _do_test_commandline(cmdline, expected):
-    cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline)
-    data = popen(cmd).read()
-    got = eval(data)[1:] # strip off argv[0]
-    if got != expected:
-        print "Error in popen commandline handling."
-        print " executed '%s', expected '%r', but got '%r'" \
-                                                    % (cmdline, expected, got)
-
-def _test_commandline():
-    _do_test_commandline("foo bar", ["foo", "bar"])
-    _do_test_commandline('foo "spam and eggs" "silly walk"', ["foo", "spam and eggs", "silly walk"])
-    _do_test_commandline('foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"])
-    print "popen seemed to process the command-line correctly"
-
-def main():
-    print "Test popen:"
-    _test_commandline()
-    reap_children()
 
-main()
+class PopenTest(unittest.TestCase):
+    def _do_test_commandline(self, cmdline, expected):
+        cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline)
+        data = os.popen(cmd).read()
+        got = eval(data)[1:] # strip off argv[0]
+        self.assertEqual(got, expected)
+
+    def test_popen(self):
+        self.assertRaises(TypeError, os.popen)
+        self._do_test_commandline(
+            "foo bar",
+            ["foo", "bar"]
+        )
+        self._do_test_commandline(
+            'foo "spam and eggs" "silly walk"',
+            ["foo", "spam and eggs", "silly walk"]
+        )
+        self._do_test_commandline(
+            'foo "a \\"quoted\\" arg" bar',
+            ["foo", 'a "quoted" arg', "bar"]
+        )
+        test_support.reap_children()
+
+def test_main():
+    test_support.run_unittest(PopenTest)
+
+if __name__ == "__main__":
+    test_main()

Modified: python/branches/bcannon-objcap/Lib/test/test_posixpath.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_posixpath.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_posixpath.py	Wed Jan 31 23:24:58 2007
@@ -374,6 +374,8 @@
             self.assertEqual(posixpath.expandvars("$foo}bar"), "bar}bar")
             self.assertEqual(posixpath.expandvars("${foo"), "${foo")
             self.assertEqual(posixpath.expandvars("${{foo}}"), "baz1}")
+            self.assertEqual(posixpath.expandvars("$foo$foo"), "barbar")
+            self.assertEqual(posixpath.expandvars("$bar$bar"), "$bar$bar")
         finally:
             os.environ.clear()
             os.environ.update(oldenv)

Modified: python/branches/bcannon-objcap/Lib/test/test_pty.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_pty.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_pty.py	Wed Jan 31 23:24:58 2007
@@ -120,7 +120,7 @@
     ##if False and lines != ['In child, calling os.setsid()',
     ##             'Good: OSError was raised.', '']:
     ##    raise TestFailed("Unexpected output from child: %r" % line)
-            
+
     (pid, status) = os.waitpid(pid, 0)
     res = status >> 8
     debug("Child (%d) exited with status %d (%d)."%(pid, res, status))
@@ -140,8 +140,8 @@
     ##    pass
     ##else:
     ##    raise TestFailed("Read from master_fd did not raise exception")
-    
-    
+
+
 os.close(master_fd)
 
 # pty.fork() passed.

Modified: python/branches/bcannon-objcap/Lib/test/test_random.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_random.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_random.py	Wed Jan 31 23:24:58 2007
@@ -515,6 +515,14 @@
         # tests validity but not completeness of the __all__ list
         self.failUnless(set(random.__all__) <= set(dir(random)))
 
+    def test_random_subclass_with_kwargs(self):
+        # SF bug #1486663 -- this used to erroneously raise a TypeError
+        class Subclass(random.Random):
+            def __init__(self, newarg=None):
+                random.Random.__init__(self)
+        Subclass(newarg=1)
+
+
 def test_main(verbose=None):
     testclasses =    [WichmannHill_TestBasicOps,
                       MersenneTwister_TestBasicOps,

Modified: python/branches/bcannon-objcap/Lib/test/test_resource.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_resource.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_resource.py	Wed Jan 31 23:24:58 2007
@@ -1,56 +1,96 @@
-import os
-import resource
+import unittest
+from test import test_support
 
-from test.test_support import TESTFN
 
-# This test is checking a few specific problem spots.  RLIMIT_FSIZE
-# should be RLIM_INFINITY, which will be a really big number on a
-# platform with large file support.  On these platforms, we need to
-# test that the get/setrlimit functions properly convert the number to
-# a C long long and that the conversion doesn't raise an error.
-
-try:
-    cur, max = resource.getrlimit(resource.RLIMIT_FSIZE)
-except AttributeError:
-    pass
-else:
-    print resource.RLIM_INFINITY == max
-    resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
-
-# Now check to see what happens when the RLIMIT_FSIZE is small.  Some
-# versions of Python were terminated by an uncaught SIGXFSZ, but
-# pythonrun.c has been fixed to ignore that exception.  If so, the
-# write() should return EFBIG when the limit is exceeded.
-
-# At least one platform has an unlimited RLIMIT_FSIZE and attempts to
-# change it raise ValueError instead.
-
-try:
-    try:
-        resource.setrlimit(resource.RLIMIT_FSIZE, (1024, max))
-        limit_set = 1
-    except ValueError:
-        limit_set = 0
-    f = open(TESTFN, "wb")
-    f.write("X" * 1024)
-    try:
-        f.write("Y")
-        f.flush()
-    except IOError:
-        if not limit_set:
-            raise
-    f.close()
-    os.unlink(TESTFN)
-finally:
-    resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
-
-# And be sure that setrlimit is checking for really large values
-too_big = 10L**50
-try:
-    resource.setrlimit(resource.RLIMIT_FSIZE, (too_big, max))
-except (OverflowError, ValueError):
-    pass
-try:
-    resource.setrlimit(resource.RLIMIT_FSIZE, (max, too_big))
-except (OverflowError, ValueError):
-    pass
+import os, resource
+
+# This test is checking a few specific problem spots with the resource module.
+
+class ResourceTest(unittest.TestCase):
+
+    def test_args(self):
+        self.assertRaises(TypeError, resource.getrlimit)
+        self.assertRaises(TypeError, resource.getrlimit, 42, 42)
+        self.assertRaises(TypeError, resource.setrlimit)
+        self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42)
+
+    def test_fsize_ismax(self):
+
+        try:
+            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
+        except AttributeError:
+            pass
+        else:
+            # RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really big
+            # number on a platform with large file support.  On these platforms,
+            # we need to test that the get/setrlimit functions properly convert
+            # the number to a C long long and that the conversion doesn't raise
+            # an error.
+            self.assertEqual(resource.RLIM_INFINITY, max)
+            resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
+
+    def test_fsize_enforced(self):
+        try:
+            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
+        except AttributeError:
+            pass
+        else:
+            # Check to see what happens when the RLIMIT_FSIZE is small.  Some
+            # versions of Python were terminated by an uncaught SIGXFSZ, but
+            # pythonrun.c has been fixed to ignore that exception.  If so, the
+            # write() should return EFBIG when the limit is exceeded.
+
+            # At least one platform has an unlimited RLIMIT_FSIZE and attempts
+            # to change it raise ValueError instead.
+            try:
+                try:
+                    resource.setrlimit(resource.RLIMIT_FSIZE, (1024, max))
+                    limit_set = True
+                except ValueError:
+                    limit_set = False
+                f = open(test_support.TESTFN, "wb")
+                f.write("X" * 1024)
+                try:
+                    f.write("Y")
+                    f.flush()
+                except IOError:
+                    if not limit_set:
+                        raise
+                f.close()
+                os.unlink(test_support.TESTFN)
+            finally:
+                resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
+
+    def test_fsize_toobig(self):
+        # Be sure that setrlimit is checking for really large values
+        too_big = 10L**50
+        try:
+            (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
+        except AttributeError:
+            pass
+        else:
+            try:
+                resource.setrlimit(resource.RLIMIT_FSIZE, (too_big, max))
+            except (OverflowError, ValueError):
+                pass
+            try:
+                resource.setrlimit(resource.RLIMIT_FSIZE, (max, too_big))
+            except (OverflowError, ValueError):
+                pass
+
+    def test_getrusage(self):
+        self.assertRaises(TypeError, resource.getrusage)
+        self.assertRaises(TypeError, resource.getrusage, 42, 42)
+        usageself = resource.getrusage(resource.RUSAGE_SELF)
+        usagechildren = resource.getrusage(resource.RUSAGE_CHILDREN)
+        # May not be available on all systems.
+        try:
+            usageboth = resource.getrusage(resource.RUSAGE_BOTH)
+        except (ValueError, AttributeError):
+            pass
+
+def test_main(verbose=None):
+    test_support.run_unittest(ResourceTest)
+
+if __name__ == "__main__":
+    test_main()

Modified: python/branches/bcannon-objcap/Lib/test/test_set.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_set.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_set.py	Wed Jan 31 23:24:58 2007
@@ -468,6 +468,16 @@
 class TestSetSubclass(TestSet):
     thetype = SetSubclass
 
+class SetSubclassWithKeywordArgs(set):
+    def __init__(self, iterable=[], newarg=None):
+        set.__init__(self, iterable)
+
+class TestSetSubclassWithKeywordArgs(TestSet):
+
+    def test_keywords_in_subclass(self):
+        'SF bug #1486663 -- this used to erroneously raise a TypeError'
+        SetSubclassWithKeywordArgs(newarg=1)
+
 class TestFrozenSet(TestJointOps):
     thetype = frozenset
 
@@ -1450,6 +1460,7 @@
     test_classes = (
         TestSet,
         TestSetSubclass,
+        TestSetSubclassWithKeywordArgs,
         TestFrozenSet,
         TestFrozenSetSubclass,
         TestSetOfSets,

Modified: python/branches/bcannon-objcap/Lib/test/test_sets.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_sets.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_sets.py	Wed Jan 31 23:24:58 2007
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
 
+import warnings
+warnings.filterwarnings("ignore", "the sets module is deprecated",
+                        DeprecationWarning, "test\.test_sets")
+
 import unittest, operator, copy, pickle, random
 from sets import Set, ImmutableSet
 from test import test_support

Modified: python/branches/bcannon-objcap/Lib/test/test_socket.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_socket.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_socket.py	Wed Jan 31 23:24:58 2007
@@ -310,6 +310,20 @@
             self.assertEqual(swapped & mask, mask)
             self.assertRaises(OverflowError, func, 1L<<34)
 
+    def testNtoHErrors(self):
+        good_values = [ 1, 2, 3, 1L, 2L, 3L ]
+        bad_values = [ -1, -2, -3, -1L, -2L, -3L ]
+        for k in good_values:
+            socket.ntohl(k)
+            socket.ntohs(k)
+            socket.htonl(k)
+            socket.htons(k)
+        for k in bad_values:
+            self.assertRaises(OverflowError, socket.ntohl, k)
+            self.assertRaises(OverflowError, socket.ntohs, k)
+            self.assertRaises(OverflowError, socket.htonl, k)
+            self.assertRaises(OverflowError, socket.htons, k)
+
     def testGetServBy(self):
         eq = self.assertEqual
         # Find one service that exists, then check all the related interfaces.
@@ -795,6 +809,31 @@
 
     bufsize = 2 # Exercise the buffering code
 
+
+class Urllib2FileobjectTest(unittest.TestCase):
+
+    # urllib2.HTTPHandler has "borrowed" socket._fileobject, and requires that
+    # it close the socket if the close c'tor argument is true
+
+    def testClose(self):
+        class MockSocket:
+            closed = False
+            def flush(self): pass
+            def close(self): self.closed = True
+
+        # must not close unless we request it: the original use of _fileobject
+        # by module socket requires that the underlying socket not be closed until
+        # the _socketobject that created the _fileobject is closed
+        s = MockSocket()
+        f = socket._fileobject(s)
+        f.close()
+        self.assert_(not s.closed)
+
+        s = MockSocket()
+        f = socket._fileobject(s, close=True)
+        f.close()
+        self.assert_(s.closed)
+
 class TCPTimeoutTest(SocketTCPTest):
 
     def testTCPTimeout(self):
@@ -947,7 +986,8 @@
         FileObjectClassTestCase,
         UnbufferedFileObjectClassTestCase,
         LineBufferedFileObjectClassTestCase,
-        SmallBufferedFileObjectClassTestCase
+        SmallBufferedFileObjectClassTestCase,
+        Urllib2FileobjectTest,
     ])
     if hasattr(socket, "socketpair"):
         tests.append(BasicSocketPairTest)

Modified: python/branches/bcannon-objcap/Lib/test/test_strptime.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_strptime.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_strptime.py	Wed Jan 31 23:24:58 2007
@@ -463,6 +463,10 @@
                                         "of the year")
         test_helper((1917, 12, 31), "Dec 31 on Monday with year starting and "
                                         "ending on Monday")
+        test_helper((2007, 01, 07), "First Sunday of 2007")
+        test_helper((2007, 01, 14), "Second Sunday of 2007")
+        test_helper((2006, 12, 31), "Last Sunday of 2006")
+        test_helper((2006, 12, 24), "Second to last Sunday of 2006")
 
 
 class CacheTests(unittest.TestCase):

Modified: python/branches/bcannon-objcap/Lib/test/test_struct.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_struct.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_struct.py	Wed Jan 31 23:24:58 2007
@@ -84,8 +84,8 @@
 if sz * 3 != struct.calcsize('iii'):
     raise TestFailed, 'inconsistent sizes'
 
-fmt = 'cbxxxxxxhhhhiillffd'
-fmt3 = '3c3b18x12h6i6l6f3d'
+fmt = 'cbxxxxxxhhhhiillffdt'
+fmt3 = '3c3b18x12h6i6l6f3d3t'
 sz = struct.calcsize(fmt)
 sz3 = struct.calcsize(fmt3)
 if sz * 3 != sz3:
@@ -108,19 +108,21 @@
 l = 65536
 f = 3.1415
 d = 3.1415
+t = True
 
 for prefix in ('', '@', '<', '>', '=', '!'):
-    for format in ('xcbhilfd', 'xcBHILfd'):
+    for format in ('xcbhilfdt', 'xcBHILfdt'):
         format = prefix + format
         if verbose:
             print "trying:", format
-        s = struct.pack(format, c, b, h, i, l, f, d)
-        cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
+        s = struct.pack(format, c, b, h, i, l, f, d, t)
+        cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s)
         if (cp != c or bp != b or hp != h or ip != i or lp != l or
-            int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d)):
+            int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d) or
+                        tp != t):
             # ^^^ calculate only to two decimal places
             raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
-                str(format), str((cp, bp, hp, ip, lp, fp, dp)))
+                str(format), str((cp, bp, hp, ip, lp, fp, dp, tp)))
 
 # Test some of the new features in detail
 
@@ -158,6 +160,11 @@
     ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0),
     ('d', -2.0, '\300\000\000\000\000\000\000\000',
                '\000\000\000\000\000\000\000\300', 0),
+        ('t', 0, '\0', '\0', 0),
+        ('t', 3, '\1', '\1', 1),
+        ('t', True, '\1', '\1', 0),
+        ('t', [], '\0', '\0', 1),
+        ('t', (1,), '\1', '\1', 1),
 ]
 
 for fmt, arg, big, lil, asy in tests:
@@ -612,3 +619,50 @@
 test_unpack_from()
 test_pack_into()
 test_pack_into_fn()
+
+def test_bool():
+    for prefix in tuple("<>!=")+('',):
+        false = (), [], [], '', 0
+        true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2
+
+        falseFormat = prefix + 't' * len(false)
+        if verbose:
+            print 'trying bool pack/unpack on', false, 'using format', falseFormat
+        packedFalse = struct.pack(falseFormat, *false)
+        unpackedFalse = struct.unpack(falseFormat, packedFalse)
+
+        trueFormat = prefix + 't' * len(true)
+        if verbose:
+            print 'trying bool pack/unpack on', true, 'using format', trueFormat
+        packedTrue = struct.pack(trueFormat, *true)
+        unpackedTrue = struct.unpack(trueFormat, packedTrue)
+
+        if len(true) != len(unpackedTrue):
+            raise TestFailed('unpacked true array is not of same size as input')
+        if len(false) != len(unpackedFalse):
+            raise TestFailed('unpacked false array is not of same size as input')
+
+        for t in unpackedFalse:
+            if t is not False:
+                raise TestFailed('%r did not unpack as False' % t)
+        for t in unpackedTrue:
+            if t is not True:
+                raise TestFailed('%r did not unpack as false' % t)
+
+        if prefix and verbose:
+            print 'trying size of bool with format %r' % (prefix+'t')
+        packed = struct.pack(prefix+'t', 1)
+
+        if len(packed) != struct.calcsize(prefix+'t'):
+            raise TestFailed('packed length is not equal to calculated size')
+
+        if len(packed) != 1 and prefix:
+            raise TestFailed('encoded bool is not one byte: %r' % packed)
+        elif not prefix and verbose:
+            print 'size of bool in native format is %i' % (len(packed))
+
+        for c in '\x01\x7f\xff\x0f\xf0':
+            if struct.unpack('>t', c)[0] is not True:
+                raise TestFailed('%c did not unpack as True' % c)
+
+test_bool()

Modified: python/branches/bcannon-objcap/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_subprocess.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_subprocess.py	Wed Jan 31 23:24:58 2007
@@ -430,6 +430,8 @@
                          '"a\\\\b c" d e')
         self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']),
                          '"a\\\\b\\ c" d e')
+        self.assertEqual(subprocess.list2cmdline(['ab', '']),
+                         'ab ""')
 
 
     def test_poll(self):

Modified: python/branches/bcannon-objcap/Lib/test/test_support.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_support.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_support.py	Wed Jan 31 23:24:58 2007
@@ -270,7 +270,7 @@
     print >> get_original_stdout(), '\tfetching %s ...' % url
     fn, _ = urllib.urlretrieve(url, filename)
     return open(fn)
-    
+
 @contextmanager
 def guard_warnings_filter():
     """Guard the warnings filter from being permanently changed."""

Modified: python/branches/bcannon-objcap/Lib/test/test_urllib2net.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_urllib2net.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_urllib2net.py	Wed Jan 31 23:24:58 2007
@@ -64,6 +64,27 @@
 #                          urllib2.urlopen, "http://evil:thing@example.com")
 
 
+class CloseSocketTest(unittest.TestCase):
+
+    def test_close(self):
+        import socket, httplib, gc
+
+        # calling .close() on urllib2's response objects should close the
+        # underlying socket
+
+        # delve deep into response to fetch socket._socketobject
+        response = urllib2.urlopen("http://www.python.org/")
+        abused_fileobject = response.fp
+        self.assert_(abused_fileobject.__class__ is socket._fileobject)
+        httpresponse = abused_fileobject._sock
+        self.assert_(httpresponse.__class__ is httplib.HTTPResponse)
+        fileobject = httpresponse.fp
+        self.assert_(fileobject.__class__ is socket._fileobject)
+
+        self.assert_(not fileobject.closed)
+        response.close()
+        self.assert_(fileobject.closed)
+
 class urlopenNetworkTests(unittest.TestCase):
     """Tests urllib2.urlopen using the network.
 
@@ -263,8 +284,12 @@
 
 def test_main():
     test_support.requires("network")
-    test_support.run_unittest(URLTimeoutTest, urlopenNetworkTests,
-                              AuthTests, OtherNetworkTests)
+    test_support.run_unittest(URLTimeoutTest,
+                              urlopenNetworkTests,
+                              AuthTests,
+                              OtherNetworkTests,
+                              CloseSocketTest,
+                              )
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/bcannon-objcap/Lib/test/test_uu.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_uu.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_uu.py	Wed Jan 31 23:24:58 2007
@@ -114,11 +114,11 @@
 
     def test_encode(self):
         try:
-            fin = open(self.tmpin, 'w')
+            fin = open(self.tmpin, 'wb')
             fin.write(plaintext)
             fin.close()
 
-            fin = open(self.tmpin, 'r')
+            fin = open(self.tmpin, 'rb')
             fout = open(self.tmpout, 'w')
             uu.encode(fin, fout, self.tmpin, mode=0644)
             fin.close()

Modified: python/branches/bcannon-objcap/Lib/test/test_weakref.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/test/test_weakref.py	(original)
+++ python/branches/bcannon-objcap/Lib/test/test_weakref.py	Wed Jan 31 23:24:58 2007
@@ -6,6 +6,8 @@
 
 from test import test_support
 
+# Used in ReferencesTestCase.test_ref_created_during_del() .
+ref_from_del = None
 
 class C:
     def method(self):
@@ -630,6 +632,18 @@
         finally:
             gc.set_threshold(*thresholds)
 
+    def test_ref_created_during_del(self):
+        # Bug #1377858
+        # A weakref created in an object's __del__() would crash the
+        # interpreter when the weakref was cleaned up since it would refer to
+        # non-existent memory.  This test should not segfault the interpreter.
+        class Target(object):
+            def __del__(self):
+                global ref_from_del
+                ref_from_del = weakref.ref(self)
+
+        w = Target()
+
 
 class SubclassableWeakrefTestCase(unittest.TestCase):
 

Modified: python/branches/bcannon-objcap/Lib/urllib.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/urllib.py	(original)
+++ python/branches/bcannon-objcap/Lib/urllib.py	Wed Jan 31 23:24:58 2007
@@ -452,7 +452,7 @@
 
     def open_local_file(self, url):
         """Use local file."""
-        import mimetypes, mimetools, email.Utils
+        import mimetypes, mimetools, email.utils
         try:
             from cStringIO import StringIO
         except ImportError:
@@ -464,7 +464,7 @@
         except OSError, e:
             raise IOError(e.errno, e.strerror, e.filename)
         size = stats.st_size
-        modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
+        modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
         mtype = mimetypes.guess_type(url)[0]
         headers = mimetools.Message(StringIO(
             'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %

Modified: python/branches/bcannon-objcap/Lib/urllib2.py
==============================================================================
--- python/branches/bcannon-objcap/Lib/urllib2.py	(original)
+++ python/branches/bcannon-objcap/Lib/urllib2.py	Wed Jan 31 23:24:58 2007
@@ -1087,7 +1087,7 @@
         # out of socket._fileobject() and into a base class.
 
         r.recv = r.read
-        fp = socket._fileobject(r)
+        fp = socket._fileobject(r, close=True)
 
         resp = addinfourl(fp, r.msg, req.get_full_url())
         resp.code = r.status
@@ -1209,14 +1209,14 @@
 
     # not entirely sure what the rules are here
     def open_local_file(self, req):
-        import email.Utils
+        import email.utils
         import mimetypes
         host = req.get_host()
         file = req.get_selector()
         localfile = url2pathname(file)
         stats = os.stat(localfile)
         size = stats.st_size
-        modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
+        modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
         mtype = mimetypes.guess_type(file)[0]
         headers = mimetools.Message(StringIO(
             'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %

Modified: python/branches/bcannon-objcap/Makefile.pre.in
==============================================================================
--- python/branches/bcannon-objcap/Makefile.pre.in	(original)
+++ python/branches/bcannon-objcap/Makefile.pre.in	Wed Jan 31 23:24:58 2007
@@ -483,6 +483,8 @@
 
 Parser/tokenizer_pgen.o:	$(srcdir)/Parser/tokenizer.c
 
+Parser/pgenmain.o:	$(srcdir)/Include/parsetok.h
+
 $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
 	$(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
 
@@ -535,6 +537,7 @@
 		Include/moduleobject.h \
 		Include/object.h \
 		Include/objimpl.h \
+		Include/parsetok.h \
 		Include/patchlevel.h \
 		Include/pyarena.h \
 		Include/pydebug.h \

Modified: python/branches/bcannon-objcap/Misc/ACKS
==============================================================================
--- python/branches/bcannon-objcap/Misc/ACKS	(original)
+++ python/branches/bcannon-objcap/Misc/ACKS	Wed Jan 31 23:24:58 2007
@@ -521,6 +521,7 @@
 Nicholas Riley
 Jean-Claude Rimbault
 Anthony Roach
+Mark Roberts
 Andy Robinson
 Jim Robinson
 Kevin Rodgers

Modified: python/branches/bcannon-objcap/Misc/NEWS
==============================================================================
--- python/branches/bcannon-objcap/Misc/NEWS	(original)
+++ python/branches/bcannon-objcap/Misc/NEWS	Wed Jan 31 23:24:58 2007
@@ -12,6 +12,23 @@
 Core and builtins
 -----------------
 
+- PEP 352: Raising a string exception now triggers a TypeError.  Attempting to
+  catch a string exception raises DeprecationWarning.
+
+- Bug #1377858: Fix the segfaulting of the interpreter when an object created
+  a weakref on itself during a __del__ call for new-style classes (classic
+  classes still have the bug).
+
+- Bug #1579370: Make PyTraceBack_Here use the current thread, not the
+  frame's thread state.
+
+- patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py
+
+- Patch #1507247: tarfile.py: use current umask for intermediate
+  directories.
+
+- Bug #1637022: Prefix AST symbols with _Py_.
+
 - Prevent seg fault on shutdown which could occur if an object
   raised a warning.
 
@@ -109,6 +126,40 @@
 Library
 -------
 
+- Patch #1634778: add missing encoding aliases for iso8859_15 and
+  iso8859_16.
+
+- Patch #1638243: the compiler package is now able to correctly compile
+  a with statement; previously, executing code containing a with statement
+  compiled by the compiler package crashed the interpreter.
+
+- Bug #1643943: Fix time.strptime's support for the %U directive.
+
+- Patch #1643874: memory leak in ctypes fixed.
+
+- Patch #1627441: close sockets properly in urllib2.
+
+- Bug #494589: make ntpath.expandvars behave according to its docstring.
+
+- Changed platform module API python_version_tuple() to actually
+  return a tuple (it used to return a list).
+
+- Added new platform module APIs python_branch(), python_revision(),
+  python_implementation() and linux_distribution().
+
+- Added support for IronPython and Jython to the platform module.
+
+- The sets module has been deprecated.  Use the built-in set/frozenset types
+  instead.
+
+- Bug #1610795: make ctypes.util.find_library work on BSD systems.
+
+- Fixes for 64-bit Windows: In ctypes.wintypes, correct the
+  definitions of HANDLE, WPARAM, LPARAM data types.  Make
+  parameterless foreign function calls work.
+
+- The version number of the ctypes package changed to "1.1.0".
+
 - Bug #1627575: logging: Added _open() method to FileHandler which can
   be used to reopen files. The FileHandler instance now saves the
   encoding (which can be None) in an attribute called "encoding".
@@ -284,10 +335,21 @@
 - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments
   were transposed.
 
+- idle: Honor the "Cancel" action in the save dialog (Debian bug #299092).
+
 
 Extension Modules
 -----------------
 
+- Bug #1486663: don't reject keyword arguments for subclasses of builtin
+  types.
+
+- Patch #1610575: The struct module now supports the 't' code, for
+  C99 _Bool.
+
+- Patch #1635058: ensure that htonl and friends never accept or
+  return negative numbers, per the underlying C implementation.
+
 - Patch #1544279: Improve thread-safety of the socket module by moving
   the sock_addr_t storage out of the socket object.
 
@@ -344,6 +406,8 @@
 Tests
 -----
 
+- Added a test for slicing of an exception.
+
 - Added test.test_support.EnvironmentVarGuard.  It's a class that provides a
   context manager so that one can temporarily set or unset environment
   variables.
@@ -360,9 +424,26 @@
   number properly.
 
 
+Tools
+-----
+
+- Added IronPython and Jython support to pybench (part of which
+  was patch #1563844)
+
+- Made some minor changes to pybench output to allow the user
+  to see which Python version is running pybench
+
+- Added support for the new platform module feature
+  platform.python_implementation(); this will now be saved
+  in the benchmark pickle
+
+
 Documentation
 -------------
 
+- Bug #1629125: fix wrong data type (int -> Py_ssize_t) in PyDict_Next
+  docs.
+
 - Bug #1565919: document set types in the Language Reference.
 
 - Bug #1546052: clarify that PyString_FromString(AndSize) copies the

Modified: python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/bcannon-objcap/Modules/_ctypes/_ctypes.c	Wed Jan 31 23:24:58 2007
@@ -4751,7 +4751,7 @@
 #endif
 	PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL));
 	PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI));
-	PyModule_AddStringConstant(m, "__version__", "1.0.1");
+	PyModule_AddStringConstant(m, "__version__", "1.1.0");
 
 	PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
 	PyModule_AddObject(m, "_memset_addr", PyLong_FromVoidPtr(memset));

Modified: python/branches/bcannon-objcap/Modules/_ctypes/_ctypes_test.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_ctypes/_ctypes_test.c	(original)
+++ python/branches/bcannon-objcap/Modules/_ctypes/_ctypes_test.c	Wed Jan 31 23:24:58 2007
@@ -68,22 +68,25 @@
 
 EXPORT(int) _testfunc_i_bhilfd(signed char b, short h, int i, long l, float f, double d)
 {
-//	printf("_testfunc_i_bhilfd got %d %d %d %ld %f %f\n",
-//	       b, h, i, l, f, d);
+/*	printf("_testfunc_i_bhilfd got %d %d %d %ld %f %f\n",
+	       b, h, i, l, f, d);
+*/
 	return (int)(b + h + i + l + f + d);
 }
 
 EXPORT(float) _testfunc_f_bhilfd(signed char b, short h, int i, long l, float f, double d)
 {
-//	printf("_testfunc_f_bhilfd got %d %d %d %ld %f %f\n",
-//	       b, h, i, l, f, d);
+/*	printf("_testfunc_f_bhilfd got %d %d %d %ld %f %f\n",
+	       b, h, i, l, f, d);
+*/
 	return (float)(b + h + i + l + f + d);
 }
 
 EXPORT(double) _testfunc_d_bhilfd(signed char b, short h, int i, long l, float f, double d)
 {
-//	printf("_testfunc_d_bhilfd got %d %d %d %ld %f %f\n",
-//	       b, h, i, l, f, d);
+/*	printf("_testfunc_d_bhilfd got %d %d %d %ld %f %f\n",
+	       b, h, i, l, f, d);
+*/
 	return (double)(b + h + i + l + f + d);
 }
 
@@ -378,8 +381,9 @@
 }
 
 PyMethodDef module_methods[] = {
-//	{"get_last_tf_arg_s", get_last_tf_arg_s, METH_NOARGS},
-//	{"get_last_tf_arg_u", get_last_tf_arg_u, METH_NOARGS},
+/*	{"get_last_tf_arg_s", get_last_tf_arg_s, METH_NOARGS},
+	{"get_last_tf_arg_u", get_last_tf_arg_u, METH_NOARGS},
+*/
 	{"func_si", py_func_si, METH_VARARGS},
 	{"func", py_func, METH_NOARGS},
 	{ NULL, NULL, 0, NULL},

Modified: python/branches/bcannon-objcap/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_ctypes/cfield.c	(original)
+++ python/branches/bcannon-objcap/Modules/_ctypes/cfield.c	Wed Jan 31 23:24:58 2007
@@ -1432,10 +1432,19 @@
 #endif
 
 #ifdef MS_WIN32
+/* We cannot use SysFreeString as the PyCObject_FromVoidPtr
+   because of different calling convention
+*/
+static void _my_SysFreeString(void *p)
+{
+	SysFreeString((BSTR)p);
+}
+
 static PyObject *
 BSTR_set(void *ptr, PyObject *value, unsigned size)
 {
 	BSTR bstr;
+	PyObject *result;
 
 	/* convert value into a PyUnicodeObject or NULL */
 	if (Py_None == value) {
@@ -1463,15 +1472,19 @@
 	} else
 		bstr = NULL;
 
-	/* free the previous contents, if any */
-	if (*(BSTR *)ptr)
-		SysFreeString(*(BSTR *)ptr);
-	
-	/* and store it */
-	*(BSTR *)ptr = bstr;
+	if (bstr) {
+		result = PyCObject_FromVoidPtr((void *)bstr, _my_SysFreeString);
+		if (result == NULL) {
+			SysFreeString(bstr);
+			return NULL;
+		}
+	} else {
+		result = Py_None;
+		Py_INCREF(result);
+	}
 
-	/* We don't need to keep any other object */
-	_RET(value);
+	*(BSTR *)ptr = bstr;
+	return result;
 }
 
 

Modified: python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffi.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffi.c	(original)
+++ python/branches/bcannon-objcap/Modules/_ctypes/libffi_msvc/ffi.c	Wed Jan 31 23:24:58 2007
@@ -224,7 +224,8 @@
 #else
     case FFI_SYSV:
       /*@-usedef@*/
-      return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes, 
+      /* Function call needs at least 40 bytes stack size, on win64 AMD64 */
+      return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes ? cif->bytes : 40,
 			   cif->flags, ecif.rvalue, fn);
       /*@=usedef@*/
       break;

Modified: python/branches/bcannon-objcap/Modules/_randommodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_randommodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/_randommodule.c	Wed Jan 31 23:24:58 2007
@@ -481,7 +481,7 @@
 	RandomObject *self;
 	PyObject *tmp;
 
-	if (!_PyArg_NoKeywords("Random()", kwds))
+	if (type == &Random_Type && !_PyArg_NoKeywords("Random()", kwds))
 		return NULL;
 
 	self = (RandomObject *)type->tp_alloc(type, 0);

Modified: python/branches/bcannon-objcap/Modules/_sqlite/cache.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/cache.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/cache.c	Wed Jan 31 23:24:58 2007
@@ -25,11 +25,11 @@
 #include <limits.h>
 
 /* only used internally */
-Node* new_node(PyObject* key, PyObject* data)
+pysqlite_Node* pysqlite_new_node(PyObject* key, PyObject* data)
 {
-    Node* node;
+    pysqlite_Node* node;
 
-    node = (Node*) (NodeType.tp_alloc(&NodeType, 0));
+    node = (pysqlite_Node*) (pysqlite_NodeType.tp_alloc(&pysqlite_NodeType, 0));
     if (!node) {
         return NULL;
     }
@@ -46,7 +46,7 @@
     return node;
 }
 
-void node_dealloc(Node* self)
+void pysqlite_node_dealloc(pysqlite_Node* self)
 {
     Py_DECREF(self->key);
     Py_DECREF(self->data);
@@ -54,7 +54,7 @@
     self->ob_type->tp_free((PyObject*)self);
 }
 
-int cache_init(Cache* self, PyObject* args, PyObject* kwargs)
+int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* factory;
     int size = 10;
@@ -86,10 +86,10 @@
     return 0;
 }
 
-void cache_dealloc(Cache* self)
+void pysqlite_cache_dealloc(pysqlite_Cache* self)
 {
-    Node* node;
-    Node* delete_node;
+    pysqlite_Node* node;
+    pysqlite_Node* delete_node;
 
     if (!self->factory) {
         /* constructor failed, just get out of here */
@@ -112,14 +112,14 @@
     self->ob_type->tp_free((PyObject*)self);
 }
 
-PyObject* cache_get(Cache* self, PyObject* args)
+PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
 {
     PyObject* key = args;
-    Node* node;
-    Node* ptr;
+    pysqlite_Node* node;
+    pysqlite_Node* ptr;
     PyObject* data;
 
-    node = (Node*)PyDict_GetItem(self->mapping, key);
+    node = (pysqlite_Node*)PyDict_GetItem(self->mapping, key);
     if (node) {
         /* an entry for this key already exists in the cache */
 
@@ -186,7 +186,7 @@
             return NULL;
         }
 
-        node = new_node(key, data);
+        node = pysqlite_new_node(key, data);
         if (!node) {
             return NULL;
         }
@@ -211,9 +211,9 @@
     return node->data;
 }
 
-PyObject* cache_display(Cache* self, PyObject* args)
+PyObject* pysqlite_cache_display(pysqlite_Cache* self, PyObject* args)
 {
-    Node* ptr;
+    pysqlite_Node* ptr;
     PyObject* prevkey;
     PyObject* nextkey;
     PyObject* fmt_args;
@@ -265,20 +265,20 @@
 }
 
 static PyMethodDef cache_methods[] = {
-    {"get", (PyCFunction)cache_get, METH_O,
+    {"get", (PyCFunction)pysqlite_cache_get, METH_O,
         PyDoc_STR("Gets an entry from the cache or calls the factory function to produce one.")},
-    {"display", (PyCFunction)cache_display, METH_NOARGS,
+    {"display", (PyCFunction)pysqlite_cache_display, METH_NOARGS,
         PyDoc_STR("For debugging only.")},
     {NULL, NULL}
 };
 
-PyTypeObject NodeType = {
+PyTypeObject pysqlite_NodeType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME "Node",                             /* tp_name */
-        sizeof(Node),                                   /* tp_basicsize */
+        sizeof(pysqlite_Node),                          /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)node_dealloc,                       /* tp_dealloc */
+        (destructor)pysqlite_node_dealloc,              /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -315,13 +315,13 @@
         0                                               /* tp_free */
 };
 
-PyTypeObject CacheType = {
+PyTypeObject pysqlite_CacheType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".Cache",                           /* tp_name */
-        sizeof(Cache),                                  /* tp_basicsize */
+        sizeof(pysqlite_Cache),                         /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)cache_dealloc,                      /* tp_dealloc */
+        (destructor)pysqlite_cache_dealloc,             /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -352,24 +352,24 @@
         0,                                              /* tp_descr_get */
         0,                                              /* tp_descr_set */
         0,                                              /* tp_dictoffset */
-        (initproc)cache_init,                           /* tp_init */
+        (initproc)pysqlite_cache_init,                  /* tp_init */
         0,                                              /* tp_alloc */
         0,                                              /* tp_new */
         0                                               /* tp_free */
 };
 
-extern int cache_setup_types(void)
+extern int pysqlite_cache_setup_types(void)
 {
     int rc;
 
-    NodeType.tp_new = PyType_GenericNew;
-    CacheType.tp_new = PyType_GenericNew;
+    pysqlite_NodeType.tp_new = PyType_GenericNew;
+    pysqlite_CacheType.tp_new = PyType_GenericNew;
 
-    rc = PyType_Ready(&NodeType);
+    rc = PyType_Ready(&pysqlite_NodeType);
     if (rc < 0) {
         return rc;
     }
 
-    rc = PyType_Ready(&CacheType);
+    rc = PyType_Ready(&pysqlite_CacheType);
     return rc;
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/cache.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/cache.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/cache.h	Wed Jan 31 23:24:58 2007
@@ -29,15 +29,15 @@
  * dictionary. The list items are of type 'Node' and the dictionary has the
  * nodes as values. */
 
-typedef struct _Node
+typedef struct _pysqlite_Node
 {
     PyObject_HEAD
     PyObject* key;
     PyObject* data;
     long count;
-    struct _Node* prev;
-    struct _Node* next;
-} Node;
+    struct _pysqlite_Node* prev;
+    struct _pysqlite_Node* next;
+} pysqlite_Node;
 
 typedef struct
 {
@@ -50,24 +50,24 @@
     /* the factory callable */
     PyObject* factory;
 
-    Node* first;
-    Node* last;
+    pysqlite_Node* first;
+    pysqlite_Node* last;
 
     /* if set, decrement the factory function when the Cache is deallocated.
      * this is almost always desirable, but not in the pysqlite context */
     int decref_factory;
-} Cache;
+} pysqlite_Cache;
 
-extern PyTypeObject NodeType;
-extern PyTypeObject CacheType;
+extern PyTypeObject pysqlite_NodeType;
+extern PyTypeObject pysqlite_CacheType;
 
-int node_init(Node* self, PyObject* args, PyObject* kwargs);
-void node_dealloc(Node* self);
+int pysqlite_node_init(pysqlite_Node* self, PyObject* args, PyObject* kwargs);
+void pysqlite_node_dealloc(pysqlite_Node* self);
 
-int cache_init(Cache* self, PyObject* args, PyObject* kwargs);
-void cache_dealloc(Cache* self);
-PyObject* cache_get(Cache* self, PyObject* args);
+int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs);
+void pysqlite_cache_dealloc(pysqlite_Cache* self);
+PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args);
 
-int cache_setup_types(void);
+int pysqlite_cache_setup_types(void);
 
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/connection.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/connection.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/connection.c	Wed Jan 31 23:24:58 2007
@@ -32,7 +32,7 @@
 
 #include "pythread.h"
 
-static int connection_set_isolation_level(Connection* self, PyObject* isolation_level);
+static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level);
 
 
 void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len)
@@ -43,11 +43,11 @@
 #if SQLITE_VERSION_NUMBER >= 3003003
     sqlite3_result_error(ctx, errmsg, len);
 #else
-    PyErr_SetString(OperationalError, errmsg);
+    PyErr_SetString(pysqlite_OperationalError, errmsg);
 #endif
 }
 
-int connection_init(Connection* self, PyObject* args, PyObject* kwargs)
+int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     static char *kwlist[] = {"database", "timeout", "detect_types", "isolation_level", "check_same_thread", "factory", "cached_statements", NULL, NULL};
 
@@ -82,7 +82,7 @@
     Py_END_ALLOW_THREADS
 
     if (rc != SQLITE_OK) {
-        _seterror(self->db);
+        _pysqlite_seterror(self->db);
         return -1;
     }
 
@@ -95,10 +95,10 @@
         Py_INCREF(isolation_level);
     }
     self->isolation_level = NULL;
-    connection_set_isolation_level(self, isolation_level);
+    pysqlite_connection_set_isolation_level(self, isolation_level);
     Py_DECREF(isolation_level);
 
-    self->statement_cache = (Cache*)PyObject_CallFunction((PyObject*)&CacheType, "Oi", self, cached_statements);
+    self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "Oi", self, cached_statements);
     if (PyErr_Occurred()) {
         return -1;
     }
@@ -135,41 +135,41 @@
         return -1;
     }
 
-    self->Warning = Warning;
-    self->Error = Error;
-    self->InterfaceError = InterfaceError;
-    self->DatabaseError = DatabaseError;
-    self->DataError = DataError;
-    self->OperationalError = OperationalError;
-    self->IntegrityError = IntegrityError;
-    self->InternalError = InternalError;
-    self->ProgrammingError = ProgrammingError;
-    self->NotSupportedError = NotSupportedError;
+    self->Warning               = pysqlite_Warning;
+    self->Error                 = pysqlite_Error;
+    self->InterfaceError        = pysqlite_InterfaceError;
+    self->DatabaseError         = pysqlite_DatabaseError;
+    self->DataError             = pysqlite_DataError;
+    self->OperationalError      = pysqlite_OperationalError;
+    self->IntegrityError        = pysqlite_IntegrityError;
+    self->InternalError         = pysqlite_InternalError;
+    self->ProgrammingError      = pysqlite_ProgrammingError;
+    self->NotSupportedError     = pysqlite_NotSupportedError;
 
     return 0;
 }
 
 /* Empty the entire statement cache of this connection */
-void flush_statement_cache(Connection* self)
+void pysqlite_flush_statement_cache(pysqlite_Connection* self)
 {
-    Node* node;
-    Statement* statement;
+    pysqlite_Node* node;
+    pysqlite_Statement* statement;
 
     node = self->statement_cache->first;
 
     while (node) {
-        statement = (Statement*)(node->data);
-        (void)statement_finalize(statement);
+        statement = (pysqlite_Statement*)(node->data);
+        (void)pysqlite_statement_finalize(statement);
         node = node->next;
     }
 
     Py_DECREF(self->statement_cache);
-    self->statement_cache = (Cache*)PyObject_CallFunction((PyObject*)&CacheType, "O", self);
+    self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "O", self);
     Py_DECREF(self);
     self->statement_cache->decref_factory = 0;
 }
 
-void reset_all_statements(Connection* self)
+void pysqlite_reset_all_statements(pysqlite_Connection* self)
 {
     int i;
     PyObject* weakref;
@@ -179,12 +179,12 @@
         weakref = PyList_GetItem(self->statements, i);
         statement = PyWeakref_GetObject(weakref);
         if (statement != Py_None) {
-            (void)statement_reset((Statement*)statement);
+            (void)pysqlite_statement_reset((pysqlite_Statement*)statement);
         }
     }
 }
 
-void connection_dealloc(Connection* self)
+void pysqlite_connection_dealloc(pysqlite_Connection* self)
 {
     Py_XDECREF(self->statement_cache);
 
@@ -208,7 +208,7 @@
     self->ob_type->tp_free((PyObject*)self);
 }
 
-PyObject* connection_cursor(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     static char *kwlist[] = {"factory", NULL, NULL};
     PyObject* factory = NULL;
@@ -220,34 +220,34 @@
         return NULL;
     }
 
-    if (!check_thread(self) || !check_connection(self)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
     if (factory == NULL) {
-        factory = (PyObject*)&CursorType;
+        factory = (PyObject*)&pysqlite_CursorType;
     }
 
     cursor = PyObject_CallFunction(factory, "O", self);
 
     if (cursor && self->row_factory != Py_None) {
-        Py_XDECREF(((Cursor*)cursor)->row_factory);
+        Py_XDECREF(((pysqlite_Cursor*)cursor)->row_factory);
         Py_INCREF(self->row_factory);
-        ((Cursor*)cursor)->row_factory = self->row_factory;
+        ((pysqlite_Cursor*)cursor)->row_factory = self->row_factory;
     }
 
     return cursor;
 }
 
-PyObject* connection_close(Connection* self, PyObject* args)
+PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
 {
     int rc;
 
-    if (!check_thread(self)) {
+    if (!pysqlite_check_thread(self)) {
         return NULL;
     }
 
-    flush_statement_cache(self);
+    pysqlite_flush_statement_cache(self);
 
     if (self->db) {
         Py_BEGIN_ALLOW_THREADS
@@ -255,7 +255,7 @@
         Py_END_ALLOW_THREADS
 
         if (rc != SQLITE_OK) {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
             return NULL;
         } else {
             self->db = NULL;
@@ -271,17 +271,17 @@
  *
  * 0 => error; 1 => ok
  */
-int check_connection(Connection* con)
+int pysqlite_check_connection(pysqlite_Connection* con)
 {
     if (!con->db) {
-        PyErr_SetString(ProgrammingError, "Cannot operate on a closed database.");
+        PyErr_SetString(pysqlite_ProgrammingError, "Cannot operate on a closed database.");
         return 0;
     } else {
         return 1;
     }
 }
 
-PyObject* _connection_begin(Connection* self)
+PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
 {
     int rc;
     const char* tail;
@@ -292,7 +292,7 @@
     Py_END_ALLOW_THREADS
 
     if (rc != SQLITE_OK) {
-        _seterror(self->db);
+        _pysqlite_seterror(self->db);
         goto error;
     }
 
@@ -300,7 +300,7 @@
     if (rc == SQLITE_DONE) {
         self->inTransaction = 1;
     } else {
-        _seterror(self->db);
+        _pysqlite_seterror(self->db);
     }
 
     Py_BEGIN_ALLOW_THREADS
@@ -308,7 +308,7 @@
     Py_END_ALLOW_THREADS
 
     if (rc != SQLITE_OK && !PyErr_Occurred()) {
-        _seterror(self->db);
+        _pysqlite_seterror(self->db);
     }
 
 error:
@@ -320,13 +320,13 @@
     }
 }
 
-PyObject* connection_commit(Connection* self, PyObject* args)
+PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args)
 {
     int rc;
     const char* tail;
     sqlite3_stmt* statement;
 
-    if (!check_thread(self) || !check_connection(self)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
@@ -335,7 +335,7 @@
         rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK) {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
             goto error;
         }
 
@@ -343,14 +343,14 @@
         if (rc == SQLITE_DONE) {
             self->inTransaction = 0;
         } else {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
         }
 
         Py_BEGIN_ALLOW_THREADS
         rc = sqlite3_finalize(statement);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK && !PyErr_Occurred()) {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
         }
 
     }
@@ -364,24 +364,24 @@
     }
 }
 
-PyObject* connection_rollback(Connection* self, PyObject* args)
+PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args)
 {
     int rc;
     const char* tail;
     sqlite3_stmt* statement;
 
-    if (!check_thread(self) || !check_connection(self)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         return NULL;
     }
 
     if (self->inTransaction) {
-        reset_all_statements(self);
+        pysqlite_reset_all_statements(self);
 
         Py_BEGIN_ALLOW_THREADS
         rc = sqlite3_prepare(self->db, "ROLLBACK", -1, &statement, &tail);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK) {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
             goto error;
         }
 
@@ -389,14 +389,14 @@
         if (rc == SQLITE_DONE) {
             self->inTransaction = 0;
         } else {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
         }
 
         Py_BEGIN_ALLOW_THREADS
         rc = sqlite3_finalize(statement);
         Py_END_ALLOW_THREADS
         if (rc != SQLITE_OK && !PyErr_Occurred()) {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
         }
 
     }
@@ -410,7 +410,7 @@
     }
 }
 
-void _set_result(sqlite3_context* context, PyObject* py_val)
+void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
 {
     long longval;
     const char* buffer;
@@ -445,7 +445,7 @@
     }
 }
 
-PyObject* _build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv)
+PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv)
 {
     PyObject* args;
     int i;
@@ -512,7 +512,7 @@
     return args;
 }
 
-void _func_callback(sqlite3_context* context, int argc, sqlite3_value** argv)
+void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** argv)
 {
     PyObject* args;
     PyObject* py_func;
@@ -524,14 +524,14 @@
 
     py_func = (PyObject*)sqlite3_user_data(context);
 
-    args = _build_py_params(context, argc, argv);
+    args = _pysqlite_build_py_params(context, argc, argv);
     if (args) {
         py_retval = PyObject_CallObject(py_func, args);
         Py_DECREF(args);
     }
 
     if (py_retval) {
-        _set_result(context, py_retval);
+        _pysqlite_set_result(context, py_retval);
         Py_DECREF(py_retval);
     } else {
         if (_enable_callback_tracebacks) {
@@ -545,7 +545,7 @@
     PyGILState_Release(threadstate);
 }
 
-static void _step_callback(sqlite3_context *context, int argc, sqlite3_value** params)
+static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_value** params)
 {
     PyObject* args;
     PyObject* function_result = NULL;
@@ -581,7 +581,7 @@
         goto error;
     }
 
-    args = _build_py_params(context, argc, params);
+    args = _pysqlite_build_py_params(context, argc, params);
     if (!args) {
         goto error;
     }
@@ -605,7 +605,7 @@
     PyGILState_Release(threadstate);
 }
 
-void _final_callback(sqlite3_context* context)
+void _pysqlite_final_callback(sqlite3_context* context)
 {
     PyObject* function_result = NULL;
     PyObject** aggregate_instance;
@@ -634,7 +634,7 @@
         }
         _sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1);
     } else {
-        _set_result(context, function_result);
+        _pysqlite_set_result(context, function_result);
     }
 
 error:
@@ -644,7 +644,7 @@
     PyGILState_Release(threadstate);
 }
 
-void _drop_unused_statement_references(Connection* self)
+void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)
 {
     PyObject* new_list;
     PyObject* weakref;
@@ -676,7 +676,7 @@
     self->statements = new_list;
 }
 
-PyObject* connection_create_function(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     static char *kwlist[] = {"name", "narg", "func", NULL, NULL};
 
@@ -691,11 +691,11 @@
         return NULL;
     }
 
-    rc = sqlite3_create_function(self->db, name, narg, SQLITE_UTF8, (void*)func, _func_callback, NULL, NULL);
+    rc = sqlite3_create_function(self->db, name, narg, SQLITE_UTF8, (void*)func, _pysqlite_func_callback, NULL, NULL);
 
     if (rc != SQLITE_OK) {
         /* Workaround for SQLite bug: no error code or string is available here */
-        PyErr_SetString(OperationalError, "Error creating function");
+        PyErr_SetString(pysqlite_OperationalError, "Error creating function");
         return NULL;
     } else {
         PyDict_SetItem(self->function_pinboard, func, Py_None);
@@ -705,7 +705,7 @@
     }
 }
 
-PyObject* connection_create_aggregate(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* aggregate_class;
 
@@ -719,10 +719,10 @@
         return NULL;
     }
 
-    rc = sqlite3_create_function(self->db, name, n_arg, SQLITE_UTF8, (void*)aggregate_class, 0, &_step_callback, &_final_callback);
+    rc = sqlite3_create_function(self->db, name, n_arg, SQLITE_UTF8, (void*)aggregate_class, 0, &_pysqlite_step_callback, &_pysqlite_final_callback);
     if (rc != SQLITE_OK) {
         /* Workaround for SQLite bug: no error code or string is available here */
-        PyErr_SetString(OperationalError, "Error creating aggregate");
+        PyErr_SetString(pysqlite_OperationalError, "Error creating aggregate");
         return NULL;
     } else {
         PyDict_SetItem(self->function_pinboard, aggregate_class, Py_None);
@@ -732,7 +732,7 @@
     }
 }
 
-int _authorizer_callback(void* user_arg, int action, const char* arg1, const char* arg2 , const char* dbname, const char* access_attempt_source)
+static int _authorizer_callback(void* user_arg, int action, const char* arg1, const char* arg2 , const char* dbname, const char* access_attempt_source)
 {
     PyObject *ret;
     int rc;
@@ -762,7 +762,7 @@
     return rc;
 }
 
-PyObject* connection_set_authorizer(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* authorizer_cb;
 
@@ -777,7 +777,7 @@
     rc = sqlite3_set_authorizer(self->db, _authorizer_callback, (void*)authorizer_cb);
 
     if (rc != SQLITE_OK) {
-        PyErr_SetString(OperationalError, "Error setting authorizer callback");
+        PyErr_SetString(pysqlite_OperationalError, "Error setting authorizer callback");
         return NULL;
     } else {
         PyDict_SetItem(self->function_pinboard, authorizer_cb, Py_None);
@@ -787,11 +787,11 @@
     }
 }
 
-int check_thread(Connection* self)
+int pysqlite_check_thread(pysqlite_Connection* self)
 {
     if (self->check_same_thread) {
         if (PyThread_get_thread_ident() != self->thread_ident) {
-            PyErr_Format(ProgrammingError,
+            PyErr_Format(pysqlite_ProgrammingError,
                         "SQLite objects created in a thread can only be used in that same thread."
                         "The object was created in thread id %ld and this is thread id %ld",
                         self->thread_ident, PyThread_get_thread_ident());
@@ -803,22 +803,22 @@
     return 1;
 }
 
-static PyObject* connection_get_isolation_level(Connection* self, void* unused)
+static PyObject* pysqlite_connection_get_isolation_level(pysqlite_Connection* self, void* unused)
 {
     Py_INCREF(self->isolation_level);
     return self->isolation_level;
 }
 
-static PyObject* connection_get_total_changes(Connection* self, void* unused)
+static PyObject* pysqlite_connection_get_total_changes(pysqlite_Connection* self, void* unused)
 {
-    if (!check_connection(self)) {
+    if (!pysqlite_check_connection(self)) {
         return NULL;
     } else {
         return Py_BuildValue("i", sqlite3_total_changes(self->db));
     }
 }
 
-static int connection_set_isolation_level(Connection* self, PyObject* isolation_level)
+static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level)
 {
     PyObject* res;
     PyObject* begin_statement;
@@ -834,7 +834,7 @@
         Py_INCREF(Py_None);
         self->isolation_level = Py_None;
 
-        res = connection_commit(self, NULL);
+        res = pysqlite_connection_commit(self, NULL);
         if (!res) {
             return -1;
         }
@@ -866,10 +866,10 @@
     return 0;
 }
 
-PyObject* connection_call(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* sql;
-    Statement* statement;
+    pysqlite_Statement* statement;
     PyObject* weakref;
     int rc;
 
@@ -877,22 +877,22 @@
         return NULL;
     }
 
-    _drop_unused_statement_references(self);
+    _pysqlite_drop_unused_statement_references(self);
 
-    statement = PyObject_New(Statement, &StatementType);
+    statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType);
     if (!statement) {
         return NULL;
     }
 
-    rc = statement_create(statement, self, sql);
+    rc = pysqlite_statement_create(statement, self, sql);
 
     if (rc != SQLITE_OK) {
         if (rc == PYSQLITE_TOO_MUCH_SQL) {
-            PyErr_SetString(Warning, "You can only execute one statement at a time.");
+            PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time.");
         } else if (rc == PYSQLITE_SQL_WRONG_TYPE) {
-            PyErr_SetString(Warning, "SQL is of wrong type. Must be string or unicode.");
+            PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string or unicode.");
         } else {
-            _seterror(self->db);
+            _pysqlite_seterror(self->db);
         }
 
         Py_DECREF(statement);
@@ -918,7 +918,7 @@
     return (PyObject*)statement;
 }
 
-PyObject* connection_execute(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* cursor = 0;
     PyObject* result = 0;
@@ -949,7 +949,7 @@
     return cursor;
 }
 
-PyObject* connection_executemany(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* cursor = 0;
     PyObject* result = 0;
@@ -980,7 +980,7 @@
     return cursor;
 }
 
-PyObject* connection_executescript(Connection* self, PyObject* args, PyObject* kwargs)
+PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* cursor = 0;
     PyObject* result = 0;
@@ -1014,7 +1014,7 @@
 /* ------------------------- COLLATION CODE ------------------------ */
 
 static int
-collation_callback(
+pysqlite_collation_callback(
         void* context,
         int text1_length, const void* text1_data,
         int text2_length, const void* text2_data)
@@ -1063,11 +1063,11 @@
 }
 
 static PyObject *
-connection_interrupt(Connection* self, PyObject* args)
+pysqlite_connection_interrupt(pysqlite_Connection* self, PyObject* args)
 {
     PyObject* retval = NULL;
 
-    if (!check_connection(self)) {
+    if (!pysqlite_check_connection(self)) {
         goto finally;
     }
 
@@ -1081,7 +1081,7 @@
 }
 
 static PyObject *
-connection_create_collation(Connection* self, PyObject* args)
+pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
 {
     PyObject* callable;
     PyObject* uppercase_name = 0;
@@ -1090,7 +1090,7 @@
     char* chk;
     int rc;
 
-    if (!check_thread(self) || !check_connection(self)) {
+    if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
         goto finally;
     }
 
@@ -1111,7 +1111,7 @@
         {
             chk++;
         } else {
-            PyErr_SetString(ProgrammingError, "invalid character in collation name");
+            PyErr_SetString(pysqlite_ProgrammingError, "invalid character in collation name");
             goto finally;
         }
     }
@@ -1131,10 +1131,10 @@
                                   PyString_AsString(uppercase_name),
                                   SQLITE_UTF8,
                                   (callable != Py_None) ? callable : NULL,
-                                  (callable != Py_None) ? collation_callback : NULL);
+                                  (callable != Py_None) ? pysqlite_collation_callback : NULL);
     if (rc != SQLITE_OK) {
         PyDict_DelItem(self->collations, uppercase_name);
-        _seterror(self->db);
+        _pysqlite_seterror(self->db);
         goto finally;
     }
 
@@ -1155,63 +1155,63 @@
 PyDoc_STR("SQLite database connection object.");
 
 static PyGetSetDef connection_getset[] = {
-    {"isolation_level",  (getter)connection_get_isolation_level, (setter)connection_set_isolation_level},
-    {"total_changes",  (getter)connection_get_total_changes, (setter)0},
+    {"isolation_level",  (getter)pysqlite_connection_get_isolation_level, (setter)pysqlite_connection_set_isolation_level},
+    {"total_changes",  (getter)pysqlite_connection_get_total_changes, (setter)0},
     {NULL}
 };
 
 static PyMethodDef connection_methods[] = {
-    {"cursor", (PyCFunction)connection_cursor, METH_VARARGS|METH_KEYWORDS,
+    {"cursor", (PyCFunction)pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS,
         PyDoc_STR("Return a cursor for the connection.")},
-    {"close", (PyCFunction)connection_close, METH_NOARGS,
+    {"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS,
         PyDoc_STR("Closes the connection.")},
-    {"commit", (PyCFunction)connection_commit, METH_NOARGS,
+    {"commit", (PyCFunction)pysqlite_connection_commit, METH_NOARGS,
         PyDoc_STR("Commit the current transaction.")},
-    {"rollback", (PyCFunction)connection_rollback, METH_NOARGS,
+    {"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS,
         PyDoc_STR("Roll back the current transaction.")},
-    {"create_function", (PyCFunction)connection_create_function, METH_VARARGS|METH_KEYWORDS,
+    {"create_function", (PyCFunction)pysqlite_connection_create_function, METH_VARARGS|METH_KEYWORDS,
         PyDoc_STR("Creates a new function. Non-standard.")},
-    {"create_aggregate", (PyCFunction)connection_create_aggregate, METH_VARARGS|METH_KEYWORDS,
+    {"create_aggregate", (PyCFunction)pysqlite_connection_create_aggregate, METH_VARARGS|METH_KEYWORDS,
         PyDoc_STR("Creates a new aggregate. Non-standard.")},
-    {"set_authorizer", (PyCFunction)connection_set_authorizer, METH_VARARGS|METH_KEYWORDS,
+    {"set_authorizer", (PyCFunction)pysqlite_connection_set_authorizer, METH_VARARGS|METH_KEYWORDS,
         PyDoc_STR("Sets authorizer callback. Non-standard.")},
-    {"execute", (PyCFunction)connection_execute, METH_VARARGS,
+    {"execute", (PyCFunction)pysqlite_connection_execute, METH_VARARGS,
         PyDoc_STR("Executes a SQL statement. Non-standard.")},
-    {"executemany", (PyCFunction)connection_executemany, METH_VARARGS,
+    {"executemany", (PyCFunction)pysqlite_connection_executemany, METH_VARARGS,
         PyDoc_STR("Repeatedly executes a SQL statement. Non-standard.")},
-    {"executescript", (PyCFunction)connection_executescript, METH_VARARGS,
+    {"executescript", (PyCFunction)pysqlite_connection_executescript, METH_VARARGS,
         PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")},
-    {"create_collation", (PyCFunction)connection_create_collation, METH_VARARGS,
+    {"create_collation", (PyCFunction)pysqlite_connection_create_collation, METH_VARARGS,
         PyDoc_STR("Creates a collation function. Non-standard.")},
-    {"interrupt", (PyCFunction)connection_interrupt, METH_NOARGS,
+    {"interrupt", (PyCFunction)pysqlite_connection_interrupt, METH_NOARGS,
         PyDoc_STR("Abort any pending database operation. Non-standard.")},
     {NULL, NULL}
 };
 
 static struct PyMemberDef connection_members[] =
 {
-    {"Warning", T_OBJECT, offsetof(Connection, Warning), RO},
-    {"Error", T_OBJECT, offsetof(Connection, Error), RO},
-    {"InterfaceError", T_OBJECT, offsetof(Connection, InterfaceError), RO},
-    {"DatabaseError", T_OBJECT, offsetof(Connection, DatabaseError), RO},
-    {"DataError", T_OBJECT, offsetof(Connection, DataError), RO},
-    {"OperationalError", T_OBJECT, offsetof(Connection, OperationalError), RO},
-    {"IntegrityError", T_OBJECT, offsetof(Connection, IntegrityError), RO},
-    {"InternalError", T_OBJECT, offsetof(Connection, InternalError), RO},
-    {"ProgrammingError", T_OBJECT, offsetof(Connection, ProgrammingError), RO},
-    {"NotSupportedError", T_OBJECT, offsetof(Connection, NotSupportedError), RO},
-    {"row_factory", T_OBJECT, offsetof(Connection, row_factory)},
-    {"text_factory", T_OBJECT, offsetof(Connection, text_factory)},
+    {"Warning", T_OBJECT, offsetof(pysqlite_Connection, Warning), RO},
+    {"Error", T_OBJECT, offsetof(pysqlite_Connection, Error), RO},
+    {"InterfaceError", T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), RO},
+    {"DatabaseError", T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), RO},
+    {"DataError", T_OBJECT, offsetof(pysqlite_Connection, DataError), RO},
+    {"OperationalError", T_OBJECT, offsetof(pysqlite_Connection, OperationalError), RO},
+    {"IntegrityError", T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), RO},
+    {"InternalError", T_OBJECT, offsetof(pysqlite_Connection, InternalError), RO},
+    {"ProgrammingError", T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), RO},
+    {"NotSupportedError", T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), RO},
+    {"row_factory", T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
+    {"text_factory", T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
     {NULL}
 };
 
-PyTypeObject ConnectionType = {
+PyTypeObject pysqlite_ConnectionType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".Connection",                      /* tp_name */
-        sizeof(Connection),                             /* tp_basicsize */
+        sizeof(pysqlite_Connection),                    /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)connection_dealloc,                 /* tp_dealloc */
+        (destructor)pysqlite_connection_dealloc,        /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -1221,7 +1221,7 @@
         0,                                              /* tp_as_sequence */
         0,                                              /* tp_as_mapping */
         0,                                              /* tp_hash */
-        (ternaryfunc)connection_call,                   /* tp_call */
+        (ternaryfunc)pysqlite_connection_call,          /* tp_call */
         0,                                              /* tp_str */
         0,                                              /* tp_getattro */
         0,                                              /* tp_setattro */
@@ -1242,14 +1242,14 @@
         0,                                              /* tp_descr_get */
         0,                                              /* tp_descr_set */
         0,                                              /* tp_dictoffset */
-        (initproc)connection_init,                      /* tp_init */
+        (initproc)pysqlite_connection_init,             /* tp_init */
         0,                                              /* tp_alloc */
         0,                                              /* tp_new */
         0                                               /* tp_free */
 };
 
-extern int connection_setup_types(void)
+extern int pysqlite_connection_setup_types(void)
 {
-    ConnectionType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&ConnectionType);
+    pysqlite_ConnectionType.tp_new = PyType_GenericNew;
+    return PyType_Ready(&pysqlite_ConnectionType);
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/connection.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/connection.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/connection.h	Wed Jan 31 23:24:58 2007
@@ -66,7 +66,7 @@
     /* thread identification of the thread the connection was created in */
     long thread_ident;
 
-    Cache* statement_cache;
+    pysqlite_Cache* statement_cache;
 
     /* A list of weak references to statements used within this connection */
     PyObject* statements;
@@ -106,24 +106,23 @@
     PyObject* InternalError;
     PyObject* ProgrammingError;
     PyObject* NotSupportedError;
-} Connection;
+} pysqlite_Connection;
 
-extern PyTypeObject ConnectionType;
+extern PyTypeObject pysqlite_ConnectionType;
 
-PyObject* connection_alloc(PyTypeObject* type, int aware);
-void connection_dealloc(Connection* self);
-PyObject* connection_cursor(Connection* self, PyObject* args, PyObject* kwargs);
-PyObject* connection_close(Connection* self, PyObject* args);
-PyObject* _connection_begin(Connection* self);
-PyObject* connection_begin(Connection* self, PyObject* args);
-PyObject* connection_commit(Connection* self, PyObject* args);
-PyObject* connection_rollback(Connection* self, PyObject* args);
-PyObject* connection_new(PyTypeObject* type, PyObject* args, PyObject* kw);
-int connection_init(Connection* self, PyObject* args, PyObject* kwargs);
+PyObject* pysqlite_connection_alloc(PyTypeObject* type, int aware);
+void pysqlite_connection_dealloc(pysqlite_Connection* self);
+PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);
+PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args);
+PyObject* _pysqlite_connection_begin(pysqlite_Connection* self);
+PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args);
+PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args);
+PyObject* pysqlite_connection_new(PyTypeObject* type, PyObject* args, PyObject* kw);
+int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);
 
-int check_thread(Connection* self);
-int check_connection(Connection* con);
+int pysqlite_check_thread(pysqlite_Connection* self);
+int pysqlite_check_connection(pysqlite_Connection* con);
 
-int connection_setup_types(void);
+int pysqlite_connection_setup_types(void);
 
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/cursor.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/cursor.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/cursor.c	Wed Jan 31 23:24:58 2007
@@ -34,9 +34,9 @@
 #define INT32_MAX 2147483647
 #endif
 
-PyObject* cursor_iternext(Cursor *self);
+PyObject* pysqlite_cursor_iternext(pysqlite_Cursor* self);
 
-static StatementKind detect_statement_type(char* statement)
+static pysqlite_StatementKind detect_statement_type(char* statement)
 {
     char buf[20];
     char* src;
@@ -74,11 +74,11 @@
     }
 }
 
-int cursor_init(Cursor* self, PyObject* args, PyObject* kwargs)
+int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs)
 {
-    Connection* connection;
+    pysqlite_Connection* connection;
 
-    if (!PyArg_ParseTuple(args, "O!", &ConnectionType, &connection))
+    if (!PyArg_ParseTuple(args, "O!", &pysqlite_ConnectionType, &connection))
     {
         return -1; 
     }
@@ -109,20 +109,20 @@
     Py_INCREF(Py_None);
     self->row_factory = Py_None;
 
-    if (!check_thread(self->connection)) {
+    if (!pysqlite_check_thread(self->connection)) {
         return -1;
     }
 
     return 0;
 }
 
-void cursor_dealloc(Cursor* self)
+void pysqlite_cursor_dealloc(pysqlite_Cursor* self)
 {
     int rc;
 
     /* Reset the statement if the user has not closed the cursor */
     if (self->statement) {
-        rc = statement_reset(self->statement);
+        rc = pysqlite_statement_reset(self->statement);
         Py_DECREF(self->statement);
     }
 
@@ -137,7 +137,7 @@
     self->ob_type->tp_free((PyObject*)self);
 }
 
-PyObject* _get_converter(PyObject* key)
+PyObject* _pysqlite_get_converter(PyObject* key)
 {
     PyObject* upcase_key;
     PyObject* retval;
@@ -153,7 +153,7 @@
     return retval;
 }
 
-int build_row_cast_map(Cursor* self)
+int pysqlite_build_row_cast_map(pysqlite_Cursor* self)
 {
     int i;
     const char* type_start = (const char*)-1;
@@ -175,7 +175,7 @@
     for (i = 0; i < sqlite3_column_count(self->statement->st); i++) {
         converter = NULL;
 
-        if (self->connection->detect_types | PARSE_COLNAMES) {
+        if (self->connection->detect_types & PARSE_COLNAMES) {
             colname = sqlite3_column_name(self->statement->st, i);
             if (colname) {
                 for (pos = colname; *pos != 0; pos++) {
@@ -190,7 +190,7 @@
                             break;
                         }
 
-                        converter = _get_converter(key);
+                        converter = _pysqlite_get_converter(key);
                         Py_DECREF(key);
                         break;
                     }
@@ -198,7 +198,7 @@
             }
         }
 
-        if (!converter && self->connection->detect_types | PARSE_DECLTYPES) {
+        if (!converter && self->connection->detect_types & PARSE_DECLTYPES) {
             decltype = sqlite3_column_decltype(self->statement->st, i);
             if (decltype) {
                 for (pos = decltype;;pos++) {
@@ -211,7 +211,7 @@
                     }
                 }
 
-                converter = _get_converter(py_decltype);
+                converter = _pysqlite_get_converter(py_decltype);
                 Py_DECREF(py_decltype);
             }
         }
@@ -234,7 +234,7 @@
     return 0;
 }
 
-PyObject* _build_column_name(const char* colname)
+PyObject* _pysqlite_build_column_name(const char* colname)
 {
     const char* pos;
 
@@ -253,7 +253,7 @@
     }
 }
 
-PyObject* unicode_from_string(const char* val_str, int optimize)
+PyObject* pysqlite_unicode_from_string(const char* val_str, int optimize)
 {
     const char* check;
     int is_ascii = 0;
@@ -285,7 +285,7 @@
  * Precondidition:
  * - sqlite3_step() has been called before and it returned SQLITE_ROW.
  */
-PyObject* _fetch_one_row(Cursor* self)
+PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
 {
     int i, numcols;
     PyObject* row;
@@ -356,10 +356,10 @@
             } else if (coltype == SQLITE_TEXT) {
                 val_str = (const char*)sqlite3_column_text(self->statement->st, i);
                 if ((self->connection->text_factory == (PyObject*)&PyUnicode_Type)
-                    || (self->connection->text_factory == OptimizedUnicode)) {
+                    || (self->connection->text_factory == pysqlite_OptimizedUnicode)) {
 
-                    converted = unicode_from_string(val_str,
-                        self->connection->text_factory == OptimizedUnicode ? 1 : 0);
+                    converted = pysqlite_unicode_from_string(val_str,
+                        self->connection->text_factory == pysqlite_OptimizedUnicode ? 1 : 0);
 
                     if (!converted) {
                         colname = sqlite3_column_name(self->statement->st, i);
@@ -368,7 +368,7 @@
                         }
                         PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column '%s' with text '%s'",
                                      colname , val_str);
-                        PyErr_SetString(OperationalError, buf);
+                        PyErr_SetString(pysqlite_OperationalError, buf);
                     }
                 } else if (self->connection->text_factory == (PyObject*)&PyString_Type) {
                     converted = PyString_FromString(val_str);
@@ -406,7 +406,7 @@
     return row;
 }
 
-PyObject* _query_execute(Cursor* self, int multiple, PyObject* args)
+PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
 {
     PyObject* operation;
     PyObject* operation_bytestr = NULL;
@@ -425,7 +425,7 @@
     PyObject* second_argument = NULL;
     long rowcount = 0;
 
-    if (!check_thread(self->connection) || !check_connection(self->connection)) {
+    if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) {
         return NULL;
     }
 
@@ -492,7 +492,7 @@
 
     if (self->statement != NULL) {
         /* There is an active statement */
-        rc = statement_reset(self->statement);
+        rc = pysqlite_statement_reset(self->statement);
     }
 
     if (PyString_Check(operation)) {
@@ -525,7 +525,7 @@
             case STATEMENT_INSERT:
             case STATEMENT_REPLACE:
                 if (!self->connection->inTransaction) {
-                    result = _connection_begin(self->connection);
+                    result = _pysqlite_connection_begin(self->connection);
                     if (!result) {
                         goto error;
                     }
@@ -536,7 +536,7 @@
                 /* it's a DDL statement or something similar
                    - we better COMMIT first so it works for all cases */
                 if (self->connection->inTransaction) {
-                    result = connection_commit(self->connection, NULL);
+                    result = pysqlite_connection_commit(self->connection, NULL);
                     if (!result) {
                         goto error;
                     }
@@ -545,7 +545,7 @@
                 break;
             case STATEMENT_SELECT:
                 if (multiple) {
-                    PyErr_SetString(ProgrammingError,
+                    PyErr_SetString(pysqlite_ProgrammingError,
                                 "You cannot execute SELECT statements in executemany().");
                     goto error;
                 }
@@ -563,11 +563,11 @@
     }
 
     if (self->statement) {
-        (void)statement_reset(self->statement);
+        (void)pysqlite_statement_reset(self->statement);
         Py_DECREF(self->statement);
     }
 
-    self->statement = (Statement*)cache_get(self->connection->statement_cache, func_args);
+    self->statement = (pysqlite_Statement*)pysqlite_cache_get(self->connection->statement_cache, func_args);
     Py_DECREF(func_args);
 
     if (!self->statement) {
@@ -576,19 +576,19 @@
 
     if (self->statement->in_use) {
         Py_DECREF(self->statement);
-        self->statement = PyObject_New(Statement, &StatementType);
+        self->statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType);
         if (!self->statement) {
             goto error;
         }
-        rc = statement_create(self->statement, self->connection, operation);
+        rc = pysqlite_statement_create(self->statement, self->connection, operation);
         if (rc != SQLITE_OK) {
             self->statement = 0;
             goto error;
         }
     }
 
-    statement_reset(self->statement);
-    statement_mark_dirty(self->statement);
+    pysqlite_statement_reset(self->statement);
+    pysqlite_statement_mark_dirty(self->statement);
 
     while (1) {
         parameters = PyIter_Next(parameters_iter);
@@ -596,27 +596,37 @@
             break;
         }
 
-        statement_mark_dirty(self->statement);
+        pysqlite_statement_mark_dirty(self->statement);
 
-        statement_bind_parameters(self->statement, parameters);
+        pysqlite_statement_bind_parameters(self->statement, parameters);
         if (PyErr_Occurred()) {
             goto error;
         }
 
-        if (build_row_cast_map(self) != 0) {
-            PyErr_SetString(OperationalError, "Error while building row_cast_map");
+        if (pysqlite_build_row_cast_map(self) != 0) {
+            PyErr_SetString(pysqlite_OperationalError, "Error while building row_cast_map");
             goto error;
         }
 
-        rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
-        if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
-            rc = statement_reset(self->statement);
+        /* Keep trying the SQL statement until the schema stops changing. */
+        while (1) {
+            /* Actually execute the SQL statement. */
+            rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
+            if (rc == SQLITE_DONE ||  rc == SQLITE_ROW) {
+                /* If it worked, let's get out of the loop */
+                break;
+            }
+            /* Something went wrong.  Re-set the statement and try again. */
+            rc = pysqlite_statement_reset(self->statement);
             if (rc == SQLITE_SCHEMA) {
-                rc = statement_recompile(self->statement, parameters);
+                /* If this was a result of the schema changing, let's try
+                   again. */
+                rc = pysqlite_statement_recompile(self->statement, parameters);
                 if (rc == SQLITE_OK) {
-                    rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
+                    continue;
                 } else {
-                    _seterror(self->connection->db);
+                    /* If the database gave us an error, promote it to Python. */
+                    _pysqlite_seterror(self->connection->db);
                     goto error;
                 }
             } else {
@@ -628,7 +638,7 @@
                         PyErr_Clear();
                     }
                 }
-                _seterror(self->connection->db);
+                _pysqlite_seterror(self->connection->db);
                 goto error;
             }
         }
@@ -649,7 +659,7 @@
                     if (!descriptor) {
                         goto error;
                     }
-                    PyTuple_SetItem(descriptor, 0, _build_column_name(sqlite3_column_name(self->statement->st, i)));
+                    PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i)));
                     Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None);
                     Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None);
                     Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None);
@@ -663,13 +673,13 @@
 
         if (rc == SQLITE_ROW) {
             if (multiple) {
-                PyErr_SetString(ProgrammingError, "executemany() can only execute DML statements.");
+                PyErr_SetString(pysqlite_ProgrammingError, "executemany() can only execute DML statements.");
                 goto error;
             }
 
-            self->next_row = _fetch_one_row(self);
+            self->next_row = _pysqlite_fetch_one_row(self);
         } else if (rc == SQLITE_DONE && !multiple) {
-            statement_reset(self->statement);
+            pysqlite_statement_reset(self->statement);
             Py_DECREF(self->statement);
             self->statement = 0;
         }
@@ -698,7 +708,7 @@
         }
 
         if (multiple) {
-            rc = statement_reset(self->statement);
+            rc = pysqlite_statement_reset(self->statement);
         }
         Py_XDECREF(parameters);
     }
@@ -717,17 +727,17 @@
     }
 }
 
-PyObject* cursor_execute(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_execute(pysqlite_Cursor* self, PyObject* args)
 {
-    return _query_execute(self, 0, args);
+    return _pysqlite_query_execute(self, 0, args);
 }
 
-PyObject* cursor_executemany(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_executemany(pysqlite_Cursor* self, PyObject* args)
 {
-    return _query_execute(self, 1, args);
+    return _pysqlite_query_execute(self, 1, args);
 }
 
-PyObject* cursor_executescript(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
 {
     PyObject* script_obj;
     PyObject* script_str = NULL;
@@ -741,7 +751,7 @@
         return NULL; 
     }
 
-    if (!check_thread(self->connection) || !check_connection(self->connection)) {
+    if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) {
         return NULL;
     }
 
@@ -760,7 +770,7 @@
     }
 
     /* commit first */
-    result = connection_commit(self->connection, NULL);
+    result = pysqlite_connection_commit(self->connection, NULL);
     if (!result) {
         goto error;
     }
@@ -778,7 +788,7 @@
                              &statement,
                              &script_cstr);
         if (rc != SQLITE_OK) {
-            _seterror(self->connection->db);
+            _pysqlite_seterror(self->connection->db);
             goto error;
         }
 
@@ -790,13 +800,13 @@
 
         if (rc != SQLITE_DONE) {
             (void)sqlite3_finalize(statement);
-            _seterror(self->connection->db);
+            _pysqlite_seterror(self->connection->db);
             goto error;
         }
 
         rc = sqlite3_finalize(statement);
         if (rc != SQLITE_OK) {
-            _seterror(self->connection->db);
+            _pysqlite_seterror(self->connection->db);
             goto error;
         }
     }
@@ -805,7 +815,7 @@
     Py_XDECREF(script_str);
 
     if (!statement_completed) {
-        PyErr_SetString(ProgrammingError, "you did not provide a complete SQL statement");
+        PyErr_SetString(pysqlite_ProgrammingError, "you did not provide a complete SQL statement");
     }
 
     if (PyErr_Occurred()) {
@@ -816,25 +826,25 @@
     }
 }
 
-PyObject* cursor_getiter(Cursor *self)
+PyObject* pysqlite_cursor_getiter(pysqlite_Cursor *self)
 {
     Py_INCREF(self);
     return (PyObject*)self;
 }
 
-PyObject* cursor_iternext(Cursor *self)
+PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self)
 {
     PyObject* next_row_tuple;
     PyObject* next_row;
     int rc;
 
-    if (!check_thread(self->connection) || !check_connection(self->connection)) {
+    if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) {
         return NULL;
     }
 
     if (!self->next_row) {
          if (self->statement) {
-            (void)statement_reset(self->statement);
+            (void)pysqlite_statement_reset(self->statement);
             Py_DECREF(self->statement);
             self->statement = NULL;
         }
@@ -851,25 +861,27 @@
         next_row = next_row_tuple;
     }
 
-    rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
-    if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
-        Py_DECREF(next_row);
-        _seterror(self->connection->db);
-        return NULL;
-    }
+    if (self->statement) {
+        rc = _sqlite_step_with_busyhandler(self->statement->st, self->connection);
+        if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
+            Py_DECREF(next_row);
+            _pysqlite_seterror(self->connection->db);
+            return NULL;
+        }
 
-    if (rc == SQLITE_ROW) {
-        self->next_row = _fetch_one_row(self);
+        if (rc == SQLITE_ROW) {
+            self->next_row = _pysqlite_fetch_one_row(self);
+        }
     }
 
     return next_row;
 }
 
-PyObject* cursor_fetchone(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args)
 {
     PyObject* row;
 
-    row = cursor_iternext(self);
+    row = pysqlite_cursor_iternext(self);
     if (!row && !PyErr_Occurred()) {
         Py_INCREF(Py_None);
         return Py_None;
@@ -878,7 +890,7 @@
     return row;
 }
 
-PyObject* cursor_fetchmany(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args)
 {
     PyObject* row;
     PyObject* list;
@@ -898,7 +910,7 @@
     row = Py_None;
 
     while (row) {
-        row = cursor_iternext(self);
+        row = pysqlite_cursor_iternext(self);
         if (row) {
             PyList_Append(list, row);
             Py_DECREF(row);
@@ -919,7 +931,7 @@
     }
 }
 
-PyObject* cursor_fetchall(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args)
 {
     PyObject* row;
     PyObject* list;
@@ -933,7 +945,7 @@
     row = (PyObject*)Py_None;
 
     while (row) {
-        row = cursor_iternext(self);
+        row = pysqlite_cursor_iternext(self);
         if (row) {
             PyList_Append(list, row);
             Py_DECREF(row);
@@ -948,21 +960,21 @@
     }
 }
 
-PyObject* pysqlite_noop(Connection* self, PyObject* args)
+PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args)
 {
     /* don't care, return None */
     Py_INCREF(Py_None);
     return Py_None;
 }
 
-PyObject* cursor_close(Cursor* self, PyObject* args)
+PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args)
 {
-    if (!check_thread(self->connection) || !check_connection(self->connection)) {
+    if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) {
         return NULL;
     }
 
     if (self->statement) {
-        (void)statement_reset(self->statement);
+        (void)pysqlite_statement_reset(self->statement);
         Py_DECREF(self->statement);
         self->statement = 0;
     }
@@ -972,19 +984,19 @@
 }
 
 static PyMethodDef cursor_methods[] = {
-    {"execute", (PyCFunction)cursor_execute, METH_VARARGS,
+    {"execute", (PyCFunction)pysqlite_cursor_execute, METH_VARARGS,
         PyDoc_STR("Executes a SQL statement.")},
-    {"executemany", (PyCFunction)cursor_executemany, METH_VARARGS,
+    {"executemany", (PyCFunction)pysqlite_cursor_executemany, METH_VARARGS,
         PyDoc_STR("Repeatedly executes a SQL statement.")},
-    {"executescript", (PyCFunction)cursor_executescript, METH_VARARGS,
+    {"executescript", (PyCFunction)pysqlite_cursor_executescript, METH_VARARGS,
         PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")},
-    {"fetchone", (PyCFunction)cursor_fetchone, METH_NOARGS,
+    {"fetchone", (PyCFunction)pysqlite_cursor_fetchone, METH_NOARGS,
         PyDoc_STR("Fetches several rows from the resultset.")},
-    {"fetchmany", (PyCFunction)cursor_fetchmany, METH_VARARGS,
+    {"fetchmany", (PyCFunction)pysqlite_cursor_fetchmany, METH_VARARGS,
         PyDoc_STR("Fetches all rows from the resultset.")},
-    {"fetchall", (PyCFunction)cursor_fetchall, METH_NOARGS,
+    {"fetchall", (PyCFunction)pysqlite_cursor_fetchall, METH_NOARGS,
         PyDoc_STR("Fetches one row from the resultset.")},
-    {"close", (PyCFunction)cursor_close, METH_NOARGS,
+    {"close", (PyCFunction)pysqlite_cursor_close, METH_NOARGS,
         PyDoc_STR("Closes the cursor.")},
     {"setinputsizes", (PyCFunction)pysqlite_noop, METH_VARARGS,
         PyDoc_STR("Required by DB-API. Does nothing in pysqlite.")},
@@ -995,25 +1007,25 @@
 
 static struct PyMemberDef cursor_members[] =
 {
-    {"connection", T_OBJECT, offsetof(Cursor, connection), RO},
-    {"description", T_OBJECT, offsetof(Cursor, description), RO},
-    {"arraysize", T_INT, offsetof(Cursor, arraysize), 0},
-    {"lastrowid", T_OBJECT, offsetof(Cursor, lastrowid), RO},
-    {"rowcount", T_OBJECT, offsetof(Cursor, rowcount), RO},
-    {"row_factory", T_OBJECT, offsetof(Cursor, row_factory), 0},
+    {"connection", T_OBJECT, offsetof(pysqlite_Cursor, connection), RO},
+    {"description", T_OBJECT, offsetof(pysqlite_Cursor, description), RO},
+    {"arraysize", T_INT, offsetof(pysqlite_Cursor, arraysize), 0},
+    {"lastrowid", T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), RO},
+    {"rowcount", T_OBJECT, offsetof(pysqlite_Cursor, rowcount), RO},
+    {"row_factory", T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0},
     {NULL}
 };
 
 static char cursor_doc[] =
 PyDoc_STR("SQLite database cursor class.");
 
-PyTypeObject CursorType = {
+PyTypeObject pysqlite_CursorType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".Cursor",                          /* tp_name */
-        sizeof(Cursor),                                 /* tp_basicsize */
+        sizeof(pysqlite_Cursor),                        /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)cursor_dealloc,                     /* tp_dealloc */
+        (destructor)pysqlite_cursor_dealloc,            /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -1034,8 +1046,8 @@
         0,                                              /* tp_clear */
         0,                                              /* tp_richcompare */
         0,                                              /* tp_weaklistoffset */
-        (getiterfunc)cursor_getiter,                    /* tp_iter */
-        (iternextfunc)cursor_iternext,                  /* tp_iternext */
+        (getiterfunc)pysqlite_cursor_getiter,           /* tp_iter */
+        (iternextfunc)pysqlite_cursor_iternext,         /* tp_iternext */
         cursor_methods,                                 /* tp_methods */
         cursor_members,                                 /* tp_members */
         0,                                              /* tp_getset */
@@ -1044,14 +1056,14 @@
         0,                                              /* tp_descr_get */
         0,                                              /* tp_descr_set */
         0,                                              /* tp_dictoffset */
-        (initproc)cursor_init,                          /* tp_init */
+        (initproc)pysqlite_cursor_init,                 /* tp_init */
         0,                                              /* tp_alloc */
         0,                                              /* tp_new */
         0                                               /* tp_free */
 };
 
-extern int cursor_setup_types(void)
+extern int pysqlite_cursor_setup_types(void)
 {
-    CursorType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&CursorType);
+    pysqlite_CursorType.tp_new = PyType_GenericNew;
+    return PyType_Ready(&pysqlite_CursorType);
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/cursor.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/cursor.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/cursor.h	Wed Jan 31 23:24:58 2007
@@ -32,40 +32,40 @@
 typedef struct
 {
     PyObject_HEAD
-    Connection* connection;
+    pysqlite_Connection* connection;
     PyObject* description;
     PyObject* row_cast_map;
     int arraysize;
     PyObject* lastrowid;
     PyObject* rowcount;
     PyObject* row_factory;
-    Statement* statement;
+    pysqlite_Statement* statement;
 
     /* the next row to be returned, NULL if no next row available */
     PyObject* next_row;
-} Cursor;
+} pysqlite_Cursor;
 
 typedef enum {
     STATEMENT_INVALID, STATEMENT_INSERT, STATEMENT_DELETE,
     STATEMENT_UPDATE, STATEMENT_REPLACE, STATEMENT_SELECT,
     STATEMENT_OTHER
-} StatementKind;
+} pysqlite_StatementKind;
 
-extern PyTypeObject CursorType;
+extern PyTypeObject pysqlite_CursorType;
 
-int cursor_init(Cursor* self, PyObject* args, PyObject* kwargs);
-void cursor_dealloc(Cursor* self);
-PyObject* cursor_execute(Cursor* self, PyObject* args);
-PyObject* cursor_executemany(Cursor* self, PyObject* args);
-PyObject* cursor_getiter(Cursor *self);
-PyObject* cursor_iternext(Cursor *self);
-PyObject* cursor_fetchone(Cursor* self, PyObject* args);
-PyObject* cursor_fetchmany(Cursor* self, PyObject* args);
-PyObject* cursor_fetchall(Cursor* self, PyObject* args);
-PyObject* pysqlite_noop(Connection* self, PyObject* args);
-PyObject* cursor_close(Cursor* self, PyObject* args);
+int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs);
+void pysqlite_cursor_dealloc(pysqlite_Cursor* self);
+PyObject* pysqlite_cursor_execute(pysqlite_Cursor* self, PyObject* args);
+PyObject* pysqlite_cursor_executemany(pysqlite_Cursor* self, PyObject* args);
+PyObject* pysqlite_cursor_getiter(pysqlite_Cursor *self);
+PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self);
+PyObject* pysqlite_cursor_fetchone(pysqlite_Cursor* self, PyObject* args);
+PyObject* pysqlite_cursor_fetchmany(pysqlite_Cursor* self, PyObject* args);
+PyObject* pysqlite_cursor_fetchall(pysqlite_Cursor* self, PyObject* args);
+PyObject* pysqlite_noop(pysqlite_Connection* self, PyObject* args);
+PyObject* pysqlite_cursor_close(pysqlite_Cursor* self, PyObject* args);
 
-int cursor_setup_types(void);
+int pysqlite_cursor_setup_types(void);
 
 #define UNKNOWN (-1)
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.c	Wed Jan 31 23:24:58 2007
@@ -57,7 +57,7 @@
     PyObject* key;
     int rc;
 
-    if (proto == NULL) proto = (PyObject*)&SQLitePrepareProtocolType;
+    if (proto == NULL) proto = (PyObject*)&pysqlite_PrepareProtocolType;
 
     key = Py_BuildValue("(OO)", (PyObject*)type, proto);
     if (!key) {
@@ -78,7 +78,7 @@
     PyObject *adapter, *key;
 
     /* we don't check for exact type conformance as specified in PEP 246
-       because the SQLitePrepareProtocolType type is abstract and there is no
+       because the pysqlite_PrepareProtocolType type is abstract and there is no
        way to get a quotable object to be its instance */
 
     /* look for an adapter in the registry */
@@ -125,17 +125,17 @@
     }
 
     /* else set the right exception and return NULL */
-    PyErr_SetString(ProgrammingError, "can't adapt");
+    PyErr_SetString(pysqlite_ProgrammingError, "can't adapt");
     return NULL;
 }
 
 /** module-level functions **/
 
 PyObject *
-psyco_microprotocols_adapt(Cursor *self, PyObject *args)
+psyco_microprotocols_adapt(pysqlite_Cursor *self, PyObject *args)
 {
     PyObject *obj, *alt = NULL;
-    PyObject *proto = (PyObject*)&SQLitePrepareProtocolType;
+    PyObject *proto = (PyObject*)&pysqlite_PrepareProtocolType;
 
     if (!PyArg_ParseTuple(args, "O|OO", &obj, &proto, &alt)) return NULL;
     return microprotocols_adapt(obj, proto, alt);

Modified: python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/microprotocols.h	Wed Jan 31 23:24:58 2007
@@ -52,7 +52,7 @@
     PyObject *obj, PyObject *proto, PyObject *alt);
 
 extern PyObject *
-    psyco_microprotocols_adapt(Cursor* self, PyObject *args);   
+    psyco_microprotocols_adapt(pysqlite_Cursor* self, PyObject *args);   
 #define psyco_microprotocols_adapt_doc \
     "adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."
 

Modified: python/branches/bcannon-objcap/Modules/_sqlite/module.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/module.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/module.c	Wed Jan 31 23:24:58 2007
@@ -35,9 +35,9 @@
 
 /* static objects at module-level */
 
-PyObject* Error, *Warning, *InterfaceError, *DatabaseError, *InternalError,
-    *OperationalError, *ProgrammingError, *IntegrityError, *DataError,
-    *NotSupportedError, *OptimizedUnicode;
+PyObject* pysqlite_Error, *pysqlite_Warning, *pysqlite_InterfaceError, *pysqlite_DatabaseError,
+    *pysqlite_InternalError, *pysqlite_OperationalError, *pysqlite_ProgrammingError,
+    *pysqlite_IntegrityError, *pysqlite_DataError, *pysqlite_NotSupportedError, *pysqlite_OptimizedUnicode;
 
 PyObject* converters;
 int _enable_callback_tracebacks;
@@ -67,7 +67,7 @@
     }
 
     if (factory == NULL) {
-        factory = (PyObject*)&ConnectionType;
+        factory = (PyObject*)&pysqlite_ConnectionType;
     }
 
     result = PyObject_Call(factory, args, kwargs);
@@ -115,7 +115,7 @@
     rc = sqlite3_enable_shared_cache(do_enable);
 
     if (rc != SQLITE_OK) {
-        PyErr_SetString(OperationalError, "Changing the shared_cache flag failed");
+        PyErr_SetString(pysqlite_OperationalError, "Changing the shared_cache flag failed");
         return NULL;
     } else {
         Py_INCREF(Py_None);
@@ -133,7 +133,7 @@
         return NULL;
     }
 
-    microprotocols_add(type, (PyObject*)&SQLitePrepareProtocolType, caster);
+    microprotocols_add(type, (PyObject*)&pysqlite_PrepareProtocolType, caster);
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -141,36 +141,29 @@
 
 static PyObject* module_register_converter(PyObject* self, PyObject* args, PyObject* kwargs)
 {
-    char* orig_name;
-    char* name = NULL;
-    char* c;
+    PyObject* orig_name;
+    PyObject* name = NULL;
     PyObject* callable;
     PyObject* retval = NULL;
 
-    if (!PyArg_ParseTuple(args, "sO", &orig_name, &callable)) {
+    if (!PyArg_ParseTuple(args, "SO", &orig_name, &callable)) {
         return NULL;
     }
 
-    /* convert the name to lowercase */
-    name = PyMem_Malloc(strlen(orig_name) + 2);
+    /* convert the name to upper case */
+    name = PyObject_CallMethod(orig_name, "upper", "");
     if (!name) {
         goto error;
     }
-    strcpy(name, orig_name);
-    for (c = name; *c != (char)0; c++) {
-        *c = (*c) & 0xDF;
-    }
 
-    if (PyDict_SetItemString(converters, name, callable) != 0) {
+    if (PyDict_SetItem(converters, name, callable) != 0) {
         goto error;
     }
 
     Py_INCREF(Py_None);
     retval = Py_None;
 error:
-    if (name) {
-        PyMem_Free(name);
-    }
+    Py_XDECREF(name);
     return retval;
 }
 
@@ -184,7 +177,7 @@
     return Py_None;
 }
 
-void converters_init(PyObject* dict)
+static void converters_init(PyObject* dict)
 {
     converters = PyDict_New();
     if (!converters) {
@@ -265,28 +258,28 @@
     module = Py_InitModule("_sqlite3", module_methods);
 
     if (!module ||
-        (row_setup_types() < 0) ||
-        (cursor_setup_types() < 0) ||
-        (connection_setup_types() < 0) ||
-        (cache_setup_types() < 0) ||
-        (statement_setup_types() < 0) ||
-        (prepare_protocol_setup_types() < 0)
+        (pysqlite_row_setup_types() < 0) ||
+        (pysqlite_cursor_setup_types() < 0) ||
+        (pysqlite_connection_setup_types() < 0) ||
+        (pysqlite_cache_setup_types() < 0) ||
+        (pysqlite_statement_setup_types() < 0) ||
+        (pysqlite_prepare_protocol_setup_types() < 0)
        ) {
         return;
     }
 
-    Py_INCREF(&ConnectionType);
-    PyModule_AddObject(module, "Connection", (PyObject*) &ConnectionType);
-    Py_INCREF(&CursorType);
-    PyModule_AddObject(module, "Cursor", (PyObject*) &CursorType);
-    Py_INCREF(&CacheType);
-    PyModule_AddObject(module, "Statement", (PyObject*)&StatementType);
-    Py_INCREF(&StatementType);
-    PyModule_AddObject(module, "Cache", (PyObject*) &CacheType);
-    Py_INCREF(&SQLitePrepareProtocolType);
-    PyModule_AddObject(module, "PrepareProtocol", (PyObject*) &SQLitePrepareProtocolType);
-    Py_INCREF(&RowType);
-    PyModule_AddObject(module, "Row", (PyObject*) &RowType);
+    Py_INCREF(&pysqlite_ConnectionType);
+    PyModule_AddObject(module, "Connection", (PyObject*) &pysqlite_ConnectionType);
+    Py_INCREF(&pysqlite_CursorType);
+    PyModule_AddObject(module, "Cursor", (PyObject*) &pysqlite_CursorType);
+    Py_INCREF(&pysqlite_CacheType);
+    PyModule_AddObject(module, "Statement", (PyObject*)&pysqlite_StatementType);
+    Py_INCREF(&pysqlite_StatementType);
+    PyModule_AddObject(module, "Cache", (PyObject*) &pysqlite_CacheType);
+    Py_INCREF(&pysqlite_PrepareProtocolType);
+    PyModule_AddObject(module, "PrepareProtocol", (PyObject*) &pysqlite_PrepareProtocolType);
+    Py_INCREF(&pysqlite_RowType);
+    PyModule_AddObject(module, "Row", (PyObject*) &pysqlite_RowType);
 
     if (!(dict = PyModule_GetDict(module))) {
         goto error;
@@ -294,67 +287,67 @@
 
     /*** Create DB-API Exception hierarchy */
 
-    if (!(Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_StandardError, NULL))) {
+    if (!(pysqlite_Error = PyErr_NewException(MODULE_NAME ".Error", PyExc_StandardError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "Error", Error);
+    PyDict_SetItemString(dict, "Error", pysqlite_Error);
 
-    if (!(Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_StandardError, NULL))) {
+    if (!(pysqlite_Warning = PyErr_NewException(MODULE_NAME ".Warning", PyExc_StandardError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "Warning", Warning);
+    PyDict_SetItemString(dict, "Warning", pysqlite_Warning);
 
     /* Error subclasses */
 
-    if (!(InterfaceError = PyErr_NewException(MODULE_NAME ".InterfaceError", Error, NULL))) {
+    if (!(pysqlite_InterfaceError = PyErr_NewException(MODULE_NAME ".InterfaceError", pysqlite_Error, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "InterfaceError", InterfaceError);
+    PyDict_SetItemString(dict, "InterfaceError", pysqlite_InterfaceError);
 
-    if (!(DatabaseError = PyErr_NewException(MODULE_NAME ".DatabaseError", Error, NULL))) {
+    if (!(pysqlite_DatabaseError = PyErr_NewException(MODULE_NAME ".DatabaseError", pysqlite_Error, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "DatabaseError", DatabaseError);
+    PyDict_SetItemString(dict, "DatabaseError", pysqlite_DatabaseError);
 
-    /* DatabaseError subclasses */
+    /* pysqlite_DatabaseError subclasses */
 
-    if (!(InternalError = PyErr_NewException(MODULE_NAME ".InternalError", DatabaseError, NULL))) {
+    if (!(pysqlite_InternalError = PyErr_NewException(MODULE_NAME ".InternalError", pysqlite_DatabaseError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "InternalError", InternalError);
+    PyDict_SetItemString(dict, "InternalError", pysqlite_InternalError);
 
-    if (!(OperationalError = PyErr_NewException(MODULE_NAME ".OperationalError", DatabaseError, NULL))) {
+    if (!(pysqlite_OperationalError = PyErr_NewException(MODULE_NAME ".OperationalError", pysqlite_DatabaseError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "OperationalError", OperationalError);
+    PyDict_SetItemString(dict, "OperationalError", pysqlite_OperationalError);
 
-    if (!(ProgrammingError = PyErr_NewException(MODULE_NAME ".ProgrammingError", DatabaseError, NULL))) {
+    if (!(pysqlite_ProgrammingError = PyErr_NewException(MODULE_NAME ".ProgrammingError", pysqlite_DatabaseError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "ProgrammingError", ProgrammingError);
+    PyDict_SetItemString(dict, "ProgrammingError", pysqlite_ProgrammingError);
 
-    if (!(IntegrityError = PyErr_NewException(MODULE_NAME ".IntegrityError", DatabaseError,NULL))) {
+    if (!(pysqlite_IntegrityError = PyErr_NewException(MODULE_NAME ".IntegrityError", pysqlite_DatabaseError,NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "IntegrityError", IntegrityError);
+    PyDict_SetItemString(dict, "IntegrityError", pysqlite_IntegrityError);
 
-    if (!(DataError = PyErr_NewException(MODULE_NAME ".DataError", DatabaseError, NULL))) {
+    if (!(pysqlite_DataError = PyErr_NewException(MODULE_NAME ".DataError", pysqlite_DatabaseError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "DataError", DataError);
+    PyDict_SetItemString(dict, "DataError", pysqlite_DataError);
 
-    if (!(NotSupportedError = PyErr_NewException(MODULE_NAME ".NotSupportedError", DatabaseError, NULL))) {
+    if (!(pysqlite_NotSupportedError = PyErr_NewException(MODULE_NAME ".NotSupportedError", pysqlite_DatabaseError, NULL))) {
         goto error;
     }
-    PyDict_SetItemString(dict, "NotSupportedError", NotSupportedError);
+    PyDict_SetItemString(dict, "NotSupportedError", pysqlite_NotSupportedError);
 
-    /* We just need "something" unique for OptimizedUnicode. It does not really
+    /* We just need "something" unique for pysqlite_OptimizedUnicode. It does not really
      * need to be a string subclass. Just anything that can act as a special
      * marker for us. So I pulled PyCell_Type out of my magic hat.
      */
     Py_INCREF((PyObject*)&PyCell_Type);
-    OptimizedUnicode = (PyObject*)&PyCell_Type;
-    PyDict_SetItemString(dict, "OptimizedUnicode", OptimizedUnicode);
+    pysqlite_OptimizedUnicode = (PyObject*)&PyCell_Type;
+    PyDict_SetItemString(dict, "OptimizedUnicode", pysqlite_OptimizedUnicode);
 
     /* Set integer constants */
     for (i = 0; _int_constants[i].constant_name != 0; i++) {

Modified: python/branches/bcannon-objcap/Modules/_sqlite/module.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/module.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/module.h	Wed Jan 31 23:24:58 2007
@@ -25,20 +25,20 @@
 #define PYSQLITE_MODULE_H
 #include "Python.h"
 
-#define PYSQLITE_VERSION "2.3.2"
+#define PYSQLITE_VERSION "2.3.3"
 
-extern PyObject* Error;
-extern PyObject* Warning;
-extern PyObject* InterfaceError;
-extern PyObject* DatabaseError;
-extern PyObject* InternalError;
-extern PyObject* OperationalError;
-extern PyObject* ProgrammingError;
-extern PyObject* IntegrityError;
-extern PyObject* DataError;
-extern PyObject* NotSupportedError;
+extern PyObject* pysqlite_Error;
+extern PyObject* pysqlite_Warning;
+extern PyObject* pysqlite_InterfaceError;
+extern PyObject* pysqlite_DatabaseError;
+extern PyObject* pysqlite_InternalError;
+extern PyObject* pysqlite_OperationalError;
+extern PyObject* pysqlite_ProgrammingError;
+extern PyObject* pysqlite_IntegrityError;
+extern PyObject* pysqlite_DataError;
+extern PyObject* pysqlite_NotSupportedError;
 
-extern PyObject* OptimizedUnicode;
+extern PyObject* pysqlite_OptimizedUnicode;
 
 /* the functions time.time() and time.sleep() */
 extern PyObject* time_time;

Modified: python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.c	Wed Jan 31 23:24:58 2007
@@ -23,23 +23,23 @@
 
 #include "prepare_protocol.h"
 
-int prepare_protocol_init(SQLitePrepareProtocol* self, PyObject* args, PyObject* kwargs)
+int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs)
 {
     return 0;
 }
 
-void prepare_protocol_dealloc(SQLitePrepareProtocol* self)
+void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self)
 {
     self->ob_type->tp_free((PyObject*)self);
 }
 
-PyTypeObject SQLitePrepareProtocolType= {
+PyTypeObject pysqlite_PrepareProtocolType= {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".PrepareProtocol",                 /* tp_name */
-        sizeof(SQLitePrepareProtocol),                  /* tp_basicsize */
+        sizeof(pysqlite_PrepareProtocol),               /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)prepare_protocol_dealloc,           /* tp_dealloc */
+        (destructor)pysqlite_prepare_protocol_dealloc,  /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -70,15 +70,15 @@
         0,                                              /* tp_descr_get */
         0,                                              /* tp_descr_set */
         0,                                              /* tp_dictoffset */
-        (initproc)prepare_protocol_init,                /* tp_init */
+        (initproc)pysqlite_prepare_protocol_init,       /* tp_init */
         0,                                              /* tp_alloc */
         0,                                              /* tp_new */
         0                                               /* tp_free */
 };
 
-extern int prepare_protocol_setup_types(void)
+extern int pysqlite_prepare_protocol_setup_types(void)
 {
-    SQLitePrepareProtocolType.tp_new = PyType_GenericNew;
-    SQLitePrepareProtocolType.ob_type= &PyType_Type;
-    return PyType_Ready(&SQLitePrepareProtocolType);
+    pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
+    pysqlite_PrepareProtocolType.ob_type= &PyType_Type;
+    return PyType_Ready(&pysqlite_PrepareProtocolType);
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/prepare_protocol.h	Wed Jan 31 23:24:58 2007
@@ -28,14 +28,14 @@
 typedef struct
 {
     PyObject_HEAD
-} SQLitePrepareProtocol;
+} pysqlite_PrepareProtocol;
 
-extern PyTypeObject SQLitePrepareProtocolType;
+extern PyTypeObject pysqlite_PrepareProtocolType;
 
-int prepare_protocol_init(SQLitePrepareProtocol* self, PyObject* args, PyObject* kwargs);
-void prepare_protocol_dealloc(SQLitePrepareProtocol* self);
+int pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol* self, PyObject* args, PyObject* kwargs);
+void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self);
 
-int prepare_protocol_setup_types(void);
+int pysqlite_prepare_protocol_setup_types(void);
 
 #define UNKNOWN (-1)
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/row.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/row.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/row.c	Wed Jan 31 23:24:58 2007
@@ -25,7 +25,7 @@
 #include "cursor.h"
 #include "sqlitecompat.h"
 
-void row_dealloc(Row* self)
+void pysqlite_row_dealloc(pysqlite_Row* self)
 {
     Py_XDECREF(self->data);
     Py_XDECREF(self->description);
@@ -33,10 +33,10 @@
     self->ob_type->tp_free((PyObject*)self);
 }
 
-int row_init(Row* self, PyObject* args, PyObject* kwargs)
+int pysqlite_row_init(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
 {
     PyObject* data;
-    Cursor* cursor;
+    pysqlite_Cursor* cursor;
 
     self->data = 0;
     self->description = 0;
@@ -45,7 +45,7 @@
         return -1;
     }
 
-    if (!PyObject_IsInstance((PyObject*)cursor, (PyObject*)&CursorType)) {
+    if (!PyObject_IsInstance((PyObject*)cursor, (PyObject*)&pysqlite_CursorType)) {
         PyErr_SetString(PyExc_TypeError, "instance of cursor required for first argument");
         return -1;
     }
@@ -64,7 +64,7 @@
     return 0;
 }
 
-PyObject* row_subscript(Row* self, PyObject* idx)
+PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
 {
     long _idx;
     char* key;
@@ -133,32 +133,63 @@
     }
 }
 
-Py_ssize_t row_length(Row* self, PyObject* args, PyObject* kwargs)
+Py_ssize_t pysqlite_row_length(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
 {
     return PyTuple_GET_SIZE(self->data);
 }
 
-static int row_print(Row* self, FILE *fp, int flags)
+PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
+{
+    PyObject* list;
+    int nitems, i;
+
+    list = PyList_New(0);
+    if (!list) {
+        return NULL;
+    }
+    nitems = PyTuple_Size(self->description);
+
+    for (i = 0; i < nitems; i++) {
+        if (PyList_Append(list, PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)) != 0) {
+            Py_DECREF(list);
+            return NULL;
+        }
+    }
+
+    return list;
+}
+
+static int pysqlite_row_print(pysqlite_Row* self, FILE *fp, int flags)
 {
     return (&PyTuple_Type)->tp_print(self->data, fp, flags);
 }
 
+static PyObject* pysqlite_iter(pysqlite_Row* self)
+{
+    return PyObject_GetIter(self->data);
+}
 
-PyMappingMethods row_as_mapping = {
-    /* mp_length        */ (lenfunc)row_length,
-    /* mp_subscript     */ (binaryfunc)row_subscript,
+PyMappingMethods pysqlite_row_as_mapping = {
+    /* mp_length        */ (lenfunc)pysqlite_row_length,
+    /* mp_subscript     */ (binaryfunc)pysqlite_row_subscript,
     /* mp_ass_subscript */ (objobjargproc)0,
 };
 
+static PyMethodDef pysqlite_row_methods[] = {
+    {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
+        PyDoc_STR("Returns the keys of the row.")},
+    {NULL, NULL}
+};
+
 
-PyTypeObject RowType = {
+PyTypeObject pysqlite_RowType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".Row",                             /* tp_name */
-        sizeof(Row),                                    /* tp_basicsize */
+        sizeof(pysqlite_Row),                           /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)row_dealloc,                        /* tp_dealloc */
-        (printfunc)row_print,                           /* tp_print */
+        (destructor)pysqlite_row_dealloc,               /* tp_dealloc */
+        (printfunc)pysqlite_row_print,                  /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
         0,                                              /* tp_compare */
@@ -174,13 +205,13 @@
         0,                                              /* tp_as_buffer */
         Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,         /* tp_flags */
         0,                                              /* tp_doc */
-        0,                                              /* tp_traverse */
+        (traverseproc)0,                                /* tp_traverse */
         0,                                              /* tp_clear */
         0,                                              /* tp_richcompare */
         0,                                              /* tp_weaklistoffset */
-        0,                                              /* tp_iter */
+        (getiterfunc)pysqlite_iter,                     /* tp_iter */
         0,                                              /* tp_iternext */
-        0,                                              /* tp_methods */
+        pysqlite_row_methods,                           /* tp_methods */
         0,                                              /* tp_members */
         0,                                              /* tp_getset */
         0,                                              /* tp_base */
@@ -188,15 +219,15 @@
         0,                                              /* tp_descr_get */
         0,                                              /* tp_descr_set */
         0,                                              /* tp_dictoffset */
-        (initproc)row_init,                             /* tp_init */
+        (initproc)pysqlite_row_init,                    /* tp_init */
         0,                                              /* tp_alloc */
         0,                                              /* tp_new */
         0                                               /* tp_free */
 };
 
-extern int row_setup_types(void)
+extern int pysqlite_row_setup_types(void)
 {
-    RowType.tp_new = PyType_GenericNew;
-    RowType.tp_as_mapping = &row_as_mapping;
-    return PyType_Ready(&RowType);
+    pysqlite_RowType.tp_new = PyType_GenericNew;
+    pysqlite_RowType.tp_as_mapping = &pysqlite_row_as_mapping;
+    return PyType_Ready(&pysqlite_RowType);
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/row.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/row.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/row.h	Wed Jan 31 23:24:58 2007
@@ -30,10 +30,10 @@
     PyObject_HEAD
     PyObject* data;
     PyObject* description;
-} Row;
+} pysqlite_Row;
 
-extern PyTypeObject RowType;
+extern PyTypeObject pysqlite_RowType;
 
-int row_setup_types(void);
+int pysqlite_row_setup_types(void);
 
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/statement.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/statement.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/statement.c	Wed Jan 31 23:24:58 2007
@@ -29,7 +29,7 @@
 #include "sqlitecompat.h"
 
 /* prototypes */
-int check_remaining_sql(const char* tail);
+static int pysqlite_check_remaining_sql(const char* tail);
 
 typedef enum {
     LINECOMMENT_1,
@@ -40,7 +40,7 @@
     NORMAL
 } parse_remaining_sql_state;
 
-int statement_create(Statement* self, Connection* connection, PyObject* sql)
+int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* connection, PyObject* sql)
 {
     const char* tail;
     int rc;
@@ -77,7 +77,7 @@
 
     self->db = connection->db;
 
-    if (rc == SQLITE_OK && check_remaining_sql(tail)) {
+    if (rc == SQLITE_OK && pysqlite_check_remaining_sql(tail)) {
         (void)sqlite3_finalize(self->st);
         self->st = NULL;
         rc = PYSQLITE_TOO_MUCH_SQL;
@@ -86,7 +86,7 @@
     return rc;
 }
 
-int statement_bind_parameter(Statement* self, int pos, PyObject* parameter)
+int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter)
 {
     int rc = SQLITE_OK;
     long longval;
@@ -133,7 +133,7 @@
     return rc;
 }
 
-void statement_bind_parameters(Statement* self, PyObject* parameters)
+void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters)
 {
     PyObject* current_param;
     PyObject* adapted;
@@ -154,19 +154,19 @@
             binding_name = sqlite3_bind_parameter_name(self->st, i);
             Py_END_ALLOW_THREADS
             if (!binding_name) {
-                PyErr_Format(ProgrammingError, "Binding %d has no name, but you supplied a dictionary (which has only names).", i);
+                PyErr_Format(pysqlite_ProgrammingError, "Binding %d has no name, but you supplied a dictionary (which has only names).", i);
                 return;
             }
 
             binding_name++; /* skip first char (the colon) */
             current_param = PyDict_GetItemString(parameters, binding_name);
             if (!current_param) {
-                PyErr_Format(ProgrammingError, "You did not supply a value for binding %d.", i);
+                PyErr_Format(pysqlite_ProgrammingError, "You did not supply a value for binding %d.", i);
                 return;
             }
 
             Py_INCREF(current_param);
-            adapted = microprotocols_adapt(current_param, (PyObject*)&SQLitePrepareProtocolType, NULL);
+            adapted = microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, NULL);
             if (adapted) {
                 Py_DECREF(current_param);
             } else {
@@ -174,11 +174,11 @@
                 adapted = current_param;
             }
 
-            rc = statement_bind_parameter(self, i, adapted);
+            rc = pysqlite_statement_bind_parameter(self, i, adapted);
             Py_DECREF(adapted);
 
             if (rc != SQLITE_OK) {
-                PyErr_Format(InterfaceError, "Error binding parameter :%s - probably unsupported type.", binding_name);
+                PyErr_Format(pysqlite_InterfaceError, "Error binding parameter :%s - probably unsupported type.", binding_name);
                 return;
            }
         }
@@ -186,7 +186,7 @@
         /* parameters passed as sequence */
         num_params = PySequence_Length(parameters);
         if (num_params != num_params_needed) {
-            PyErr_Format(ProgrammingError, "Incorrect number of bindings supplied. The current statement uses %d, and there are %d supplied.",
+            PyErr_Format(pysqlite_ProgrammingError, "Incorrect number of bindings supplied. The current statement uses %d, and there are %d supplied.",
                          num_params_needed, num_params);
             return;
         }
@@ -195,7 +195,7 @@
             if (!current_param) {
                 return;
             }
-            adapted = microprotocols_adapt(current_param, (PyObject*)&SQLitePrepareProtocolType, NULL);
+            adapted = microprotocols_adapt(current_param, (PyObject*)&pysqlite_PrepareProtocolType, NULL);
 
             if (adapted) {
                 Py_DECREF(current_param);
@@ -204,18 +204,18 @@
                 adapted = current_param;
             }
 
-            rc = statement_bind_parameter(self, i + 1, adapted);
+            rc = pysqlite_statement_bind_parameter(self, i + 1, adapted);
             Py_DECREF(adapted);
 
             if (rc != SQLITE_OK) {
-                PyErr_Format(InterfaceError, "Error binding parameter %d - probably unsupported type.", i);
+                PyErr_Format(pysqlite_InterfaceError, "Error binding parameter %d - probably unsupported type.", i);
                 return;
             }
         }
     }
 }
 
-int statement_recompile(Statement* self, PyObject* params)
+int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
 {
     const char* tail;
     int rc;
@@ -250,7 +250,7 @@
     return rc;
 }
 
-int statement_finalize(Statement* self)
+int pysqlite_statement_finalize(pysqlite_Statement* self)
 {
     int rc;
 
@@ -267,7 +267,7 @@
     return rc;
 }
 
-int statement_reset(Statement* self)
+int pysqlite_statement_reset(pysqlite_Statement* self)
 {
     int rc;
 
@@ -286,12 +286,12 @@
     return rc;
 }
 
-void statement_mark_dirty(Statement* self)
+void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
 {
     self->in_use = 1;
 }
 
-void statement_dealloc(Statement* self)
+void pysqlite_statement_dealloc(pysqlite_Statement* self)
 {
     int rc;
 
@@ -320,7 +320,7 @@
  *
  * Returns 1 if there is more left than should be. 0 if ok.
  */
-int check_remaining_sql(const char* tail)
+static int pysqlite_check_remaining_sql(const char* tail)
 {
     const char* pos = tail;
 
@@ -382,13 +382,13 @@
     return 0;
 }
 
-PyTypeObject StatementType = {
+PyTypeObject pysqlite_StatementType = {
         PyObject_HEAD_INIT(NULL)
         0,                                              /* ob_size */
         MODULE_NAME ".Statement",                       /* tp_name */
-        sizeof(Statement),                              /* tp_basicsize */
+        sizeof(pysqlite_Statement),                     /* tp_basicsize */
         0,                                              /* tp_itemsize */
-        (destructor)statement_dealloc,                  /* tp_dealloc */
+        (destructor)pysqlite_statement_dealloc,         /* tp_dealloc */
         0,                                              /* tp_print */
         0,                                              /* tp_getattr */
         0,                                              /* tp_setattr */
@@ -408,7 +408,7 @@
         0,                                              /* tp_traverse */
         0,                                              /* tp_clear */
         0,                                              /* tp_richcompare */
-        offsetof(Statement, in_weakreflist),            /* tp_weaklistoffset */
+        offsetof(pysqlite_Statement, in_weakreflist),   /* tp_weaklistoffset */
         0,                                              /* tp_iter */
         0,                                              /* tp_iternext */
         0,                                              /* tp_methods */
@@ -425,8 +425,8 @@
         0                                               /* tp_free */
 };
 
-extern int statement_setup_types(void)
+extern int pysqlite_statement_setup_types(void)
 {
-    StatementType.tp_new = PyType_GenericNew;
-    return PyType_Ready(&StatementType);
+    pysqlite_StatementType.tp_new = PyType_GenericNew;
+    return PyType_Ready(&pysqlite_StatementType);
 }

Modified: python/branches/bcannon-objcap/Modules/_sqlite/statement.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/statement.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/statement.h	Wed Jan 31 23:24:58 2007
@@ -39,21 +39,21 @@
     PyObject* sql;
     int in_use;
     PyObject* in_weakreflist; /* List of weak references */
-} Statement;
+} pysqlite_Statement;
 
-extern PyTypeObject StatementType;
+extern PyTypeObject pysqlite_StatementType;
 
-int statement_create(Statement* self, Connection* connection, PyObject* sql);
-void statement_dealloc(Statement* self);
+int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* connection, PyObject* sql);
+void pysqlite_statement_dealloc(pysqlite_Statement* self);
 
-int statement_bind_parameter(Statement* self, int pos, PyObject* parameter);
-void statement_bind_parameters(Statement* self, PyObject* parameters);
+int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter);
+void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters);
 
-int statement_recompile(Statement* self, PyObject* parameters);
-int statement_finalize(Statement* self);
-int statement_reset(Statement* self);
-void statement_mark_dirty(Statement* self);
+int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* parameters);
+int pysqlite_statement_finalize(pysqlite_Statement* self);
+int pysqlite_statement_reset(pysqlite_Statement* self);
+void pysqlite_statement_mark_dirty(pysqlite_Statement* self);
 
-int statement_setup_types(void);
+int pysqlite_statement_setup_types(void);
 
 #endif

Modified: python/branches/bcannon-objcap/Modules/_sqlite/util.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/util.c	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/util.c	Wed Jan 31 23:24:58 2007
@@ -24,8 +24,7 @@
 #include "module.h"
 #include "connection.h"
 
-int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, Connection* connection
-)
+int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* connection)
 {
     int rc;
 
@@ -40,7 +39,7 @@
  * Checks the SQLite error code and sets the appropriate DB-API exception.
  * Returns the error code (0 means no error occurred).
  */
-int _seterror(sqlite3* db)
+int _pysqlite_seterror(sqlite3* db)
 {
     int errorcode;
 
@@ -53,7 +52,7 @@
             break;
         case SQLITE_INTERNAL:
         case SQLITE_NOTFOUND:
-            PyErr_SetString(InternalError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_InternalError, sqlite3_errmsg(db));
             break;
         case SQLITE_NOMEM:
             (void)PyErr_NoMemory();
@@ -71,23 +70,23 @@
         case SQLITE_PROTOCOL:
         case SQLITE_EMPTY:
         case SQLITE_SCHEMA:
-            PyErr_SetString(OperationalError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_OperationalError, sqlite3_errmsg(db));
             break;
         case SQLITE_CORRUPT:
-            PyErr_SetString(DatabaseError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_DatabaseError, sqlite3_errmsg(db));
             break;
         case SQLITE_TOOBIG:
-            PyErr_SetString(DataError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_DataError, sqlite3_errmsg(db));
             break;
         case SQLITE_CONSTRAINT:
         case SQLITE_MISMATCH:
-            PyErr_SetString(IntegrityError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_IntegrityError, sqlite3_errmsg(db));
             break;
         case SQLITE_MISUSE:
-            PyErr_SetString(ProgrammingError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_ProgrammingError, sqlite3_errmsg(db));
             break;
         default:
-            PyErr_SetString(DatabaseError, sqlite3_errmsg(db));
+            PyErr_SetString(pysqlite_DatabaseError, sqlite3_errmsg(db));
             break;
     }
 

Modified: python/branches/bcannon-objcap/Modules/_sqlite/util.h
==============================================================================
--- python/branches/bcannon-objcap/Modules/_sqlite/util.h	(original)
+++ python/branches/bcannon-objcap/Modules/_sqlite/util.h	Wed Jan 31 23:24:58 2007
@@ -28,11 +28,11 @@
 #include "sqlite3.h"
 #include "connection.h"
 
-int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, Connection* connection);
+int _sqlite_step_with_busyhandler(sqlite3_stmt* statement, pysqlite_Connection* connection);
 
 /**
  * Checks the SQLite error code and sets the appropriate DB-API exception.
  * Returns the error code (0 means no error occurred).
  */
-int _seterror(sqlite3* db);
+int _pysqlite_seterror(sqlite3* db);
 #endif

Modified: python/branches/bcannon-objcap/Modules/_struct.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/_struct.c	(original)
+++ python/branches/bcannon-objcap/Modules/_struct.c	Wed Jan 31 23:24:58 2007
@@ -104,6 +104,15 @@
 #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG))
 #endif
 
+#ifdef HAVE_C99_BOOL
+#define BOOL_TYPE _Bool
+typedef struct { char c; _Bool x; } s_bool;
+#define BOOL_ALIGN (sizeof(s_bool) - sizeof(BOOL_TYPE))
+#else
+#define BOOL_TYPE char
+#define BOOL_ALIGN 0
+#endif
+
 #define STRINGIFY(x)    #x
 
 #ifdef __powerc
@@ -536,6 +545,15 @@
 #endif
 
 static PyObject *
+nu_bool(const char *p, const formatdef *f)
+{
+	BOOL_TYPE x;
+	memcpy((char *)&x, p, sizeof x);
+	return PyBool_FromLong(x != 0);
+}
+
+
+static PyObject *
 nu_float(const char *p, const formatdef *f)
 {
 	float x;
@@ -711,6 +729,16 @@
 }
 #endif
 
+
+static int
+np_bool(char *p, PyObject *v, const formatdef *f)
+{
+	BOOL_TYPE y; 
+	y = PyObject_IsTrue(v);
+	memcpy(p, (char *)&y, sizeof y);
+	return 0;
+}
+
 static int
 np_float(char *p, PyObject *v, const formatdef *f)
 {
@@ -771,6 +799,7 @@
 	{'q',	sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong},
 	{'Q',	sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong},
 #endif
+	{'t',	sizeof(BOOL_TYPE),	BOOL_ALIGN,	nu_bool,	np_bool},
 	{'f',	sizeof(float),	FLOAT_ALIGN,	nu_float,	np_float},
 	{'d',	sizeof(double),	DOUBLE_ALIGN,	nu_double,	np_double},
 	{'P',	sizeof(void *),	VOID_P_ALIGN,	nu_void_p,	np_void_p},
@@ -865,6 +894,14 @@
 	return unpack_double(p, 0);
 }
 
+static PyObject *
+bu_bool(const char *p, const formatdef *f)
+{
+	char x;
+	memcpy((char *)&x, p, sizeof x);
+	return PyBool_FromLong(x != 0);
+}
+
 static int
 bp_int(char *p, PyObject *v, const formatdef *f)
 {
@@ -969,6 +1006,15 @@
 	return _PyFloat_Pack8(x, (unsigned char *)p, 0);
 }
 
+static int
+bp_bool(char *p, PyObject *v, const formatdef *f)
+{
+	char y; 
+	y = PyObject_IsTrue(v);
+	memcpy(p, (char *)&y, sizeof y);
+	return 0;
+}
+
 static formatdef bigendian_table[] = {
 	{'x',	1,		0,		NULL},
 #ifdef PY_STRUCT_OVERFLOW_MASKING
@@ -990,6 +1036,7 @@
 	{'L',	4,		0,		bu_uint,	bp_uint},
 	{'q',	8,		0,		bu_longlong,	bp_longlong},
 	{'Q',	8,		0,		bu_ulonglong,	bp_ulonglong},
+	{'t',	1,		0,		bu_bool,	bp_bool},
 	{'f',	4,		0,		bu_float,	bp_float},
 	{'d',	8,		0,		bu_double,	bp_double},
 	{0}
@@ -1208,6 +1255,8 @@
 	{'L',	4,		0,		lu_uint,	lp_uint},
 	{'q',	8,		0,		lu_longlong,	lp_longlong},
 	{'Q',	8,		0,		lu_ulonglong,	lp_ulonglong},
+	{'t',	1,		0,		bu_bool,	bp_bool}, /* Std rep not endian dep,
+		but potentially different from native rep -- reuse bx_bool funcs. */
 	{'f',	4,		0,		lu_float,	lp_float},
 	{'d',	8,		0,		lu_double,	lp_double},
 	{0}

Modified: python/branches/bcannon-objcap/Modules/arraymodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/arraymodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/arraymodule.c	Wed Jan 31 23:24:58 2007
@@ -1797,7 +1797,7 @@
 	PyObject *initial = NULL, *it = NULL;
 	struct arraydescr *descr;
 	
-	if (!_PyArg_NoKeywords("array.array()", kwds))
+	if (type == &Arraytype && !_PyArg_NoKeywords("array.array()", kwds))
 		return NULL;
 
 	if (!PyArg_ParseTuple(args, "c|O:array", &c, &initial))

Modified: python/branches/bcannon-objcap/Modules/collectionsmodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/collectionsmodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/collectionsmodule.c	Wed Jan 31 23:24:58 2007
@@ -95,7 +95,7 @@
 	dequeobject *deque;
 	block *b;
 
-	if (!_PyArg_NoKeywords("deque()", kwds))
+	if (type == &deque_type && !_PyArg_NoKeywords("deque()", kwds))
 		return NULL;
 
 	/* create dequeobject structure */

Modified: python/branches/bcannon-objcap/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/itertoolsmodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/itertoolsmodule.c	Wed Jan 31 23:24:58 2007
@@ -681,7 +681,7 @@
 	PyObject *saved;
 	cycleobject *lz;
 
-	if (!_PyArg_NoKeywords("cycle()", kwds))
+	if (type == &cycle_type && !_PyArg_NoKeywords("cycle()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "cycle", 1, 1, &iterable))
@@ -831,7 +831,7 @@
 	PyObject *it;
 	dropwhileobject *lz;
 
-	if (!_PyArg_NoKeywords("dropwhile()", kwds))
+	if (type == &dropwhile_type && !_PyArg_NoKeywords("dropwhile()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "dropwhile", 2, 2, &func, &seq))
@@ -975,7 +975,7 @@
 	PyObject *it;
 	takewhileobject *lz;
 
-	if (!_PyArg_NoKeywords("takewhile()", kwds))
+	if (type == &takewhile_type && !_PyArg_NoKeywords("takewhile()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "takewhile", 2, 2, &func, &seq))
@@ -1120,7 +1120,7 @@
 	Py_ssize_t numargs;
 	isliceobject *lz;
 
-	if (!_PyArg_NoKeywords("islice()", kwds))
+	if (type == &islice_type && !_PyArg_NoKeywords("islice()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3))
@@ -1311,7 +1311,7 @@
 	PyObject *it;
 	starmapobject *lz;
 
-	if (!_PyArg_NoKeywords("starmap()", kwds))
+	if (type == &starmap_type && !_PyArg_NoKeywords("starmap()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq))
@@ -1443,7 +1443,7 @@
 	imapobject *lz;
 	Py_ssize_t numargs, i;
 
-	if (!_PyArg_NoKeywords("imap()", kwds))
+	if (type == &imap_type && !_PyArg_NoKeywords("imap()", kwds))
 		return NULL;
 
 	numargs = PyTuple_Size(args);
@@ -1625,7 +1625,7 @@
 	Py_ssize_t i;
 	PyObject *ittuple;
 
-	if (!_PyArg_NoKeywords("chain()", kwds))
+	if (type == &chain_type && !_PyArg_NoKeywords("chain()", kwds))
 		return NULL;
 
 	/* obtain iterators */
@@ -1768,7 +1768,7 @@
 	PyObject *it;
 	ifilterobject *lz;
 
-	if (!_PyArg_NoKeywords("ifilter()", kwds))
+	if (type == &ifilter_type && !_PyArg_NoKeywords("ifilter()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq))
@@ -1912,7 +1912,8 @@
 	PyObject *it;
 	ifilterfalseobject *lz;
 
-	if (!_PyArg_NoKeywords("ifilterfalse()", kwds))
+	if (type == &ifilterfalse_type &&
+	    !_PyArg_NoKeywords("ifilterfalse()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, "ifilterfalse", 2, 2, &func, &seq))
@@ -2054,7 +2055,7 @@
 	countobject *lz;
 	Py_ssize_t cnt = 0;
 
-	if (!_PyArg_NoKeywords("count()", kwds))
+	if (type == &count_type && !_PyArg_NoKeywords("count()", kwds))
 		return NULL;
 
 	if (!PyArg_ParseTuple(args, "|n:count", &cnt))
@@ -2153,7 +2154,7 @@
 	PyObject *result;
 	Py_ssize_t tuplesize = PySequence_Length(args);
 
-	if (!_PyArg_NoKeywords("izip()", kwds))
+	if (type == &izip_type && !_PyArg_NoKeywords("izip()", kwds))
 		return NULL;
 
 	/* args must be a tuple */
@@ -2336,7 +2337,7 @@
 	PyObject *element;
 	Py_ssize_t cnt = -1;
 
-	if (!_PyArg_NoKeywords("repeat()", kwds))
+	if (type == &repeat_type && !_PyArg_NoKeywords("repeat()", kwds))
 		return NULL;
 
 	if (!PyArg_ParseTuple(args, "O|n:repeat", &element, &cnt))

Modified: python/branches/bcannon-objcap/Modules/posixmodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/posixmodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/posixmodule.c	Wed Jan 31 23:24:58 2007
@@ -1462,7 +1462,7 @@
 /* POSIX methods */
 
 PyDoc_STRVAR(posix_access__doc__,
-"access(path, mode) -> 1 if granted, 0 otherwise\n\n\
+"access(path, mode) -> True if granted, False otherwise\n\n\
 Use the real uid/gid to test for access to a path.  Note that most\n\
 operations will use the effective uid/gid, therefore this routine can\n\
 be used in a suid/sgid environment to test if the invoking user has the\n\

Modified: python/branches/bcannon-objcap/Modules/socketmodule.c
==============================================================================
--- python/branches/bcannon-objcap/Modules/socketmodule.c	(original)
+++ python/branches/bcannon-objcap/Modules/socketmodule.c	Wed Jan 31 23:24:58 2007
@@ -3468,7 +3468,12 @@
 	if (!PyArg_ParseTuple(args, "i:ntohs", &x1)) {
 		return NULL;
 	}
-	x2 = (int)ntohs((short)x1);
+	if (x1 < 0) {
+		PyErr_SetString(PyExc_OverflowError,
+			"can't convert negative number to unsigned long");
+		return NULL;
+	}
+	x2 = (unsigned int)ntohs((unsigned short)x1);
 	return PyInt_FromLong(x2);
 }
 
@@ -3487,6 +3492,11 @@
 		x = PyInt_AS_LONG(arg);
 		if (x == (unsigned long) -1 && PyErr_Occurred())
 			return NULL;
+		if ((long)x < 0) {
+			PyErr_SetString(PyExc_OverflowError,
+			  "can't convert negative number to unsigned long");
+			return NULL;
+		}
 	}
 	else if (PyLong_Check(arg)) {
 		x = PyLong_AsUnsignedLong(arg);
@@ -3510,7 +3520,7 @@
 				    arg->ob_type->tp_name);
 	if (x == (unsigned long) -1 && PyErr_Occurred())
 		return NULL;
-	return PyInt_FromLong(ntohl(x));
+	return PyLong_FromUnsignedLong(ntohl(x));
 }
 
 PyDoc_STRVAR(ntohl_doc,
@@ -3527,7 +3537,12 @@
 	if (!PyArg_ParseTuple(args, "i:htons", &x1)) {
 		return NULL;
 	}
-	x2 = (int)htons((short)x1);
+	if (x1 < 0) {
+		PyErr_SetString(PyExc_OverflowError,
+			"can't convert negative number to unsigned long");
+		return NULL;
+	}
+	x2 = (unsigned int)htons((unsigned short)x1);
 	return PyInt_FromLong(x2);
 }
 
@@ -3546,6 +3561,11 @@
 		x = PyInt_AS_LONG(arg);
 		if (x == (unsigned long) -1 && PyErr_Occurred())
 			return NULL;
+		if ((long)x < 0) {
+			PyErr_SetString(PyExc_OverflowError,
+			  "can't convert negative number to unsigned long");
+			return NULL;
+		}
 	}
 	else if (PyLong_Check(arg)) {
 		x = PyLong_AsUnsignedLong(arg);
@@ -3567,7 +3587,7 @@
 		return PyErr_Format(PyExc_TypeError,
 				    "expected int/long, %s found",
 				    arg->ob_type->tp_name);
-	return PyInt_FromLong(htonl(x));
+	return PyLong_FromUnsignedLong(htonl((unsigned long)x));
 }
 
 PyDoc_STRVAR(htonl_doc,

Modified: python/branches/bcannon-objcap/Objects/fileobject.c
==============================================================================
--- python/branches/bcannon-objcap/Objects/fileobject.c	(original)
+++ python/branches/bcannon-objcap/Objects/fileobject.c	Wed Jan 31 23:24:58 2007
@@ -354,6 +354,8 @@
 {
 	PyFileObject *file = (PyFileObject*)f;
 	PyObject *str = PyString_FromString(enc);
+
+	assert(PyFile_Check(f));
 	if (!str)
 		return 0;
 	Py_DECREF(file->f_encoding);

Modified: python/branches/bcannon-objcap/Objects/intobject.c
==============================================================================
--- python/branches/bcannon-objcap/Objects/intobject.c	(original)
+++ python/branches/bcannon-objcap/Objects/intobject.c	Wed Jan 31 23:24:58 2007
@@ -1070,8 +1070,9 @@
 argument will be truncated towards zero (this does not include a string\n\
 representation of a floating point number!)  When converting a string, use\n\
 the optional base.  It is an error to supply a base when converting a\n\
-non-string. If the argument is outside the integer range a long object\n\
-will be returned instead.");
+non-string.  If base is zero, the proper base is guessed based on the\n\
+string content.  If the argument is outside the integer range a\n\
+long object will be returned instead.");
 
 static PyNumberMethods int_as_number = {
 	(binaryfunc)int_add,	/*nb_add*/

Modified: python/branches/bcannon-objcap/Objects/setobject.c
==============================================================================
--- python/branches/bcannon-objcap/Objects/setobject.c	(original)
+++ python/branches/bcannon-objcap/Objects/setobject.c	Wed Jan 31 23:24:58 2007
@@ -1004,7 +1004,7 @@
 {
 	PyObject *iterable = NULL, *result;
 
-	if (!_PyArg_NoKeywords("frozenset()", kwds))
+	if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds))
 		return NULL;
 
 	if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable))
@@ -1048,7 +1048,7 @@
 static PyObject *
 set_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-	if (!_PyArg_NoKeywords("set()", kwds))
+	if (type == &PySet_Type && !_PyArg_NoKeywords("set()", kwds))
 		return NULL;
 	
 	return make_new_set(type, NULL);

Modified: python/branches/bcannon-objcap/Objects/typeobject.c
==============================================================================
--- python/branches/bcannon-objcap/Objects/typeobject.c	(original)
+++ python/branches/bcannon-objcap/Objects/typeobject.c	Wed Jan 31 23:24:58 2007
@@ -666,6 +666,17 @@
 			goto endlabel;	/* resurrected */
 		else
 			_PyObject_GC_UNTRACK(self);
+		/* New weakrefs could be created during the finalizer call.
+		    If this occurs, clear them out without calling their
+		    finalizers since they might rely on part of the object
+		    being finalized that has already been destroyed. */
+		if (type->tp_weaklistoffset && !base->tp_weaklistoffset) {
+			/* Modeled after GET_WEAKREFS_LISTPTR() */
+			PyWeakReference **list = (PyWeakReference **) \
+				PyObject_GET_WEAKREFS_LISTPTR(self);
+			while (*list)
+				_PyWeakref_ClearRef(*list);
+		}
 	}
 
 	/*  Clear slots up to the nearest base with a different tp_dealloc */

Modified: python/branches/bcannon-objcap/Objects/weakrefobject.c
==============================================================================
--- python/branches/bcannon-objcap/Objects/weakrefobject.c	(original)
+++ python/branches/bcannon-objcap/Objects/weakrefobject.c	Wed Jan 31 23:24:58 2007
@@ -57,6 +57,9 @@
             PyWeakref_GET_OBJECT(self));
 
         if (*list == self)
+	    /* If 'self' is the end of the list (and thus self->wr_next == NULL)
+	       then the weakref list itself (and thus the value of *list) will
+	       end up being set to NULL. */
             *list = self->wr_next;
         self->wr_object = Py_None;
         if (self->wr_prev != NULL)

Modified: python/branches/bcannon-objcap/PCbuild/_bsddb.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_bsddb.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_bsddb.vcproj	Wed Jan 31 23:24:58 2007
@@ -130,7 +130,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include;..\PC;&quot;..\..\db-4.4.20\build_win32&quot;"

Modified: python/branches/bcannon-objcap/PCbuild/_elementtree.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_elementtree.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_elementtree.vcproj	Wed Jan 31 23:24:58 2007
@@ -129,7 +129,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"

Modified: python/branches/bcannon-objcap/PCbuild/_msi.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_msi.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_msi.vcproj	Wed Jan 31 23:24:58 2007
@@ -129,7 +129,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"
@@ -150,7 +150,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK"
-				AdditionalDependencies="fci.lib msi.lib rpcrt4.lib"
+				AdditionalDependencies="fci.lib msi.lib rpcrt4.lib bufferoverflowU.lib"
 				OutputFile="./_msi.pyd"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"

Modified: python/branches/bcannon-objcap/PCbuild/_socket.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_socket.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_socket.vcproj	Wed Jan 31 23:24:58 2007
@@ -128,7 +128,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/_sqlite3.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_sqlite3.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_sqlite3.vcproj	Wed Jan 31 23:24:58 2007
@@ -131,7 +131,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"
@@ -193,7 +193,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_OPTERON"
+				AdditionalOptions=" /USECL:MS_OPTERON /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include;..\PC;..\..\sqlite-source-3.3.4"

Modified: python/branches/bcannon-objcap/PCbuild/_ssl.mak
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_ssl.mak	(original)
+++ python/branches/bcannon-objcap/PCbuild/_ssl.mak	Wed Jan 31 23:24:58 2007
@@ -31,7 +31,7 @@
 
 _hashlib$(SUFFIX): $(HASH_SOURCE) $(SSL_LIB_DIR)/libeay32.lib ../PC/*.h ../Include/*.h
     @if not exist "$(TEMP)/_hashlib/." mkdir "$(TEMP)/_hashlib"
-    cl /nologo /c $(HASH_SOURCE) $(CFLAGS) /Fo$(TEMP)\_hashlib\$*.obj $(INCLUDES) 
+    cl /nologo /c $(HASH_SOURCE) $(CFLAGS) $(EXTRA_CFLAGS) /Fo$(TEMP)\_hashlib\$*.obj $(INCLUDES) 
     link /nologo @<<
 	/dll /out:_hashlib$(SUFFIX) $(HASH_LIBS) $(TEMP)\_hashlib\$*.obj
 <<

Modified: python/branches/bcannon-objcap/PCbuild/_testcapi.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_testcapi.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_testcapi.vcproj	Wed Jan 31 23:24:58 2007
@@ -126,7 +126,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/_tkinter.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/_tkinter.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/_tkinter.vcproj	Wed Jan 31 23:24:58 2007
@@ -130,7 +130,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\..\tcltk\include,..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/build_ssl.py
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/build_ssl.py	(original)
+++ python/branches/bcannon-objcap/PCbuild/build_ssl.py	Wed Jan 31 23:24:58 2007
@@ -169,6 +169,8 @@
     defs = "SSL_DIR=\"%s\"" % (ssl_dir,)
     if debug:
         defs = defs + " " + "DEBUG=1"
+    if arch in ('amd64', 'ia64'):
+        defs = defs + " EXTRA_CFLAGS=/GS-"
     makeCommand = 'nmake /nologo -f _ssl.mak ' + defs + " " + make_flags
     print "Executing:", makeCommand
     sys.stdout.flush()

Modified: python/branches/bcannon-objcap/PCbuild/bz2.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/bz2.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/bz2.vcproj	Wed Jan 31 23:24:58 2007
@@ -137,7 +137,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC,..\..\bzip2-1.0.3"

Modified: python/branches/bcannon-objcap/PCbuild/pyexpat.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/pyexpat.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/pyexpat.vcproj	Wed Jan 31 23:24:58 2007
@@ -128,7 +128,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"
@@ -189,7 +189,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_OPTERON"
+				AdditionalOptions=" /USECL:MS_OPTERON  /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC,..\Modules\expat"

Modified: python/branches/bcannon-objcap/PCbuild/python.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/python.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/python.vcproj	Wed Jan 31 23:24:58 2007
@@ -137,7 +137,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM /VSEXTCOMP_VERBOSE"
+				AdditionalOptions=" /USECL:MS_ITANIUM  /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/pythoncore.vcproj	Wed Jan 31 23:24:58 2007
@@ -144,7 +144,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/pythonw.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/pythonw.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/pythonw.vcproj	Wed Jan 31 23:24:58 2007
@@ -130,7 +130,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/select.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/select.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/select.vcproj	Wed Jan 31 23:24:58 2007
@@ -130,7 +130,7 @@
 			ATLMinimizesCRunTimeLibraryUsage="FALSE">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/unicodedata.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/unicodedata.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/unicodedata.vcproj	Wed Jan 31 23:24:58 2007
@@ -126,7 +126,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/PCbuild/winsound.vcproj
==============================================================================
--- python/branches/bcannon-objcap/PCbuild/winsound.vcproj	(original)
+++ python/branches/bcannon-objcap/PCbuild/winsound.vcproj	Wed Jan 31 23:24:58 2007
@@ -128,7 +128,7 @@
 			CharacterSet="2">
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions=" /USECL:MS_ITANIUM"
+				AdditionalOptions=" /USECL:MS_ITANIUM /GS-"
 				Optimization="2"
 				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="..\Include,..\PC"

Modified: python/branches/bcannon-objcap/Parser/asdl_c.py
==============================================================================
--- python/branches/bcannon-objcap/Parser/asdl_c.py	(original)
+++ python/branches/bcannon-objcap/Parser/asdl_c.py	Wed Jan 31 23:24:58 2007
@@ -260,7 +260,12 @@
             argstr += ", PyArena *arena"
         else:
             argstr = "PyArena *arena"
-        self.emit("%s %s(%s);" % (ctype, name, argstr), 0)
+        margs = "a0"
+        for i in range(1, len(args)+1):
+            margs += ", a%d" % i
+        self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0,
+                reflow = 0)
+        self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), 0)
 
     def visitProduct(self, prod, name):
         self.emit_function(name, get_c_type(name),

Modified: python/branches/bcannon-objcap/Python/ceval.c
==============================================================================
--- python/branches/bcannon-objcap/Python/ceval.c	(original)
+++ python/branches/bcannon-objcap/Python/ceval.c	Wed Jan 31 23:24:58 2007
@@ -2206,8 +2206,9 @@
 		case SETUP_LOOP:
 		case SETUP_EXCEPT:
 		case SETUP_FINALLY:
-			/* NOTE: If you add any new block-setup opcodes that are not try/except/finally
-			   handlers, you may need to update the PyGen_NeedsFinalizing() function. */
+			/* NOTE: If you add any new block-setup opcodes that are
+		           not try/except/finally handlers, you may need to
+			   update the PyGen_NeedsFinalizing() function. */
 
 			PyFrame_BlockSetup(f, opcode, INSTR_OFFSET() + oparg,
 					   STACK_LEVEL());
@@ -3069,15 +3070,7 @@
 		Py_DECREF(tmp);
 	}
 
-	if (PyString_CheckExact(type)) {
-		/* Raising builtin string is deprecated but still allowed --
-		 * do nothing.  Raising an instance of a new-style str
-		 * subclass is right out. */
-		if (PyErr_Warn(PyExc_DeprecationWarning,
-			   "raising a string exception is deprecated"))
-			goto raise_error;
-	}
-	else if (PyExceptionClass_Check(type))
+	if (PyExceptionClass_Check(type))
 		PyErr_NormalizeException(&type, &value, &tb);
 
 	else if (PyExceptionInstance_Check(type)) {
@@ -3099,8 +3092,7 @@
 		/* Not something you can raise.  You get an exception
 		   anyway, just not what you specified :-) */
 		PyErr_Format(PyExc_TypeError,
-			     "exceptions must be classes, instances, or "
-			     "strings (deprecated), not %s",
+			     "exceptions must be classes or instances, not %s",
 			     type->ob_type->tp_name);
 		goto raise_error;
 	}
@@ -3985,6 +3977,35 @@
 		res = !res;
 		break;
 	case PyCmp_EXC_MATCH:
+		if (PyTuple_Check(w)) {
+			Py_ssize_t i, length;
+			length = PyTuple_Size(w);
+			for (i = 0; i < length; i += 1) {
+				PyObject *exc = PyTuple_GET_ITEM(w, i);
+				if (PyString_Check(exc)) {
+					int ret_val;
+					ret_val = PyErr_WarnEx(
+							PyExc_DeprecationWarning,
+							"catching of string "
+							"exceptions is "
+							"deprecated", 1);
+					if (ret_val == -1)
+						return NULL;
+				}
+			}
+		}
+		else {
+			if (PyString_Check(w)) {
+				int ret_val;
+				ret_val = PyErr_WarnEx(
+						PyExc_DeprecationWarning,
+						"catching of string "
+						"exceptions is deprecated",
+						1);
+				if (ret_val == -1)
+					return NULL;
+			}
+		}
 		res = PyErr_GivenExceptionMatches(v, w);
 		break;
 	default:

Modified: python/branches/bcannon-objcap/Python/pythonrun.c
==============================================================================
--- python/branches/bcannon-objcap/Python/pythonrun.c	(original)
+++ python/branches/bcannon-objcap/Python/pythonrun.c	Wed Jan 31 23:24:58 2007
@@ -290,7 +290,8 @@
 		sys_isatty = PyObject_CallMethod(sys_stream, "isatty", "");
 		if (!sys_isatty)
 			PyErr_Clear();
-		if(sys_isatty && PyObject_IsTrue(sys_isatty)) {
+		if(sys_isatty && PyObject_IsTrue(sys_isatty) &&
+		   PyFile_Check(sys_stream)) {
 			if (!PyFile_SetEncoding(sys_stream, codeset))
 				Py_FatalError("Cannot set codeset of stdin");
 		}
@@ -300,7 +301,8 @@
 		sys_isatty = PyObject_CallMethod(sys_stream, "isatty", "");
 		if (!sys_isatty)
 			PyErr_Clear();
-		if(sys_isatty && PyObject_IsTrue(sys_isatty)) {
+		if(sys_isatty && PyObject_IsTrue(sys_isatty) &&
+		   PyFile_Check(sys_stream)) {
 			if (!PyFile_SetEncoding(sys_stream, codeset))
 				Py_FatalError("Cannot set codeset of stdout");
 		}
@@ -310,7 +312,8 @@
 		sys_isatty = PyObject_CallMethod(sys_stream, "isatty", "");
 		if (!sys_isatty)
 			PyErr_Clear();
-		if(sys_isatty && PyObject_IsTrue(sys_isatty)) {
+		if(sys_isatty && PyObject_IsTrue(sys_isatty) &&
+		   PyFile_Check(sys_stream)) {
 			if (!PyFile_SetEncoding(sys_stream, codeset))
 				Py_FatalError("Cannot set codeset of stderr");
 		}

Modified: python/branches/bcannon-objcap/Python/sysmodule.c
==============================================================================
--- python/branches/bcannon-objcap/Python/sysmodule.c	(original)
+++ python/branches/bcannon-objcap/Python/sysmodule.c	Wed Jan 31 23:24:58 2007
@@ -1102,17 +1102,17 @@
 	if (PyErr_Occurred())
 		return NULL;
 #ifdef MS_WINDOWS
-	if(isatty(_fileno(stdin))){
+	if(isatty(_fileno(stdin)) && PyFile_Check(sysin)) {
 		sprintf(buf, "cp%d", GetConsoleCP());
 		if (!PyFile_SetEncoding(sysin, buf))
 			return NULL;
 	}
-	if(isatty(_fileno(stdout))) {
+	if(isatty(_fileno(stdout)) && PyFile_Check(sysout)) {
 		sprintf(buf, "cp%d", GetConsoleOutputCP());
 		if (!PyFile_SetEncoding(sysout, buf))
 			return NULL;
 	}
-	if(isatty(_fileno(stderr))) {
+	if(isatty(_fileno(stderr)) && PyFile_Check(syserr)) {
 		sprintf(buf, "cp%d", GetConsoleOutputCP());
 		if (!PyFile_SetEncoding(syserr, buf))
 			return NULL;

Modified: python/branches/bcannon-objcap/Python/traceback.c
==============================================================================
--- python/branches/bcannon-objcap/Python/traceback.c	(original)
+++ python/branches/bcannon-objcap/Python/traceback.c	Wed Jan 31 23:24:58 2007
@@ -113,7 +113,7 @@
 int
 PyTraceBack_Here(PyFrameObject *frame)
 {
-	PyThreadState *tstate = frame->f_tstate;
+	PyThreadState *tstate = PyThreadState_GET();
 	PyTracebackObject *oldtb = (PyTracebackObject *) tstate->curexc_traceback;
 	PyTracebackObject *tb = newtracebackobject(oldtb, frame);
 	if (tb == NULL)

Modified: python/branches/bcannon-objcap/Tools/msi/uuids.py
==============================================================================
--- python/branches/bcannon-objcap/Tools/msi/uuids.py	(original)
+++ python/branches/bcannon-objcap/Tools/msi/uuids.py	Wed Jan 31 23:24:58 2007
@@ -33,4 +33,8 @@
     '2.5.121': '{8e9321bc-6b24-48a3-8fd4-c95f8e531e5f}', # 2.5c1
     '2.5.122': '{a6cd508d-9599-45da-a441-cbffa9f7e070}', # 2.5c2
     '2.5.150': '{0a2c5854-557e-48c8-835a-3b9f074bdcaa}', # 2.5.0
+    '2.5.1121':'{0378b43e-6184-4c2f-be1a-4a367781cd54}', # 2.5.1c1
+    '2.5.1150':'{31800004-6386-4999-a519-518f2d78d8f0}', # 2.5.1
+    '2.5.2150':'{6304a7da-1132-4e91-a343-a296269eab8a}', # 2.5.2c1
+    '2.5.2150':'{6b976adf-8ae8-434e-b282-a06c7f624d2f}', # 2.5.2
 }

Modified: python/branches/bcannon-objcap/Tools/pybench/pybench.py
==============================================================================
--- python/branches/bcannon-objcap/Tools/pybench/pybench.py	(original)
+++ python/branches/bcannon-objcap/Tools/pybench/pybench.py	Wed Jan 31 23:24:58 2007
@@ -34,7 +34,7 @@
 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
 """
 
-import sys, time, operator, string
+import sys, time, operator, string, platform
 from CommandLine import *
 
 try:
@@ -102,27 +102,26 @@
 
 def get_machine_details():
 
-    import platform
     if _debug:
         print 'Getting machine details...'
     buildno, builddate = platform.python_build()
     python = platform.python_version()
-    if python > '2.0':
-        try:
-            unichr(100000)
-        except ValueError:
-            # UCS2 build (standard)
-            unicode = 'UCS2'
-        else:
-            # UCS4 build (most recent Linux distros)
-            unicode = 'UCS4'
-    else:
+    try:
+        unichr(100000)
+    except ValueError:
+        # UCS2 build (standard)
+        unicode = 'UCS2'
+    except NameError:
         unicode = None
+    else:
+        # UCS4 build (most recent Linux distros)
+        unicode = 'UCS4'
     bits, linkage = platform.architecture()
     return {
         'platform': platform.platform(),
         'processor': platform.processor(),
         'executable': sys.executable,
+        'implementation': platform.python_implementation(),
         'python': platform.python_version(),
         'compiler': platform.python_compiler(),
         'buildno': buildno,
@@ -134,17 +133,18 @@
 def print_machine_details(d, indent=''):
 
     l = ['Machine Details:',
-         '   Platform ID:  %s' % d.get('platform', 'n/a'),
-         '   Processor:    %s' % d.get('processor', 'n/a'),
+         '   Platform ID:    %s' % d.get('platform', 'n/a'),
+         '   Processor:      %s' % d.get('processor', 'n/a'),
          '',
          'Python:',
-         '   Executable:   %s' % d.get('executable', 'n/a'),
-         '   Version:      %s' % d.get('python', 'n/a'),
-         '   Compiler:     %s' % d.get('compiler', 'n/a'),
-         '   Bits:         %s' % d.get('bits', 'n/a'),
-         '   Build:        %s (#%s)' % (d.get('builddate', 'n/a'),
-                                        d.get('buildno', 'n/a')),
-         '   Unicode:      %s' % d.get('unicode', 'n/a'),
+         '   Implementation: %s' % d.get('implementation', 'n/a'),
+         '   Executable:     %s' % d.get('executable', 'n/a'),
+         '   Version:        %s' % d.get('python', 'n/a'),
+         '   Compiler:       %s' % d.get('compiler', 'n/a'),
+         '   Bits:           %s' % d.get('bits', 'n/a'),
+         '   Build:          %s (#%s)' % (d.get('builddate', 'n/a'),
+                                          d.get('buildno', 'n/a')),
+         '   Unicode:        %s' % d.get('unicode', 'n/a'),
          ]
     print indent + string.join(l, '\n' + indent) + '\n'
 
@@ -499,9 +499,10 @@
 
     def calibrate(self):
 
-        print 'Calibrating tests. Please wait...'
+        print 'Calibrating tests. Please wait...',
         if self.verbose:
             print
+            print
             print 'Test                              min      max'
             print '-' * LINE
         tests = self.tests.items()
@@ -514,6 +515,11 @@
                       (name,
                        min(test.overhead_times) * MILLI_SECONDS,
                        max(test.overhead_times) * MILLI_SECONDS)
+        if self.verbose:
+            print
+            print 'Done with the calibration.'
+        else:
+            print 'done.'
         print
 
     def run(self):
@@ -830,7 +836,9 @@
         print '-' * LINE
         print 'PYBENCH %s' % __version__
         print '-' * LINE
-        print '* using Python %s' % (string.split(sys.version)[0])
+        print '* using %s %s' % (
+            platform.python_implementation(),
+            string.join(string.split(sys.version), ' '))
 
         # Switch off garbage collection
         if not withgc:
@@ -839,15 +847,23 @@
             except ImportError:
                 print '* Python version doesn\'t support garbage collection'
             else:
-                gc.disable()
-                print '* disabled garbage collection'
+                try:
+                    gc.disable()
+                except NotImplementedError:
+                    print '* Python version doesn\'t support gc.disable'
+                else:
+                    print '* disabled garbage collection'
 
         # "Disable" sys check interval
         if not withsyscheck:
             # Too bad the check interval uses an int instead of a long...
             value = 2147483647
-            sys.setcheckinterval(value)
-            print '* system check interval set to maximum: %s' % value
+            try:
+                sys.setcheckinterval(value)
+            except (AttributeError, NotImplementedError):
+                print '* Python version doesn\'t support sys.setcheckinterval'
+            else:
+                print '* system check interval set to maximum: %s' % value
 
         if timer == TIMER_SYSTIMES_PROCESSTIME:
             import systimes

Modified: python/branches/bcannon-objcap/configure
==============================================================================
--- python/branches/bcannon-objcap/configure	(original)
+++ python/branches/bcannon-objcap/configure	Wed Jan 31 23:24:58 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 52456 .
+# From configure.in Revision: 52843 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for python 2.6.
 #
@@ -10144,6 +10144,479 @@
 
 fi
 
+echo "$as_me:$LINENO: checking for _Bool support" >&5
+echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6
+have_c99_bool=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+_Bool x; x = (_Bool)0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_C99_BOOL 1
+_ACEOF
+
+  have_c99_bool=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $have_c99_bool" >&5
+echo "${ECHO_T}$have_c99_bool" >&6
+if test "$have_c99_bool" = yes ; then
+echo "$as_me:$LINENO: checking for _Bool" >&5
+echo $ECHO_N "checking for _Bool... $ECHO_C" >&6
+if test "${ac_cv_type__Bool+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if ((_Bool *) 0)
+  return 0;
+if (sizeof (_Bool))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type__Bool=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type__Bool=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+echo "${ECHO_T}$ac_cv_type__Bool" >&6
+
+echo "$as_me:$LINENO: checking size of _Bool" >&5
+echo $ECHO_N "checking size of _Bool... $ECHO_C" >&6
+if test "${ac_cv_sizeof__Bool+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type__Bool" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (_Bool))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof__Bool=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (_Bool), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+long longval () { return (long) (sizeof (_Bool)); }
+unsigned long ulongval () { return (long) (sizeof (_Bool)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (_Bool))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (_Bool))))
+	exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (_Bool))))
+	exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof__Bool=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (_Bool), 77
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof__Bool=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5
+echo "${ECHO_T}$ac_cv_sizeof__Bool" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF__BOOL $ac_cv_sizeof__Bool
+_ACEOF
+
+
+fi
+
 echo "$as_me:$LINENO: checking for uintptr_t" >&5
 echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
 if test "${ac_cv_type_uintptr_t+set}" = set; then

Modified: python/branches/bcannon-objcap/configure.in
==============================================================================
--- python/branches/bcannon-objcap/configure.in	(original)
+++ python/branches/bcannon-objcap/configure.in	Wed Jan 31 23:24:58 2007
@@ -1218,6 +1218,17 @@
 AC_CHECK_SIZEOF(long long, 8)
 fi
 
+AC_MSG_CHECKING(for _Bool support)
+have_c99_bool=no
+AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
+  AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) 
+  have_c99_bool=yes
+])
+AC_MSG_RESULT($have_c99_bool)
+if test "$have_c99_bool" = yes ; then
+AC_CHECK_SIZEOF(_Bool, 1)
+fi
+
 AC_CHECK_TYPES(uintptr_t, 
    [AC_CHECK_SIZEOF(uintptr_t, 4)], 
    [], [#ifdef HAVE_STDINT_H

Modified: python/branches/bcannon-objcap/pyconfig.h.in
==============================================================================
--- python/branches/bcannon-objcap/pyconfig.h.in	(original)
+++ python/branches/bcannon-objcap/pyconfig.h.in	Wed Jan 31 23:24:58 2007
@@ -64,6 +64,9 @@
 /* Define if pthread_sigmask() does not work on your system. */
 #undef HAVE_BROKEN_PTHREAD_SIGMASK
 
+/* Define this if you have the type _Bool. */
+#undef HAVE_C99_BOOL
+
 /* Define to 1 if you have the `chown' function. */
 #undef HAVE_CHOWN
 
@@ -835,6 +838,9 @@
 /* The size of a `wchar_t', as computed by sizeof. */
 #undef SIZEOF_WCHAR_T
 
+/* The size of a `_Bool', as computed by sizeof. */
+#undef SIZEOF__BOOL
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 


More information about the Python-checkins mailing list