[Python-checkins] r80393 - in python/branches/py3k-jit: Doc/library/_thread.rst Doc/library/datetime.rst Doc/library/logging.rst Doc/library/os.rst Doc/library/shutil.rst Doc/library/signal.rst Doc/library/ssl.rst Doc/library/threading.rst Doc/library/unittest.rst Doc/library/urllib.parse.rst Doc/library/urllib.request.rst Doc/library/winreg.rst Doc/tutorial/interpreter.rst Doc/whatsnew/2.7.rst Doc/whatsnew/3.2.rst Include/Python.h Include/pyport.h Include/unicodeobject.h Lib Lib/ctypes Lib/ctypes/macholib Lib/ctypes/test Lib/curses Lib/dbm Lib/distutils Lib/distutils/command Lib/distutils/tests Lib/email Lib/email/mime Lib/email/test Lib/email/test/data Lib/email/test/test_email.py Lib/encodings Lib/ftplib.py Lib/html Lib/http Lib/idlelib Lib/idlelib/Icons Lib/importlib Lib/importlib/test Lib/importlib/test/__main__.py Lib/importlib/test/builtin Lib/importlib/test/extension Lib/importlib/test/frozen Lib/importlib/test/import_ Lib/importlib/test/source Lib/json Lib/json/tests Lib/lib2to3 Lib/lib2to3/fixes Lib/lib2to3/pgen2 Lib/lib2to3/tests Lib/lib2to3/tests/data Lib/lib2to3/tests/data/fixers Lib/lib2to3/tests/data/fixers/myfixes Lib/logging Lib/mailcap.py Lib/msilib Lib/multiprocessing Lib/multiprocessing/dummy Lib/plat-aix4 Lib/plat-darwin Lib/plat-freebsd4 Lib/plat-freebsd5 Lib/plat-freebsd6 Lib/plat-freebsd7 Lib/plat-freebsd8 Lib/plat-generic Lib/plat-linux2 Lib/plat-netbsd1 Lib/plat-next3 Lib/plat-os2emx Lib/plat-sunos5 Lib/plat-unixware7 Lib/plistlib.py Lib/py_compile.py Lib/pydoc_data Lib/shutil.py Lib/site-packages Lib/sqlite3 Lib/sqlite3/test Lib/sqlite3/test/regression.py Lib/ssl.py Lib/test Lib/test/crashers Lib/test/decimaltestdata Lib/test/gdb_sample.py Lib/test/leakers Lib/test/lock_tests.py Lib/test/sha256.pem Lib/test/support.py Lib/test/test_bytes.py Lib/test/test_codecs.py Lib/test/test_datetime.py Lib/test/test_gdb.py Lib/test/test_genericpath.py Lib/test/test_linecache.py Lib/test/test_locale.py Lib/test/test_os.py Lib/test/test_plistlib.py Lib/test/test_set.py Lib/test/test_shutil.py Lib/test/test_signal.py Lib/test/test_site.py Lib/test/test_ssl.py Lib/test/test_urllib2net.py Lib/test/test_urlparse.py Lib/test/test_winreg.py Lib/test/xmltestdata Lib/threading.py Lib/tkinter Lib/tkinter/test Lib/tkinter/test/test_tkinter Lib/tkinter/test/test_ttk Lib/unittest Lib/unittest/test Lib/unittest/test/test_break.py Lib/urllib Lib/urllib/parse.py Lib/urllib/request.py Lib/wsgiref Lib/xml Lib/xml/dom Lib/xml/etree Lib/xml/parsers Lib/xml/sax Lib/xmlrpc Mac/BuildScript/build-installer.py Mac/BuildScript/scripts/postflight.framework Mac/Makefile.in Mac/PythonLauncher/Makefile.in Misc/ACKS Misc/NEWS Misc/developers.txt Misc/maintainers.rst Modules/Setup.dist Modules/_ctypes/callproc.c Modules/_posixsubprocess.c Modules/_scproxy.c Modules/_sqlite/connection.c Modules/_ssl.c Modules/datetimemodule.c Modules/main.c Modules/posixmodule.c Modules/python.c Objects/setobject.c Objects/unicodeobject.c PC/winreg.c Python/marshal.c Tools/gdb/libpython.py configure configure.in setup.py

collin.winter python-checkins at python.org
Fri Apr 23 02:01:12 CEST 2010


Author: collin.winter
Date: Fri Apr 23 02:01:11 2010
New Revision: 80393

Log:
Merged revisions 80140-80141,80143,80148,80153-80154,80157-80159,80161,80163,80167,80170,80176,80181-80182,80185,80190-80191,80195-80196,80198,80200,80205-80207,80211-80212,80217,80219,80224,80228,80230,80233,80240,80244,80246,80248,80251,80253,80256,80259,80261,80263,80266,80272-80273,80275-80276,80278,80280,80286,80289-80291,80293,80296,80299-80300,80302-80303,80309,80311-80312,80317,80321,80323-80324,80326-80329,80331,80333-80335,80337,80342-80343,80346,80349,80353,80359,80361,80364,80366,80368-80370,80379,80382,80384 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r80140 | benjamin.peterson | 2010-04-16 17:29:51 -0700 (Fri, 16 Apr 2010) | 1 line
  
  change svn:ignore to __pycache__
................
  r80141 | barry.warsaw | 2010-04-16 17:31:11 -0700 (Fri, 16 Apr 2010) | 1 line
  
  Remove unnecessary XXX
................
  r80143 | benjamin.peterson | 2010-04-16 19:00:25 -0700 (Fri, 16 Apr 2010) | 1 line
  
  fix svn:ignore
................
  r80148 | senthil.kumaran | 2010-04-17 07:44:14 -0700 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80146 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80146 | senthil.kumaran | 2010-04-17 20:00:53 +0530 (Sat, 17 Apr 2010) | 3 lines
    
    Fix Issue5650 - Update the RFC List in the urlparse module.
  ........
................
  r80153 | martin.v.loewis | 2010-04-17 10:11:55 -0700 (Sat, 17 Apr 2010) | 9 lines
  
  Merged revisions 80152 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80152 | martin.v.loewis | 2010-04-17 19:10:55 +0200 (Sa, 17 Apr 2010) | 2 lines
    
    Add Giampaolo.
  ........
................
  r80154 | antoine.pitrou | 2010-04-17 10:40:45 -0700 (Sat, 17 Apr 2010) | 10 lines
  
  Merged revisions 80151 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80151 | antoine.pitrou | 2010-04-17 19:10:38 +0200 (sam., 17 avril 2010) | 4 lines
    
    Issue #8322: Add a *ciphers* argument to SSL sockets, so as to change the
    available cipher list.  Helps fix test_ssl with OpenSSL 1.0.0.
  ........
................
  r80157 | antoine.pitrou | 2010-04-17 16:51:58 -0700 (Sat, 17 Apr 2010) | 4 lines
  
  Issue #850728: Add a *timeout* parameter to the `acquire()` method of
  `threading.Semaphore` objects.  Original patch by Torsten Landschoff.
................
  r80158 | antoine.pitrou | 2010-04-17 16:52:21 -0700 (Sat, 17 Apr 2010) | 3 lines
  
  Wording in NEWS.
................
  r80159 | victor.stinner | 2010-04-17 17:00:44 -0700 (Sat, 17 Apr 2010) | 3 lines
  
  Issue #8394: _ctypes.dlopen() accepts bytes, bytearray and str with
  surrogates.
................
  r80161 | victor.stinner | 2010-04-18 00:59:53 -0700 (Sun, 18 Apr 2010) | 4 lines
  
  Issue #8340, test_abs_path() of test_site: encode paths to ASCII with
  backslashreplace to avoid locale issues, don't write stderr to a pipe to ease
  debug, separate directories by newlines instead of a space.
................
  r80163 | victor.stinner | 2010-04-18 01:23:42 -0700 (Sun, 18 Apr 2010) | 4 lines
  
  Issue #8422, test_genericpath: skip the creation of a directory with an invalid
  UTF name on Mac OS X because the OS deny it (the name have to be a valid UTF8
  string).
................
  r80167 | victor.stinner | 2010-04-18 02:11:53 -0700 (Sun, 18 Apr 2010) | 14 lines
  
  Merged revisions 80166 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80166 | victor.stinner | 2010-04-18 11:07:49 +0200 (dim., 18 avril 2010) | 7 lines
  
    platform: use subprocess.Popen() instead of os.popen() in _syscmd_file()
  
     * Popen() avoids ugly shell escape: target.replace('"', '\\"')
     * Use proc.communicate() instead of f.stdout.read()
     * Get output from stdout by splitting with ": " instead of splitting by spaces
       to support filename with spaces
  ........
................
  r80170 | georg.brandl | 2010-04-18 02:50:07 -0700 (Sun, 18 Apr 2010) | 1 line
  
  Remove colspanning cells.
................
  r80176 | giampaolo.rodola | 2010-04-18 06:36:35 -0700 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80172 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80172 | giampaolo.rodola | 2010-04-18 14:55:03 +0200 (dom, 18 apr 2010) | 1 line
    
    Fix Issue #3817: 225 is now considered a valid response code for ABOR
  ........
................
  r80181 | ronald.oussoren | 2010-04-18 07:46:12 -0700 (Sun, 18 Apr 2010) | 7 lines
  
  Move _Py_char2wchar from python.c to main.c.
  
  This fixes issue #8441: python.c is not included
  in the framework while main.c is and without this
  patch you get a link error when building 
  Python.framework on OSX.
................
  r80182 | ronald.oussoren | 2010-04-18 08:02:38 -0700 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80178 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80178 | ronald.oussoren | 2010-04-18 15:47:49 +0200 (Sun, 18 Apr 2010) | 2 lines
    
    Fix for issue #7072
  ........
................
  r80185 | ronald.oussoren | 2010-04-18 08:24:17 -0700 (Sun, 18 Apr 2010) | 12 lines
  
  Merged revisions 80179 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80179 | ronald.oussoren | 2010-04-18 16:01:05 +0200 (Sun, 18 Apr 2010) | 5 lines
    
    Add check to build-installer.py to ensure that
    the right version of Tcl/Tk is available (on OSX)
    
    Fixes issue #5651
  ........
................
  r80190 | victor.stinner | 2010-04-18 11:28:09 -0700 (Sun, 18 Apr 2010) | 2 lines
  
  Revert r80167, it breaks build on many platforms
................
  r80191 | ronald.oussoren | 2010-04-18 12:07:43 -0700 (Sun, 18 Apr 2010) | 13 lines
  
  Merged revisions 80187 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80187 | ronald.oussoren | 2010-04-18 19:59:37 +0200 (Sun, 18 Apr 2010) | 6 lines
    
    Add the OSX universal binary related options
    to CFLAGS instead of BASECFLAGS.
    
    This fixes issue 8366 and is needed due to
    changes introduced in the fix for issue 1628484.
  ........
................
  r80195 | antoine.pitrou | 2010-04-18 12:17:01 -0700 (Sun, 18 Apr 2010) | 9 lines
  
  Merged revisions 80194 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80194 | antoine.pitrou | 2010-04-18 21:14:38 +0200 (dim., 18 avril 2010) | 3 lines
    
    Fix catastrophic file opening and closing logic in test_linecache
  ........
................
  r80196 | raymond.hettinger | 2010-04-18 13:26:14 -0700 (Sun, 18 Apr 2010) | 1 line
  
  Issue 8420: Fix ref counting problem in set_repr().
................
  r80198 | ronald.oussoren | 2010-04-18 13:46:11 -0700 (Sun, 18 Apr 2010) | 4 lines
  
  For for issue #7154: Port the code that uses
  the SystemConfiguration framework to detect the
  proxy settings on OSX from the trunk to python 3.2
................
  r80200 | ronald.oussoren | 2010-04-18 13:53:49 -0700 (Sun, 18 Apr 2010) | 2 lines
  
  For for issue #5652
................
  r80205 | raymond.hettinger | 2010-04-18 16:05:22 -0700 (Sun, 18 Apr 2010) | 1 line
  
  Issue 8436: set.__init__ accepts keyword args
................
  r80206 | benjamin.peterson | 2010-04-18 16:08:30 -0700 (Sun, 18 Apr 2010) | 8 lines
  
  Blocked revisions 80202 via svnmerge
  
  ........
    r80202 | raymond.hettinger | 2010-04-18 17:57:57 -0500 (Sun, 18 Apr 2010) | 1 line
    
    Issue 8436: set.__init__ accepts keyword args
  ........
................
  r80207 | sean.reifschneider | 2010-04-18 23:06:12 -0700 (Sun, 18 Apr 2010) | 2 lines
  
  I'll maintain syslog.  I've made most of the "recent" changes to it anyway.
................
  r80211 | antoine.pitrou | 2010-04-19 07:05:51 -0700 (Mon, 19 Apr 2010) | 3 lines
  
  Add version{added,changed} for lock timeout support.
................
  r80212 | antoine.pitrou | 2010-04-19 07:09:57 -0700 (Mon, 19 Apr 2010) | 3 lines
  
  Remove obsolete mention of IRIX native threads -- we don't use them anymore.
................
  r80217 | antoine.pitrou | 2010-04-19 12:38:22 -0700 (Mon, 19 Apr 2010) | 9 lines
  
  Blocked revisions 80215 via svnmerge
  
  ........
    r80215 | antoine.pitrou | 2010-04-19 20:52:43 +0200 (lun., 19 avril 2010) | 4 lines
    
    Issue #8438: Remove reference to the missing "surrogateescape" encoding
    error handler from the new IO library.
  ........
................
  r80219 | tarek.ziade | 2010-04-19 14:19:57 -0700 (Mon, 19 Apr 2010) | 9 lines
  
  Merged revisions 80218 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80218 | tarek.ziade | 2010-04-19 23:13:03 +0200 (Mon, 19 Apr 2010) | 1 line
    
    few pep8 fixes
  ........
................
  r80224 | tarek.ziade | 2010-04-19 14:31:42 -0700 (Mon, 19 Apr 2010) | 9 lines
  
  Merged revisions 80221 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80221 | tarek.ziade | 2010-04-19 23:28:21 +0200 (Mon, 19 Apr 2010) | 1 line
    
    Fixed #8463: added missing reference to bztar in shutil's documentation.
  ........
................
  r80228 | giampaolo.rodola | 2010-04-19 15:05:54 -0700 (Mon, 19 Apr 2010) | 9 lines
  
  Merged revisions 80226 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80226 | giampaolo.rodola | 2010-04-19 23:46:28 +0200 (lun, 19 apr 2010) | 1 line
    
    Fix Issue #4841: timeout is now applied for connections resulting from PORT/EPRT commands
  ........
................
  r80230 | tarek.ziade | 2010-04-19 15:30:51 -0700 (Mon, 19 Apr 2010) | 1 line
  
  Fixed #1540112: now shutil.copytree will let you provide your own copy() function
................
  r80233 | ronald.oussoren | 2010-04-19 23:36:47 -0700 (Mon, 19 Apr 2010) | 10 lines
  
  Merged revisions 80232 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80232 | ronald.oussoren | 2010-04-20 07:50:44 +0200 (Tue, 20 Apr 2010) | 3 lines
    
    Explicitly set system default for $PATH to
    ensure we have a clean build environment (OSX installer)
  ........
................
  r80240 | stefan.krah | 2010-04-20 01:13:03 -0700 (Tue, 20 Apr 2010) | 15 lines
  
  Merged revisions 80238 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80238 | stefan.krah | 2010-04-20 09:59:10 +0200 (Tue, 20 Apr 2010) | 9 lines
    
    
    1) The timeout in the itimer tests was too low for slow or heavily
       loaded machines.
    
    2) Even with the increased timeout, the OS does not guarantee that
       a process will get a certain amount of virtual time in 60s, so
       the failure is changed to a diagnostic.
  ........
................
  r80244 | tarek.ziade | 2010-04-20 01:57:33 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Fixed #6547: Added the ignore_dangling_symlinks option to shutil.copytree
................
  r80246 | tarek.ziade | 2010-04-20 02:13:23 -0700 (Tue, 20 Apr 2010) | 1 line
  
  added a note on shutil.copytree improvements
................
  r80248 | ezio.melotti | 2010-04-20 02:32:54 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Fix versionadded in unittest.rst.
................
  r80251 | ezio.melotti | 2010-04-20 02:41:59 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Update the python version in the interpreter tutorial.
................
  r80253 | ezio.melotti | 2010-04-20 02:55:05 -0700 (Tue, 20 Apr 2010) | 29 lines
  
  Merged revisions 79963,80024,80064,80070,80085,80088 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79963 | andrew.kuchling | 2010-04-11 23:40:09 +0300 (Sun, 11 Apr 2010) | 1 line
    
    Add several items
  ........
    r80024 | andrew.kuchling | 2010-04-13 04:32:51 +0300 (Tue, 13 Apr 2010) | 1 line
    
    Add an item; stray edit
  ........
    r80064 | andrew.kuchling | 2010-04-14 04:14:59 +0300 (Wed, 14 Apr 2010) | 1 line
    
    Add argparse example
  ........
    r80070 | andrew.kuchling | 2010-04-14 17:28:31 +0300 (Wed, 14 Apr 2010) | 1 line
    
    Add some text
  ........
    r80085 | andrew.kuchling | 2010-04-15 02:55:17 +0300 (Thu, 15 Apr 2010) | 1 line
    
    Add various items; correct argparse output
  ........
    r80088 | andrew.kuchling | 2010-04-15 04:42:27 +0300 (Thu, 15 Apr 2010) | 1 line
    
    Add various items
  ........
................
  r80256 | senthil.kumaran | 2010-04-20 03:35:49 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80236 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80236 | senthil.kumaran | 2010-04-20 12:24:59 +0530 (Tue, 20 Apr 2010) | 3 lines
    
    Fix Issue8460: Victor's patch to add timeout in test_urllib2net test_urls.
  ........
................
  r80259 | ezio.melotti | 2010-04-20 03:57:44 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Fix two versionchanged.
................
  r80261 | ezio.melotti | 2010-04-20 04:26:51 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Add missing arg, fix indentation and spelling.
................
  r80263 | tarek.ziade | 2010-04-20 07:31:49 -0700 (Tue, 20 Apr 2010) | 1 line
  
  fixed typo -- thanks Nick
................
  r80266 | brian.curtin | 2010-04-20 08:28:06 -0700 (Tue, 20 Apr 2010) | 11 lines
  
  Updated version numbers from 2.7 to 3.2
  
  Merged revisions 80265 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80265 | brian.curtin | 2010-04-20 10:23:18 -0500 (Tue, 20 Apr 2010) | 2 lines
    
    Add version info for os.kill and signal changes from #1220212.
  ........
................
  r80272 | ezio.melotti | 2010-04-20 09:57:51 -0700 (Tue, 20 Apr 2010) | 8 lines
  
  Blocked revisions 80270 via svnmerge
  
  ........
    r80270 | ezio.melotti | 2010-04-20 19:49:48 +0300 (Tue, 20 Apr 2010) | 1 line
    
    #8472: fix wrong function name in functions.rst: itertools.filterfalse -> itertools.ifilterfalse
  ........
................
  r80273 | georg.brandl | 2010-04-20 11:15:54 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Markup nit.
................
  r80275 | matthias.klose | 2010-04-20 12:48:04 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80274 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80274 | matthias.klose | 2010-04-20 21:45:34 +0200 (Di, 20 Apr 2010) | 2 lines
    
    fix typo in r79533, introduced by the fix for issue #8233
  ........
................
  r80276 | ronald.oussoren | 2010-04-20 12:51:33 -0700 (Tue, 20 Apr 2010) | 4 lines
  
  * Fixes cut&paste error in configure
  * Ensure that framework install works given the
    recent CFLAGS and BASECFLAGS changes
................
  r80278 | senthil.kumaran | 2010-04-20 13:42:50 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80277 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80277 | senthil.kumaran | 2010-04-21 02:07:59 +0530 (Wed, 21 Apr 2010) | 3 lines
    
    Issue2987 - Added additional Invalid URL and changed the Invalid URL checking code for better.
  ........
................
  r80280 | ronald.oussoren | 2010-04-20 14:00:34 -0700 (Tue, 20 Apr 2010) | 10 lines
  
  Merged revisions 80279 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80279 | ronald.oussoren | 2010-04-20 22:59:37 +0200 (Tue, 20 Apr 2010) | 3 lines
    
    Fix for issue 7852: the DTD for OSX Plists has changed due
    to a change in the company name for Apple.
  ........
................
  r80286 | tarek.ziade | 2010-04-20 14:40:47 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80282 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80282 | tarek.ziade | 2010-04-20 23:09:06 +0200 (Tue, 20 Apr 2010) | 1 line
    
    removed ztar support in shutil.make_archive
  ........
................
  r80289 | victor.stinner | 2010-04-20 15:32:07 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80288 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80288 | victor.stinner | 2010-04-21 00:28:31 +0200 (mer., 21 avril 2010) | 2 lines
    
    Issue #8437: Fix test_gdb failures, patch written by Dave Malcolm
  ........
................
  r80290 | mark.dickinson | 2010-04-20 15:32:49 -0700 (Tue, 20 Apr 2010) | 13 lines
  
  Issue #2706:  Add support for dividing a timedelta by another timedelta.
  
  Adds support for the three division operations:
  
    - timedelta / timedelta -> float
    - timedelta // timedelta -> int
    - timedelta % timedelta -> timedelta
  
  also adds support for divmod(timedelta, timedelta).
  
  Patch by Victor Stinner, adapted for py3k and extended by Alexander
  Belopolsky.
................
  r80291 | mark.dickinson | 2010-04-20 15:39:53 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Fix memory leak.
................
  r80293 | mark.dickinson | 2010-04-20 16:24:25 -0700 (Tue, 20 Apr 2010) | 1 line
  
  Rework delta_divmod to avoid use of PyTuple_SetItem.
................
  r80296 | r.david.murray | 2010-04-20 18:51:57 -0700 (Tue, 20 Apr 2010) | 14 lines
  
  Merged revisions 80144 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80144 | r.david.murray | 2010-04-17 01:26:26 -0400 (Sat, 17 Apr 2010) | 8 lines
    
    Issue #3864: Skip three test_signal tests on freebsd6 due to platform bug.
    
    Two itimer tests and an interprocess signal test fail on FreeBSD 6 if
    any test that starts a thread runs before test_signal.  Since FreeBSD7
    does not show this behavior, the bug is most likely a platform bug,
    so this patch just skips the failing tests on freebsd6.
  ........
................
  r80299 | ronald.oussoren | 2010-04-20 23:01:23 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80298 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80298 | ronald.oussoren | 2010-04-21 08:00:35 +0200 (Wed, 21 Apr 2010) | 2 lines
    
    Sync test_plistlib.py with plistlib.py
  ........
................
  r80300 | martin.v.loewis | 2010-04-20 23:05:58 -0700 (Tue, 20 Apr 2010) | 17 lines
  
  Merged revisions 79986-79987,80156 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79986 | martin.v.loewis | 2010-04-12 07:18:16 +0200 (Mo, 12 Apr 2010) | 2 lines
    
    Issue #8330: Fix expected output in test_gdb.
  ........
    r79987 | martin.v.loewis | 2010-04-12 07:22:25 +0200 (Mo, 12 Apr 2010) | 2 lines
    
    Re-enable all tests, to see which ones fail on the buildbots.
  ........
    r80156 | martin.v.loewis | 2010-04-18 00:40:40 +0200 (So, 18 Apr 2010) | 2 lines
    
    Issue #8279: Fix test_gdb failures.
  ........
................
  r80302 | martin.v.loewis | 2010-04-20 23:38:30 -0700 (Tue, 20 Apr 2010) | 9 lines
  
  Merged revisions 80301 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80301 | martin.v.loewis | 2010-04-21 08:37:48 +0200 (Mi, 21 Apr 2010) | 2 lines
    
    Add Tim Golden.
  ........
................
  r80303 | tarek.ziade | 2010-04-21 00:30:43 -0700 (Wed, 21 Apr 2010) | 1 line
  
  fixed typo
................
  r80309 | tarek.ziade | 2010-04-21 06:35:21 -0700 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80306 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80306 | tarek.ziade | 2010-04-21 15:32:26 +0200 (Wed, 21 Apr 2010) | 1 line
    
    shutil: removed unused import and fixed attributes names in _call_external_zip
  ........
................
  r80311 | victor.stinner | 2010-04-21 06:53:05 -0700 (Wed, 21 Apr 2010) | 5 lines
  
  Adapt libpython.py and test_gdb.py to Python3
  
   * Rename PyStringObjectPtr to PyBytesObjectPtr
   * Replace PyObject_Print by textiowrapper_write
................
  r80312 | victor.stinner | 2010-04-21 06:55:23 -0700 (Wed, 21 Apr 2010) | 4 lines
  
  Update NEWS file accoding to my last patch (r80311 about gdb)
  
  Move test_gdb issues to the Tests section.
................
  r80317 | antoine.pitrou | 2010-04-21 12:46:23 -0700 (Wed, 21 Apr 2010) | 15 lines
  
  Merged revisions 80314-80315 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80314 | antoine.pitrou | 2010-04-21 21:28:03 +0200 (mer., 21 avril 2010) | 5 lines
    
    Issue #8484: Load all ciphers and digest algorithms when initializing
    the _ssl extension, such that verification of some SSL certificates
    doesn't fail because of an "unknown algorithm".
  ........
    r80315 | antoine.pitrou | 2010-04-21 21:36:23 +0200 (mer., 21 avril 2010) | 3 lines
    
    Forgot to add the sample certificate (followup to r80314)
  ........
................
  r80321 | matthias.klose | 2010-04-21 14:47:45 -0700 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80320 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80320 | matthias.klose | 2010-04-21 23:45:30 +0200 (Mi, 21 Apr 2010) | 2 lines
    
    setup.py: search ffi.h in include dirs, if LIBFFI_INCLUDEDIR is empty.
  ........
................
  r80323 | matthias.klose | 2010-04-21 15:21:03 -0700 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80322 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80322 | matthias.klose | 2010-04-22 00:18:52 +0200 (Do, 22 Apr 2010) | 2 lines
    
    - Build the ossaudio extension on GNU/kFreeBSD.
  ........
................
  r80324 | martin.v.loewis | 2010-04-21 15:38:42 -0700 (Wed, 21 Apr 2010) | 2 lines
  
  Issue #8380: Port gdb/libpython to 3.x.
................
  r80326 | antoine.pitrou | 2010-04-21 15:56:22 -0700 (Wed, 21 Apr 2010) | 12 lines
  
  Merged revisions 80325 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80325 | antoine.pitrou | 2010-04-22 00:53:29 +0200 (jeu., 22 avril 2010) | 6 lines
    
    Issue #7332: Remove the 16KB stack-based buffer in
    PyMarshal_ReadLastObjectFromFile, which doesn't bring any noticeable
    benefit compared to the dynamic memory allocation fallback.  Patch by
    Charles-François Natali.
  ........
................
  r80327 | antoine.pitrou | 2010-04-21 15:59:01 -0700 (Wed, 21 Apr 2010) | 3 lines
  
  Add myself to ssl, although I'm not a de facto maintainer or expert
................
  r80328 | r.david.murray | 2010-04-21 16:05:10 -0700 (Wed, 21 Apr 2010) | 3 lines
  
  Add myself to email, move 'windows' to Platforms where it
  belongs, and finish alphabetizing the Platforms list.
................
  r80329 | brian.curtin | 2010-04-21 16:56:21 -0700 (Wed, 21 Apr 2010) | 4 lines
  
  Port #7347 to py3k.
  
  Add CreateKeyEx and DeleteKeyEx, along with test improvements.
................
  r80331 | r.david.murray | 2010-04-21 17:53:47 -0700 (Wed, 21 Apr 2010) | 12 lines
  
  Merged revisions 80155 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80155 | r.david.murray | 2010-04-17 17:59:26 -0400 (Sat, 17 Apr 2010) | 5 lines
    
    Issue #8263: On freebsd6 the unittest 'break' test stops regrtest; skip it.
    
    This is presumably related to issue 3864, and appears to be due
    to a platform bug on freebsd6.
  ........
................
  r80333 | brian.curtin | 2010-04-21 18:07:36 -0700 (Wed, 21 Apr 2010) | 2 lines
  
  Add a note about #7347.
................
  r80334 | r.david.murray | 2010-04-21 18:49:37 -0700 (Wed, 21 Apr 2010) | 2 lines
  
  Fix verb tense in skip message.
................
  r80335 | brian.curtin | 2010-04-21 18:52:50 -0700 (Wed, 21 Apr 2010) | 2 lines
  
  #7347 entry got entered in the wrong spot.
................
  r80337 | senthil.kumaran | 2010-04-21 22:53:18 -0700 (Wed, 21 Apr 2010) | 9 lines
  
  Merged revisions 80336 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80336 | senthil.kumaran | 2010-04-22 11:18:35 +0530 (Thu, 22 Apr 2010) | 3 lines
    
    Updated the RFCs list in the See Also section of urlparse.rst
  ........
................
  r80342 | georg.brandl | 2010-04-22 00:00:42 -0700 (Thu, 22 Apr 2010) | 1 line
  
  Fix indentation.
................
  r80343 | georg.brandl | 2010-04-22 00:02:51 -0700 (Thu, 22 Apr 2010) | 1 line
  
  Typo fixes.
................
  r80346 | senthil.kumaran | 2010-04-22 03:53:30 -0700 (Thu, 22 Apr 2010) | 4 lines
  
  Fixing a note on encoding declaration, its usage in urlopen based on review
  comments from RDM and Ezio.
................
  r80349 | victor.stinner | 2010-04-22 04:23:23 -0700 (Thu, 22 Apr 2010) | 3 lines
  
  Issue #8195: Fix a crash in sqlite Connection.create_collation() if the
  collation name contains a surrogate character.
................
  r80353 | ezio.melotti | 2010-04-22 04:29:27 -0700 (Thu, 22 Apr 2010) | 9 lines
  
  Merged revisions 80350 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80350 | ezio.melotti | 2010-04-22 14:23:31 +0300 (Thu, 22 Apr 2010) | 1 line
    
    #8474: fix duplicate test in test_email.
  ........
................
  r80359 | ezio.melotti | 2010-04-22 04:57:12 -0700 (Thu, 22 Apr 2010) | 9 lines
  
  Merged revisions 80357 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80357 | ezio.melotti | 2010-04-22 14:53:21 +0300 (Thu, 22 Apr 2010) | 1 line
    
    Rephrase comment.
  ........
................
  r80361 | victor.stinner | 2010-04-22 05:08:36 -0700 (Thu, 22 Apr 2010) | 3 lines
  
  Issue #8485: PyUnicode_FSConverter() doesn't accept bytearray object anymore,
  you have to convert your bytearray filenames to bytes
................
  r80364 | senthil.kumaran | 2010-04-22 05:19:46 -0700 (Thu, 22 Apr 2010) | 10 lines
  
  Merged revisions 80362 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80362 | senthil.kumaran | 2010-04-22 17:40:13 +0530 (Thu, 22 Apr 2010) | 4 lines
    
    Changed tests to only urlparse one, which was enough, addressed Ezio's comment
    on Invalid url check statement and versionchanged string in docs.
  ........
................
  r80366 | martin.v.loewis | 2010-04-22 06:16:44 -0700 (Thu, 22 Apr 2010) | 10 lines
  
  Merged revisions 80355 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80355 | martin.v.loewis | 2010-04-22 13:34:36 +0200 (Do, 22 Apr 2010) | 3 lines
    
    Issue #8475: Pass absolute interpreter path to
    "make html".
  ........
................
  r80368 | antoine.pitrou | 2010-04-22 06:19:31 -0700 (Thu, 22 Apr 2010) | 3 lines
  
  Fix mailcap.py built-in test.
................
  r80369 | antoine.pitrou | 2010-04-22 06:30:10 -0700 (Thu, 22 Apr 2010) | 5 lines
  
  Issue #8496: make mailcap.lookup() always return a list, rather than an iterator.
  Patch by Gregory Nofi.
................
  r80370 | matthias.klose | 2010-04-22 06:38:12 -0700 (Thu, 22 Apr 2010) | 2 lines
  
  - Mention _posixsubprocess.c in Modules/Setup.dist
................
  r80379 | antoine.pitrou | 2010-04-22 11:43:31 -0700 (Thu, 22 Apr 2010) | 9 lines
  
  Merged revisions 80375 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80375 | antoine.pitrou | 2010-04-22 20:00:41 +0200 (jeu., 22 avril 2010) | 3 lines
    
    Skip test on old versions of OpenSSL
  ........
................
  r80382 | victor.stinner | 2010-04-22 12:38:16 -0700 (Thu, 22 Apr 2010) | 3 lines
  
  Issue #8092: Fix PyUnicode_EncodeUTF8() to support error handler producing
  unicode string (eg. backslashreplace)
................
  r80384 | victor.stinner | 2010-04-22 13:01:57 -0700 (Thu, 22 Apr 2010) | 2 lines
  
  Fix my previous commit (r80382) for wide build (unicodeobject.c)
................


Added:
   python/branches/py3k-jit/Lib/test/sha256.pem
      - copied unchanged from r80384, /python/branches/py3k/Lib/test/sha256.pem
   python/branches/py3k-jit/Modules/_scproxy.c
      - copied unchanged from r80384, /python/branches/py3k/Modules/_scproxy.c
Modified:
   python/branches/py3k-jit/   (props changed)
   python/branches/py3k-jit/Doc/library/_thread.rst
   python/branches/py3k-jit/Doc/library/datetime.rst
   python/branches/py3k-jit/Doc/library/logging.rst
   python/branches/py3k-jit/Doc/library/os.rst
   python/branches/py3k-jit/Doc/library/shutil.rst
   python/branches/py3k-jit/Doc/library/signal.rst
   python/branches/py3k-jit/Doc/library/ssl.rst
   python/branches/py3k-jit/Doc/library/threading.rst
   python/branches/py3k-jit/Doc/library/unittest.rst
   python/branches/py3k-jit/Doc/library/urllib.parse.rst
   python/branches/py3k-jit/Doc/library/urllib.request.rst
   python/branches/py3k-jit/Doc/library/winreg.rst
   python/branches/py3k-jit/Doc/tutorial/interpreter.rst
   python/branches/py3k-jit/Doc/whatsnew/2.7.rst
   python/branches/py3k-jit/Doc/whatsnew/3.2.rst
   python/branches/py3k-jit/Include/Python.h
   python/branches/py3k-jit/Include/pyport.h
   python/branches/py3k-jit/Include/unicodeobject.h
   python/branches/py3k-jit/Lib/   (props changed)
   python/branches/py3k-jit/Lib/ctypes/   (props changed)
   python/branches/py3k-jit/Lib/ctypes/macholib/   (props changed)
   python/branches/py3k-jit/Lib/ctypes/test/   (props changed)
   python/branches/py3k-jit/Lib/curses/   (props changed)
   python/branches/py3k-jit/Lib/dbm/   (props changed)
   python/branches/py3k-jit/Lib/distutils/   (props changed)
   python/branches/py3k-jit/Lib/distutils/command/   (props changed)
   python/branches/py3k-jit/Lib/distutils/tests/   (props changed)
   python/branches/py3k-jit/Lib/email/   (props changed)
   python/branches/py3k-jit/Lib/email/mime/   (props changed)
   python/branches/py3k-jit/Lib/email/test/   (props changed)
   python/branches/py3k-jit/Lib/email/test/data/   (props changed)
   python/branches/py3k-jit/Lib/email/test/test_email.py
   python/branches/py3k-jit/Lib/encodings/   (props changed)
   python/branches/py3k-jit/Lib/ftplib.py
   python/branches/py3k-jit/Lib/html/   (props changed)
   python/branches/py3k-jit/Lib/http/   (props changed)
   python/branches/py3k-jit/Lib/idlelib/   (props changed)
   python/branches/py3k-jit/Lib/idlelib/Icons/   (props changed)
   python/branches/py3k-jit/Lib/importlib/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/__main__.py
   python/branches/py3k-jit/Lib/importlib/test/builtin/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/extension/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/frozen/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/import_/   (props changed)
   python/branches/py3k-jit/Lib/importlib/test/source/   (props changed)
   python/branches/py3k-jit/Lib/json/   (props changed)
   python/branches/py3k-jit/Lib/json/tests/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/fixes/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/pgen2/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/tests/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/tests/data/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/tests/data/fixers/   (props changed)
   python/branches/py3k-jit/Lib/lib2to3/tests/data/fixers/myfixes/   (props changed)
   python/branches/py3k-jit/Lib/logging/   (props changed)
   python/branches/py3k-jit/Lib/mailcap.py
   python/branches/py3k-jit/Lib/msilib/   (props changed)
   python/branches/py3k-jit/Lib/multiprocessing/   (props changed)
   python/branches/py3k-jit/Lib/multiprocessing/dummy/   (props changed)
   python/branches/py3k-jit/Lib/plat-aix4/   (props changed)
   python/branches/py3k-jit/Lib/plat-darwin/   (props changed)
   python/branches/py3k-jit/Lib/plat-freebsd4/   (props changed)
   python/branches/py3k-jit/Lib/plat-freebsd5/   (props changed)
   python/branches/py3k-jit/Lib/plat-freebsd6/   (props changed)
   python/branches/py3k-jit/Lib/plat-freebsd7/   (props changed)
   python/branches/py3k-jit/Lib/plat-freebsd8/   (props changed)
   python/branches/py3k-jit/Lib/plat-generic/   (props changed)
   python/branches/py3k-jit/Lib/plat-linux2/   (props changed)
   python/branches/py3k-jit/Lib/plat-netbsd1/   (props changed)
   python/branches/py3k-jit/Lib/plat-next3/   (props changed)
   python/branches/py3k-jit/Lib/plat-os2emx/   (props changed)
   python/branches/py3k-jit/Lib/plat-sunos5/   (props changed)
   python/branches/py3k-jit/Lib/plat-unixware7/   (props changed)
   python/branches/py3k-jit/Lib/plistlib.py
   python/branches/py3k-jit/Lib/py_compile.py
   python/branches/py3k-jit/Lib/pydoc_data/   (props changed)
   python/branches/py3k-jit/Lib/shutil.py
   python/branches/py3k-jit/Lib/site-packages/   (props changed)
   python/branches/py3k-jit/Lib/sqlite3/   (props changed)
   python/branches/py3k-jit/Lib/sqlite3/test/   (props changed)
   python/branches/py3k-jit/Lib/sqlite3/test/regression.py
   python/branches/py3k-jit/Lib/ssl.py
   python/branches/py3k-jit/Lib/test/   (props changed)
   python/branches/py3k-jit/Lib/test/crashers/   (props changed)
   python/branches/py3k-jit/Lib/test/decimaltestdata/   (props changed)
   python/branches/py3k-jit/Lib/test/gdb_sample.py
   python/branches/py3k-jit/Lib/test/leakers/   (props changed)
   python/branches/py3k-jit/Lib/test/lock_tests.py
   python/branches/py3k-jit/Lib/test/support.py
   python/branches/py3k-jit/Lib/test/test_bytes.py
   python/branches/py3k-jit/Lib/test/test_codecs.py
   python/branches/py3k-jit/Lib/test/test_datetime.py
   python/branches/py3k-jit/Lib/test/test_gdb.py
   python/branches/py3k-jit/Lib/test/test_genericpath.py
   python/branches/py3k-jit/Lib/test/test_linecache.py
   python/branches/py3k-jit/Lib/test/test_locale.py
   python/branches/py3k-jit/Lib/test/test_os.py
   python/branches/py3k-jit/Lib/test/test_plistlib.py
   python/branches/py3k-jit/Lib/test/test_set.py
   python/branches/py3k-jit/Lib/test/test_shutil.py
   python/branches/py3k-jit/Lib/test/test_signal.py
   python/branches/py3k-jit/Lib/test/test_site.py
   python/branches/py3k-jit/Lib/test/test_ssl.py
   python/branches/py3k-jit/Lib/test/test_urllib2net.py
   python/branches/py3k-jit/Lib/test/test_urlparse.py
   python/branches/py3k-jit/Lib/test/test_winreg.py
   python/branches/py3k-jit/Lib/test/xmltestdata/   (props changed)
   python/branches/py3k-jit/Lib/threading.py
   python/branches/py3k-jit/Lib/tkinter/   (props changed)
   python/branches/py3k-jit/Lib/tkinter/test/   (props changed)
   python/branches/py3k-jit/Lib/tkinter/test/test_tkinter/   (props changed)
   python/branches/py3k-jit/Lib/tkinter/test/test_ttk/   (props changed)
   python/branches/py3k-jit/Lib/unittest/   (props changed)
   python/branches/py3k-jit/Lib/unittest/test/   (props changed)
   python/branches/py3k-jit/Lib/unittest/test/test_break.py
   python/branches/py3k-jit/Lib/urllib/   (props changed)
   python/branches/py3k-jit/Lib/urllib/parse.py
   python/branches/py3k-jit/Lib/urllib/request.py
   python/branches/py3k-jit/Lib/wsgiref/   (props changed)
   python/branches/py3k-jit/Lib/xml/   (props changed)
   python/branches/py3k-jit/Lib/xml/dom/   (props changed)
   python/branches/py3k-jit/Lib/xml/etree/   (props changed)
   python/branches/py3k-jit/Lib/xml/parsers/   (props changed)
   python/branches/py3k-jit/Lib/xml/sax/   (props changed)
   python/branches/py3k-jit/Lib/xmlrpc/   (props changed)
   python/branches/py3k-jit/Mac/BuildScript/build-installer.py
   python/branches/py3k-jit/Mac/BuildScript/scripts/postflight.framework
   python/branches/py3k-jit/Mac/Makefile.in
   python/branches/py3k-jit/Mac/PythonLauncher/Makefile.in
   python/branches/py3k-jit/Misc/ACKS
   python/branches/py3k-jit/Misc/NEWS
   python/branches/py3k-jit/Misc/developers.txt
   python/branches/py3k-jit/Misc/maintainers.rst
   python/branches/py3k-jit/Modules/Setup.dist
   python/branches/py3k-jit/Modules/_ctypes/callproc.c
   python/branches/py3k-jit/Modules/_posixsubprocess.c
   python/branches/py3k-jit/Modules/_sqlite/connection.c
   python/branches/py3k-jit/Modules/_ssl.c
   python/branches/py3k-jit/Modules/datetimemodule.c
   python/branches/py3k-jit/Modules/main.c
   python/branches/py3k-jit/Modules/posixmodule.c
   python/branches/py3k-jit/Modules/python.c
   python/branches/py3k-jit/Objects/setobject.c
   python/branches/py3k-jit/Objects/unicodeobject.c
   python/branches/py3k-jit/PC/winreg.c
   python/branches/py3k-jit/Python/marshal.c
   python/branches/py3k-jit/Tools/gdb/libpython.py
   python/branches/py3k-jit/configure
   python/branches/py3k-jit/configure.in
   python/branches/py3k-jit/setup.py

Modified: python/branches/py3k-jit/Doc/library/_thread.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/_thread.rst	(original)
+++ python/branches/py3k-jit/Doc/library/_thread.rst	Fri Apr 23 02:01:11 2010
@@ -109,6 +109,8 @@
    :meth:`Lock.acquire`. Specifiying a timeout greater than this value will
    raise an :exc:`OverflowError`.
 
+   .. versionadded:: 3.2
+
 
 Lock objects have the following methods:
 
@@ -132,6 +134,9 @@
    The return value is ``True`` if the lock is acquired successfully,
    ``False`` if not.
 
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
+
 .. method:: lock.release()
 
    Releases the lock.  The lock must have been acquired earlier, but not
@@ -171,12 +176,10 @@
 * It is not possible to interrupt the :meth:`acquire` method on a lock --- the
   :exc:`KeyboardInterrupt` exception will happen after the lock has been acquired.
 
-  .. index:: pair: threads; IRIX
-
 * When the main thread exits, it is system defined whether the other threads
-  survive.  On SGI IRIX using the native thread implementation, they survive.  On
-  most other systems, they are killed without executing :keyword:`try` ...
-  :keyword:`finally` clauses or executing object destructors.
+  survive.  On most systems, they are killed without executing
+  :keyword:`try` ... :keyword:`finally` clauses or executing object
+  destructors.
 
 * When the main thread exits, it does not do any of its usual cleanup (except
   that :keyword:`try` ... :keyword:`finally` clauses are honored), and the

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

Modified: python/branches/py3k-jit/Doc/library/logging.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/logging.rst	(original)
+++ python/branches/py3k-jit/Doc/library/logging.rst	Fri Apr 23 02:01:11 2010
@@ -2028,8 +2028,8 @@
       The symbolic ``LOG_`` values are defined in :class:`SysLogHandler` and
       mirror the values defined in the ``sys/syslog.h`` header file.
 
-      +------------------------------------------+
-      | Priorities                               |
+      **Priorities**
+
       +--------------------------+---------------+
       | Name (string)            | Symbolic value|
       +==========================+===============+
@@ -2050,8 +2050,8 @@
       | ``warn`` or ``warning``  | LOG_WARNING   |
       +--------------------------+---------------+
 
-      +-------------------------------+
-      | Facilities                    |
+      **Facilities**
+
       +---------------+---------------+
       | Name (string) | Symbolic value|
       +===============+===============+
@@ -2497,7 +2497,7 @@
 methods have the same signatures as their counterparts in :class:`Logger`, so
 you can use the two types of instances interchangeably.
 
-.. versionchanged:: 2.7
+.. versionchanged:: 3.2
 
 The :meth:`isEnabledFor` method was added to :class:`LoggerAdapter`. This method
 delegates to the underlying logger.

Modified: python/branches/py3k-jit/Doc/library/os.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/os.rst	(original)
+++ python/branches/py3k-jit/Doc/library/os.rst	Fri Apr 23 02:01:11 2010
@@ -1500,6 +1500,8 @@
    will be set to *sig*. The Windows version of :func:`kill` additionally takes
    process handles to be killed.
 
+   .. versionadded:: 3.2 Windows support
+
 
 .. function:: killpg(pgid, sig)
 

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

Modified: python/branches/py3k-jit/Doc/library/signal.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/signal.rst	(original)
+++ python/branches/py3k-jit/Doc/library/signal.rst	Fri Apr 23 02:01:11 2010
@@ -77,16 +77,18 @@
 .. data:: CTRL_C_EVENT
 
    The signal corresponding to the CTRL+C keystroke event.
-
    Availability: Windows.
 
+   .. versionadded:: 3.2
+
 
 .. data:: CTRL_BREAK_EVENT
 
    The signal corresponding to the CTRL+BREAK keystroke event.
-
    Availability: Windows.
 
+   .. versionadded:: 3.2
+
 
 .. data:: NSIG
 

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

Modified: python/branches/py3k-jit/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/threading.rst	(original)
+++ python/branches/py3k-jit/Doc/library/threading.rst	Fri Apr 23 02:01:11 2010
@@ -164,6 +164,7 @@
    Specifiying a timeout greater than this value will raise an
    :exc:`OverflowError`.
 
+   .. versionadded:: 3.2
 
 Detailed interfaces for the objects are documented below.
 
@@ -382,6 +383,8 @@
    The return value is ``True`` if the lock is acquired successfully,
    ``False`` if not (for example if the *timeout* expired).
 
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
 
 .. method:: Lock.release()
 
@@ -439,6 +442,9 @@
    and as long as the lock cannot be acquired.  Return true if the lock has
    been acquired, false if the timeout has elapsed.
 
+   .. versionchanged:: 3.2
+      The *timeout* parameter is new.
+
 
 .. method:: RLock.release()
 
@@ -596,7 +602,7 @@
    defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is
    raised.
 
-   .. method:: acquire(blocking=True)
+   .. method:: acquire(blocking=True, timeout=None)
 
       Acquire a semaphore.
 
@@ -607,14 +613,18 @@
       interlocking so that if multiple :meth:`acquire` calls are blocked,
       :meth:`release` will wake exactly one of them up.  The implementation may
       pick one at random, so the order in which blocked threads are awakened
-      should not be relied on.  There is no return value in this case.
-
-      When invoked with *blocking* set to true, do the same thing as when called
-      without arguments, and return true.
+      should not be relied on.  Returns true (or blocks indefinitely).
 
       When invoked with *blocking* set to false, do not block.  If a call
-      without an argument would block, return false immediately; otherwise, do
-      the same thing as when called without arguments, and return true.
+      without an argument would block, return false immediately; otherwise,
+      do the same thing as when called without arguments, and return true.
+
+      When invoked with a *timeout* other than None, it will block for at
+      most *timeout* seconds.  If acquire does not complete successfully in
+      that interval, return false.  Return true otherwise.
+
+      .. versionchanged:: 3.2
+         The *timeout* parameter is new.
 
    .. method:: release()
 

Modified: python/branches/py3k-jit/Doc/library/unittest.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/unittest.rst	(original)
+++ python/branches/py3k-jit/Doc/library/unittest.rst	Fri Apr 23 02:01:11 2010
@@ -272,7 +272,7 @@
   run. Output during a passing test is discarded. Output is echoed normally
   on test fail or error and is added to the failure messages.
 
-..  versionadded:: 2.7
+.. versionadded:: 3.2
    The command line options ``-c``, ``-b`` and ``-f`` where added.
 
 The command line can also be used for test discovery, for running all of the
@@ -284,7 +284,7 @@
 Test Discovery
 --------------
 
-.. versionadded:: 2.7
+.. versionadded:: 3.2
 
 Unittest supports simple test discovery. For a project's tests to be
 compatible with test discovery they must all be importable from the top level
@@ -765,7 +765,7 @@
       Calling this during the a test method or :meth:`setUp` skips the current
       test.  See :ref:`unittest-skipping` for more information.
 
-      .. versionadded:: 2.7
+      .. versionadded:: 3.1
 
 
    .. method:: debug()
@@ -920,7 +920,7 @@
       a regular expression object or a string containing a regular expression
       suitable for use by :func:`re.search`.
 
-      .. versionadded:: 2.7
+      .. versionadded:: 3.2
 
 
    .. method:: assertIn(first, second, msg=None)
@@ -1563,7 +1563,7 @@
       only be echoed onto the real ``sys.stdout`` and ``sys.stderr`` if the test
       fails or errors. Any output is also attached to the failure / error message.
 
-      .. versionadded:: 2.7
+      .. versionadded:: 3.2
 
 
    .. attribute:: failfast
@@ -1571,7 +1571,7 @@
       If set to true :meth:`stop` will be called on the first failure or error,
       halting the test run.
 
-      .. versionadded:: 2.7
+      .. versionadded:: 3.2
 
 
    .. method:: wasSuccessful()

Modified: python/branches/py3k-jit/Doc/library/urllib.parse.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/urllib.parse.rst	(original)
+++ python/branches/py3k-jit/Doc/library/urllib.parse.rst	Fri Apr 23 02:01:11 2010
@@ -88,6 +88,9 @@
    See section :ref:`urlparse-result-object` for more information on the result
    object.
 
+   .. versionchanged:: 3.2
+      Added IPv6 URL parsing capabilities.
+
 
 .. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False)
 
@@ -326,17 +329,29 @@
 
 .. seealso::
 
-   :rfc:`1738` - Uniform Resource Locators (URL)
-      This specifies the formal syntax and semantics of absolute URLs.
+   :rfc:`3986` - Uniform Resource Identifiers
+      This is the current standard (STD66). Any changes to urlparse module
+      should conform to this. Certain deviations could be observed, which are
+      mostly due backward compatiblity purposes and for certain de-facto
+      parsing requirements as commonly observed in major browsers.
+
+   :rfc:`2732` - Format for Literal IPv6 Addresses in URL's.
+      This specifies the parsing requirements of IPv6 URLs.
+
+   :rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax
+      Document describing the generic syntactic requirements for both Uniform Resource
+      Names (URNs) and Uniform Resource Locators (URLs).
+
+   :rfc:`2368` - The mailto URL scheme.
+      Parsing requirements for mailto url schemes.
 
    :rfc:`1808` - Relative Uniform Resource Locators
       This Request For Comments includes the rules for joining an absolute and a
       relative URL, including a fair number of "Abnormal Examples" which govern the
       treatment of border cases.
 
-   :rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax
-      Document describing the generic syntactic requirements for both Uniform Resource
-      Names (URNs) and Uniform Resource Locators (URLs).
+   :rfc:`1738` - Uniform Resource Locators (URL)
+      This specifies the formal syntax and semantics of absolute URLs.
 
 
 .. _urlparse-result-object:

Modified: python/branches/py3k-jit/Doc/library/urllib.request.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/urllib.request.rst	(original)
+++ python/branches/py3k-jit/Doc/library/urllib.request.rst	Fri Apr 23 02:01:11 2010
@@ -1072,30 +1072,37 @@
 Examples
 --------
 
-This example gets the python.org main page and displays the first 100 bytes of
-it.::
+This example gets the python.org main page and displays the first 300 bytes of
+it. ::
 
    >>> import urllib.request
    >>> f = urllib.request.urlopen('http://www.python.org/')
-   >>> print(f.read(100))
-   b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-   <?xml-stylesheet href="./css/ht2html'
-
-Note that in Python 3, urlopen returns a bytes object by default. In many
-circumstances, you might expect the output of urlopen to be a string. This
-might be a carried over expectation from Python 2, where urlopen returned
-string or it might even the common usecase. In those cases, you should
-explicitly decode the bytes to string.
-
-In the examples below, we have chosen *utf-8* encoding for demonstration, you
-might choose the encoding which is suitable for the webpage you are
-requesting::
+   >>> print(f.read(300))
+   b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n\n<html
+   xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n\n<head>\n
+   <meta http-equiv="content-type" content="text/html; charset=utf-8" />\n
+   <title>Python Programming '
+
+Note that urlopen returns a bytes object.  This is because there is no way
+for urlopen to automatically determine the encoding of the byte stream
+it receives from the http server. In general, a program will decode
+the returned bytes object to string once it determines or guesses
+the appropriate encoding.
+
+The following W3C document, http://www.w3.org/International/O-charset  , lists
+the various ways in which a (X)HTML or a XML document could have specified its
+encoding information.
+
+As python.org website uses *utf-8* encoding as specified in it's meta tag, we
+will use same for decoding the bytes object. ::
 
    >>> import urllib.request
    >>> f = urllib.request.urlopen('http://www.python.org/')
-   >>> print(f.read(100).decode('utf-8')
-   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-   <?xml-stylesheet href="./css/ht2html
+   >>> print(fp.read(100).decode('utf-8'))
+   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtm
+
 
 In the following example, we are sending a data-stream to the stdin of a CGI
 and reading the data it returns to us. Note that this example will only work

Modified: python/branches/py3k-jit/Doc/library/winreg.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/winreg.rst	(original)
+++ python/branches/py3k-jit/Doc/library/winreg.rst	Fri Apr 23 02:01:11 2010
@@ -61,15 +61,40 @@
    :exc:`WindowsError` exception is  raised.
 
 
+.. function:: CreateKeyEx(key, sub_key, res=0, sam=KEY_ALL_ACCESS)
+
+   Creates or opens the specified key, returning a :dfn:`handle object`
+
+   *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+   constants.
+
+   *sub_key* is a string that names the key this method opens or creates.
+
+   *res* is a reserved integer, and must be zero. The default is zero.
+
+   *sam* is an integer that specifies an access mask that describes the desired
+   security access for the key. Default is :const:`KEY_ALL_ACCESS`
+
+   If *key* is one of the predefined keys, *sub_key* may  be ``None``. In that
+   case, the handle returned is the same key handle  passed in to the function.
+
+   If the key already exists, this function opens the existing key.
+
+   The return value is the handle of the opened key. If the function fails, a
+   :exc:`WindowsError` exception is raised.
+
+   .. versionadded:: 3.2
+
+
 .. function:: DeleteKey(key, sub_key)
 
    Deletes the specified key.
 
-   *key* is an already open key, or any one of the predefined  :const:`HKEY_\*`
+   *key* is an already open key, or any one of the predefined :const:`HKEY_\*`
    constants.
 
-   *sub_key* is a string that must be a subkey of the key  identified by the *key*
-   parameter.  This value must not be  ``None``, and the key may not have subkeys.
+   *sub_key* is a string that must be a subkey of the key identified by the *key*
+   parameter.  This value must not be ``None``, and the key may not have subkeys.
 
    *This method can not delete keys with subkeys.*
 
@@ -77,6 +102,37 @@
    If the method fails, a :exc:`WindowsError`  exception is raised.
 
 
+.. function:: DeleteKeyEx(key, sub_key, sam=KEY_WOW64_64KEY, res=0)
+
+   Deletes the specified key.
+
+   .. note::
+      The :func:`DeleteKeyEx` function is implemented with the RegDeleteKeyEx
+      Windows API function, which is specific to 64-bit versions of Windows.
+      See http://msdn.microsoft.com/en-us/library/ms724847%28VS.85%29.aspx
+
+   *key* is an already open key, or any one of the predefined :const:`HKEY_\*`
+   constants.
+
+   *sub_key* is a string that must be a subkey of the key identified by the
+   *key* parameter. This value must not be ``None``, and the key may not have
+   subkeys.
+
+   *res* is a reserved integer, and must be zero. The default is zero.
+
+   *sam* is an integer that specifies an access mask that describes the
+   desired security access for the key. Default is :const:`KEY_WOW64_64KEY`
+
+   *This method can not delete keys with subkeys.*
+
+   If the method succeeds, the entire key, including all of its values, is
+   removed. If the method fails, a :exc:`WindowsError` exception is raised.
+
+   On unsupported Windows versions, :exc:`NotImplementedError` is raised.
+
+   .. versionadded:: 3.2
+
+
 .. function:: DeleteValue(key, value)
 
    Removes a named value from a registry key.
@@ -374,6 +430,48 @@
    registry.  This helps the registry perform efficiently.
 
 
+.. function:: DisableReflectionKey(key)
+
+   Disables registry reflection for 32-bit processes running on a 64-bit
+   Operating System.
+
+   *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+   constants.
+
+   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+   Operating System.
+
+   If the key is not on the reflection list, the function succeeds but has no
+   effect. Disabling reflection for a key does not affect reflection of any
+   subkeys.
+
+
+.. function:: EnableReflectionKey(key)
+
+   Restores registry reflection for the specified disabled key.
+
+   *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+   constants.
+
+   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+   Operating System.
+
+   Restoring reflection for a key does not affect reflection of any subkeys.
+
+
+.. function:: QueryReflectionKey(key)
+
+   Determines the reflection state for the specified key.
+
+   *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+   constants.
+
+   Returns ``True`` if reflection is disabled.
+
+   Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+   Operating System.
+
+
 .. _handle-object:
 
 Registry Handle Objects

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

Modified: python/branches/py3k-jit/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.7.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.7.rst	Fri Apr 23 02:01:11 2010
@@ -8,7 +8,7 @@
 
 .. Fix accents on Kristjan Valur Jonsson, Fuerstenau
 
-.. Big jobs: argparse, ElementTree 1.3, pep 391, 3106, sysconfig
+.. Big jobs: ElementTree 1.3, pep 391, sysconfig
 ..  unittest test discovery
 ..  hyperlink all the methods & functions.
 
@@ -58,8 +58,9 @@
 schedule is described in :pep:`373`.
 
 Python 2.7 is planned to be the last major release in the 2.x series.
-Though more major releases have not been absolutely ruled out, it's
-likely that the 2.7 release will have an extended period of
+Though more major releases have not been absolutely ruled out, the
+Python maintainers are planning to focus more on Python 3.x.  Despite
+that, it's likely that the 2.7 release will have a longer period of
 maintenance compared to earlier 2.x versions.
 
 .. Compare with previous release in 2 - 3 sentences here.
@@ -181,14 +182,21 @@
 ..     :meth:`~collections.namedtuple._asdict()` (see below)
 
 The standard library now supports use of ordered dictionaries in several
-modules.  The :mod:`configparser` module uses them by default.  This lets
-configuration files be read, modified, and then written back in their original
-order.  The :meth:`~collections.somenamedtuple._asdict()` method for
-:func:`collections.namedtuple` now returns an ordered dictionary with the
-values appearing in the same order as the underlying tuple indices.
-The :mod:`json` module is being built-out with an *object_pairs_hook* to allow
-OrderedDicts to be built by the decoder.
-Support was also added for third-party tools like `PyYAML <http://pyyaml.org/>`_.
+modules.
+
+* The :mod:`ConfigParser` module uses them by default, letting
+  configuration files be read, modified, and then written back in their original
+  order.
+
+* The :meth:`~collections.somenamedtuple._asdict()` method for
+  :func:`collections.namedtuple` now returns an ordered dictionary with the
+  values appearing in the same order as the underlying tuple indices.
+
+* The :mod:`json` module's :class:`~json.JSONDecoder` class
+  constructor was extended with an *object_pairs_hook* parameter to
+  allow :class:`OrderedDict` instances to be built by the decoder.
+  Support was also added for third-party tools like
+  `PyYAML <http://pyyaml.org/>`_.
 
 .. seealso::
 
@@ -254,11 +262,69 @@
 API consistent with :mod:`optparse`'s interface was discussed but
 rejected as too messy and difficult.)
 
-To summarize, if you're writing a new script and don't need to worry
+In short, if you're writing a new script and don't need to worry
 about compatibility with earlier versions of Python, use
 :mod:`argparse` instead of :mod:`optparse`.
 
-XXX need an example
+Here's an example::
+
+    import argparse
+
+    parser = argparse.ArgumentParser(description='Command-line example.')
+
+    # Add optional switches
+    parser.add_argument('-v', action='store_true', dest='is_verbose',
+                        help='produce verbose output')
+    parser.add_argument('-o', action='store', dest='output',
+                        metavar='FILE',
+                        help='direct output to FILE instead of stdout')
+    parser.add_argument('-C', action='store', type=int, dest='context',
+                        metavar='NUM', default=0,
+                        help='display NUM lines of added context')
+
+    # Allow any number of additional arguments.
+    parser.add_argument(nargs='*', action='store', dest='inputs',
+                        help='input filenames (default is stdin)')
+
+    args = parser.parse_args()
+    print args.__dict__
+
+Unless you override it, :option:`-h` and :option:`--help` switches
+are automatically added, and produce neatly formatted output::
+
+    -> ./python.exe argparse-example.py --help
+    usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs [inputs ...]]
+
+    Command-line example.
+
+    positional arguments:
+      inputs      input filenames (default is stdin)
+
+    optional arguments:
+      -h, --help  show this help message and exit
+      -v          produce verbose output
+      -o FILE     direct output to FILE instead of stdout
+      -C NUM      display NUM lines of added context
+
+Similarly to :mod:`optparse`, the command-line switches and arguments
+are returned as an object with attributes named by the *dest* parameters::
+
+    -> ./python.exe argparse-example.py -v
+    {'output': None, 'is_verbose': True, 'context': 0, 'inputs': []}
+
+    -> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2
+    {'output': '/tmp/output', 'is_verbose': True, 'context': 4,
+     'inputs': ['file1', 'file2']}
+
+:mod:`argparse` has much fancier validation than :mod:`optparse`; you
+can specify an exact number of arguments as an integer, 0 or more
+arguments by passing ``'*'``, 1 or more by passing ``'+'``, or an
+optional argument with ``'?'``.  A top-level parser can contain
+sub-parsers, so you can define subcommands that have different sets of
+switches, as in ``svn commit``, ``svn checkout``, etc.  You can
+specify an argument type as :class:`~argparse.FileType`, which will
+automatically open files for you and understands that ``'-'`` means
+standard input or output.
 
 .. seealso::
 
@@ -272,7 +338,28 @@
 PEP 391: Dictionary-Based Configuration For Logging
 ====================================================
 
-XXX write this section.
+.. not documented in library reference yet.
+
+The :mod:`logging` module is very flexible; an application can define
+a tree of logging subsystems, and each logger in this tree can filter
+out certain messages, format them differently, and direct messages to
+a varying number of handlers.
+
+All this flexibility can require a lot of configuration.  You can
+write Python statements to create objects and set their properties,
+but a complex set-up would require verbose but boring code.
+:mod:`logging` also supports a :func:`~logging.config.fileConfig`
+function that parses a file, but the file format doesn't support
+configuring filters, and it's messier to generate programmatically.
+
+Python 2.7 adds a :func:`~logging.config.dictConfig` function that
+uses a dictionary, and there are many ways to produce a dictionary
+from different sources.  You can construct one with code, of course.
+Python's standard library now includes a JSON parser, so you could
+parse a file containing JSON, or you could use a YAML parsing library
+if one is installed.
+
+XXX describe an example.
 
 Two smaller enhancements to the logging module are:
 
@@ -296,7 +383,48 @@
 PEP 3106: Dictionary Views
 ====================================================
 
-XXX write this section.
+The dictionary methods :meth:`keys`, :meth:`values`, and :meth:`items`
+are different in Python 3.x.  They return an object called a :dfn:`view`
+instead of a fully materialized list.
+
+.. Views can be iterated over, but they also behave like sets.  XXX not working.
+
+It's not possible to change the return values of :meth:`keys`,
+:meth:`values`, and :meth:`items` in Python 2.7 because too much code
+would break.  Instead the 3.x versions were added under the new names
+of :meth:`viewkeys`, :meth:`viewvalues`, and :meth:`viewitems`.
+
+::
+
+    >>> d = dict((i*10, chr(65+i)) for i in range(26))
+    >>> d
+    {0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}
+    >>> d.viewkeys()
+    dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])
+
+The view keeps track of the dictionary and its contents change as the
+dictionary is modified::
+
+    >>> vk = d.viewkeys()
+    >>> vk
+    dict_keys([0, 130, 10, ..., 250])
+    >>> d[260] = '&'
+    >>> vk
+    dict_keys([0, 130, 260, 10, ..., 250])
+
+However, note that you can't add or remove keys while you're iterating
+over the view::
+
+    >>> for k in vk:
+    ...     d[k*2] = k
+    ...
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    RuntimeError: dictionary changed size during iteration
+
+You can use the view methods in Python 2.x code, and the 2to3
+converter will change them to the standard :meth:`keys`,
+:meth:`values`, and :meth:`items` methods.
 
 .. seealso::
 
@@ -496,6 +624,10 @@
   Python3-warning mode, Python 2.7 will now warn about this odd usage.
   (Noted by James Lingard; :issue:`7362`.)
 
+* It's now possible to create weak references to old-style class
+  objects.  New-style classes were always weak-referenceable.  (Fixed
+  by Antoine Pitrou; :issue:`8268`.)
+
 * When a module object is garbage-collected, the module's dictionary is
   now only cleared if no one else is holding a reference to the
   dictionary (:issue:`7140`).
@@ -684,11 +816,15 @@
      >>> c['z']
      0
 
-  There are two additional :class:`~collections.Counter` methods:
-  :meth:`~collections.Counter.most_common` returns the N most common elements
-  and their counts, and :meth:`~collections.Counter.elements`
-  returns an iterator over the contained element, repeating each element
-  as many times as its count::
+  There are three additional :class:`~collections.Counter` methods:
+  :meth:`~collections.Counter.most_common` returns the N most common
+  elements and their counts.  :meth:`~collections.Counter.elements`
+  returns an iterator over the contained elements, repeating each
+  element as many times as its count.
+  :meth:`~collections.Counter.subtract` takes an iterable and
+  subtracts one for each element instead of adding; if the argument is
+  a dictionary or another :class:`Counter`, the counts are
+  subtracted. ::
 
     >>> c.most_common(5)
     [(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]
@@ -697,11 +833,16 @@
        'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',
        'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',
        's', 's', 'r', 't', 't', 'x'
-
-  .. maybe it's better to use list(c.elements()) here
+    >>> c['e']
+    5
+    >>> c.subtract('very heavy on the letter e')
+    >>> c['e']    # Count is now lower
+    -1
 
   Contributed by Raymond Hettinger; :issue:`1696199`.
 
+  .. revision 79660
+
   The new :class:`~collections.OrderedDict` class is described in the earlier
   section :ref:`pep-0372`.
 
@@ -757,18 +898,28 @@
   :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context.is_canonical`
   methods.  (Patch by Juan José Conti; :issue:`7633`.)
 
-  The constructor for :class:`~decimal.Decimal` now accepts non-European
-  Unicode characters, such as Arabic-Indic digits.  (Contributed by
-  Mark Dickinson; :issue:`6595`.)
+  The constructor for :class:`~decimal.Decimal` now accepts
+  floating-point numbers (added by Raymond Hettinger; :issue:`8257`)
+  and non-European Unicode characters such as Arabic-Indic digits
+  (contributed by Mark Dickinson; :issue:`6595`).
 
   When using :class:`~decimal.Decimal` instances with a string's
   :meth:`~str.format` method, the default alignment was previously
   left-alignment.  This has been changed to right-alignment, which seems
   more sensible for numeric types.  (Changed by Mark Dickinson; :issue:`6857`.)
 
-* The :class:`~fractions.Fraction` class now accepts two rational numbers
-  as arguments to its constructor.
-  (Implemented by Mark Dickinson; :issue:`5812`.)
+* The :mod:`difflib` module now produces output that is more
+  compatible with modern :command:`diff`/:command:`patch` tools thanks
+  to two changes: 1) the header giving the filename now uses a tab
+  character instead of spaces as a separator, and 2) the date format
+  used is now ISO-8601 style, ``2005-01-26 23:30:50``.  (Fixed by
+  Anatoly Techtonik; :issue:`7585`.)
+
+* The :class:`~fractions.Fraction` class now accepts a single float or
+  :class:`~decimal.Decimal` instance, or two rational numbers, as
+  arguments to its constructor.  (Implemented by Mark Dickinson;
+  rationals added in :issue:`5812`, and float/decimal in
+  :issue:`8294`.)
 
   An oversight was fixed, making the :class:`Fraction` match the other
   numeric types; ordering comparisons (``<``, ``<=``, ``>``, ``>=``) between
@@ -837,6 +988,25 @@
 * The :mod:`imaplib` module now supports IPv6 addresses.
   (Contributed by Derek Morr; :issue:`1655`.)
 
+* New function: the :mod:`inspect` module's :func:`~inspect.getcallargs`
+  takes a callable and its positional and keyword arguments,
+  and figures out which of the callable's parameters will receive each argument,
+  returning a dictionary mapping argument names to their values.  For example::
+
+    >>> from inspect import getcallargs
+    >>> def f(a, b=1, *pos, **named):
+    ...     pass
+    >>> getcallargs(f, 1, 2, 3)
+    {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}
+    >>> getcallargs(f, a=2, x=4)
+    {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}
+    >>> getcallargs(f)
+    Traceback (most recent call last):
+    ...
+    TypeError: f() takes at least 1 argument (0 given)
+
+  Contributed by George Sakkis; :issue:`3135`.
+
 * Updated module: The :mod:`io` library has been upgraded to the version shipped with
   Python 3.1.  For 3.1, the I/O library was entirely rewritten in C
   and is 2 to 20 times faster depending on the task being performed.  The
@@ -975,13 +1145,17 @@
   Victor Stinner; :issue:`3137`.)
 
 * The :mod:`socket` module's :class:`~ssl.SSL` objects now support the
-  buffer API, which fixed a test suite failure.  (Fixed by Antoine
-  Pitrou; :issue:`7133`.)  The version of OpenSSL being used is
-  now available as the module attributes
-  :attr:`OPENSSL_VERSION` (a string),
+  buffer API, which fixed a test suite failure (fix by Antoine Pitrou;
+  :issue:`7133`).  :class:`SSL` objects also now automatically set
+  OpenSSL's :cmacro:`SSL_MODE_AUTO_RETRY`, which will prevent an error
+  code being returned from :meth:`recv` operations that trigger an SSL
+  renegotiation (fix by Antoine Pitrou; :issue:`8222`).
+
+  The version of OpenSSL being used is now available as the module
+  attributes :attr:`OPENSSL_VERSION` (a string),
   :attr:`OPENSSL_VERSION_INFO` (a 5-tuple), and
-  :attr:`OPENSSL_VERSION_NUMBER` (an integer).  (Added by Antoine Pitrou;
-  :issue:`8321`.)
+  :attr:`OPENSSL_VERSION_NUMBER` (an integer).  (Added by Antoine
+  Pitrou; :issue:`8321`.)
 
   The :func:`~socket.create_connection` function
   gained a *source_address* parameter, a ``(host, port)`` 2-tuple
@@ -1011,7 +1185,10 @@
   errors when a value is too large for a particular integer format
   code (one of ``bBhHiIlLqQ``); it now always raises a
   :exc:`struct.error` exception.  (Changed by Mark Dickinson;
-  :issue:`1523`.)
+  :issue:`1523`.)  The :func:`~struct.pack` function will also
+  attempt to use :meth:`__index__` to convert and pack non-integers
+  before trying the :meth:`__int__` method or reporting an error.
+  (Changed by Mark Dickinson; :issue:`8300`.)
 
 * New function: the :mod:`subprocess` module's
   :func:`~subprocess.check_output` runs a command with a specified set of arguments
@@ -1346,6 +1523,18 @@
 
 Changes to Python's build process and to the C API include:
 
+* The latest release of the GNU Debugger, GDB 7, can be `scripted
+  using Python
+  <http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html>`__.
+  When you begin debugging an executable program P, GDB will look for
+  a file named ``P-gdb.py`` and automatically read it.  Dave Malcolm
+  contributed a :file:`python-gdb.py` that adds a number of useful
+  commands when debugging Python itself.  For example, there are
+  ``py-up`` and ``py-down`` that go up or down one Python stack frame,
+  which usually corresponds to several C stack frames.  ``py-print``
+  prints the value of a Python variable, and ``py-bt`` prints the
+  Python stack trace.  (Added as a result of :issue:`8032`.)
+
 * If you use the :file:`.gdbinit` file provided with Python,
   the "pyo" macro in the 2.7 version now works correctly when the thread being
   debugged doesn't hold the GIL; the macro now acquires it before printing.
@@ -1442,9 +1631,10 @@
   building the :mod:`pyexpat` module to use the system Expat library.
   (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:`7609`.)
 
-* New configure option: Compiling Python with the
+* New configure option: compiling Python with the
   :option:`--with-valgrind` option will now disable the pymalloc
-  allocator, which is difficult for the Valgrind to analyze correctly.
+  allocator, which is difficult for the Valgrind memory-error detector
+  to analyze correctly.
   Valgrind will therefore be better at detecting memory leaks and
   overruns. (Contributed by James Henstridge; :issue:`2422`.)
 
@@ -1459,6 +1649,10 @@
   but it's available if anyone wishes to use it.
   (Added by Mark Dickinson; :issue:`2937`.)
 
+  :program:`configure` also now sets a :envvar:`LDCXXSHARED` Makefile
+  variable for supporting C++ linking.  (Contributed by Arfrever
+  Frehtes Taifersar Arahesis; :issue:`1222585`.)
+
 * The build process now creates the necessary files for pkg-config
   support.  (Contributed by Clinton Roy; :issue:`3585`.)
 
@@ -1482,6 +1676,13 @@
   the native thread-local storage functions are now used.
   (Contributed by Kristjan Valur Jonsson; :issue:`3582`.)
 
+* The :func:`os.kill` function now works on Windows.  The signal value
+  can be the constants :const:`CTRL_C_EVENT`,
+  :const:`CTRL_BREAK_EVENT`, or any integer.  The Control-C and
+  Control-Break keystroke events can be sent to subprocesses; any
+  other value will use the :cfunc:`TerminateProcess` API.
+  (Contributed by Miki Tebeka; :issue:`1220212`.)
+
 * The :func:`os.listdir` function now correctly fails
   for an empty path.  (Fixed by Hirokazu Yamamoto; :issue:`5913`.)
 
@@ -1533,6 +1734,11 @@
   with a new :option:`-F` switch that runs selected tests in a loop
   until they fail.  (Added by Antoine Pitrou; :issue:`7312`.)
 
+* When executed as a script, the :file:`py_compile.py` module now
+  accepts ``'-'`` as an argument, which will read standard input for
+  the list of filenames to be compiled.  (Contributed by Piotr
+  Ożarowski; :issue:`8233`.)
+
 .. ======================================================================
 
 Porting to Python 2.7
@@ -1591,5 +1797,5 @@
 
 The author would like to thank the following people for offering
 suggestions, corrections and assistance with various drafts of this
-article: Ryan Lovett, Hugh Secker-Walker.
+article: Ryan Lovett, R. David Murray, Hugh Secker-Walker.
 

Modified: python/branches/py3k-jit/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/3.2.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/3.2.rst	Fri Apr 23 02:01:11 2010
@@ -85,6 +85,18 @@
   (Contributed by Georg Brandl and Mattias Brändström;
   `appspot issue 53094 <http://codereview.appspot.com/53094>`_.)
 
+* The :func:`shutil.copytree` function has two new options:
+
+  * *ignore_dangling_symlinks*: when ``symlinks=False`` (meaning that the
+    function copies the file pointed to by the symlink, not the symlink
+    itself) this option will silence the error thrown if the file doesn't
+    exist.
+
+  * *copy_function*: a callable that will be used to copy files.
+    :func:`shutil.copy2` is used by default.
+
+  (Contributed by Tarek Ziade.)
+
 Multi-threading
 ===============
 
@@ -103,7 +115,7 @@
   (however, "priority requests" as exposed in this message have not been
   kept for inclusion).
 
-  (Contributed by Antoine Pitrou)
+  (Contributed by Antoine Pitrou.)
 
 * Recursive locks (created with the :func:`threading.RLock` API) now benefit
   from a C implementation which makes them as fast as regular locks, and
@@ -139,4 +151,6 @@
 This section lists previously described changes and other bugfixes
 that may require changes to your code:
 
+* bytearray objects cannot be used anymore as filenames: convert them to bytes
+
 * Stub

Modified: python/branches/py3k-jit/Include/Python.h
==============================================================================
--- python/branches/py3k-jit/Include/Python.h	(original)
+++ python/branches/py3k-jit/Include/Python.h	Fri Apr 23 02:01:11 2010
@@ -126,7 +126,7 @@
 /* _Py_Mangle is defined in compile.c */
 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
 
-/* _Py_char2wchar lives in python.c */
+/* _Py_char2wchar lives in main.c */
 PyAPI_FUNC(wchar_t *) _Py_char2wchar(char *);
 #ifdef __cplusplus
 }

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

Modified: python/branches/py3k-jit/Include/unicodeobject.h
==============================================================================
--- python/branches/py3k-jit/Include/unicodeobject.h	(original)
+++ python/branches/py3k-jit/Include/unicodeobject.h	Fri Apr 23 02:01:11 2010
@@ -1238,8 +1238,8 @@
 /* --- File system encoding ---------------------------------------------- */
 
 /* ParseTuple converter which converts a Unicode object into the file
-   system encoding, using the PEP 383 error handler; bytes objects are
-   output as-is. */
+   system encoding as a bytes object, using the PEP 383 error handler; bytes
+   objects are output as-is. */
 
 PyAPI_FUNC(int) PyUnicode_FSConverter(PyObject*, void*);
 

Modified: python/branches/py3k-jit/Lib/email/test/test_email.py
==============================================================================
--- python/branches/py3k-jit/Lib/email/test/test_email.py	(original)
+++ python/branches/py3k-jit/Lib/email/test/test_email.py	Fri Apr 23 02:01:11 2010
@@ -520,15 +520,10 @@
 
     def test_default_cte(self):
         eq = self.assertEqual
+        # 7bit data and the default us-ascii _charset
         msg = MIMEText('hello world')
         eq(msg['content-transfer-encoding'], '7bit')
-
-    def test_default_cte(self):
-        eq = self.assertEqual
-        # With no explicit _charset its us-ascii, and all are 7-bit
-        msg = MIMEText('hello world')
-        eq(msg['content-transfer-encoding'], '7bit')
-        # Similar, but with 8-bit data
+        # Similar, but with 8bit data
         msg = MIMEText('hello \xf8 world')
         eq(msg['content-transfer-encoding'], '8bit')
         # And now with a different charset

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

Modified: python/branches/py3k-jit/Lib/importlib/test/__main__.py
==============================================================================
--- python/branches/py3k-jit/Lib/importlib/test/__main__.py	(original)
+++ python/branches/py3k-jit/Lib/importlib/test/__main__.py	Fri Apr 23 02:01:11 2010
@@ -18,7 +18,6 @@
         start_dir = sep.join(parts[:-2])
     else:
         start_dir = os.path.dirname(__file__)
-    # XXX 2010-03-18 barry: Fix __file__
     top_dir = os.path.dirname(os.path.dirname(start_dir))
     test_loader = unittest.TestLoader()
     if '--builtin' in sys.argv:

Modified: python/branches/py3k-jit/Lib/mailcap.py
==============================================================================
--- python/branches/py3k-jit/Lib/mailcap.py	(original)
+++ python/branches/py3k-jit/Lib/mailcap.py	Fri Apr 23 02:01:11 2010
@@ -164,7 +164,7 @@
     if MIMEtype in caps:
         entries = entries + caps[MIMEtype]
     if key is not None:
-        entries = filter(lambda e, key=key: key in e, entries)
+        entries = [e for e in entries if key in e]
     return entries
 
 def subst(field, MIMEtype, filename, plist=[]):
@@ -239,14 +239,12 @@
     if not caps: caps = getcaps()
     print("Mailcap entries:")
     print()
-    ckeys = caps.keys()
-    ckeys.sort()
+    ckeys = sorted(caps)
     for type in ckeys:
         print(type)
         entries = caps[type]
         for e in entries:
-            keys = e.keys()
-            keys.sort()
+            keys = sorted(e)
             for k in keys:
                 print("  %-15s" % k, e[k])
             print()

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

Modified: python/branches/py3k-jit/Lib/py_compile.py
==============================================================================
--- python/branches/py3k-jit/Lib/py_compile.py	(original)
+++ python/branches/py3k-jit/Lib/py_compile.py	Fri Apr 23 02:01:11 2010
@@ -169,7 +169,7 @@
         for filename in args:
             try:
                 compile(filename, doraise=True)
-            except PyCompileError as err:
+            except PyCompileError as error:
                 # return value to indicate at least one failure
                 rv = 1
                 sys.stderr.write(error.msg)

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

Modified: python/branches/py3k-jit/Lib/sqlite3/test/regression.py
==============================================================================
--- python/branches/py3k-jit/Lib/sqlite3/test/regression.py	(original)
+++ python/branches/py3k-jit/Lib/sqlite3/test/regression.py	Fri Apr 23 02:01:11 2010
@@ -274,6 +274,13 @@
         """
         self.assertRaises(sqlite.Warning, self.con, 1)
 
+    def CheckCollation(self):
+        def collation_cb(a, b):
+            return 1
+        self.assertRaises(sqlite.ProgrammingError, self.con.create_collation,
+            # Lone surrogate cannot be encoded to the default encoding (utf8)
+            "\uDC80", collation_cb)
+
 def suite():
     regression_suite = unittest.makeSuite(RegressionTests, "Check")
     return unittest.TestSuite((regression_suite,))

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

Modified: python/branches/py3k-jit/Lib/test/gdb_sample.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/gdb_sample.py	(original)
+++ python/branches/py3k-jit/Lib/test/gdb_sample.py	Fri Apr 23 02:01:11 2010
@@ -7,6 +7,6 @@
     baz(a, b, c)
 
 def baz(*args):
-    print(42)
+    id(42)
 
 foo(1, 2, 3)

Modified: python/branches/py3k-jit/Lib/test/lock_tests.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/lock_tests.py	(original)
+++ python/branches/py3k-jit/Lib/test/lock_tests.py	Fri Apr 23 02:01:11 2010
@@ -521,6 +521,19 @@
         # ordered.
         self.assertEqual(sorted(results), [False] * 7 + [True] *  3 )
 
+    def test_acquire_timeout(self):
+        sem = self.semtype(2)
+        self.assertRaises(ValueError, sem.acquire, False, timeout=1.0)
+        self.assertTrue(sem.acquire(timeout=0.005))
+        self.assertTrue(sem.acquire(timeout=0.005))
+        self.assertFalse(sem.acquire(timeout=0.005))
+        sem.release()
+        self.assertTrue(sem.acquire(timeout=0.005))
+        t = time.time()
+        self.assertFalse(sem.acquire(timeout=0.5))
+        dt = time.time() - t
+        self.assertTimeout(dt, 0.5)
+
     def test_default_value(self):
         # The default initial value is 1.
         sem = self.semtype()

Modified: python/branches/py3k-jit/Lib/test/support.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/support.py	(original)
+++ python/branches/py3k-jit/Lib/test/support.py	Fri Apr 23 02:01:11 2010
@@ -755,6 +755,17 @@
 
 
 @contextlib.contextmanager
+def transient_internet():
+    """Return a context manager that raises ResourceDenied when various issues
+    with the Internet connection manifest themselves as exceptions."""
+    time_out = TransientResource(IOError, errno=errno.ETIMEDOUT)
+    socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET)
+    ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET)
+    with time_out, socket_peer_reset, ioerror_peer_reset:
+        yield
+
+
+ at contextlib.contextmanager
 def captured_output(stream_name):
     """Run the 'with' statement body using a StringIO object in place of a
     specific attribute on the sys module.

Modified: python/branches/py3k-jit/Lib/test/test_bytes.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_bytes.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_bytes.py	Fri Apr 23 02:01:11 2010
@@ -815,13 +815,6 @@
         self.assertRaises(BufferError, delslice)
         self.assertEquals(b, orig)
 
-    def test_empty_bytearray(self):
-        # Issue #7561: operations on empty bytearrays could crash in many
-        # situations, due to a fragile implementation of the
-        # PyByteArray_AS_STRING() C macro.
-        self.assertRaises(ValueError, int, bytearray(b''))
-        self.assertRaises((ValueError, OSError), os.mkdir, bytearray(b''))
-
 
 class AssortedBytesTest(unittest.TestCase):
     #

Modified: python/branches/py3k-jit/Lib/test/test_codecs.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_codecs.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_codecs.py	Fri Apr 23 02:01:11 2010
@@ -571,6 +571,16 @@
     def test_lone_surrogates(self):
         self.assertRaises(UnicodeEncodeError, "\ud800".encode, "utf-8")
         self.assertRaises(UnicodeDecodeError, b"\xed\xa0\x80".decode, "utf-8")
+        self.assertEqual("[\uDC80]".encode("utf-8", "backslashreplace"),
+                         b'[\\udc80]')
+        self.assertEqual("[\uDC80]".encode("utf-8", "xmlcharrefreplace"),
+                         b'[&#56448;]')
+        self.assertEqual("[\uDC80]".encode("utf-8", "surrogateescape"),
+                         b'[\x80]')
+        self.assertEqual("[\uDC80]".encode("utf-8", "ignore"),
+                         b'[]')
+        self.assertEqual("[\uDC80]".encode("utf-8", "replace"),
+                         b'[?]')
 
     def test_surrogatepass_handler(self):
         self.assertEquals("abc\ud800def".encode("utf-8", "surrogatepass"),

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

Modified: python/branches/py3k-jit/Lib/test/test_gdb.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_gdb.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_gdb.py	Fri Apr 23 02:01:11 2010
@@ -9,7 +9,7 @@
 import sys
 import unittest
 
-from test.support import run_unittest
+from test.support import run_unittest, findfile
 
 try:
     gdb_version, _ = subprocess.Popen(["gdb", "--version"],
@@ -31,6 +31,21 @@
 if gdbpy_version == b'':
     raise unittest.SkipTest("gdb not built with embedded python support")
 
+def gdb_has_frame_select():
+    # Does this build of gdb have gdb.Frame.select ?
+    cmd = "--eval-command=python print(dir(gdb.Frame))"
+    p = subprocess.Popen(["gdb", "--batch", cmd],
+                         stdout=subprocess.PIPE)
+    stdout, _ = p.communicate()
+    m = re.match(br'.*\[(.*)\].*', stdout)
+    if not m:
+        raise unittest.SkipTest("Unable to parse output from gdb.Frame.select test")
+    gdb_frame_dir = m.group(1).split(b', ')
+    return b"'select'" in gdb_frame_dir
+
+HAS_PYUP_PYDOWN = gdb_has_frame_select()
+
+BREAKPOINT_FN='builtin_id'
 
 class DebuggerTests(unittest.TestCase):
 
@@ -44,10 +59,10 @@
         out, err = subprocess.Popen(
             args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
             ).communicate()
-        return out, err
+        return out.decode('utf-8'), err.decode('utf-8')
 
     def get_stack_trace(self, source=None, script=None,
-                        breakpoint='PyObject_Print',
+                        breakpoint=BREAKPOINT_FN,
                         cmds_after_breakpoint=None,
                         import_site=False):
         '''
@@ -65,7 +80,7 @@
         # error, which typically happens python is dynamically linked (the
         # breakpoints of interest are to be found in the shared library)
         # When this happens, we still get:
-        #   Function "PyObject_Print" not defined.
+        #   Function "textiowrapper_write" not defined.
         # emitted to stderr each time, alas.
 
         # Initially I had "--eval-command=continue" here, but removed it to
@@ -116,19 +131,21 @@
                      cmds_after_breakpoint=None,
                      import_site=False):
         # Given an input python source representation of data,
-        # run "python -c'print DATA'" under gdb with a breakpoint on
-        # PyObject_Print and scrape out gdb's representation of the "op"
+        # run "python -c'id(DATA)'" under gdb with a breakpoint on
+        # builtin_id and scrape out gdb's representation of the "op"
         # parameter, and verify that the gdb displays the same string
         #
+        # Verify that the gdb displays the expected string
+        #
         # For a nested structure, the first time we hit the breakpoint will
         # give us the top-level structure
-        gdb_output = self.get_stack_trace(source, breakpoint='PyObject_Print',
+        gdb_output = self.get_stack_trace(source, breakpoint=BREAKPOINT_FN,
                                           cmds_after_breakpoint=cmds_after_breakpoint,
                                           import_site=import_site)
         # gdb can insert additional '\n' and space characters in various places
         # in its output, depending on the width of the terminal it's connected
         # to (using its "wrap_here" function)
-        m = re.match('.*#0\s+PyObject_Print\s+\(\s*op\=\s*(.*?),\s+fp=.*\).*',
+        m = re.match('.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+Python/bltinmodule.c.*',
                      gdb_output, re.DOTALL)
         if not m:
             self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
@@ -141,34 +158,34 @@
 
     def assertMultilineMatches(self, actual, pattern):
         m = re.match(pattern, actual, re.DOTALL)
-        self.assert_(m,
-                     msg='%r did not match %r' % (actual, pattern))
+        if not m:
+            self.fail(msg='%r did not match %r' % (actual, pattern))
+
+    def get_sample_script(self):
+        return findfile('gdb_sample.py')
 
 class PrettyPrintTests(DebuggerTests):
     def test_getting_backtrace(self):
-        gdb_output = self.get_stack_trace('print 42')
-        self.assertTrue('PyObject_Print' in gdb_output)
+        gdb_output = self.get_stack_trace('id(42)')
+        self.assertTrue(BREAKPOINT_FN in gdb_output)
 
-    def assertGdbRepr(self, val, cmds_after_breakpoint=None):
+    def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None):
         # Ensure that gdb's rendering of the value in a debugged process
         # matches repr(value) in this process:
-        gdb_repr, gdb_output = self.get_gdb_repr('print ' + repr(val),
+        gdb_repr, gdb_output = self.get_gdb_repr('id(' + repr(val) + ')',
                                                  cmds_after_breakpoint)
-        self.assertEquals(gdb_repr, repr(val), gdb_output)
+        if not exp_repr:
+            exp_repr = repr(val)
+        self.assertEquals(gdb_repr, exp_repr,
+                          ('%r did not equal expected %r; full output was:\n%s'
+                           % (gdb_repr, exp_repr, gdb_output)))
 
     def test_int(self):
-        'Verify the pretty-printing of various "int" values'
+        'Verify the pretty-printing of various "int"/long values'
         self.assertGdbRepr(42)
         self.assertGdbRepr(0)
         self.assertGdbRepr(-7)
-        self.assertGdbRepr(sys.maxint)
-        self.assertGdbRepr(-sys.maxint)
-
-    def test_long(self):
-        'Verify the pretty-printing of various "long" values'
-        self.assertGdbRepr(0)
         self.assertGdbRepr(1000000000000)
-        self.assertGdbRepr(-1)
         self.assertGdbRepr(-1000000000000000)
 
     def test_singletons(self):
@@ -186,27 +203,27 @@
     def test_lists(self):
         'Verify the pretty-printing of lists'
         self.assertGdbRepr([])
-        self.assertGdbRepr(range(5))
+        self.assertGdbRepr(list(range(5)))
+
+    def test_bytes(self):
+        'Verify the pretty-printing of bytes'
+        self.assertGdbRepr(b'')
+        self.assertGdbRepr(b'And now for something hopefully the same')
+        self.assertGdbRepr(b'string with embedded NUL here \0 and then some more text')
+        self.assertGdbRepr(b'this is a tab:\t'
+                           b' this is a slash-N:\n'
+                           b' this is a slash-R:\r'
+                           )
+
+        self.assertGdbRepr(b'this is byte 255:\xff and byte 128:\x80')
+
+        self.assertGdbRepr(bytes([b for b in range(255)]))
 
     def test_strings(self):
-        'Verify the pretty-printing of strings'
+        'Verify the pretty-printing of unicode strings'
         self.assertGdbRepr('')
         self.assertGdbRepr('And now for something hopefully the same')
         self.assertGdbRepr('string with embedded NUL here \0 and then some more text')
-        self.assertGdbRepr('this is byte 255:\xff and byte 128:\x80')
-
-    def test_tuples(self):
-        'Verify the pretty-printing of tuples'
-        self.assertGdbRepr(tuple())
-        self.assertGdbRepr((1,))
-        self.assertGdbRepr(('foo', 'bar', 'baz'))
-
-    def test_unicode(self):
-        'Verify the pretty-printing of unicode values'
-        # Test the empty unicode string:
-        self.assertGdbRepr('')
-
-        self.assertGdbRepr('hello world')
 
         # Test printing a single character:
         #    U+2620 SKULL AND CROSSBONES
@@ -222,12 +239,19 @@
         # This is:
         # UTF-8: 0xF0 0x9D 0x84 0xA1
         # UTF-16: 0xD834 0xDD21
-        try:
-            # This will only work on wide-unicode builds:
+        if sys.maxunicode == 0x10FFFF:
+            # wide unicode:
             self.assertGdbRepr(chr(0x1D121))
-        except ValueError as e:
-            if e.message != 'chr() arg not in range(0x10000) (narrow Python build)':
-                raise e
+        else:
+            # narrow unicode:
+            self.assertGdbRepr(chr(0x1D121),
+                               "'\\U0000d834\\U0000dd21'")
+
+    def test_tuples(self):
+        'Verify the pretty-printing of tuples'
+        self.assertGdbRepr(tuple())
+        self.assertGdbRepr((1,), '(1,)')
+        self.assertGdbRepr(('foo', 'bar', 'baz'))
 
     def test_sets(self):
         'Verify the pretty-printing of sets'
@@ -235,12 +259,12 @@
         self.assertGdbRepr(set(['a', 'b']))
         self.assertGdbRepr(set([4, 5, 6]))
 
-        # Ensure that we handled sets containing the "dummy" key value,
+        # Ensure that we handle sets containing the "dummy" key value,
         # which happens on deletion:
         gdb_repr, gdb_output = self.get_gdb_repr('''s = set(['a','b'])
 s.pop()
-print s''')
-        self.assertEquals(gdb_repr, "set(['b'])")
+id(s)''')
+        self.assertEquals(gdb_repr, "{'b'}")
 
     def test_frozensets(self):
         'Verify the pretty-printing of frozensets'
@@ -253,43 +277,31 @@
         gdb_repr, gdb_output = self.get_gdb_repr('''
 try:
     raise RuntimeError("I am an error")
-except RuntimeError, e:
-    print e
+except RuntimeError as e:
+    id(e)
 ''')
         self.assertEquals(gdb_repr,
-                          "exceptions.RuntimeError('I am an error',)")
+                          "RuntimeError('I am an error',)")
 
 
         # Test division by zero:
         gdb_repr, gdb_output = self.get_gdb_repr('''
 try:
     a = 1 / 0
-except ZeroDivisionError, e:
-    print e
+except ZeroDivisionError as e:
+    id(e)
 ''')
         self.assertEquals(gdb_repr,
-                          "exceptions.ZeroDivisionError('integer division or modulo by zero',)")
-
-    def test_classic_class(self):
-        'Verify the pretty-printing of classic class instances'
-        gdb_repr, gdb_output = self.get_gdb_repr('''
-class Foo:
-    pass
-foo = Foo()
-foo.an_int = 42
-print foo''')
-        m = re.match(r'<Foo\(an_int=42\) at remote 0x[0-9a-f]+>', gdb_repr)
-        self.assertTrue(m,
-                        msg='Unexpected classic-class rendering %r' % gdb_repr)
+                          "ZeroDivisionError('division by zero',)")
 
     def test_modern_class(self):
         'Verify the pretty-printing of new-style class instances'
         gdb_repr, gdb_output = self.get_gdb_repr('''
-class Foo(object):
+class Foo:
     pass
 foo = Foo()
 foo.an_int = 42
-print foo''')
+id(foo)''')
         m = re.match(r'<Foo\(an_int=42\) at remote 0x[0-9a-f]+>', gdb_repr)
         self.assertTrue(m,
                         msg='Unexpected new-style class rendering %r' % gdb_repr)
@@ -302,8 +314,9 @@
 foo = Foo()
 foo += [1, 2, 3]
 foo.an_int = 42
-print foo''')
+id(foo)''')
         m = re.match(r'<Foo\(an_int=42\) at remote 0x[0-9a-f]+>', gdb_repr)
+
         self.assertTrue(m,
                         msg='Unexpected new-style class rendering %r' % gdb_repr)
 
@@ -316,12 +329,13 @@
     pass
 foo = Foo((1, 2, 3))
 foo.an_int = 42
-print foo''')
+id(foo)''')
         m = re.match(r'<Foo\(an_int=42\) at remote 0x[0-9a-f]+>', gdb_repr)
+
         self.assertTrue(m,
                         msg='Unexpected new-style class rendering %r' % gdb_repr)
 
-    def assertSane(self, source, corruption, exp_type='unknown'):
+    def assertSane(self, source, corruption, exprepr=None):
         '''Run Python under gdb, corrupting variables in the inferior process
         immediately before taking a backtrace.
 
@@ -335,16 +349,26 @@
         gdb_repr, gdb_output = \
             self.get_gdb_repr(source,
                               cmds_after_breakpoint=cmds_after_breakpoint)
-        self.assertTrue(re.match('<%s at remote 0x[0-9a-f]+>' % exp_type,
-                                 gdb_repr),
-                        'Unexpected gdb representation: %r\n%s' % \
-                            (gdb_repr, gdb_output))
+        if exprepr:
+            if gdb_repr == exprepr:
+                # gdb managed to print the value in spite of the corruption;
+                # this is good (see http://bugs.python.org/issue8330)
+                return
+
+        # Match anything for the type name; 0xDEADBEEF could point to
+        # something arbitrary (see  http://bugs.python.org/issue8330)
+        pattern = '<.* at remote 0x[0-9a-f]+>'
+
+        m = re.match(pattern, gdb_repr)
+        if not m:
+            self.fail('Unexpected gdb representation: %r\n%s' % \
+                          (gdb_repr, gdb_output))
 
     def test_NULL_ptr(self):
         'Ensure that a NULL PyObject* is handled gracefully'
         gdb_repr, gdb_output = (
-            self.get_gdb_repr('print 42',
-                              cmds_after_breakpoint=['set variable op=0',
+            self.get_gdb_repr('id(42)',
+                              cmds_after_breakpoint=['set variable v=0',
                                                      'backtrace'])
             )
 
@@ -352,42 +376,33 @@
 
     def test_NULL_ob_type(self):
         'Ensure that a PyObject* with NULL ob_type is handled gracefully'
-        self.assertSane('print 42',
-                        'set op->ob_type=0')
+        self.assertSane('id(42)',
+                        'set v->ob_type=0')
 
     def test_corrupt_ob_type(self):
         'Ensure that a PyObject* with a corrupt ob_type is handled gracefully'
-        self.assertSane('print 42',
-                        'set op->ob_type=0xDEADBEEF')
+        self.assertSane('id(42)',
+                        'set v->ob_type=0xDEADBEEF',
+                        exprepr='42')
 
     def test_corrupt_tp_flags(self):
         'Ensure that a PyObject* with a type with corrupt tp_flags is handled'
-        self.assertSane('print 42',
-                        'set op->ob_type->tp_flags=0x0',
-                        exp_type='int')
+        self.assertSane('id(42)',
+                        'set v->ob_type->tp_flags=0x0',
+                        exprepr='42')
 
     def test_corrupt_tp_name(self):
         'Ensure that a PyObject* with a type with corrupt tp_name is handled'
-        self.assertSane('print 42',
-                        'set op->ob_type->tp_name=0xDEADBEEF')
-
-    def test_NULL_instance_dict(self):
-        'Ensure that a PyInstanceObject with with a NULL in_dict is handled'
-        self.assertSane('''
-class Foo:
-    pass
-foo = Foo()
-foo.an_int = 42
-print foo''',
-                        'set ((PyInstanceObject*)op)->in_dict = 0',
-                        exp_type='Foo')
+        self.assertSane('id(42)',
+                        'set v->ob_type->tp_name=0xDEADBEEF',
+                        exprepr='42')
 
     def test_builtins_help(self):
         'Ensure that the new-style class _Helper in site.py can be handled'
         # (this was the issue causing tracebacks in
         #  http://bugs.python.org/issue8032#msg100537 )
+        gdb_repr, gdb_output = self.get_gdb_repr('id(__builtins__.help)', import_site=True)
 
-        gdb_repr, gdb_output = self.get_gdb_repr('print __builtins__.help', import_site=True)
         m = re.match(r'<_Helper at remote 0x[0-9a-f]+>', gdb_repr)
         self.assertTrue(m,
                         msg='Unexpected rendering %r' % gdb_repr)
@@ -396,20 +411,18 @@
         '''Ensure that a reference loop involving a list doesn't lead proxyval
         into an infinite loop:'''
         gdb_repr, gdb_output = \
-            self.get_gdb_repr("a = [3, 4, 5] ; a.append(a) ; print a")
-
+            self.get_gdb_repr("a = [3, 4, 5] ; a.append(a) ; id(a)")
         self.assertEquals(gdb_repr, '[3, 4, 5, [...]]')
 
         gdb_repr, gdb_output = \
-            self.get_gdb_repr("a = [3, 4, 5] ; b = [a] ; a.append(b) ; print a")
-
+            self.get_gdb_repr("a = [3, 4, 5] ; b = [a] ; a.append(b) ; id(a)")
         self.assertEquals(gdb_repr, '[3, 4, 5, [[...]]]')
 
     def test_selfreferential_dict(self):
         '''Ensure that a reference loop involving a dict doesn't lead proxyval
         into an infinite loop:'''
         gdb_repr, gdb_output = \
-            self.get_gdb_repr("a = {} ; b = {'bar':a} ; a['foo'] = b ; print a")
+            self.get_gdb_repr("a = {} ; b = {'bar':a} ; a['foo'] = b ; id(a)")
 
         self.assertEquals(gdb_repr, "{'foo': {'bar': {...}}}")
 
@@ -420,7 +433,7 @@
     pass
 foo = Foo()
 foo.an_attr = foo
-print foo''')
+id(foo)''')
         self.assertTrue(re.match('<Foo\(an_attr=<\.\.\.>\) at remote 0x[0-9a-f]+>',
                                  gdb_repr),
                         'Unexpected gdb representation: %r\n%s' % \
@@ -433,7 +446,7 @@
     pass
 foo = Foo()
 foo.an_attr = foo
-print foo''')
+id(foo)''')
         self.assertTrue(re.match('<Foo\(an_attr=<\.\.\.>\) at remote 0x[0-9a-f]+>',
                                  gdb_repr),
                         'Unexpected gdb representation: %r\n%s' % \
@@ -447,7 +460,7 @@
 b = Foo()
 a.an_attr = b
 b.an_attr = a
-print a''')
+id(a)''')
         self.assertTrue(re.match('<Foo\(an_attr=<Foo\(an_attr=<\.\.\.>\) at remote 0x[0-9a-f]+>\) at remote 0x[0-9a-f]+>',
                                  gdb_repr),
                         'Unexpected gdb representation: %r\n%s' % \
@@ -455,7 +468,7 @@
 
     def test_truncation(self):
         'Verify that very long output is truncated'
-        gdb_repr, gdb_output = self.get_gdb_repr('print range(1000)')
+        gdb_repr, gdb_output = self.get_gdb_repr('id(list(range(1000)))')
         self.assertEquals(gdb_repr,
                           "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "
                           "14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, "
@@ -481,13 +494,9 @@
         self.assertEquals(len(gdb_repr),
                           1024 + len('...(truncated)'))
 
-    def test_builtin_function(self):
-        gdb_repr, gdb_output = self.get_gdb_repr('print len')
-        self.assertEquals(gdb_repr, '<built-in function len>')
-
     def test_builtin_method(self):
-        gdb_repr, gdb_output = self.get_gdb_repr('import sys; print sys.stdout.readlines')
-        self.assertTrue(re.match('<built-in method readlines of file object at remote 0x[0-9a-f]+>',
+        gdb_repr, gdb_output = self.get_gdb_repr('import sys; id(sys.stdout.readlines)')
+        self.assertTrue(re.match('<built-in method readlines of _io.TextIOWrapper object at remote 0x[0-9a-f]+>',
                                  gdb_repr),
                         'Unexpected gdb representation: %r\n%s' % \
                             (gdb_repr, gdb_output))
@@ -498,11 +507,11 @@
     pass
 
 foo(3, 4, 5)
-print foo.__code__''',
-                                          breakpoint='PyObject_Print',
-                                          cmds_after_breakpoint=['print (PyFrameObject*)(((PyCodeObject*)op)->co_zombieframe)']
+id(foo.__code__)''',
+                                          breakpoint='builtin_id',
+                                          cmds_after_breakpoint=['print (PyFrameObject*)(((PyCodeObject*)v)->co_zombieframe)']
                                           )
-        self.assertTrue(re.match(r'.*\s+\$1 =\s+Frame 0x[0-9a-f]+, for file <string>, line 3, in foo \(\)\s+.*',
+        self.assertTrue(re.match('.*\s+\$1 =\s+Frame 0x[0-9a-f]+, for file <string>, line 3, in foo \(\)\s+.*',
                                  gdb_output,
                                  re.DOTALL),
                         'Unexpected gdb representation: %r\n%s' % (gdb_output, gdb_output))
@@ -513,144 +522,144 @@
 
     def test_basic_command(self):
         'Verify that the "py-list" command works'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-list'])
 
-        self.assertListing('''
-   5
-   6    def bar(a, b, c):
-   7        baz(a, b, c)
-   8
-   9    def baz(*args):
- >10        print(42)
-  11
-  12    foo(1, 2, 3)
-''',
-                      bt)
+        self.assertListing('   5    \n'
+                           '   6    def bar(a, b, c):\n'
+                           '   7        baz(a, b, c)\n'
+                           '   8    \n'
+                           '   9    def baz(*args):\n'
+                           ' >10        id(42)\n'
+                           '  11    \n'
+                           '  12    foo(1, 2, 3)\n',
+                           bt)
 
     def test_one_abs_arg(self):
         'Verify the "py-list" command with one absolute argument'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-list 9'])
 
-        self.assertListing('''
-   9    def baz(*args):
- >10        print(42)
-  11
-  12    foo(1, 2, 3)
-''',
-                      bt)
+        self.assertListing('   9    def baz(*args):\n'
+                           ' >10        id(42)\n'
+                           '  11    \n'
+                           '  12    foo(1, 2, 3)\n',
+                           bt)
 
     def test_two_abs_args(self):
         'Verify the "py-list" command with two absolute arguments'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-list 1,3'])
 
-        self.assertListing('''
-   1    # Sample script for use by test_gdb.py
-   2
-   3    def foo(a, b, c):
-''',
-                      bt)
+        self.assertListing('   1    # Sample script for use by test_gdb.py\n'
+                           '   2    \n'
+                           '   3    def foo(a, b, c):\n',
+                           bt)
 
 class StackNavigationTests(DebuggerTests):
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_pyup_command(self):
         'Verify that the "py-up" command works'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-up'])
         self.assertMultilineMatches(bt,
                                     r'''^.*
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
     baz\(a, b, c\)
 $''')
 
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_down_at_bottom(self):
         'Verify handling of "py-down" at the bottom of the stack'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-down'])
         self.assertEndsWith(bt,
                             'Unable to find a newer python frame\n')
 
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_up_at_top(self):
         'Verify handling of "py-up" at the top of the stack'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-up'] * 4)
         self.assertEndsWith(bt,
                             'Unable to find an older python frame\n')
 
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_up_then_down(self):
         'Verify "py-up" followed by "py-down"'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-up', 'py-down'])
         self.assertMultilineMatches(bt,
                                     r'''^.*
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
     baz\(a, b, c\)
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 10, in baz \(args=\(1, 2, 3\)\)
-    print\(42\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 10, in baz \(args=\(1, 2, 3\)\)
+    id\(42\)
 $''')
 
 class PyBtTests(DebuggerTests):
     def test_basic_command(self):
         'Verify that the "py-bt" command works'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-bt'])
         self.assertMultilineMatches(bt,
                                     r'''^.*
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
     baz\(a, b, c\)
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
     bar\(a, b, c\)
-#[0-9]+ Frame 0x[0-9a-f]+, for file Lib/test/test_gdb_sample.py, line 12, in <module> \(\)
+#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
 foo\(1, 2, 3\)
 ''')
 
 class PyPrintTests(DebuggerTests):
     def test_basic_command(self):
         'Verify that the "py-print" command works'
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-print args'])
         self.assertMultilineMatches(bt,
                                     r".*\nlocal 'args' = \(1, 2, 3\)\n.*")
 
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_print_after_up(self):
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a'])
         self.assertMultilineMatches(bt,
                                     r".*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*")
 
     def test_printing_global(self):
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-print __name__'])
         self.assertMultilineMatches(bt,
                                     r".*\nglobal '__name__' = '__main__'\n.*")
 
     def test_printing_builtin(self):
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-print len'])
         self.assertMultilineMatches(bt,
-                                    r".*\nbuiltin 'len' = <built-in function len>\n.*")
+                                    r".*\nbuiltin 'len' = <built-in method len of module object at remote 0x[0-9a-f]+>\n.*")
 
 class PyLocalsTests(DebuggerTests):
     def test_basic_command(self):
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-locals'])
         self.assertMultilineMatches(bt,
                                     r".*\nargs = \(1, 2, 3\)\n.*")
 
+    @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands")
     def test_locals_after_up(self):
-        bt = self.get_stack_trace(script='Lib/test/test_gdb_sample.py',
+        bt = self.get_stack_trace(script=self.get_sample_script(),
                                   cmds_after_breakpoint=['py-up', 'py-locals'])
         self.assertMultilineMatches(bt,
                                     r".*\na = 1\nb = 2\nc = 3\n.*")
 
 def test_main():
-    run_unittest(#PrettyPrintTests,
-                 #PyListTests,
-                 #StackNavigationTests,
-                 #PyBtTests,
-                 #PyPrintTests,
-                 #PyLocalsTests
+    run_unittest(PrettyPrintTests,
+                 PyListTests,
+                 StackNavigationTests,
+                 PyBtTests,
+                 PyPrintTests,
+                 PyLocalsTests
                  )
 
 if __name__ == "__main__":

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

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

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

Modified: python/branches/py3k-jit/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_os.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_os.py	Fri Apr 23 02:01:11 2010
@@ -607,14 +607,6 @@
     def test_execvpe_with_bad_arglist(self):
         self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
 
-class ArgTests(unittest.TestCase):
-    def test_bytearray(self):
-        # Issue #7561: posix module didn't release bytearray exports properly.
-        b = bytearray(os.sep.encode('ascii'))
-        self.assertRaises(OSError, os.mkdir, b)
-        # Check object is still resizable.
-        b[:] = b''
-
 class Win32ErrorTests(unittest.TestCase):
     def test_rename(self):
         self.assertRaises(WindowsError, os.rename, support.TESTFN, support.TESTFN+".bak")
@@ -872,7 +864,6 @@
 
 def test_main():
     support.run_unittest(
-        ArgTests,
         FileTests,
         StatAttributeTests,
         EnvironTests,

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

Modified: python/branches/py3k-jit/Lib/test/test_set.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_set.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_set.py	Fri Apr 23 02:01:11 2010
@@ -48,6 +48,7 @@
 
     def test_new_or_init(self):
         self.assertRaises(TypeError, self.thetype, [], 2)
+        self.assertRaises(TypeError, set().__init__, a=1)
 
     def test_uniquification(self):
         actual = sorted(self.s)

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

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

Modified: python/branches/py3k-jit/Lib/test/test_site.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_site.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_site.py	Fri Apr 23 02:01:11 2010
@@ -268,26 +268,31 @@
         parent = os.path.relpath(os.path.dirname(os.__file__))
         env = os.environ.copy()
         env['PYTHONPATH'] = parent
-        command = 'import os; print(os.__file__, os.__cached__)'
+        code = ('import os, sys',
+            # use ASCII to avoid locale issues with non-ASCII directories
+            'os_file = os.__file__.encode("ascii", "backslashreplace")',
+            r'sys.stdout.buffer.write(os_file + b"\n")',
+            'os_cached = os.__cached__.encode("ascii", "backslashreplace")',
+            r'sys.stdout.buffer.write(os_cached + b"\n")')
+        command = '\n'.join(code)
         # First, prove that with -S (no 'import site'), the paths are
         # relative.
         proc = subprocess.Popen([sys.executable, '-S', '-c', command],
                                 env=env,
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.PIPE)
+                                stdout=subprocess.PIPE)
         stdout, stderr = proc.communicate()
+
         self.assertEqual(proc.returncode, 0)
-        os__file__, os__cached__ = stdout.split()
+        os__file__, os__cached__ = stdout.splitlines()[:2]
         self.assertFalse(os.path.isabs(os__file__))
         self.assertFalse(os.path.isabs(os__cached__))
         # Now, with 'import site', it works.
         proc = subprocess.Popen([sys.executable, '-c', command],
                                 env=env,
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.PIPE)
+                                stdout=subprocess.PIPE)
         stdout, stderr = proc.communicate()
         self.assertEqual(proc.returncode, 0)
-        os__file__, os__cached__ = stdout.split()
+        os__file__, os__cached__ = stdout.splitlines()[:2]
         self.assertTrue(os.path.isabs(os__file__))
         self.assertTrue(os.path.isabs(os__cached__))
 

Modified: python/branches/py3k-jit/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_ssl.py	Fri Apr 23 02:01:11 2010
@@ -121,6 +121,23 @@
         self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
                         (s, t))
 
+    def test_ciphers(self):
+        if not support.is_resource_enabled('network'):
+            return
+        remote = ("svn.python.org", 443)
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="ALL")
+        s.connect(remote)
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT")
+        s.connect(remote)
+        # Error checking occurs when connecting, because the SSL context
+        # isn't created before.
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx")
+        with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
+            s.connect(remote)
+
 
 class NetworkedTests(unittest.TestCase):
 
@@ -201,6 +218,29 @@
         if support.verbose:
             sys.stdout.write("\nVerified certificate for svn.python.org:443 is\n%s\n" % pem)
 
+    def test_algorithms(self):
+        # Issue #8484: all algorithms should be available when verifying a
+        # certificate.
+        # SHA256 was added in OpenSSL 0.9.8
+        if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15):
+            self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION)
+        # NOTE: https://sha256.tbs-internet.com is another possible test host
+        remote = ("sha2.hboeck.de", 443)
+        sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem")
+        s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+                            cert_reqs=ssl.CERT_REQUIRED,
+                            ca_certs=sha256_cert,)
+        with support.transient_internet():
+            try:
+                s.connect(remote)
+                if support.verbose:
+                    sys.stdout.write("\nCipher with %r is %r\n" %
+                                     (remote, s.cipher()))
+                    sys.stdout.write("Certificate is:\n%s\n" %
+                                     pprint.pformat(s.getpeercert()))
+            finally:
+                s.close()
+
 
 try:
     import threading
@@ -234,7 +274,8 @@
                                                    certfile=self.server.certificate,
                                                    ssl_version=self.server.protocol,
                                                    ca_certs=self.server.cacerts,
-                                                   cert_reqs=self.server.certreqs)
+                                                   cert_reqs=self.server.certreqs,
+                                                   ciphers=self.server.ciphers)
                 except:
                     if self.server.chatty:
                         handle_error("\n server:  bad connection attempt from " + repr(self.addr) + ":\n")
@@ -333,7 +374,8 @@
 
         def __init__(self, certificate, ssl_version=None,
                      certreqs=None, cacerts=None, expect_bad_connects=False,
-                     chatty=True, connectionchatty=False, starttls_server=False):
+                     chatty=True, connectionchatty=False, starttls_server=False,
+                     ciphers=None):
             if ssl_version is None:
                 ssl_version = ssl.PROTOCOL_TLSv1
             if certreqs is None:
@@ -342,6 +384,7 @@
             self.protocol = ssl_version
             self.certreqs = certreqs
             self.cacerts = cacerts
+            self.ciphers = ciphers
             self.expect_bad_connects = expect_bad_connects
             self.chatty = chatty
             self.connectionchatty = connectionchatty
@@ -648,12 +691,13 @@
     def serverParamsTest (certfile, protocol, certreqs, cacertsfile,
                           client_certfile, client_protocol=None,
                           indata="FOO\n",
-                          chatty=False, connectionchatty=False):
+                          ciphers=None, chatty=False, connectionchatty=False):
 
         server = ThreadedEchoServer(certfile,
                                     certreqs=certreqs,
                                     ssl_version=protocol,
                                     cacerts=cacertsfile,
+                                    ciphers=ciphers,
                                     chatty=chatty,
                                     connectionchatty=False)
         flag = threading.Event()
@@ -669,6 +713,7 @@
                                 certfile=client_certfile,
                                 ca_certs=cacertsfile,
                                 cert_reqs=certreqs,
+                                ciphers=ciphers,
                                 ssl_version=client_protocol)
             s.connect((HOST, server.port))
         except ssl.SSLError as x:
@@ -723,8 +768,12 @@
                               ssl.get_protocol_name(server_protocol),
                               certtype))
         try:
+            # NOTE: we must enable "ALL" ciphers, otherwise an SSLv23 client
+            # will send an SSLv3 hello (rather than SSLv2) starting from
+            # OpenSSL 1.0.0 (see issue #8322).
             serverParamsTest(CERTFILE, server_protocol, certsreqs,
                              CERTFILE, CERTFILE, client_protocol,
+                             ciphers="ALL",
                              chatty=False, connectionchatty=False)
         except support.TestFailed:
             if expectedToWork:

Modified: python/branches/py3k-jit/Lib/test/test_urllib2net.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_urllib2net.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_urllib2net.py	Fri Apr 23 02:01:11 2010
@@ -8,6 +8,9 @@
 import socket
 import urllib.error
 import urllib.request
+import sys
+
+TIMEOUT = 60  # seconds
 
 
 def _retry_thrice(func, exc, *args, **kwargs):
@@ -162,20 +165,29 @@
                 req = expected_err = None
             debug(url)
             try:
-                f = urlopen(url, req)
+                f = urlopen(url, req, TIMEOUT)
             except EnvironmentError as err:
                 debug(err)
                 if expected_err:
                     msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" %
                            (expected_err, url, req, type(err), err))
                     self.assertIsInstance(err, expected_err, msg)
+            except urllib.error.URLError as err:
+                if isinstance(err[0], socket.timeout):
+                    print("<timeout: %s>" % url, file=sys.stderr)
+                    continue
+                else:
+                    raise
             else:
-                with support.time_out, \
-                     support.socket_peer_reset, \
-                     support.ioerror_peer_reset:
-                    buf = f.read()
+                try:
+                    with support.time_out, \
+                         support.socket_peer_reset, \
+                         support.ioerror_peer_reset:
+                        buf = f.read()
+                        debug("read %d bytes" % len(buf))
+                except socket.timeout:
+                    print("<timeout: %s>" % url, file=sys.stderr)
                 f.close()
-                debug("read %d bytes" % len(buf))
             debug("******** next url coming up...")
             time.sleep(0.1)
 

Modified: python/branches/py3k-jit/Lib/test/test_urlparse.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_urlparse.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_urlparse.py	Fri Apr 23 02:01:11 2010
@@ -273,9 +273,10 @@
         for invalid_url in [
                 'http://::12.34.56.78]/',
                 'http://[::1/foo/',
+                'ftp://[::1/foo/bad]/bad',
+                'http://[::1/foo/bad]/bad',
                 'http://[::ffff:12.34.56.78']:
-            self.assertRaises(ValueError, lambda : urllib.parse.urlparse(invalid_url).hostname)
-            self.assertRaises(ValueError, lambda : urllib.parse.urlparse(invalid_url))
+            self.assertRaises(ValueError, urllib.parse.urlparse, invalid_url)
 
     def test_urldefrag(self):
         for url, defrag, frag in [

Modified: python/branches/py3k-jit/Lib/test/test_winreg.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_winreg.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_winreg.py	Fri Apr 23 02:01:11 2010
@@ -5,13 +5,32 @@
 import os, sys
 import unittest
 from test import support
+from platform import machine
 
 # Do this first so test will be skipped if module doesn't exist
 support.import_module('winreg')
 # Now import everything
 from winreg import *
 
+try:
+    REMOTE_NAME = sys.argv[sys.argv.index("--remote")+1]
+except (IndexError, ValueError):
+    REMOTE_NAME = None
+
+# tuple of (major, minor)
+WIN_VER = sys.getwindowsversion()[:2]
+# Some tests should only run on 64-bit architectures where WOW64 will be.
+WIN64_MACHINE = True if machine() == "AMD64" else False
+
+# Starting with Windows 7 and Windows Server 2008 R2, WOW64 no longer uses
+# registry reflection and formerly reflected keys are shared instead.
+# Windows 7 and Windows Server 2008 R2 are version 6.1. Due to this, some
+# tests are only valid up until 6.1
+HAS_REFLECTION = True if WIN_VER < (6, 1) else False
+
 test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me"
+# On OS'es that support reflection we should test with a reflected key
+test_reflect_key_name = "SOFTWARE\\Classes\\Python Test Key - Delete Me"
 
 test_data = [
     ("Int Value",     45,                                      REG_DWORD),
@@ -25,8 +44,7 @@
     ("Japanese 日本", "日本語", REG_SZ),
 ]
 
-class WinregTests(unittest.TestCase):
-    remote_name = None
+class BaseWinregTests(unittest.TestCase):
 
     def setUp(self):
         # Make sure that the test key is absent when the test
@@ -49,7 +67,8 @@
         CloseKey(hkey)
         DeleteKey(root, subkey)
 
-    def WriteTestData(self, root_key, subkeystr="sub_key"):
+    def _write_test_data(self, root_key, subkeystr="sub_key",
+                         CreateKey=CreateKey):
         # Set the default value for this key.
         SetValue(root_key, test_key_name, REG_SZ, "Default value")
         key = CreateKey(root_key, test_key_name)
@@ -90,7 +109,7 @@
         except EnvironmentError:
             pass
 
-    def ReadTestData(self, root_key, subkeystr="sub_key"):
+    def _read_test_data(self, root_key, subkeystr="sub_key", OpenKey=OpenKey):
         # Check we can get default value for this key.
         val = QueryValue(root_key, test_key_name)
         self.assertEquals(val, "Default value",
@@ -130,7 +149,7 @@
 
         key.Close()
 
-    def DeleteTestData(self, root_key, subkeystr="sub_key"):
+    def _delete_test_data(self, root_key, subkeystr="sub_key"):
         key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS)
         sub_key = OpenKey(key, subkeystr, 0, KEY_ALL_ACCESS)
         # It is not necessary to delete the values before deleting
@@ -160,39 +179,179 @@
         except WindowsError: # Use this error name this time
             pass
 
-    def TestAll(self, root_key, subkeystr="sub_key"):
-        self.WriteTestData(root_key, subkeystr)
-        self.ReadTestData(root_key, subkeystr)
-        self.DeleteTestData(root_key, subkeystr)
-
-    def testLocalMachineRegistryWorks(self):
-        self.TestAll(HKEY_CURRENT_USER)
-        self.TestAll(HKEY_CURRENT_USER, "日本-subkey")
+    def _test_all(self, root_key, subkeystr="sub_key"):
+        self._write_test_data(root_key, subkeystr)
+        self._read_test_data(root_key, subkeystr)
+        self._delete_test_data(root_key, subkeystr)
+
+class LocalWinregTests(BaseWinregTests):
+
+    def test_registry_works(self):
+        self._test_all(HKEY_CURRENT_USER)
+        self._test_all(HKEY_CURRENT_USER, "日本-subkey")
+
+    def test_registry_works_extended_functions(self):
+        # Substitute the regular CreateKey and OpenKey calls with their
+        # extended counterparts.
+        # Note: DeleteKeyEx is not used here because it is platform dependent
+        cke = lambda key, sub_key: CreateKeyEx(key, sub_key, 0, KEY_ALL_ACCESS)
+        self._write_test_data(HKEY_CURRENT_USER, CreateKey=cke)
+
+        oke = lambda key, sub_key: OpenKeyEx(key, sub_key, 0, KEY_READ)
+        self._read_test_data(HKEY_CURRENT_USER, OpenKey=oke)
 
-    def testConnectRegistryToLocalMachineWorks(self):
+        self._delete_test_data(HKEY_CURRENT_USER)
+
+    def test_connect_registry_to_local_machine_works(self):
         # perform minimal ConnectRegistry test which just invokes it
         h = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
+        self.assertNotEqual(h.handle, 0)
         h.Close()
+        self.assertEqual(h.handle, 0)
 
-    def testRemoteMachineRegistryWorks(self):
-        if not self.remote_name:
-            return # remote machine name not specified
-        remote_key = ConnectRegistry(self.remote_name, HKEY_CURRENT_USER)
-        self.TestAll(remote_key)
+    def test_inexistant_remote_registry(self):
+        connect = lambda: ConnectRegistry("abcdefghijkl", HKEY_CURRENT_USER)
+        self.assertRaises(WindowsError, connect)
 
     def testExpandEnvironmentStrings(self):
         r = ExpandEnvironmentStrings("%windir%\\test")
         self.assertEqual(type(r), str)
         self.assertEqual(r, os.environ["windir"] + "\\test")
 
+    def test_context_manager(self):
+        # ensure that the handle is closed if an exception occurs
+        try:
+            with ConnectRegistry(None, HKEY_LOCAL_MACHINE) as h:
+                self.assertNotEqual(h.handle, 0)
+                raise WindowsError
+        except WindowsError:
+            self.assertEqual(h.handle, 0)
+
+    # Reflection requires XP x64/Vista at a minimum. XP doesn't have this stuff
+    # or DeleteKeyEx so make sure their use raises NotImplementedError
+    @unittest.skipUnless(WIN_VER < (5, 2), "Requires Windows XP")
+    def test_reflection_unsupported(self):
+        try:
+            with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck:
+                self.assertNotEqual(ck.handle, 0)
+
+            key = OpenKey(HKEY_CURRENT_USER, test_key_name)
+            self.assertNotEqual(key.handle, 0)
+
+            with self.assertRaises(NotImplementedError):
+                DisableReflectionKey(key)
+            with self.assertRaises(NotImplementedError):
+                EnableReflectionKey(key)
+            with self.assertRaises(NotImplementedError):
+                QueryReflectionKey(key)
+            with self.assertRaises(NotImplementedError):
+                DeleteKeyEx(HKEY_CURRENT_USER, test_key_name)
+        finally:
+            DeleteKey(HKEY_CURRENT_USER, test_key_name)
+
+
+ at unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests")
+class RemoteWinregTests(BaseWinregTests):
+
+    def test_remote_registry_works(self):
+        remote_key = ConnectRegistry(REMOTE_NAME, HKEY_CURRENT_USER)
+        self._test_all(remote_key)
+
+
+ at unittest.skipUnless(WIN64_MACHINE, "x64 specific registry tests")
+class Win64WinregTests(BaseWinregTests):
+
+    def test_reflection_functions(self):
+        # Test that we can call the query, enable, and disable functions
+        # on a key which isn't on the reflection list with no consequences.
+        with OpenKey(HKEY_LOCAL_MACHINE, "Software") as key:
+            # HKLM\Software is redirected but not reflected in all OSes
+            self.assertTrue(QueryReflectionKey(key))
+            self.assertEquals(None, EnableReflectionKey(key))
+            self.assertEquals(None, DisableReflectionKey(key))
+            self.assertTrue(QueryReflectionKey(key))
+
+    @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection")
+    def test_reflection(self):
+        # Test that we can create, open, and delete keys in the 32-bit
+        # area. Because we are doing this in a key which gets reflected,
+        # test the differences of 32 and 64-bit keys before and after the
+        # reflection occurs (ie. when the created key is closed).
+        try:
+            with CreateKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                             KEY_ALL_ACCESS | KEY_WOW64_32KEY) as created_key:
+                self.assertNotEqual(created_key.handle, 0)
+
+                # The key should now be available in the 32-bit area
+                with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                             KEY_ALL_ACCESS | KEY_WOW64_32KEY) as key:
+                    self.assertNotEqual(key.handle, 0)
+
+                # Write a value to what currently is only in the 32-bit area
+                SetValueEx(created_key, "", 0, REG_SZ, "32KEY")
+
+                # The key is not reflected until created_key is closed.
+                # The 64-bit version of the key should not be available yet.
+                open_fail = lambda: OpenKey(HKEY_CURRENT_USER,
+                                            test_reflect_key_name, 0,
+                                            KEY_READ | KEY_WOW64_64KEY)
+                self.assertRaises(WindowsError, open_fail)
+
+            # Now explicitly open the 64-bit version of the key
+            with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                         KEY_ALL_ACCESS | KEY_WOW64_64KEY) as key:
+                self.assertNotEqual(key.handle, 0)
+                # Make sure the original value we set is there
+                self.assertEqual("32KEY", QueryValue(key, ""))
+                # Set a new value, which will get reflected to 32-bit
+                SetValueEx(key, "", 0, REG_SZ, "64KEY")
+
+            # Reflection uses a "last-writer wins policy, so the value we set
+            # on the 64-bit key should be the same on 32-bit
+            with OpenKey(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                         KEY_READ | KEY_WOW64_32KEY) as key:
+                self.assertEqual("64KEY", QueryValue(key, ""))
+        finally:
+            DeleteKeyEx(HKEY_CURRENT_USER, test_reflect_key_name,
+                        KEY_WOW64_32KEY, 0)
+
+    @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection")
+    def test_disable_reflection(self):
+        # Make use of a key which gets redirected and reflected
+        try:
+            with CreateKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                             KEY_ALL_ACCESS | KEY_WOW64_32KEY) as created_key:
+                # QueryReflectionKey returns whether or not the key is disabled
+                disabled = QueryReflectionKey(created_key)
+                self.assertEqual(type(disabled), bool)
+                # HKCU\Software\Classes is reflected by default
+                self.assertFalse(disabled)
+
+                DisableReflectionKey(created_key)
+                self.assertTrue(QueryReflectionKey(created_key))
+
+            # The key is now closed and would normally be reflected to the
+            # 64-bit area, but let's make sure that didn't happen.
+            open_fail = lambda: OpenKeyEx(HKEY_CURRENT_USER,
+                                          test_reflect_key_name, 0,
+                                          KEY_READ | KEY_WOW64_64KEY)
+            self.assertRaises(WindowsError, open_fail)
+
+            # Make sure the 32-bit key is actually there
+            with OpenKeyEx(HKEY_CURRENT_USER, test_reflect_key_name, 0,
+                           KEY_READ | KEY_WOW64_32KEY) as key:
+                self.assertNotEqual(key.handle, 0)
+        finally:
+            DeleteKeyEx(HKEY_CURRENT_USER, test_reflect_key_name,
+                        KEY_WOW64_32KEY, 0)
+
+
 def test_main():
-    support.run_unittest(WinregTests)
+    support.run_unittest(LocalWinregTests, RemoteWinregTests,
+                         Win64WinregTests)
 
 if __name__ == "__main__":
-    try:
-        WinregTests.remote_name = sys.argv[sys.argv.index("--remote")+1]
-    except (IndexError, ValueError):
+    if not REMOTE_NAME:
         print("Remote registry calls can be tested using",
               "'test_winreg.py --remote \\\\machine_name'")
-        WinregTests.remote_name = None
     test_main()

Modified: python/branches/py3k-jit/Lib/threading.py
==============================================================================
--- python/branches/py3k-jit/Lib/threading.py	(original)
+++ python/branches/py3k-jit/Lib/threading.py	Fri Apr 23 02:01:11 2010
@@ -290,8 +290,11 @@
         self._cond = Condition(Lock())
         self._value = value
 
-    def acquire(self, blocking=True):
+    def acquire(self, blocking=True, timeout=None):
+        if not blocking and timeout is not None:
+            raise ValueError("can't specify timeout for non-blocking acquire")
         rc = False
+        endtime = None
         self._cond.acquire()
         while self._value == 0:
             if not blocking:
@@ -299,7 +302,14 @@
             if __debug__:
                 self._note("%s.acquire(%s): blocked waiting, value=%s",
                            self, blocking, self._value)
-            self._cond.wait()
+            if timeout is not None:
+                if endtime is None:
+                    endtime = _time() + timeout
+                else:
+                    timeout = endtime - _time()
+                    if timeout <= 0:
+                        break
+            self._cond.wait(timeout)
         else:
             self._value = self._value - 1
             if __debug__:

Modified: python/branches/py3k-jit/Lib/unittest/test/test_break.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/test/test_break.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/test/test_break.py	Fri Apr 23 02:01:11 2010
@@ -10,6 +10,8 @@
 
 @unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
 @unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
+ at unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
+    "if threads have been used")
 class TestBreak(unittest.TestCase):
 
     def setUp(self):

Modified: python/branches/py3k-jit/Lib/urllib/parse.py
==============================================================================
--- python/branches/py3k-jit/Lib/urllib/parse.py	(original)
+++ python/branches/py3k-jit/Lib/urllib/parse.py	Fri Apr 23 02:01:11 2010
@@ -1,7 +1,29 @@
 """Parse (absolute and relative) URLs.
 
-See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
-UC Irvine, June 1995.
+urlparse module is based upon the following RFC specifications.
+
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
+and L.  Masinter, January 2005.
+
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
+and L.Masinter, December 1999.
+
+RFC2396:  "Uniform Resource Identifiers (URI)": Generic Syntax by T.
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.
+
+RFC2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zwinski, July 1998.
+
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
+1995.
+
+RFC1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
+McCahill, December 1994
+
+RFC 3986 is considered the current standard and any changes to urlparse module
+should conform to this.  urlparse module is not entirely compliant with this.
+The defacto scenarios of parsing are considered sometimes and for backward
+compatiblity purposes, older RFC uses of parsing are retained. The testcases in
+test_urlparse.py provides a good indicator of parsing behavior.
 """
 
 import sys
@@ -73,8 +95,6 @@
         netloc = self.netloc.split('@')[-1]
         if '[' in netloc and ']' in netloc:
             return netloc.split(']')[0][1:].lower()
-        elif '[' in netloc or ']' in netloc:
-            raise ValueError("Invalid IPv6 hostname")
         elif ':' in netloc:
             return netloc.split(':')[0].lower()
         elif netloc == '':
@@ -134,10 +154,6 @@
 
 def _splitnetloc(url, start=0):
     delim = len(url)   # position of end of domain part of url, default is end
-    if '[' in url:     # check for invalid IPv6 URL
-        if not ']' in url: raise ValueError("Invalid IPv6 URL")
-    elif ']' in url:
-        if not '[' in url: raise ValueError("Invalid IPv6 URL")
     for c in '/?#':    # look for delimiters; the order is NOT important
         wdelim = url.find(c, start)        # find first of this delim
         if wdelim >= 0:                    # if found
@@ -165,6 +181,9 @@
             url = url[i+1:]
             if url[:2] == '//':
                 netloc, url = _splitnetloc(url, 2)
+                if (('[' in netloc and ']' not in netloc) or
+                        (']' in netloc and '[' not in netloc)):
+                    raise ValueError("Invalid IPv6 URL")
             if allow_fragments and '#' in url:
                 url, fragment = url.split('#', 1)
             if '?' in url:
@@ -179,6 +198,9 @@
             scheme, url = url[:i].lower(), url[i+1:]
     if url[:2] == '//':
         netloc, url = _splitnetloc(url, 2)
+        if (('[' in netloc and ']' not in netloc) or
+                (']' in netloc and '[' not in netloc)):
+            raise ValueError("Invalid IPv6 URL")
     if allow_fragments and scheme in uses_fragment and '#' in url:
         url, fragment = url.split('#', 1)
     if scheme in uses_query and '?' in url:

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

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

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

Modified: python/branches/py3k-jit/Mac/Makefile.in
==============================================================================
--- python/branches/py3k-jit/Mac/Makefile.in	(original)
+++ python/branches/py3k-jit/Mac/Makefile.in	Fri Apr 23 02:01:11 2010
@@ -17,6 +17,9 @@
 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
 CC=@CC@
+MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
+export MACOSX_DEPLOYMENT_TARGET
+
 
 
 # These are normally glimpsed from the previous set

Modified: python/branches/py3k-jit/Mac/PythonLauncher/Makefile.in
==============================================================================
--- python/branches/py3k-jit/Mac/PythonLauncher/Makefile.in	(original)
+++ python/branches/py3k-jit/Mac/PythonLauncher/Makefile.in	Fri Apr 23 02:01:11 2010
@@ -2,7 +2,7 @@
 LD=@CC@
 BASECFLAGS=@BASECFLAGS@
 OPT=@OPT@
-CFLAGS=$(BASECFLAGS) $(OPT)
+CFLAGS=@CFLAGS@ $(BASECFLAGS) $(OPT)
 LDFLAGS=@LDFLAGS@
 srcdir=         @srcdir@
 VERSION=	@VERSION@

Modified: python/branches/py3k-jit/Misc/ACKS
==============================================================================
--- python/branches/py3k-jit/Misc/ACKS	(original)
+++ python/branches/py3k-jit/Misc/ACKS	Fri Apr 23 02:01:11 2010
@@ -437,6 +437,7 @@
 Vladimir Kushnir
 David Laing
 Cameron Laird
+Torsten Landschoff
 Tino Lange
 Andrew Langmead
 Detlef Lannert
@@ -546,6 +547,7 @@
 John Nagle
 Takahiro Nakayama
 Travers Naran
+Charles-François Natali
 Fredrik Nehr
 Trent Nelson
 Tony Nelson

Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS	(original)
+++ python/branches/py3k-jit/Misc/NEWS	Fri Apr 23 02:01:11 2010
@@ -12,6 +12,17 @@
 Core and Builtins
 -----------------
 
+- Issue #8092: Fix PyUnicode_EncodeUTF8() to support error handler producing
+  unicode string (eg. backslashreplace)
+
+- Issue #8485: PyUnicode_FSConverter() doesn't accept bytearray object anymore,
+  you have to convert your bytearray filenames to bytes
+
+- Issue #7332: Remove the 16KB stack-based buffer in
+  PyMarshal_ReadLastObjectFromFile, which doesn't bring any noticeable
+  benefit compared to the dynamic memory allocation fallback.  Patch by
+  Charles-François Natali.
+
 - Issue #8417: Raise an OverflowError when an integer larger than sys.maxsize is
   passed to bytes or bytearray.
 
@@ -261,6 +272,9 @@
 
 - Code objects now support weak references.
 
+- Issue #7072: isspace(0xa0) is true on Mac OS X
+
+
 C-API
 -----
 
@@ -315,6 +329,41 @@
 Library
 -------
 
+- Issue #8496: make mailcap.lookup() always return a list, rather than an
+  iterator.  Patch by Gregory Nofi.
+
+- Issue #8195: Fix a crash in sqlite Connection.create_collation() if the
+  collation name contains a surrogate character.
+
+- Issue #8484: Load all ciphers and digest algorithms when initializing
+  the _ssl extension, such that verification of some SSL certificates
+  doesn't fail because of an "unknown algorithm".
+
+- Issue #6547: Added the ignore_dangling_symlinks option to shutil.copytree.
+
+- Issue #1540112: Now allowing the choice of a copy function in 
+  shutil.copytree.
+
+- Issue #4814: timeout parameter is now applied also for connections resulting
+  from PORT/EPRT commands.
+
+- Issue #8463: added missing reference to bztar in shutil's documentation.
+
+- Issue #7154: urllib.request can now detect the proxy settings on OSX 10.6
+  (as long as the user didn't specify 'automatic proxy configuration').
+
+- Issue #3817: ftplib.FTP.abort() method now considers 225 a valid response
+  code as stated in RFC-959 at chapter 5.4.
+
+- Issue #8394: _ctypes.dlopen() accepts bytes, bytearray and str with
+  surrogates.
+
+- Issue #850728: Add a *timeout* parameter to the `acquire()` method of
+  `threading.Semaphore` objects.  Original patch by Torsten Landschoff.
+
+- Issue #8322: Add a *ciphers* argument to SSL sockets, so as to change the
+  available cipher list.  Helps fix test_ssl with OpenSSL 1.0.0.
+
 - Issue #8393: subprocess accepts bytes, bytearray and str with surrogates for
   the current working directory.
 
@@ -936,6 +985,10 @@
 Extension Modules
 -----------------
 
+- Issue #2706: Allow division of a timedelta by another timedelta:
+  timedelta / timedelta, timedelta % timedelta, timedelta // timedelta
+  and divmod(timedelta, timedelta) are all supported.
+
 - Issue #8314: Fix unsigned long long bug in libffi on Sparc v8.
 
 - Issue #8300: When passing a non-integer argument to struct.pack with any
@@ -986,6 +1039,11 @@
 - Issue #7999: os.setreuid() and os.setregid() would refuse to accept a -1
   parameter on some platforms such as OS X.
 
+- Build the ossaudio extension on GNU/kFreeBSD.
+
+- Issue #7347: winreg: Add CreateKeyEx and DeleteKeyEx, as well as fix a
+  bug in the return value of QueryReflectionKey.
+
 Build
 -----
 
@@ -1062,6 +1120,12 @@
 Tests
 -----
 
+- Issues #8279, #8330, #8437, #8480: Fix test_gdb failures, patch written by
+  Dave Malcolm
+
+- Issue #3864: Skip three test_signal tests on freebsd6 because they fail
+  if any thread was previously started, most likely due to a platform bug.
+
 - Issue #8193: Fix test_zlib failure with zlib 1.2.4.
 
 - Issue #8248: Add some tests for the bool type.  Patch by Gregory Nofi.

Modified: python/branches/py3k-jit/Misc/developers.txt
==============================================================================
--- python/branches/py3k-jit/Misc/developers.txt	(original)
+++ python/branches/py3k-jit/Misc/developers.txt	Fri Apr 23 02:01:11 2010
@@ -20,6 +20,12 @@
 Permissions History
 -------------------
 
+- Tim Golden was given commit access on April 21 2010 by MvL,
+  at suggestion of Michael Foord.
+
+- Giampaolo Rodolà was given commit access on April 17 2010 by
+  MvL, at suggestion of R. David Murray.
+
 - Jean-Paul Calderone was given commit access on April 6 2010 by
   GFB, at suggestion of Michael Foord and others.
 

Modified: python/branches/py3k-jit/Misc/maintainers.rst
==============================================================================
--- python/branches/py3k-jit/Misc/maintainers.rst	(original)
+++ python/branches/py3k-jit/Misc/maintainers.rst	Fri Apr 23 02:01:11 2010
@@ -88,7 +88,7 @@
 distutils           tarek
 doctest             tim_one (inactive)
 dummy_threading     brett.cannon
-email               barry
+email               barry, r.david.murray
 encodings           lemburg, loewis
 errno
 exceptions
@@ -187,7 +187,7 @@
 socketserver
 spwd
 sqlite3             ghaering
-ssl                 janssen
+ssl                 janssen, pitrou
 stat
 string
 stringprep
@@ -198,7 +198,7 @@
 symtable            benjamin.peterson
 sys
 sysconfig           tarek
-syslog
+syslog              jafo
 tabnanny            tim_one
 tarfile             lars.gustaebel
 telnetlib
@@ -251,12 +251,13 @@
 AIX
 Cygwin              jlt63
 FreeBSD
+HP-UX
 Linux
 Mac                 ronaldoussoren
 NetBSD1
 OS2/EMX             aimacintyre
 Solaris
-HP-UX
+Windows
 ==================  ===========
 
 
@@ -292,5 +293,4 @@
 tracker
 unicode             lemburg, ezio.melotti, haypo
 version control
-windows
 ==================  ===========

Modified: python/branches/py3k-jit/Modules/Setup.dist
==============================================================================
--- python/branches/py3k-jit/Modules/Setup.dist	(original)
+++ python/branches/py3k-jit/Modules/Setup.dist	Fri Apr 23 02:01:11 2010
@@ -217,6 +217,7 @@
 #termios termios.c	# Steen Lumholt's termios module
 #resource resource.c	# Jeremy Hylton's rlimit interface
 
+#_posixsubprocess _posixsubprocess.c  # POSIX subprocess module helper
 
 # Multimedia modules -- off by default.
 # These don't work for 64-bit platforms!!!

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

Modified: python/branches/py3k-jit/Modules/_posixsubprocess.c
==============================================================================
--- python/branches/py3k-jit/Modules/_posixsubprocess.c	(original)
+++ python/branches/py3k-jit/Modules/_posixsubprocess.c	Fri Apr 23 02:01:11 2010
@@ -271,10 +271,7 @@
     if (cwd_obj != Py_None) {
         if (PyUnicode_FSConverter(cwd_obj, &cwd_obj2) == 0)
             goto cleanup;
-        if (PyBytes_Check(cwd_obj2))
-            cwd = PyBytes_AS_STRING(cwd_obj2);
-        else
-            cwd = PyByteArray_AS_STRING(cwd_obj2);
+        cwd = PyBytes_AsString(cwd_obj2);
     } else {
         cwd = NULL;
         cwd_obj2 = NULL;

Modified: python/branches/py3k-jit/Modules/_sqlite/connection.c
==============================================================================
--- python/branches/py3k-jit/Modules/_sqlite/connection.c	(original)
+++ python/branches/py3k-jit/Modules/_sqlite/connection.c	Fri Apr 23 02:01:11 2010
@@ -1374,7 +1374,9 @@
     PyObject* uppercase_name = 0;
     PyObject* name;
     PyObject* retval;
-    char* chk;
+    Py_UNICODE* chk;
+    Py_ssize_t i, len;
+    char *uppercase_name_str;
     int rc;
 
     if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
@@ -1390,19 +1392,24 @@
         goto finally;
     }
 
-    chk = _PyUnicode_AsString(uppercase_name);
-    while (*chk) {
+    len = PyUnicode_GET_SIZE(uppercase_name);
+    chk = PyUnicode_AS_UNICODE(uppercase_name);
+    for (i=0; i<len; i++, chk++) {
         if ((*chk >= '0' && *chk <= '9')
          || (*chk >= 'A' && *chk <= 'Z')
          || (*chk == '_'))
         {
-            chk++;
+            continue;
         } else {
             PyErr_SetString(pysqlite_ProgrammingError, "invalid character in collation name");
             goto finally;
         }
     }
 
+    uppercase_name_str = _PyUnicode_AsString(uppercase_name);
+    if (!uppercase_name_str)
+        goto finally;
+
     if (callable != Py_None && !PyCallable_Check(callable)) {
         PyErr_SetString(PyExc_TypeError, "parameter must be callable");
         goto finally;
@@ -1417,7 +1424,7 @@
     }
 
     rc = sqlite3_create_collation(self->db,
-                                  _PyUnicode_AsString(uppercase_name),
+                                  uppercase_name_str,
                                   SQLITE_UTF8,
                                   (callable != Py_None) ? callable : NULL,
                                   (callable != Py_None) ? pysqlite_collation_callback : NULL);

Modified: python/branches/py3k-jit/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-jit/Modules/_ssl.c	(original)
+++ python/branches/py3k-jit/Modules/_ssl.c	Fri Apr 23 02:01:11 2010
@@ -262,7 +262,7 @@
 	       enum py_ssl_server_or_client socket_type,
 	       enum py_ssl_cert_requirements certreq,
 	       enum py_ssl_version proto_version,
-	       char *cacerts_file)
+	       char *cacerts_file, char *ciphers)
 {
 	PySSLObject *self;
 	char *errstr = NULL;
@@ -310,6 +310,14 @@
 		goto fail;
 	}
 
+	if (ciphers != NULL) {
+		ret = SSL_CTX_set_cipher_list(self->ctx, ciphers);
+		if (ret == 0) {
+			errstr = ERRSTR("No cipher can be selected.");
+			goto fail;
+		}
+	}
+
 	if (certreq != PY_SSL_CERT_NONE) {
 		if (cacerts_file == NULL) {
 			errstr = ERRSTR("No root certificates specified for "
@@ -408,14 +416,15 @@
 	char *key_file = NULL;
 	char *cert_file = NULL;
 	char *cacerts_file = NULL;
+	char *ciphers = NULL;
 
-	if (!PyArg_ParseTuple(args, "O!i|zziiz:sslwrap",
+	if (!PyArg_ParseTuple(args, "O!i|zziizz:sslwrap",
 			      PySocketModule.Sock_Type,
 			      &Sock,
 			      &server_side,
 			      &key_file, &cert_file,
 			      &verification_mode, &protocol,
-			      &cacerts_file))
+			      &cacerts_file, &ciphers))
 		return NULL;
 
 	/*
@@ -428,12 +437,13 @@
 
 	return (PyObject *) newPySSLObject(Sock, key_file, cert_file,
 					   server_side, verification_mode,
-					   protocol, cacerts_file);
+					   protocol, cacerts_file,
+					   ciphers);
 }
 
 PyDoc_STRVAR(ssl_doc,
 "sslwrap(socket, server_side, [keyfile, certfile, certs_mode, protocol,\n"
-"                              cacertsfile]) -> sslobject");
+"                              cacertsfile, ciphers]) -> sslobject");
 
 /* SSL object methods */
 
@@ -1659,13 +1669,14 @@
 
 	/* Init OpenSSL */
 	SSL_load_error_strings();
+	SSL_library_init();
 #ifdef WITH_THREAD
 	/* note that this will start threading if not already started */
 	if (!_setup_ssl_threads()) {
 		return NULL;
 	}
 #endif
-	SSLeay_add_ssl_algorithms();
+	OpenSSL_add_all_algorithms();
 
 	/* Add symbols to module dict */
 	PySSLErrorObject = PyErr_NewException("ssl.SSLError",

Modified: python/branches/py3k-jit/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/datetimemodule.c	(original)
+++ python/branches/py3k-jit/Modules/datetimemodule.c	Fri Apr 23 02:01:11 2010
@@ -1666,6 +1666,52 @@
 }
 
 static PyObject *
+divide_timedelta_timedelta(PyDateTime_Delta *left, PyDateTime_Delta *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *result;
+
+	pyus_left = delta_to_microseconds(left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds(right);
+	if (pyus_right == NULL)	{
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	result = PyNumber_FloorDivide(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	return result;
+}
+
+static PyObject *
+truedivide_timedelta_timedelta(PyDateTime_Delta *left, PyDateTime_Delta *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *result;
+
+	pyus_left = delta_to_microseconds(left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds(right);
+	if (pyus_right == NULL)	{
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	result = PyNumber_TrueDivide(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	return result;
+}
+
+static PyObject *
 delta_add(PyObject *left, PyObject *right)
 {
 	PyObject *result = Py_NotImplemented;
@@ -1810,6 +1856,27 @@
 			result = divide_timedelta_int(
 					(PyDateTime_Delta *)left,
 					right);
+		else if (PyDelta_Check(right))
+			result = divide_timedelta_timedelta(
+					(PyDateTime_Delta *)left,
+					(PyDateTime_Delta *)right);
+	}
+
+	if (result == Py_NotImplemented)
+		Py_INCREF(result);
+	return result;
+}
+
+static PyObject *
+delta_truedivide(PyObject *left, PyObject *right)
+{
+	PyObject *result = Py_NotImplemented;
+
+	if (PyDelta_Check(left)) {
+		if (PyDelta_Check(right))
+			result = truedivide_timedelta_timedelta(
+					(PyDateTime_Delta *)left,
+					(PyDateTime_Delta *)right);
 	}
 
 	if (result == Py_NotImplemented)
@@ -1817,6 +1884,85 @@
 	return result;
 }
 
+static PyObject *
+delta_remainder(PyObject *left, PyObject *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *pyus_remainder;
+	PyObject *remainder;
+
+	if (!PyDelta_Check(left) || !PyDelta_Check(right)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+
+	pyus_left = delta_to_microseconds((PyDateTime_Delta *)left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds((PyDateTime_Delta *)right);
+	if (pyus_right == NULL) {
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	pyus_remainder = PyNumber_Remainder(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	if (pyus_remainder == NULL)
+		return NULL;
+
+	remainder = microseconds_to_delta(pyus_remainder);
+	Py_DECREF(pyus_remainder);
+	if (remainder == NULL)
+		return NULL;
+
+	return remainder;
+}
+
+static PyObject *
+delta_divmod(PyObject *left, PyObject *right)
+{
+	PyObject *pyus_left;
+	PyObject *pyus_right;
+	PyObject *divmod;
+	PyObject *delta;
+	PyObject *result;
+
+	if (!PyDelta_Check(left) || !PyDelta_Check(right)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+
+	pyus_left = delta_to_microseconds((PyDateTime_Delta *)left);
+	if (pyus_left == NULL)
+		return NULL;
+
+	pyus_right = delta_to_microseconds((PyDateTime_Delta *)right);
+	if (pyus_right == NULL) {
+		Py_DECREF(pyus_left);
+		return NULL;
+	}
+
+	divmod = PyNumber_Divmod(pyus_left, pyus_right);
+	Py_DECREF(pyus_left);
+	Py_DECREF(pyus_right);
+	if (divmod == NULL)
+		return NULL;
+
+	assert(PyTuple_Size(divmod) == 2);
+	delta = microseconds_to_delta(PyTuple_GET_ITEM(divmod, 1));
+	if (delta == NULL) {
+		Py_DECREF(divmod);
+		return NULL;
+	}
+	result = PyTuple_Pack(2, PyTuple_GET_ITEM(divmod, 0), delta);
+	Py_DECREF(delta);
+	Py_DECREF(divmod);
+	return result;
+}
+
 /* Fold in the value of the tag ("seconds", "weeks", etc) component of a
  * timedelta constructor.  sofar is the # of microseconds accounted for
  * so far, and there are factor microseconds per current unit, the number
@@ -2108,8 +2254,8 @@
 	delta_add,				/* nb_add */
 	delta_subtract,				/* nb_subtract */
 	delta_multiply,				/* nb_multiply */
-	0,					/* nb_remainder */
-	0,					/* nb_divmod */
+	delta_remainder,			/* nb_remainder */
+	delta_divmod,				/* nb_divmod */
 	0,					/* nb_power */
 	(unaryfunc)delta_negative,		/* nb_negative */
 	(unaryfunc)delta_positive,		/* nb_positive */
@@ -2135,7 +2281,7 @@
 	0,					/*nb_inplace_xor*/
 	0,					/*nb_inplace_or*/
 	delta_divide,				/* nb_floor_divide */
-	0,					/* nb_true_divide */
+	delta_truedivide,			/* nb_true_divide */
 	0,					/* nb_inplace_floor_divide */
 	0,					/* nb_inplace_true_divide */
 };

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

Modified: python/branches/py3k-jit/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/posixmodule.c	(original)
+++ python/branches/py3k-jit/Modules/posixmodule.c	Fri Apr 23 02:01:11 2010
@@ -536,38 +536,6 @@
 	return d;
 }
 
-/* Convert a bytes object to a char*. Optionally lock the buffer if it is a
-   bytes array. */
-
-static char*
-bytes2str(PyObject* o, int lock)
-{
-	if(PyBytes_Check(o))
-		return PyBytes_AsString(o);
-	else if(PyByteArray_Check(o)) {
-		if (lock && PyObject_GetBuffer(o, NULL, 0) < 0)
-			/* On a bytearray, this should not fail. */
-			PyErr_BadInternalCall();
-		return PyByteArray_AsString(o);
-	} else {
-		/* The FS converter should have verified that this
-		   is either bytes or bytearray. */
-		Py_FatalError("bad object passed to bytes2str");
-		/* not reached. */
-		return "";
-	}
-}
-
-/* Release the lock, decref the object. */
-static void
-release_bytes(PyObject* o)
-{
-	if (PyByteArray_Check(o))
-		o->ob_type->tp_as_buffer->bf_releasebuffer(o, 0);
-	Py_DECREF(o);
-}
-
-
 /* Set a POSIX-specific error from errno, and return NULL */
 
 static PyObject *
@@ -594,8 +562,8 @@
 posix_error_with_allocated_filename(PyObject* name)
 {
 	PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, 
-						      bytes2str(name, 0));
-	release_bytes(name);
+						      PyBytes_AsString(name));
+	Py_DECREF(name);
 	return rc;
 }
 
@@ -751,13 +719,13 @@
 	if (!PyArg_ParseTuple(args, format,
 	                      PyUnicode_FSConverter, &opath1))
 		return NULL;
-	path1 = bytes2str(opath1, 1);
+	path1 = PyBytes_AsString(opath1);
 	Py_BEGIN_ALLOW_THREADS
 	res = (*func)(path1);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath1);
-	release_bytes(opath1);
+	Py_DECREF(opath1);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -775,13 +743,13 @@
 	                      PyUnicode_FSConverter, &opath2)) {
 		return NULL;
 	}
-	path1 = bytes2str(opath1, 1);
-	path2 = bytes2str(opath2, 1);
+	path1 = PyBytes_AsString(opath1);
+	path2 = PyBytes_AsString(opath2);
 	Py_BEGIN_ALLOW_THREADS
 	res = (*func)(path1, path2);
 	Py_END_ALLOW_THREADS
-	release_bytes(opath1);
-	release_bytes(opath2);
+	Py_DECREF(opath1);
+	Py_DECREF(opath2);
 	if (res != 0)
 		/* XXX how to report both path1 and path2??? */
 		return posix_error();
@@ -1530,7 +1498,7 @@
 	if (!PyArg_ParseTuple(args, format,
 	                      PyUnicode_FSConverter, &opath))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = (*statfunc)(path, &st);
 	Py_END_ALLOW_THREADS
@@ -1545,7 +1513,7 @@
 	else
 		result = _pystat_fromstructstat(&st);
 
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return result;
 }
 
@@ -1583,11 +1551,11 @@
 	if (!PyArg_ParseTuple(args, "O&i:access",
 			      PyUnicode_FSConverter, &opath, &mode))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	attr = GetFileAttributesA(path);
 	Py_END_ALLOW_THREADS
-	release_bytes(opath);
+	Py_DECREF(opath);
 finish:
 	if (attr == 0xFFFFFFFF)
 		/* File does not exist, or cannot read attributes */
@@ -1603,11 +1571,11 @@
 	if (!PyArg_ParseTuple(args, "O&i:access", 
 			      PyUnicode_FSConverter, &opath, &mode))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = access(path, mode);
 	Py_END_ALLOW_THREADS
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return PyBool_FromLong(res == 0);
 #endif
 }
@@ -1750,7 +1718,7 @@
 	if (!PyArg_ParseTuple(args, "O&i:chmod", PyUnicode_FSConverter,
 	                      &opath, &i))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	attr = GetFileAttributesA(path);
 	if (attr != 0xFFFFFFFF) {
@@ -1765,23 +1733,23 @@
 	Py_END_ALLOW_THREADS
 	if (!res) {
 		win32_error("chmod", path);
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 #else /* MS_WINDOWS */
 	if (!PyArg_ParseTuple(args, "O&i:chmod", PyUnicode_FSConverter,
 	                      &opath, &i))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = chmod(path, i);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 #endif
@@ -1824,13 +1792,13 @@
 	if (!PyArg_ParseTuple(args, "O&i:lchmod", PyUnicode_FSConverter,
 	                      &opath, &i))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = lchmod(path, i);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_RETURN_NONE;
 }
 #endif /* HAVE_LCHMOD */
@@ -1851,13 +1819,13 @@
 	if (!PyArg_ParseTuple(args, "O&k:chflags",
 			      PyUnicode_FSConverter, &opath, &flags))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = chflags(path, flags);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -1879,13 +1847,13 @@
 	if (!PyArg_ParseTuple(args, "O&k:lchflags",
 			      PyUnicode_FSConverter, &opath, &flags))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = lchflags(path, flags);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -1950,13 +1918,13 @@
 	                      PyUnicode_FSConverter, &opath,
 	                      &uid, &gid))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = chown(path, (uid_t) uid, (gid_t) gid);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -2002,13 +1970,13 @@
 	                      PyUnicode_FSConverter, &opath,
 	                      &uid, &gid))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	res = lchown(path, (uid_t) uid, (gid_t) gid);
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -2209,12 +2177,12 @@
 	if (!PyArg_ParseTuple(args, "O&:listdir",
 	                      PyUnicode_FSConverter, &opath))
 		return NULL;
-	if (PyObject_Size(opath)+1 > MAX_PATH) {
+	if (PyBytes_GET_SIZE(opath)+1 > MAX_PATH) {
 		PyErr_SetString(PyExc_ValueError, "path too long");
 		Py_DECREF(opath);
 		return NULL;
 	}
-	strcpy(namebuf, bytes2str(opath, 0));
+	strcpy(namebuf, PyBytes_AsString(opath));
 	len = PyObject_Size(opath);
 	if (len > 0) {
 		char ch = namebuf[len-1];
@@ -2290,10 +2258,10 @@
     if (!PyArg_ParseTuple(args, "O&:listdir", 
                           PyUnicode_FSConverter, &oname))
         return NULL;
-    name = bytes2str(oname);
-    len = PyObject_Size(oname);
+    name = PyBytes_AsString(oname);
+    len = PyBytes_GET_SIZE(oname);
     if (len >= MAX_PATH) {
-        release_bytes(oname);
+        Py_DECREF(oname);
         PyErr_SetString(PyExc_ValueError, "path too long");
         return NULL;
     }
@@ -2306,7 +2274,7 @@
     strcpy(namebuf + len, "*.*");
 
     if ((d = PyList_New(0)) == NULL) {
-        release_bytes(oname);
+        Py_DECREF(oname);
         return NULL;
     }
 
@@ -2349,7 +2317,7 @@
         } while (DosFindNext(hdir, &ep, sizeof(ep), &srchcnt) == NO_ERROR && srchcnt > 0);
     }
 
-    release_bytes(oname);
+    Py_DECREF(oname);
     return d;
 #else
 	PyObject *oname;
@@ -2366,13 +2334,13 @@
 	}
 	if (!PyArg_ParseTuple(args, "O&:listdir", PyUnicode_FSConverter, &oname))
 		return NULL;
-	name = bytes2str(oname, 1);
+	name = PyBytes_AsString(oname);
 	if ((dirp = opendir(name)) == NULL) {
 		return posix_error_with_allocated_filename(oname);
 	}
 	if ((d = PyList_New(0)) == NULL) {
 		closedir(dirp);
-		release_bytes(oname);
+		Py_DECREF(oname);
 		return NULL;
 	}
 	for (;;) {
@@ -2425,7 +2393,7 @@
 		Py_DECREF(v);
 	}
 	closedir(dirp);
-	release_bytes(oname);
+	Py_DECREF(oname);
 
 	return d;
 
@@ -2474,14 +2442,14 @@
 	if (!PyArg_ParseTuple (args, "O&:_getfullpathname",
 	                       PyUnicode_FSConverter, &opath))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (!GetFullPathName(path, sizeof(outbuf)/sizeof(outbuf[0]),
 	                     outbuf, &temp)) {
 		win32_error("GetFullPathName", path);
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
-	release_bytes(opath);
+	Py_DECREF(opath);
 	if (PyUnicode_Check(PyTuple_GetItem(args, 0))) {
 		return PyUnicode_Decode(outbuf, strlen(outbuf),
 			Py_FileSystemDefaultEncoding, NULL);
@@ -2521,7 +2489,7 @@
 	if (!PyArg_ParseTuple(args, "O&|i:mkdir",
 	                      PyUnicode_FSConverter, &opath, &mode))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 	/* PyUnicode_AS_UNICODE OK without thread lock as
 	   it is a simple dereference. */
@@ -2529,10 +2497,10 @@
 	Py_END_ALLOW_THREADS
 	if (!res) {
 		win32_error("mkdir", path);
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 #else
@@ -2540,7 +2508,7 @@
 	if (!PyArg_ParseTuple(args, "O&|i:mkdir",
 	                      PyUnicode_FSConverter, &opath, &mode))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	Py_BEGIN_ALLOW_THREADS
 #if ( defined(__WATCOMC__) || defined(PYCC_VACPP) ) && !defined(__QNX__)
 	res = mkdir(path);
@@ -2550,7 +2518,7 @@
 	Py_END_ALLOW_THREADS
 	if (res < 0)
 		return posix_error_with_allocated_filename(opath);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 #endif
@@ -2699,11 +2667,11 @@
 	                      PyUnicode_FSConverter, &command_obj))
 		return NULL;
 
-	command = bytes2str(command_obj, 1);
+	command = PyBytes_AsString(command_obj);
 	Py_BEGIN_ALLOW_THREADS
 	sts = system(command);
 	Py_END_ALLOW_THREADS
-	release_bytes(command_obj);
+	Py_DECREF(command_obj);
 #endif
 	return PyLong_FromLong(sts);
 }
@@ -2838,7 +2806,7 @@
 		if (!PyArg_ParseTuple(args, "O&O:utime",
 				PyUnicode_FSConverter, &oapath, &arg))
 			return NULL;
-		apath = bytes2str(oapath, 1);
+		apath = PyBytes_AsString(oapath);
 		Py_BEGIN_ALLOW_THREADS
 		hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0,
 				    NULL, OPEN_EXISTING,
@@ -2846,10 +2814,10 @@
 		Py_END_ALLOW_THREADS
 		if (hFile == INVALID_HANDLE_VALUE) {
 			win32_error("utime", apath);
-			release_bytes(oapath);
+			Py_DECREF(oapath);
 			return NULL;
 		}
-		release_bytes(oapath);
+		Py_DECREF(oapath);
 	}
 	
 	if (arg == Py_None) {
@@ -2917,7 +2885,7 @@
 	if (!PyArg_ParseTuple(args, "O&O:utime",
 				  PyUnicode_FSConverter, &opath, &arg))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (arg == Py_None) {
 		/* optional time values not given */
 		Py_BEGIN_ALLOW_THREADS
@@ -2927,18 +2895,18 @@
 	else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) {
 		PyErr_SetString(PyExc_TypeError,
 				"utime() arg 2 must be a tuple (atime, mtime)");
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
 	else {
 		if (extract_time(PyTuple_GET_ITEM(arg, 0),
 				 &atime, &ausec) == -1) {
-			release_bytes(opath);
+			Py_DECREF(opath);
 			return NULL;
 		}
 		if (extract_time(PyTuple_GET_ITEM(arg, 1),
 				 &mtime, &musec) == -1) {
-			release_bytes(opath);
+			Py_DECREF(opath);
 			return NULL;
 		}
 		ATIME = atime;
@@ -2958,7 +2926,7 @@
 	if (res < 0) {
 		return posix_error_with_allocated_filename(opath);
 	}
-	release_bytes(opath);
+	Py_DECREF(opath);
 	Py_INCREF(Py_None);
 	return Py_None;
 #undef UTIME_ARG
@@ -3001,12 +2969,11 @@
 	Py_ssize_t size;
 	if (!PyUnicode_FSConverter(o, &bytes))
 		return 0;
-	size = PyObject_Size(bytes);
+	size = PyBytes_GET_SIZE(bytes);
 	*out = PyMem_Malloc(size+1);
 	if (!*out)
 		return 0;
-	/* Don't lock bytes, as we hold the GIL */
-	memcpy(*out, bytes2str(bytes, 0), size+1);
+	memcpy(*out, PyBytes_AsString(bytes), size+1);
 	Py_DECREF(bytes);
 	return 1;
 }
@@ -3038,7 +3005,7 @@
                               PyUnicode_FSConverter,
                               &opath, &argv))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3049,18 +3016,18 @@
 	}
 	else {
 		PyErr_SetString(PyExc_TypeError, "execv() arg 2 must be a tuple or list");
-                release_bytes(opath);
+                Py_DECREF(opath);
 		return NULL;
 	}
 	if (argc < 1) {
 		PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty");
-                release_bytes(opath);
+                Py_DECREF(opath);
 		return NULL;
 	}
 
 	argvlist = PyMem_NEW(char *, argc+1);
 	if (argvlist == NULL) {
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return PyErr_NoMemory();
 	}
 	for (i = 0; i < argc; i++) {
@@ -3069,7 +3036,7 @@
 			free_string_array(argvlist, i);
 			PyErr_SetString(PyExc_TypeError,
 					"execv() arg 2 must contain only strings");
-			release_bytes(opath);
+			Py_DECREF(opath);
 			return NULL;
 
 		}
@@ -3081,7 +3048,7 @@
 	/* If we get here it's definitely an error */
 
 	free_string_array(argvlist, argc);
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return posix_error();
 }
 
@@ -3115,7 +3082,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv, &env))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3224,7 +3191,7 @@
 	Py_XDECREF(vals);
 	Py_XDECREF(keys);
   fail_0:
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return NULL;
 }
 #endif /* HAVE_EXECV */
@@ -3258,7 +3225,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3270,13 +3237,13 @@
 	else {
 		PyErr_SetString(PyExc_TypeError,
 				"spawnv() arg 2 must be a tuple or list");
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
 
 	argvlist = PyMem_NEW(char *, argc+1);
 	if (argvlist == NULL) {
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return PyErr_NoMemory();
 	}
 	for (i = 0; i < argc; i++) {
@@ -3286,7 +3253,7 @@
 			PyErr_SetString(
 				PyExc_TypeError,
 				"spawnv() arg 2 must contain only strings");
-			release_bytes(opath);
+			Py_DECREF(opath);
 			return NULL;
 		}
 	}
@@ -3306,7 +3273,7 @@
 #endif
 
 	free_string_array(argvlist, argc);
-	release_bytes(opath);
+	Py_DECREF(opath);
 
 	if (spawnval == -1)
 		return posix_error();
@@ -3351,7 +3318,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv, &env))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3468,7 +3435,7 @@
 	Py_XDECREF(vals);
 	Py_XDECREF(keys);
   fail_0:
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return res;
 }
 
@@ -3501,7 +3468,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv))
 		return NULL;
-	path = bytes2str(opath);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3513,13 +3480,13 @@
 	else {
 		PyErr_SetString(PyExc_TypeError,
 				"spawnvp() arg 2 must be a tuple or list");
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
 
 	argvlist = PyMem_NEW(char *, argc+1);
 	if (argvlist == NULL) {
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return PyErr_NoMemory();
 	}
 	for (i = 0; i < argc; i++) {
@@ -3529,7 +3496,7 @@
 			PyErr_SetString(
 				PyExc_TypeError,
 				"spawnvp() arg 2 must contain only strings");
-			release_bytes(opath);
+			Py_DECREF(opath);
 			return NULL;
 		}
 	}
@@ -3544,7 +3511,7 @@
 	Py_END_ALLOW_THREADS
 
 	free_string_array(argvlist, argc);
-	release_bytes(opath);
+	Py_DECREF(opath);
 
 	if (spawnval == -1)
 		return posix_error();
@@ -3585,7 +3552,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv, &env))
 		return NULL;
-	path = bytes2str(opath);
+	path = PyBytes_AsString(opath);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3693,7 +3660,7 @@
 	Py_XDECREF(vals);
 	Py_XDECREF(keys);
   fail_0:
-	release_bytes(opath);
+	Py_DECREF(opath);
 	return res;
 }
 #endif /* PYOS_OS2 */
@@ -4692,10 +4659,10 @@
 	if (!PyArg_ParseTuple(args, "O&:readlink", 
 				PyUnicode_FSConverter, &opath))
 		return NULL;
-	path = bytes2str(opath, 1);
+	path = PyBytes_AsString(opath);
 	v = PySequence_GetItem(args, 0);
 	if (v == NULL) {
-		release_bytes(opath);
+		Py_DECREF(opath);
 		return NULL;
 	}
 
@@ -4710,7 +4677,7 @@
 	if (n < 0)
 		return posix_error_with_allocated_filename(opath);
 
-	release_bytes(opath);
+	Py_DECREF(opath);
 	v = PyBytes_FromStringAndSize(buf, n);
 	if (arg_is_unicode) {
 		PyObject *w;
@@ -4955,13 +4922,13 @@
 	                      PyUnicode_FSConverter, &ofile,
 	                      &flag, &mode))
 		return NULL;
-	file = bytes2str(ofile, 1);
+	file = PyBytes_AsString(ofile);
 	Py_BEGIN_ALLOW_THREADS
 	fd = open(file, flag, mode);
 	Py_END_ALLOW_THREADS
 	if (fd < 0)
 		return posix_error_with_allocated_filename(ofile);
-	release_bytes(ofile);
+	Py_DECREF(ofile);
 	return PyLong_FromLong((long)fd);
 }
 
@@ -5423,8 +5390,8 @@
 			      PyUnicode_FSConverter, &os1, 
 			      PyUnicode_FSConverter, &os2))
 		return NULL;
-	s1 = bytes2str(os1, 1);
-	s2 = bytes2str(os2, 1);
+	s1 = PyBytes_AsString(os1);
+	s2 = PyBytes_AsString(os2);
 #endif
 
 #if defined(PYOS_OS2)
@@ -5468,8 +5435,8 @@
 	PyOS_snprintf(newenv, len, "%s=%s", s1, s2);
 	if (putenv(newenv)) {
                 Py_DECREF(newstr);
-		release_bytes(os1);
-		release_bytes(os2);
+		Py_DECREF(os1);
+		Py_DECREF(os2);
                 posix_error();
                 return NULL;
 	}
@@ -5491,8 +5458,8 @@
     }
 #endif
 #ifndef MS_WINDOWS
-	release_bytes(os1);
-	release_bytes(os2);
+	Py_DECREF(os1);
+	Py_DECREF(os2);
 #endif
 	Py_INCREF(Py_None);
         return Py_None;
@@ -6865,17 +6832,17 @@
 			      PyUnicode_FSConverter, &ofilepath, 
 			      &operation))
 		return NULL;
-	filepath = bytes2str(ofilepath, 1);
+	filepath = PyBytes_AsString(ofilepath);
 	Py_BEGIN_ALLOW_THREADS
 	rc = ShellExecute((HWND)0, operation, filepath, 
 			  NULL, NULL, SW_SHOWNORMAL);
 	Py_END_ALLOW_THREADS
 	if (rc <= (HINSTANCE)32) {
 		PyObject *errval = win32_error("startfile", filepath);
-		release_bytes(ofilepath);
+		Py_DECREF(ofilepath);
 		return errval;
 	}
-	release_bytes(ofilepath);
+	Py_DECREF(ofilepath);
 	Py_INCREF(Py_None);
 	return Py_None;
 }

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

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

Modified: python/branches/py3k-jit/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/unicodeobject.c	(original)
+++ python/branches/py3k-jit/Objects/unicodeobject.c	Fri Apr 23 02:01:11 2010
@@ -159,6 +159,12 @@
        const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject,
        Py_ssize_t startpos, Py_ssize_t endpos, Py_ssize_t *newpos);
 
+static void raise_encode_exception(PyObject **exceptionObject,
+                                   const char *encoding,
+                                   const Py_UNICODE *unicode, Py_ssize_t size,
+                                   Py_ssize_t startpos, Py_ssize_t endpos,
+                                   const char *reason);
+
 /* Same for linebreaks */
 static unsigned char ascii_linebreak[] = {
     0, 0, 0, 0, 0, 0, 0, 0,
@@ -1624,7 +1630,7 @@
         Py_DECREF(*(PyObject**)addr);
         return 1;
     }
-    if (PyBytes_Check(arg) || PyByteArray_Check(arg)) {
+    if (PyBytes_Check(arg)) {
         output = arg;
         Py_INCREF(output);
     }
@@ -2542,61 +2548,89 @@
             /* Encode Latin-1 */
             *p++ = (char)(0xc0 | (ch >> 6));
             *p++ = (char)(0x80 | (ch & 0x3f));
-        }
-        else {
-            /* Encode UCS2 Unicode ordinals */
-            if (ch < 0x10000) {
+        } else if (0xD800 <= ch && ch <= 0xDFFF) {
 #ifndef Py_UNICODE_WIDE
-                /* Special case: check for high surrogate */
-                if (0xD800 <= ch && ch <= 0xDBFF && i != size) {
-                    Py_UCS4 ch2 = s[i];
-                    /* Check for low surrogate and combine the two to
-                       form a UCS4 value */
-                    if (0xDC00 <= ch2 && ch2 <= 0xDFFF) {
-                        ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000;
-                        i++;
-                        goto encodeUCS4;
-                    }
-                    /* Fall through: handles isolated high surrogates */
-                }
+            /* Special case: check for high and low surrogate */
+            if (ch <= 0xDBFF && i != size && 0xDC00 <= s[i] && s[i] <= 0xDFFF) {
+                Py_UCS4 ch2 = s[i];
+                /* Combine the two surrogates to form a UCS4 value */
+                ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000;
+                i++;
+
+                /* Encode UCS4 Unicode ordinals */
+                *p++ = (char)(0xf0 | (ch >> 18));
+                *p++ = (char)(0x80 | ((ch >> 12) & 0x3f));
+                *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
+                *p++ = (char)(0x80 | (ch & 0x3f));
+            } else {
 #endif
-                if (ch >= 0xd800 && ch <= 0xdfff) {
-                    Py_ssize_t newpos;
-                    PyObject *rep;
-                    char *prep;
-                    int k;
-                    rep = unicode_encode_call_errorhandler
-                        (errors, &errorHandler, "utf-8", "surrogates not allowed", 
-                         s, size, &exc, i-1, i, &newpos);
-                    if (!rep)
-                        goto error;
-                    /* Implementation limitations: only support error handler that return
-                       bytes, and only support up to four replacement bytes. */
-                    if (!PyBytes_Check(rep)) {
-                        PyErr_SetString(PyExc_TypeError, "error handler should have returned bytes");
-                        Py_DECREF(rep);
+                Py_ssize_t newpos;
+                PyObject *rep;
+                Py_ssize_t repsize, k;
+                rep = unicode_encode_call_errorhandler
+                    (errors, &errorHandler, "utf-8", "surrogates not allowed",
+                     s, size, &exc, i-1, i, &newpos);
+                if (!rep)
+                    goto error;
+
+                if (PyBytes_Check(rep))
+                    repsize = PyBytes_GET_SIZE(rep);
+                else
+                    repsize = PyUnicode_GET_SIZE(rep);
+
+                if (repsize > 4) {
+                    Py_ssize_t offset;
+
+                    if (result == NULL)
+                        offset = p - stackbuf;
+                    else
+                        offset = p - PyBytes_AS_STRING(result);
+
+                    if (nallocated > PY_SSIZE_T_MAX - repsize + 4) {
+                        /* integer overflow */
+                        PyErr_NoMemory();
                         goto error;
                     }
-                    if (PyBytes_Size(rep) > 4) {
-                        PyErr_SetString(PyExc_TypeError, "error handler returned too many bytes");
-                        Py_DECREF(rep);
-                        goto error;
+                    nallocated += repsize - 4;
+                    if (result != NULL) {
+                        if (_PyBytes_Resize(&result, nallocated) < 0)
+                            goto error;
+                    } else {
+                        result = PyBytes_FromStringAndSize(NULL, nallocated);
+                        if (result == NULL)
+                            goto error;
+                        Py_MEMCPY(PyBytes_AS_STRING(result), stackbuf, offset);
                     }
-                    prep = PyBytes_AsString(rep);
-                    for(k = PyBytes_Size(rep); k > 0; k--)
+                    p = PyBytes_AS_STRING(result) + offset;
+                }
+
+                if (PyBytes_Check(rep)) {
+                    char *prep = PyBytes_AS_STRING(rep);
+                    for(k = repsize; k > 0; k--)
                         *p++ = *prep++;
-                    Py_DECREF(rep);
-                    continue;
-                    
+                } else /* rep is unicode */ {
+                    Py_UNICODE *prep = PyUnicode_AS_UNICODE(rep);
+                    Py_UNICODE c;
+
+                    for(k=0; k<repsize; k++) {
+                        c = prep[k];
+                        if (0x80 <= c) {
+                            raise_encode_exception(&exc, "utf-8", s, size,
+                                                   i-1, i, "surrogates not allowed");
+                            goto error;
+                        }
+                        *p++ = (char)prep[k];
+                    }
                 }
-                *p++ = (char)(0xe0 | (ch >> 12));
-                *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
-                *p++ = (char)(0x80 | (ch & 0x3f));
-                continue;
-            }
+                Py_DECREF(rep);
 #ifndef Py_UNICODE_WIDE
-          encodeUCS4:
+            }
 #endif
+        } else if (ch < 0x10000) {
+            *p++ = (char)(0xe0 | (ch >> 12));
+            *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
+            *p++ = (char)(0x80 | (ch & 0x3f));
+        } else /* ch >= 0x10000 */ {
             /* Encode UCS4 Unicode ordinals */
             *p++ = (char)(0xf0 | (ch >> 18));
             *p++ = (char)(0x80 | ((ch >> 12) & 0x3f));

Modified: python/branches/py3k-jit/PC/winreg.c
==============================================================================
--- python/branches/py3k-jit/PC/winreg.c	(original)
+++ python/branches/py3k-jit/PC/winreg.c	Fri Apr 23 02:01:11 2010
@@ -88,7 +88,7 @@
 "key is the predefined handle to connect to.\n"
 "\n"
 "The return value is the handle of the opened key.\n"
-"If the function fails, an EnvironmentError exception is raised.");
+"If the function fails, a WindowsError exception is raised.");
 
 PyDoc_STRVAR(CreateKey_doc,
 "key = CreateKey(key, sub_key) - Creates or opens the specified key.\n"
@@ -103,6 +103,21 @@
 "The return value is the handle of the opened key.\n"
 "If the function fails, an exception is raised.");
 
+PyDoc_STRVAR(CreateKeyEx_doc,
+"key = CreateKeyEx(key, sub_key, res, sam) - Creates or opens the specified key.\n"
+"\n"
+"key is an already open key, or one of the predefined HKEY_* constants\n"
+"sub_key is a string that names the key this method opens or creates.\n"
+"res is a reserved integer, and must be zero.  Default is zero.\n"
+"sam is an integer that specifies an access mask that describes the desired\n"
+" If key is one of the predefined keys, sub_key may be None. In that case,\n"
+" the handle returned is the same key handle passed in to the function.\n"
+"\n"
+"If the key already exists, this function opens the existing key\n"
+"\n"
+"The return value is the handle of the opened key.\n"
+"If the function fails, an exception is raised.");
+
 PyDoc_STRVAR(DeleteKey_doc,
 "DeleteKey(key, sub_key) - Deletes the specified key.\n"
 "\n"
@@ -113,7 +128,22 @@
 "This method can not delete keys with subkeys.\n"
 "\n"
 "If the method succeeds, the entire key, including all of its values,\n"
-"is removed.  If the method fails, an EnvironmentError exception is raised.");
+"is removed.  If the method fails, a WindowsError exception is raised.");
+
+PyDoc_STRVAR(DeleteKeyEx_doc,
+"DeleteKeyEx(key, sub_key, sam, res) - Deletes the specified key.\n"
+"\n"
+"key is an already open key, or any one of the predefined HKEY_* constants.\n"
+"sub_key is a string that must be a subkey of the key identified by the key parameter.\n"
+"res is a reserved integer, and must be zero.  Default is zero.\n"
+"sam is an integer that specifies an access mask that describes the desired\n"
+" This value must not be None, and the key may not have subkeys.\n"
+"\n"
+"This method can not delete keys with subkeys.\n"
+"\n"
+"If the method succeeds, the entire key, including all of its values,\n"
+"is removed.  If the method fails, a WindowsError exception is raised.\n"
+"On unsupported Windows versions, NotImplementedError is raised.");
 
 PyDoc_STRVAR(DeleteValue_doc,
 "DeleteValue(key, value) - Removes a named value from a registry key.\n"
@@ -128,7 +158,7 @@
 "index is an integer that identifies the index of the key to retrieve.\n"
 "\n"
 "The function retrieves the name of one subkey each time it is called.\n"
-"It is typically called repeatedly until an EnvironmentError exception is\n"
+"It is typically called repeatedly until a WindowsError exception is\n"
 "raised, indicating no more values are available.");
 
 PyDoc_STRVAR(EnumValue_doc,
@@ -137,7 +167,7 @@
 "index is an integer that identifies the index of the value to retrieve.\n"
 "\n"
 "The function retrieves the name of one subkey each time it is called.\n"
-"It is typically called repeatedly, until an EnvironmentError exception\n"
+"It is typically called repeatedly, until a WindowsError exception\n"
 "is raised, indicating no more values.\n"
 "\n"
 "The result is a tuple of 3 items:\n"
@@ -191,7 +221,7 @@
 " security access for the key.  Default is KEY_READ\n"
 "\n"
 "The result is a new handle to the specified key\n"
-"If the function fails, an EnvironmentError exception is raised.");
+"If the function fails, a WindowsError exception is raised.");
 
 PyDoc_STRVAR(OpenKeyEx_doc, "See OpenKey()");
 
@@ -957,6 +987,29 @@
 }
 
 static PyObject *
+PyCreateKeyEx(PyObject *self, PyObject *args)
+{
+	HKEY hKey;
+	PyObject *obKey;
+	wchar_t *subKey;
+	HKEY retKey;
+	int res = 0;
+	REGSAM sam = KEY_WRITE;
+	long rc;
+	if (!PyArg_ParseTuple(args, "OZ|ii:CreateKeyEx", &obKey, &subKey,
+						  &res, &sam))
+		return NULL;
+	if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
+		return NULL;
+
+	rc = RegCreateKeyExW(hKey, subKey, res, NULL, (DWORD)NULL, 
+						sam, NULL, &retKey, NULL);
+	if (rc != ERROR_SUCCESS)
+		return PyErr_SetFromWindowsErrWithFunction(rc, "CreateKeyEx");
+	return PyHKEY_FromHKEY(retKey);
+}
+
+static PyObject *
 PyDeleteKey(PyObject *self, PyObject *args)
 {
 	HKEY hKey;
@@ -975,6 +1028,46 @@
 }
 
 static PyObject *
+PyDeleteKeyEx(PyObject *self, PyObject *args)
+{
+	HKEY hKey;
+	PyObject *obKey;
+	HMODULE hMod;
+	typedef LONG (WINAPI *RDKEFunc)(HKEY, const wchar_t*, REGSAM, int);
+	RDKEFunc pfn = NULL;
+	wchar_t *subKey;
+	long rc;
+	int res = 0;
+	REGSAM sam = KEY_WOW64_64KEY;
+
+	if (!PyArg_ParseTuple(args, "Ou|ii:DeleteKeyEx",
+						  &obKey, &subKey, &sam, &res))
+		return NULL;
+	if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
+		return NULL;
+
+	/* Only available on 64bit platforms, so we must load it
+	   dynamically. */
+	hMod = GetModuleHandle("advapi32.dll");
+	if (hMod)
+		pfn = (RDKEFunc)GetProcAddress(hMod,
+									   "RegDeleteKeyExW");
+	if (!pfn) {
+		PyErr_SetString(PyExc_NotImplementedError,
+						"not implemented on this platform");
+		return NULL;
+	}
+	Py_BEGIN_ALLOW_THREADS
+	rc = (*pfn)(hKey, subKey, sam, res);
+	Py_END_ALLOW_THREADS
+
+	if (rc != ERROR_SUCCESS)
+		return PyErr_SetFromWindowsErrWithFunction(rc, "RegDeleteKeyEx");
+	Py_INCREF(Py_None);
+	return Py_None;
+}
+
+static PyObject *
 PyDeleteValue(PyObject *self, PyObject *args)
 {
 	HKEY hKey;
@@ -1412,8 +1505,8 @@
 	if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
 		return NULL;
 
-	// Only available on 64bit platforms, so we must load it
-	// dynamically.
+	/* Only available on 64bit platforms, so we must load it
+	   dynamically.*/
 	hMod = GetModuleHandle("advapi32.dll");
 	if (hMod)
 		pfn = (RDRKFunc)GetProcAddress(hMod,
@@ -1448,8 +1541,8 @@
 	if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
 		return NULL;
 
-	// Only available on 64bit platforms, so we must load it
-	// dynamically.
+	/* Only available on 64bit platforms, so we must load it
+	   dynamically.*/
 	hMod = GetModuleHandle("advapi32.dll");
 	if (hMod)
 		pfn = (RERKFunc)GetProcAddress(hMod,
@@ -1485,8 +1578,8 @@
 	if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
 		return NULL;
 
-	// Only available on 64bit platforms, so we must load it
-	// dynamically.
+	/* Only available on 64bit platforms, so we must load it
+	   dynamically.*/
 	hMod = GetModuleHandle("advapi32.dll");
 	if (hMod)
 		pfn = (RQRKFunc)GetProcAddress(hMod,
@@ -1502,14 +1595,16 @@
 	if (rc != ERROR_SUCCESS)
 		return PyErr_SetFromWindowsErrWithFunction(rc,
 		                                           "RegQueryReflectionKey");
-	return PyBool_FromLong(rc);
+	return PyBool_FromLong(result);
 }
 
 static struct PyMethodDef winreg_methods[] = {
 	{"CloseKey",         PyCloseKey,        METH_VARARGS, CloseKey_doc},
 	{"ConnectRegistry",  PyConnectRegistry, METH_VARARGS, ConnectRegistry_doc},
 	{"CreateKey",        PyCreateKey,       METH_VARARGS, CreateKey_doc},
+	{"CreateKeyEx",      PyCreateKeyEx,     METH_VARARGS, CreateKeyEx_doc},
 	{"DeleteKey",        PyDeleteKey,       METH_VARARGS, DeleteKey_doc},
+	{"DeleteKeyEx",      PyDeleteKeyEx,     METH_VARARGS, DeleteKeyEx_doc},
 	{"DeleteValue",      PyDeleteValue,     METH_VARARGS, DeleteValue_doc},
 	{"DisableReflectionKey", PyDisableReflectionKey, METH_VARARGS, DisableReflectionKey_doc},
 	{"EnableReflectionKey",  PyEnableReflectionKey,  METH_VARARGS, EnableReflectionKey_doc},

Modified: python/branches/py3k-jit/Python/marshal.c
==============================================================================
--- python/branches/py3k-jit/Python/marshal.c	(original)
+++ python/branches/py3k-jit/Python/marshal.c	Fri Apr 23 02:01:11 2010
@@ -1078,23 +1078,13 @@
 PyObject *
 PyMarshal_ReadLastObjectFromFile(FILE *fp)
 {
-/* 75% of 2.1's .pyc files can exploit SMALL_FILE_LIMIT.
- * REASONABLE_FILE_LIMIT is by defn something big enough for Tkinter.pyc.
- */
-#define SMALL_FILE_LIMIT (1L << 14)
+/* REASONABLE_FILE_LIMIT is by defn something big enough for Tkinter.pyc. */
 #define REASONABLE_FILE_LIMIT (1L << 18)
 #ifdef HAVE_FSTAT
 	off_t filesize;
-#endif
-#ifdef HAVE_FSTAT
 	filesize = getfilesize(fp);
-	if (filesize > 0) {
-		char buf[SMALL_FILE_LIMIT];
-		char* pBuf = NULL;
-		if (filesize <= SMALL_FILE_LIMIT)
-			pBuf = buf;
-		else if (filesize <= REASONABLE_FILE_LIMIT)
-			pBuf = (char *)PyMem_MALLOC(filesize);
+	if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) {
+		char* pBuf = (char *)PyMem_MALLOC(filesize);
 		if (pBuf != NULL) {
 			PyObject* v;
 			size_t n;
@@ -1102,8 +1092,7 @@
 			   is smaller than REASONABLE_FILE_LIMIT */
 			n = fread(pBuf, 1, (int)filesize, fp);
 			v = PyMarshal_ReadObjectFromString(pBuf, n);
-			if (pBuf != buf)
-				PyMem_FREE(pBuf);
+			PyMem_FREE(pBuf);
 			return v;
 		}
 
@@ -1114,7 +1103,6 @@
 	 */
 	return PyMarshal_ReadObjectFromFile(fp);
 
-#undef SMALL_FILE_LIMIT
 #undef REASONABLE_FILE_LIMIT
 }
 

Modified: python/branches/py3k-jit/Tools/gdb/libpython.py
==============================================================================
--- python/branches/py3k-jit/Tools/gdb/libpython.py	(original)
+++ python/branches/py3k-jit/Tools/gdb/libpython.py	Fri Apr 23 02:01:11 2010
@@ -19,9 +19,10 @@
 In particular, given a gdb.Value corresponding to a PyObject* in the inferior
 process, we can generate a "proxy value" within the gdb process.  For example,
 given a PyObject* in the inferior process that is in fact a PyListObject*
-holding three PyObject* that turn out to be PyStringObject* instances, we can
-generate a proxy value within the gdb process that is a list of strings:
-  ["foo", "bar", "baz"]
+holding three PyObject* that turn out to be PyBytesObject* instances, we can
+generate a proxy value within the gdb process that is a list of bytes
+instances:
+  [b"foo", b"bar", b"baz"]
 
 Doing so can be expensive for complicated graphs of objects, and could take
 some time, so we also have a "write_repr" method that writes a representation
@@ -57,7 +58,7 @@
 Py_TPFLAGS_LONG_SUBCLASS     = (1L << 24)
 Py_TPFLAGS_LIST_SUBCLASS     = (1L << 25)
 Py_TPFLAGS_TUPLE_SUBCLASS    = (1L << 26)
-Py_TPFLAGS_STRING_SUBCLASS   = (1L << 27)
+Py_TPFLAGS_BYTES_SUBCLASS    = (1L << 27)
 Py_TPFLAGS_UNICODE_SUBCLASS  = (1L << 28)
 Py_TPFLAGS_DICT_SUBCLASS     = (1L << 29)
 Py_TPFLAGS_BASE_EXC_SUBCLASS = (1L << 30)
@@ -66,6 +67,9 @@
 
 MAX_OUTPUT_LEN=1024
 
+hexdigits = "0123456789abcdef"
+
+
 class NullPyObjectPtr(RuntimeError):
     pass
 
@@ -108,7 +112,7 @@
 class PyObjectPtr(object):
     """
     Class wrapping a gdb.Value that's a either a (PyObject*) within the
-    inferior process, or some subclass pointer e.g. (PyStringObject*)
+    inferior process, or some subclass pointer e.g. (PyBytesObject*)
 
     There will be a subclass for every refined PyObject type that we care
     about.
@@ -148,12 +152,8 @@
             return pyo_ptr.dereference()[name]
 
         if name == 'ob_size':
-            try:
-            # Python 2:
-                return self._gdbval.dereference()[name]
-            except RuntimeError:
-                # Python 3:
-                return self._gdbval.dereference()['ob_base'][name]
+            pyo_ptr = self._gdbval.cast(PyVarObjectPtr.get_gdb_type())
+            return pyo_ptr.dereference()[name]
 
         # General case: look it up inside the object:
         return self._gdbval.dereference()[name]
@@ -318,8 +318,8 @@
             return PyListObjectPtr
         if tp_flags & Py_TPFLAGS_TUPLE_SUBCLASS:
             return PyTupleObjectPtr
-        if tp_flags & Py_TPFLAGS_STRING_SUBCLASS:
-            return PyStringObjectPtr
+        if tp_flags & Py_TPFLAGS_BYTES_SUBCLASS:
+            return PyBytesObjectPtr
         if tp_flags & Py_TPFLAGS_UNICODE_SUBCLASS:
             return PyUnicodeObjectPtr
         if tp_flags & Py_TPFLAGS_DICT_SUBCLASS:
@@ -355,6 +355,8 @@
     def as_address(self):
         return long(self._gdbval)
 
+class PyVarObjectPtr(PyObjectPtr):
+    _typename = 'PyVarObject'
 
 class ProxyAlreadyVisited(object):
     '''
@@ -515,20 +517,6 @@
         out.write(self.safe_tp_name())
         self.write_field_repr('args', out, visited)
 
-class PyBoolObjectPtr(PyObjectPtr):
-    """
-    Class wrapping a gdb.Value that's a PyBoolObject* i.e. one of the two
-    <bool> instances (Py_True/Py_False) within the process being debugged.
-    """
-    _typename = 'PyBoolObject'
-
-    def proxyval(self, visited):
-        if int_from_int(self.field('ob_ival')):
-            return True
-        else:
-            return False
-
-
 class PyClassObjectPtr(PyObjectPtr):
     """
     Class wrapping a gdb.Value that's a PyClassObject* i.e. a <classobj>
@@ -691,13 +679,6 @@
         _write_instance_repr(out, visited,
                              cl_name, pyop_in_dict, self.as_address())
 
-class PyIntObjectPtr(PyObjectPtr):
-    _typename = 'PyIntObject'
-
-    def proxyval(self, visited):
-        result = int_from_int(self.field('ob_ival'))
-        return result
-
 class PyListObjectPtr(PyObjectPtr):
     _typename = 'PyListObject'
 
@@ -770,6 +751,22 @@
             result = -result
         return result
 
+    def write_repr(self, out, visited):
+        # Write this out as a Python 3 int literal, i.e. without the "L" suffix
+        proxy = self.proxyval(visited)
+        out.write("%s" % proxy)
+
+
+class PyBoolObjectPtr(PyLongObjectPtr):
+    """
+    Class wrapping a gdb.Value that's a PyBoolObject* i.e. one of the two
+    <bool> instances (Py_True/Py_False) within the process being debugged.
+    """
+    def proxyval(self, visited):
+        if PyLongObjectPtr.proxyval(self, visited):
+            return True
+        else:
+            return False
 
 class PyNoneStructPtr(PyObjectPtr):
     """
@@ -894,9 +891,9 @@
             return
         out.write('Frame 0x%x, for file %s, line %i, in %s ('
                   % (self.as_address(),
-                     self.co_filename,
+                     self.co_filename.proxyval(visited),
                      self.current_line_num(),
-                     self.co_name))
+                     self.co_name.proxyval(visited)))
         first = True
         for pyop_name, pyop_value in self.iter_locals():
             if not first:
@@ -933,7 +930,8 @@
             return set(members)
 
     def write_repr(self, out, visited):
-        out.write(self.safe_tp_name())
+        # Emulate Python 3's set_repr
+        tp_name = self.safe_tp_name()
 
         # Guard against infinite loops:
         if self.as_address() in visited:
@@ -941,7 +939,18 @@
             return
         visited.add(self.as_address())
 
-        out.write('([')
+        # Python 3's set_repr special-cases the empty set:
+        if not self.field('used'):
+            out.write(tp_name)
+            out.write('()')
+            return
+
+        # Python 3 uses {} for set literals:
+        if tp_name != 'set':
+            out.write(tp_name)
+            out.write('(')
+
+        out.write('{')
         first = True
         table = self.field('table')
         for i in safe_range(self.field('mask')+1):
@@ -955,11 +964,14 @@
                         out.write(', ')
                     first = False
                     pyop_key.write_repr(out, visited)
-        out.write('])')
+        out.write('}')
+
+        if tp_name != 'set':
+            out.write(')')
 
 
-class PyStringObjectPtr(PyObjectPtr):
-    _typename = 'PyStringObject'
+class PyBytesObjectPtr(PyObjectPtr):
+    _typename = 'PyBytesObject'
 
     def __str__(self):
         field_ob_size = self.field('ob_size')
@@ -970,6 +982,37 @@
     def proxyval(self, visited):
         return str(self)
 
+    def write_repr(self, out, visited):
+        # Write this out as a Python 3 bytes literal, i.e. with a "b" prefix
+
+        # Get a PyStringObject* within the Python 2 gdb process:
+        proxy = self.proxyval(visited)
+
+        # Transliteration of Python 3's Objects/bytesobject.c:PyBytes_Repr
+        # to Python 2 code:
+        quote = "'"
+        if "'" in proxy and not '"' in proxy:
+            quote = '"'
+        out.write('b')
+        out.write(quote)
+        for byte in proxy:
+            if byte == quote or byte == '\\':
+                out.write('\\')
+                out.write(byte)
+            elif byte == '\t':
+                out.write('\\t')
+            elif byte == '\n':
+                out.write('\\n')
+            elif byte == '\r':
+                out.write('\\r')
+            elif byte < ' ' or ord(byte) >= 0x7f:
+                out.write('\\x')
+                out.write(hexdigits[(ord(byte) & 0xf0) >> 4])
+                out.write(hexdigits[ord(byte) & 0xf])
+            else:
+                out.write(byte)
+        out.write(quote)
+
 class PyTupleObjectPtr(PyObjectPtr):
     _typename = 'PyTupleObject'
 
@@ -1010,9 +1053,21 @@
     _typename = 'PyTypeObject'
 
 
+def _unichr_is_printable(char):
+    # Logic adapted from Python 3's Tools/unicode/makeunicodedata.py
+    if char == u" ":
+        return True
+    import unicodedata
+    return unicodedata.category(char)[0] not in ("C", "Z")
+
+
 class PyUnicodeObjectPtr(PyObjectPtr):
     _typename = 'PyUnicodeObject'
 
+    def char_width(self):
+        _type_Py_UNICODE = gdb.lookup_type('Py_UNICODE')
+        return _type_Py_UNICODE.sizeof
+
     def proxyval(self, visited):
         # From unicodeobject.h:
         #     Py_ssize_t length;  /* Length of raw Unicode data in buffer */
@@ -1029,6 +1084,102 @@
         result = u''.join([unichr(ucs) for ucs in Py_UNICODEs])
         return result
 
+    def write_repr(self, out, visited):
+        # Write this out as a Python 3 str literal, i.e. without a "u" prefix
+
+        # Get a PyUnicodeObject* within the Python 2 gdb process:
+        proxy = self.proxyval(visited)
+
+        # Transliteration of Python 3's Object/unicodeobject.c:unicode_repr
+        # to Python 2:
+        if "'" in proxy and '"' not in proxy:
+            quote = '"'
+        else:
+            quote = "'"
+        out.write(quote)
+
+        i = 0
+        while i < len(proxy):
+            ch = proxy[i]
+            i += 1
+
+            # Escape quotes and backslashes
+            if ch == quote or ch == '\\':
+                out.write('\\')
+                out.write(ch)
+
+            #  Map special whitespace to '\t', \n', '\r'
+            elif ch == '\t':
+                out.write('\\t')
+            elif ch == '\n':
+                out.write('\\n')
+            elif ch == '\r':
+                out.write('\\r')
+
+            # Map non-printable US ASCII to '\xhh' */
+            elif ch < ' ' or ch == 0x7F:
+                out.write('\\x')
+                out.write(hexdigits[(ord(ch) >> 4) & 0x000F])
+                out.write(hexdigits[ord(ch) & 0x000F])
+
+            # Copy ASCII characters as-is
+            elif ord(ch) < 0x7F:
+                out.write(ch)
+
+            # Non-ASCII characters
+            else:
+                ucs = ch;
+
+                if self.char_width == 2:
+                    ch2 = 0
+                    # Get code point from surrogate pair
+                    if i < len(proxy):
+                        ch2 = proxy[i]
+                        if (ord(ch) >= 0xD800 and ord(ch) < 0xDC00
+                            and ord(ch2) >= 0xDC00 and ord(ch2) <= 0xDFFF):
+                            ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
+                            i += 1
+
+                # Map Unicode whitespace and control characters
+                # (categories Z* and C* except ASCII space)
+                if not _unichr_is_printable(ucs):
+                    # Unfortuately, Python 2's unicode type doesn't seem
+                    # to expose the "isprintable" method
+
+                    # Map 8-bit characters to '\\xhh'
+                    if ucs <= 0xff:
+                        out.write('\\x')
+                        out.write(hexdigits[(ord(ucs) >> 4) & 0x000F])
+                        out.write(hexdigits[ord(ucs) & 0x000F])
+                    # Map 21-bit characters to '\U00xxxxxx'
+                    elif ucs >= 0x10000:
+                        out.write('\\U')
+                        out.write(hexdigits[(ord(ucs) >> 28) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 24) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 20) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 16) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 12) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 8) & 0x0000000F])
+                        out.write(hexdigits[(ord(ucs) >> 4) & 0x0000000F])
+                        out.write(hexdigits[ord(ucs) & 0x0000000F])
+                    # Map 16-bit characters to '\uxxxx'
+                    else:
+                        out.write('\\u')
+                        out.write(hexdigits[(ord(ucs) >> 12) & 0x000F])
+                        out.write(hexdigits[(ord(ucs) >> 8) & 0x000F])
+                        out.write(hexdigits[(ord(ucs) >> 4) & 0x000F])
+                        out.write(hexdigits[ord(ucs) & 0x000F])
+                else:
+                    # Copy characters as-is
+                    out.write(ch)
+                    if self.char_width == 2:
+                        if ord(ucs) >= 0x10000:
+                            out.write(ch2)
+
+        out.write(quote)
+
+
+
 
 def int_from_int(gdbval):
     return int(str(gdbval))
@@ -1065,7 +1216,7 @@
     if type.code == gdb.TYPE_CODE_PTR:
         type = type.target().unqualified()
         t = str(type)
-        if t in ("PyObject", "PyFrameObject"):
+        if t in ("PyObject", "PyFrameObject", "PyUnicodeObject"):
             return PyObjectPtrPrinter(gdbval)
 
 """
@@ -1097,6 +1248,11 @@
 register (gdb.current_objfile ())
 
 
+
+# Unfortunately, the exact API exposed by the gdb module varies somewhat
+# from build to build
+# See http://bugs.python.org/issue8279?#msg102276
+
 class Frame(object):
     '''
     Wrapper for gdb.Frame, adding various methods
@@ -1119,7 +1275,16 @@
             return None
 
     def select(self):
+        '''If supported, select this frame and return True; return False if unsupported
+
+        Not all builds have a gdb.Frame.select method; seems to be present on Fedora 12
+        onwards, but absent on Ubuntu buildbot'''
+        if not hasattr(self._gdbframe, 'select'):
+            print ('Unable to select frame: '
+                   'this build of gdb does not expose a gdb.Frame.select method')
+            return False
         self._gdbframe.select()
+        return True
 
     def get_index(self):
         '''Calculate index of frame, starting at 0 for the newest frame within
@@ -1133,18 +1298,18 @@
         return index
 
     def is_evalframeex(self):
-        if self._gdbframe.function():
-            if self._gdbframe.function().name == 'PyEval_EvalFrameEx':
-                '''
-                I believe we also need to filter on the inline
-                struct frame_id.inline_depth, only regarding frames with
-                an inline depth of 0 as actually being this function
-
-                So we reject those with type gdb.INLINE_FRAME
-                '''
-                if self._gdbframe.type() == gdb.NORMAL_FRAME:
-                    # We have a PyEval_EvalFrameEx frame:
-                    return True
+        '''Is this a PyEval_EvalFrameEx frame?'''
+        if self._gdbframe.name() == 'PyEval_EvalFrameEx':
+            '''
+            I believe we also need to filter on the inline
+            struct frame_id.inline_depth, only regarding frames with
+            an inline depth of 0 as actually being this function
+
+            So we reject those with type gdb.INLINE_FRAME
+            '''
+            if self._gdbframe.type() == gdb.NORMAL_FRAME:
+                # We have a PyEval_EvalFrameEx frame:
+                return True
 
         return False
 
@@ -1271,8 +1436,8 @@
 
         if iter_frame.is_evalframeex():
             # Result:
-            iter_frame.select()
-            iter_frame.print_summary()
+            if iter_frame.select():
+                iter_frame.print_summary()
             return
 
         frame = iter_frame
@@ -1294,8 +1459,6 @@
     def invoke(self, args, from_tty):
         move_in_stack(move_up=True)
 
-PyUp()
-
 class PyDown(gdb.Command):
     'Select and print the python stack frame called by this one (if any)'
     def __init__(self):
@@ -1308,7 +1471,10 @@
     def invoke(self, args, from_tty):
         move_in_stack(move_up=False)
 
-PyDown()
+# Not all builds of gdb have gdb.Frame.select
+if hasattr(gdb.Frame, 'select'):
+    PyUp()
+    PyDown()
 
 class PyBacktrace(gdb.Command):
     'Display the current python frame and all the frames within its call stack (if any)'

Modified: python/branches/py3k-jit/configure
==============================================================================
--- python/branches/py3k-jit/configure	(original)
+++ python/branches/py3k-jit/configure	Fri Apr 23 02:01:11 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 79975 .
+# From configure.in Revision: 80191 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.2.
 #
@@ -3834,7 +3834,7 @@
   { echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6; }
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 
 
@@ -4693,6 +4693,22 @@
 	Darwin*)
 	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
 	    # used to be here, but non-Apple gcc doesn't accept them.
+            if test "${CC}" = gcc
+	    then
+		{ echo "$as_me:$LINENO: checking which compiler should be used" >&5
+echo $ECHO_N "checking which compiler should be used... $ECHO_C" >&6; }
+		case "${UNIVERSALSDK}" in
+		*/MacOSX10.4u.sdk)
+			# Build using 10.4 SDK, force usage of gcc when the
+			# compiler is gcc, otherwise the user will get very
+			# confusing error messages when building on OSX 10.6
+			CC=gcc-4.0
+			CPP=cpp-4.0
+			;;
+		esac
+		{ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+	    fi
 
 
 	    if test "${enable_universalsdk}"; then
@@ -4729,10 +4745,12 @@
 		 fi
 
 
-		BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
-		tgt=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
-		if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
-			CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		if test "${UNIVERSALSDK}" != "/"
+		then
+			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
 		fi
 	    fi
 
@@ -5421,7 +5439,7 @@
 else
   ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -5442,7 +5460,7 @@
 else
   ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -6542,7 +6560,7 @@
 
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 { echo "$as_me:$LINENO: result: $was_it_defined" >&5
 echo "${ECHO_T}$was_it_defined" >&6; }
@@ -7072,7 +7090,7 @@
 else
   ac_cv_type_uid_t=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
@@ -15775,7 +15793,7 @@
 else
   unistd_defines_pthreads=no
 fi
-rm -f conftest*
+rm -f -r conftest*
 
     { echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5
 echo "${ECHO_T}$unistd_defines_pthreads" >&6; }
@@ -17073,7 +17091,7 @@
   $EGREP "yes" >/dev/null 2>&1; then
   ipv6type=$i
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		kame)
@@ -17096,7 +17114,7 @@
 				ipv6libdir=/usr/local/v6/lib
 				ipv6trylibc=yes
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		linux-glibc)
@@ -17117,7 +17135,7 @@
   ipv6type=$i;
 				ipv6trylibc=yes
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		linux-inet6)
@@ -17155,7 +17173,7 @@
 				ipv6lib=inet6;
 				ipv6libdir=/usr/local/v6/lib
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		v6d)
@@ -17178,7 +17196,7 @@
 				ipv6libdir=/usr/local/v6/lib;
 				BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		zeta)
@@ -17200,7 +17218,7 @@
 				ipv6lib=inet6;
 				ipv6libdir=/usr/local/v6/lib
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 			;;
 		esac
@@ -25715,7 +25733,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -25734,7 +25752,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 
@@ -26004,7 +26022,7 @@
 _ACEOF
 
 fi
-rm -f conftest*
+rm -f -r conftest*
 
 fi
 

Modified: python/branches/py3k-jit/configure.in
==============================================================================
--- python/branches/py3k-jit/configure.in	(original)
+++ python/branches/py3k-jit/configure.in	Fri Apr 23 02:01:11 2010
@@ -908,6 +908,20 @@
 	Darwin*)
 	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
 	    # used to be here, but non-Apple gcc doesn't accept them.
+            if test "${CC}" = gcc
+	    then
+		AC_MSG_CHECKING(which compiler should be used)
+		case "${UNIVERSALSDK}" in
+		*/MacOSX10.4u.sdk)
+			# Build using 10.4 SDK, force usage of gcc when the 
+			# compiler is gcc, otherwise the user will get very
+			# confusing error messages when building on OSX 10.6
+			CC=gcc-4.0
+			CPP=cpp-4.0
+			;;
+		esac
+		AC_MSG_RESULT($CC)
+	    fi
 
 
 	    if test "${enable_universalsdk}"; then
@@ -942,10 +956,12 @@
 		 fi
 
 
-		BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
-		tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
-		if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
-			CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
+		if test "${UNIVERSALSDK}" != "/"
+		then
+			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
 		fi
 	    fi
 

Modified: python/branches/py3k-jit/setup.py
==============================================================================
--- python/branches/py3k-jit/setup.py	(original)
+++ python/branches/py3k-jit/setup.py	Fri Apr 23 02:01:11 2010
@@ -1227,8 +1227,9 @@
         # End multiprocessing
 
         # Platform-specific libraries
-        if platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
-                        'freebsd7', 'freebsd8'):
+        if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
+                        'freebsd7', 'freebsd8')
+            or platform.startswith("gnukfreebsd")):
             exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
         else:
             missing.append('ossaudiodev')
@@ -1238,6 +1239,12 @@
                        Extension('_gestalt', ['_gestalt.c'],
                        extra_link_args=['-framework', 'Carbon'])
                        )
+            exts.append(
+                       Extension('_scproxy', ['_scproxy.c'],
+                       extra_link_args=[
+                           '-framework', 'SystemConfiguration',
+                           '-framework', 'CoreFoundation',
+                        ]))
 
         self.extensions.extend(exts)
 
@@ -1577,7 +1584,7 @@
             inc_dirs.append('/usr/include/ffi')
 
         ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
-        if not ffi_inc:
+        if not ffi_inc or ffi_inc[0] == '':
             ffi_inc = find_file('ffi.h', [], inc_dirs)
         if ffi_inc is not None:
             ffi_h = ffi_inc[0] + '/ffi.h'


More information about the Python-checkins mailing list