[Python-checkins] r82021 - in python/branches/py3k-jit: Doc/c-api/arg.rst Doc/c-api/buffer.rst Doc/distutils/builtdist.rst Doc/extending/newtypes.rst Doc/library/argparse.rst Doc/library/datetime.rst Doc/library/decimal.rst Doc/library/dis.rst Doc/library/doctest.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/io.rst Doc/library/os.rst Doc/library/socket.rst Doc/library/sqlite3.rst Doc/library/ssl.rst Doc/library/struct.rst Doc/library/subprocess.rst Doc/library/sysconfig.rst Doc/library/tarfile.rst Doc/library/time.rst Doc/library/unittest.rst Doc/library/urllib.parse.rst Doc/library/winreg.rst Doc/library/xml.dom.minidom.rst Doc/tools/sphinxext/pyspecific.py Doc/whatsnew/3.2.rst Include/longobject.h Lib/base64.py Lib/ctypes/test/test_bytes.py Lib/ctypes/test/test_structures.py Lib/decimal.py Lib/distutils/unixccompiler.py Lib/doctest.py Lib/email/charset.py Lib/email/encoders.py Lib/email/test/test_email.py Lib/ftplib.py Lib/html/parser.py Lib/http/client.py Lib/logging/config.py Lib/os.py Lib/sqlite3/test/dbapi.py Lib/struct.py Lib/sunau.py Lib/sysconfig.py Lib/tarfile.py Lib/test/math_testcases.txt Lib/test/regrtest.py Lib/test/test_base64.py Lib/test/test_builtin.py Lib/test/test_calendar.py Lib/test/test_capi.py Lib/test/test_codecs.py Lib/test/test_curses.py Lib/test/test_datetime.py Lib/test/test_descr.py Lib/test/test_doctest.py Lib/test/test_enumerate.py Lib/test/test_fractions.py Lib/test/test_ftplib.py Lib/test/test_getargs2.py Lib/test/test_htmlparser.py Lib/test/test_httplib.py Lib/test/test_long.py Lib/test/test_math.py Lib/test/test_minidom.py Lib/test/test_numeric_tower.py Lib/test/test_os.py Lib/test/test_socketserver.py Lib/test/test_ssl.py Lib/test/test_struct.py Lib/test/test_sunau.py Lib/test/test_sundry.py Lib/test/test_sys.py Lib/test/test_sysconfig.py Lib/test/test_tarfile.py Lib/test/test_tcl.py Lib/test/test_unicode.py Lib/test/test_urllib2.py Lib/test/test_winreg.py Lib/test/test_winsound.py Lib/test/testtar.tar Lib/tkinter/_fix.py Lib/unittest/case.py Lib/unittest/loader.py Lib/unittest/suite.py Lib/unittest/test/test_case.py Lib/unittest/test/test_runner.py Lib/unittest/test/test_setups.py Lib/unittest/util.py Lib/urllib/request.py Lib/webbrowser.py Lib/xml/dom/minidom.py Mac/Tools/pythonw.c Misc/ACKS Misc/NEWS Misc/developers.txt Misc/maintainers.rst Modules/_codecsmodule.c Modules/_ctypes/_ctypes.c Modules/_ctypes/cfield.c Modules/_localemodule.c Modules/_multiprocessing/multiprocessing.h Modules/_sqlite/connection.c Modules/_struct.c Modules/_testcapimodule.c Modules/config.c.in Modules/datetimemodule.c Modules/itertoolsmodule.c Modules/mathmodule.c Modules/readline.c Modules/timemodule.c Objects/abstract.c Objects/bytearrayobject.c Objects/bytesobject.c Objects/exceptions.c Objects/longobject.c Objects/stringlib/formatter.h Objects/stringlib/string_format.h Objects/typeobject.c Objects/unicodeobject.c PC/winreg.c Parser/asdl_c.py Python/Python-ast.c Python/ceval.c Python/errors.c Python/getargs.c Python/modsupport.c Python/pythonrun.c Python/symtable.c Python/sysmodule.c Tools/i18n/msgfmt.py Tools/scripts/serve.py configure configure.in setup.py

collin.winter python-checkins at python.org
Wed Jun 16 18:21:26 CEST 2010


Author: collin.winter
Date: Wed Jun 16 18:21:24 2010
New Revision: 82021

Log:
Merged revisions 81498,81504,81511,81513-81514,81519,81522,81526,81528,81532-81533,81535,81538,81541,81545,81547-81548,81550,81553,81556-81557,81560,81564-81565,81568,81572,81575,81581,81583,81585,81588,81590,81595,81600,81604,81607,81609,81611-81613,81623,81625,81628,81630,81632,81638,81642,81647,81650,81654,81656,81660,81665,81670,81673,81682,81685,81689,81694-81695,81698-81699,81703,81708,81711,81713,81725,81730-81731,81737,81742-81743,81746,81748,81751,81754-81755,81757,81762,81765-81766,81768,81771,81778-81782,81790,81792,81794,81806-81807,81809,81811,81814,81816,81818,81821,81823,81826-81827,81829-81832,81835,81838,81840-81841,81843-81844,81849,81851,81854,81856-81857,81862,81865,81869,81871,81873-81875,81877,81879,81883,81885,81891,81893-81898,81901-81902,81905,81908,81911-81912,81914,81916,81918,81920,81923,81925,81927,81929-81930,81936-81938,81944,81946-81952,81954-81956,81958,81961,81965,81968,81970,81972-81974,81981,81988-81989 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81498 | antoine.pitrou | 2010-05-24 14:20:20 -0700 (Mon, 24 May 2010) | 3 lines
  
  Document the context attribute of SSL sockets
................
  r81504 | victor.stinner | 2010-05-24 14:46:25 -0700 (Mon, 24 May 2010) | 13 lines
  
  Recorded merge of revisions 81500-81501 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81500 | victor.stinner | 2010-05-24 23:33:24 +0200 (lun., 24 mai 2010) | 2 lines
    
    Issue #6662: Fix parsing of malformatted charref (&#bad;)
  ........
    r81501 | victor.stinner | 2010-05-24 23:37:28 +0200 (lun., 24 mai 2010) | 2 lines
    
    Add the author of the last fix (Issue #6662)
  ........
................
  r81511 | benjamin.peterson | 2010-05-24 19:27:55 -0700 (Mon, 24 May 2010) | 8 lines
  
  Blocked revisions 81509 via svnmerge
  
  ........
    r81509 | benjamin.peterson | 2010-05-24 21:23:32 -0500 (Mon, 24 May 2010) | 1 line
    
    correct default docs
  ........
................
  r81513 | tarek.ziade | 2010-05-25 02:44:36 -0700 (Tue, 25 May 2010) | 1 line
  
  Made sysconfig a script that displays useful information - #8770
................
  r81514 | tarek.ziade | 2010-05-25 02:47:06 -0700 (Tue, 25 May 2010) | 1 line
  
  added the list of public APIs in sysconfig
................
  r81519 | r.david.murray | 2010-05-25 08:26:21 -0700 (Tue, 25 May 2010) | 13 lines
  
  Blocked revisions 81518 via svnmerge
  
  ........
    r81518 | r.david.murray | 2010-05-25 11:20:46 -0400 (Tue, 25 May 2010) | 8 lines
    
    Issue 8143: sync unquote in urlparse with urllib; add comment about doing so.
    
    unquote is duplicated in the two files to avoid a circular reference.
    (This is fixed in Python3.)  Updates keep getting made to the public unquote
    without fixing the urlparse one, however, so this fix syncs the two
    and adds a comment to both to make sure changes are applied to both.
  ........
................
  r81522 | r.david.murray | 2010-05-25 08:36:46 -0700 (Tue, 25 May 2010) | 9 lines
  
  Recorded merge of revisions 81521 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81521 | r.david.murray | 2010-05-25 11:32:06 -0400 (Tue, 25 May 2010) | 2 lines
    
    Issue 8818: urlparse/urlsplit keyword is 'scheme', not 'default_scheme'.
  ........
................
  r81526 | mark.dickinson | 2010-05-25 12:06:24 -0700 (Tue, 25 May 2010) | 10 lines
  
  Merged revisions 81525 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81525 | mark.dickinson | 2010-05-25 20:01:08 +0100 (Tue, 25 May 2010) | 3 lines
    
    Issue #8816: Extra tests for some built-in functions.  These tests are
    ports of IronPython tests.  Thanks Gregory Nofi.
  ........
................
  r81528 | mark.dickinson | 2010-05-25 12:46:20 -0700 (Tue, 25 May 2010) | 9 lines
  
  Merged revisions 81527 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81527 | mark.dickinson | 2010-05-25 20:44:49 +0100 (Tue, 25 May 2010) | 1 line
    
    Fix a NameError in test_enumerate.
  ........
................
  r81532 | martin.v.loewis | 2010-05-25 13:07:11 -0700 (Tue, 25 May 2010) | 9 lines
  
  Merged revisions 81531 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81531 | martin.v.loewis | 2010-05-25 22:06:02 +0200 (Di, 25 Mai 2010) | 2 lines
    
    Add Alexander Belopolsky.
  ........
................
  r81533 | victor.stinner | 2010-05-25 14:12:34 -0700 (Tue, 25 May 2010) | 3 lines
  
  Issue #4769: Fix main() function of the base64 module, use sys.stdin.buffer and
  sys.stdout.buffer (instead of sys.stdin and sys.stdout) to use the bytes API
................
  r81535 | victor.stinner | 2010-05-25 15:17:22 -0700 (Tue, 25 May 2010) | 2 lines
  
  Fix the new TestMain.test_decode() of test_base64 for Windows
................
  r81538 | victor.stinner | 2010-05-25 15:35:40 -0700 (Tue, 25 May 2010) | 11 lines
  
  Blocked revisions 81537 via svnmerge
  
  ........
    r81537 | victor.stinner | 2010-05-26 00:30:32 +0200 (mer., 26 mai 2010) | 3 lines
  
    Issue #3798: Write sys.exit() message to sys.stderr to use stderr encoding and
    error handler, instead of writing to the C stderr file in utf-8
  ........
  
  py3k was already fixed by r81252.
................
  r81541 | mark.dickinson | 2010-05-26 09:02:59 -0700 (Wed, 26 May 2010) | 4 lines
  
  Issue #8817: Expose round-to-nearest variant of divmod in _PyLong_Divmod_Near
  for use by the datetime module; also refactor long_round to use this function.
................
  r81545 | victor.stinner | 2010-05-26 10:33:03 -0700 (Wed, 26 May 2010) | 9 lines
  
  Merged revisions 81543 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81543 | victor.stinner | 2010-05-26 19:25:28 +0200 (mer., 26 mai 2010) | 2 lines
    
    Issue #7449: Skip test_socketserver if threading support is disabled
  ........
................
  r81547 | brian.curtin | 2010-05-26 10:43:50 -0700 (Wed, 26 May 2010) | 6 lines
  
  Fix #2810 - handle the case where some registry calls return
  ERROR_MORE_DATA, requiring another call to get the remaining data.
  
  Patch by Daniel Stutzbach
................
  r81548 | giampaolo.rodola | 2010-05-26 11:06:04 -0700 (Wed, 26 May 2010) | 1 line
  
  Fix issue #8806: add SSL contexts support to ftplib
................
  r81550 | giampaolo.rodola | 2010-05-26 11:21:26 -0700 (Wed, 26 May 2010) | 1 line
  
  fix wrong assertIs context
................
  r81553 | mark.dickinson | 2010-05-26 12:14:01 -0700 (Wed, 26 May 2010) | 9 lines
  
  Merged revisions 81551 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81551 | mark.dickinson | 2010-05-26 20:06:33 +0100 (Wed, 26 May 2010) | 1 line
    
    Issue #8825: additional testcases for int(string, 0) and long(string, 0).
  ........
................
  r81556 | alexander.belopolsky | 2010-05-26 13:00:12 -0700 (Wed, 26 May 2010) | 10 lines
  
  Merged revisions 81555 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81555 | alexander.belopolsky | 2010-05-26 15:43:16 -0400 (Wed, 26 May 2010) | 3 lines
    
    Issue #7879: Do not test negative timestamps on any Windows platform
    including Windows CE.
  ........
................
  r81557 | mark.dickinson | 2010-05-26 13:07:58 -0700 (Wed, 26 May 2010) | 4 lines
  
  Issue #2844: Make int('42', n) consistently raise ValueError for
  invalid integers n (including n = -909).
................
  r81560 | alexander.belopolsky | 2010-05-26 13:48:30 -0700 (Wed, 26 May 2010) | 10 lines
  
  Merged revisions 81559 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81559 | alexander.belopolsky | 2010-05-26 16:45:37 -0400 (Wed, 26 May 2010) | 3 lines
    
    Issue #7879: Skip negative timestamps test on any Windows platform
    using unittest.skipIf decorator.
  ........
................
  r81564 | mark.dickinson | 2010-05-27 12:45:50 -0700 (Thu, 27 May 2010) | 9 lines
  
  Merged revisions 81512 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81512 | brett.cannon | 2010-05-25 03:53:04 +0100 (Tue, 25 May 2010) | 1 line
    
    Make the contributor list alphabetical again.
  ........
................
  r81565 | mark.dickinson | 2010-05-27 12:47:53 -0700 (Thu, 27 May 2010) | 1 line
  
  Stefan Krah was missing from Misc/ACKS in the py3k branch.
................
  r81568 | alexander.belopolsky | 2010-05-27 14:42:58 -0700 (Thu, 27 May 2010) | 10 lines
  
  Merged revisions 81566 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81566 | alexander.belopolsky | 2010-05-27 16:55:27 -0400 (Thu, 27 May 2010) | 3 lines
    
    Issue #7150: Raise OverflowError if the result of adding or subtracting
    timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range.
  ........
................
  r81572 | benjamin.peterson | 2010-05-27 15:32:22 -0700 (Thu, 27 May 2010) | 1 line
  
  correct default value in signature
................
  r81575 | ezio.melotti | 2010-05-27 15:38:16 -0700 (Thu, 27 May 2010) | 9 lines
  
  Merged revisions 81318 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81318 | ezio.melotti | 2010-05-19 03:32:52 +0300 (Wed, 19 May 2010) | 1 line
    
    Fix typo in argparse doc.
  ........
................
  r81581 | benjamin.peterson | 2010-05-27 20:23:57 -0700 (Thu, 27 May 2010) | 12 lines
  
  Blocked revisions 81578-81579 via svnmerge
  
  ........
    r81578 | benjamin.peterson | 2010-05-27 21:12:36 -0500 (Thu, 27 May 2010) | 1 line
    
    remove non-ascii coding per PEP 8
  ........
    r81579 | benjamin.peterson | 2010-05-27 22:10:31 -0500 (Thu, 27 May 2010) | 1 line
    
    2to3 doesn't fix test_support #6583
  ........
................
  r81583 | martin.v.loewis | 2010-05-28 08:44:20 -0700 (Fri, 28 May 2010) | 9 lines
  
  Merged revisions 81582 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81582 | martin.v.loewis | 2010-05-28 17:28:47 +0200 (Fr, 28 Mai 2010) | 2 lines
    
    Issue #1759169: Drop _XOPEN_SOURCE on Solaris.
  ........
................
  r81585 | brian.curtin | 2010-05-28 09:08:40 -0700 (Fri, 28 May 2010) | 10 lines
  
  Merged revisions 81584 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81584 | brian.curtin | 2010-05-28 10:49:21 -0500 (Fri, 28 May 2010) | 3 lines
    
    Fix #8405 for slow buildbots. Remove the sleep on startup and move the
    pipe communication into a loop to retry in case a buildbot gets even slower.
  ........
................
  r81588 | victor.stinner | 2010-05-28 14:55:10 -0700 (Fri, 28 May 2010) | 3 lines
  
  Issue #8837: Remove "O?" format of PyArg_Parse*() functions. The format is no
  used anymore and it was never documented.
................
  r81590 | victor.stinner | 2010-05-28 17:13:06 -0700 (Fri, 28 May 2010) | 2 lines
  
  Remove dead code
................
  r81595 | antoine.pitrou | 2010-05-29 05:08:25 -0700 (Sat, 29 May 2010) | 9 lines
  
  Merged revisions 81594 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81594 | antoine.pitrou | 2010-05-29 14:06:13 +0200 (sam., 29 mai 2010) | 3 lines
    
    Issue #8840: Make documentation for truncate() clearer
  ........
................
  r81600 | stefan.krah | 2010-05-29 05:59:18 -0700 (Sat, 29 May 2010) | 9 lines
  
  Merged revisions 81598 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81598 | stefan.krah | 2010-05-29 14:54:35 +0200 (Sat, 29 May 2010) | 1 line
    
    Fix typo
  ........
................
  r81604 | mark.dickinson | 2010-05-29 14:05:27 -0700 (Sat, 29 May 2010) | 9 lines
  
  Merged revisions 81602 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81602 | mark.dickinson | 2010-05-29 22:00:52 +0100 (Sat, 29 May 2010) | 1 line
    
    Untabify Modules/config.c.in.
  ........
................
  r81607 | mark.dickinson | 2010-05-30 05:12:56 -0700 (Sun, 30 May 2010) | 10 lines
  
  Blocked revisions 81606 via svnmerge
  
  ........
    r81606 | mark.dickinson | 2010-05-30 13:12:25 +0100 (Sun, 30 May 2010) | 4 lines
    
    Issue #5211: Complete removal of implicit coercions for the complex
    type.  Coercion for arithmetic operations was already removed in
    r78280, but that commit didn't remove coercion for rich comparisons.
  ........
................
  r81609 | mark.dickinson | 2010-05-30 05:17:39 -0700 (Sun, 30 May 2010) | 8 lines
  
  Blocked revisions 81608 via svnmerge
  
  ........
    r81608 | mark.dickinson | 2010-05-30 13:17:11 +0100 (Sun, 30 May 2010) | 1 line
    
    Remove declaration for unused variable.
  ........
................
  r81611 | mark.dickinson | 2010-05-30 06:18:47 -0700 (Sun, 30 May 2010) | 10 lines
  
  Recorded merge of revisions 81610 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81610 | mark.dickinson | 2010-05-30 14:18:10 +0100 (Sun, 30 May 2010) | 3 lines
    
    Issue #8748: Fix incorrect results from comparisons between an integer
    and a complex instance.  Based on a patch by Meador Inge.
  ........
................
  r81612 | benjamin.peterson | 2010-05-30 07:49:32 -0700 (Sun, 30 May 2010) | 1 line
  
  use atomic structures in non-thread version
................
  r81613 | ronald.oussoren | 2010-05-30 08:46:48 -0700 (Sun, 30 May 2010) | 4 lines
  
  Remove conditional import of 'ic', that module
  was removed in the transition from python 2.x to
  python 3.x.
................
  r81623 | antoine.pitrou | 2010-05-31 10:04:40 -0700 (Mon, 31 May 2010) | 9 lines
  
  Merged revisions 81621 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81621 | antoine.pitrou | 2010-05-31 19:01:01 +0200 (lun., 31 mai 2010) | 4 lines
    
    Improve documentation for getaddrinfo() (part of #8857)
  ........
................
  r81625 | alexander.belopolsky | 2010-05-31 10:33:47 -0700 (Mon, 31 May 2010) | 3 lines
  
  Issue #1289118: datetime.timedelta objects can now be multiplied by float
  and divided by float and int objects.
................
  r81628 | r.david.murray | 2010-05-31 16:23:50 -0700 (Mon, 31 May 2010) | 9 lines
  
  Merged revisions 81587 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81587 | r.david.murray | 2010-05-28 14:17:20 -0400 (Fri, 28 May 2010) | 2 lines
    
    Make the ctl-C shutdown of serve.py prettier.
  ........
................
  r81630 | r.david.murray | 2010-05-31 18:11:18 -0700 (Mon, 31 May 2010) | 9 lines
  
  Merged revisions 81586 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81586 | r.david.murray | 2010-05-28 14:08:11 -0400 (Fri, 28 May 2010) | 2 lines
    
    Make reference to Generic Attribute Management a hyperlink.
  ........
................
  r81632 | r.david.murray | 2010-05-31 18:32:12 -0700 (Mon, 31 May 2010) | 4 lines
  
  #8845: expose sqlite3 inTransaction as RO in_transaction Connection attribute.
  
  Patch by R. David Murray, unit tests by Shashwat Anand.
................
  r81638 | senthil.kumaran | 2010-06-01 05:53:48 -0700 (Tue, 01 Jun 2010) | 9 lines
  
  Merged revisions 81636 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81636 | senthil.kumaran | 2010-06-01 18:10:07 +0530 (Tue, 01 Jun 2010) | 3 lines
    
    Fix Issue8797 - urllib2 basic authentication fix for wrong passwords. It fails after 5 retries.
  ........
................
  r81642 | brian.curtin | 2010-06-01 06:49:19 -0700 (Tue, 01 Jun 2010) | 10 lines
  
  Merged revisions 81640 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81640 | brian.curtin | 2010-06-01 08:29:13 -0500 (Tue, 01 Jun 2010) | 3 lines
    
    Fix #8618. Ask the Windows mixer API if there are any playback devices
    configured before attempting to test PlaySound.
  ........
................
  r81647 | senthil.kumaran | 2010-06-01 19:29:00 -0700 (Tue, 01 Jun 2010) | 9 lines
  
  Merged revisions 81645 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81645 | senthil.kumaran | 2010-06-02 07:49:15 +0530 (Wed, 02 Jun 2010) | 3 lines
    
    Fix issue8788 - description of doseq parameter in urllib.urlencode
  ........
................
  r81650 | ronald.oussoren | 2010-06-01 20:50:56 -0700 (Tue, 01 Jun 2010) | 11 lines
  
  Merged revisions 81649 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81649 | ronald.oussoren | 2010-06-02 05:47:14 +0200 (Wed, 02 Jun 2010) | 5 lines
    
    Fix for issue8868: without this patch 'MacOS.WMAvailable()' will return
    False on MacOSX 10.5 or earlier and scripts won't be able to access GUI
    functionality.
  ........
................
  r81654 | antoine.pitrou | 2010-06-02 10:10:49 -0700 (Wed, 02 Jun 2010) | 10 lines
  
  Merged revisions 81652 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81652 | antoine.pitrou | 2010-06-02 19:08:47 +0200 (mer., 02 juin 2010) | 4 lines
    
    Issue #8873: add a documentation note about possible performance issues with the
    default of unbuffered IO in subprocess.Popen.
  ........
................
  r81656 | benjamin.peterson | 2010-06-02 11:10:09 -0700 (Wed, 02 Jun 2010) | 1 line
  
  remove description of LOAD_LOCALS #8874
................
  r81660 | r.david.murray | 2010-06-02 18:58:28 -0700 (Wed, 02 Jun 2010) | 25 lines
  
  Fix Charset.body_encode to encode to output_charset before calling base64mime.
  
  This means that what gets encoded in base64 is the encoded version of the
  unicode payload.  This bug was revealed by a forward port of the tests from
  Issue 1368247, but the fix was completely different.
  
  Note that the merge is only of the tests, the doc changes were inappropriate
  since email5 expects unicode, not bytes.  I'm also not convinced that
  quopri works correctly in email5, but that's a different issue.
  
  Merged revisions 81658 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81658 | r.david.murray | 2010-06-02 18:03:15 -0400 (Wed, 02 Jun 2010) | 9 lines
    
    #1368247: make set_charset/MIMEText automatically encode unicode _payload.
    
    Fixes (mysterious, to the end user) UnicodeErrors when using utf-8 as
    the charset and unicode as the _text argument.  Also makes the way in
    which unicode gets encoded to quoted printable for other charsets more
    sane (it only worked by accident previously).  The _payload now is encoded
    to the charset.output_charset if it is unicode.
  ........
................
  r81665 | lars.gustaebel | 2010-06-03 03:11:52 -0700 (Thu, 03 Jun 2010) | 11 lines
  
  Merged revisions 81663 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81663 | lars.gustaebel | 2010-06-03 11:56:22 +0200 (Thu, 03 Jun 2010) | 4 lines
    
    Issue #8833: tarfile created hard link entries with a size
    field != 0 by mistake. The associated testcase did not
    expose this bug because it was broken too.
  ........
................
  r81670 | lars.gustaebel | 2010-06-03 05:45:16 -0700 (Thu, 03 Jun 2010) | 14 lines
  
  Merged revisions 81667 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81667 | lars.gustaebel | 2010-06-03 14:34:14 +0200 (Thu, 03 Jun 2010) | 8 lines
    
    Issue #8741: Fixed the TarFile.makelink() method that is responsible
    for extracting symbolic and hard link entries as regular files as a
    work-around on platforms that do not support filesystem links.
    
    This stopped working reliably after a change in r74571. I also added
    a few tests for this functionality.
  ........
................
  r81673 | ronald.oussoren | 2010-06-03 07:42:25 -0700 (Thu, 03 Jun 2010) | 16 lines
  
  Merged revisions 81662 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81662 | ronald.oussoren | 2010-06-03 11:47:21 +0200 (Thu, 03 Jun 2010) | 9 lines
    
    Fix for issue #7724: ensure that distutils and python's own setup.py
    honor the MacOSX SDK when one is specified.
    
    This is needed to be able to build using the 10.4u SDK while running
    on OSX 10.6.
    
    This is a fixed version of the patch in r80963, I've tested this patch
    on OSX and Linux.
  ........
................
  r81682 | sean.reifschneider | 2010-06-03 18:51:38 -0700 (Thu, 03 Jun 2010) | 2 lines
  
  Issue8810: Clearing up docstring for tzinfo.utcoffset.
................
  r81685 | r.david.murray | 2010-06-04 09:11:08 -0700 (Fri, 04 Jun 2010) | 4 lines
  
  #4768: store base64 encoded email body parts as text, not binary.
  
  Patch and tests by Forest Bond.
................
  r81689 | senthil.kumaran | 2010-06-04 09:38:00 -0700 (Fri, 04 Jun 2010) | 9 lines
  
  Merged revisions 81687 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81687 | senthil.kumaran | 2010-06-04 22:02:14 +0530 (Fri, 04 Jun 2010) | 3 lines
    
    Fix issue6312 - close the resp object for HEAD response.
  ........
................
  r81694 | martin.v.loewis | 2010-06-04 10:20:56 -0700 (Fri, 04 Jun 2010) | 10 lines
  
  Merged revisions 81692 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81692 | martin.v.loewis | 2010-06-04 19:18:42 +0200 (Fr, 04 Jun 2010) | 3 lines
    
    Issue #8864: Define _XOPEN_SOURCE on Solaris for the 
    multiprocessing module.
  ........
................
  r81695 | senthil.kumaran | 2010-06-04 10:27:11 -0700 (Fri, 04 Jun 2010) | 9 lines
  
  Merged revisions 81691 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81691 | senthil.kumaran | 2010-06-04 22:47:09 +0530 (Fri, 04 Jun 2010) | 3 lines
    
    test verifying the resp object is closed for HEAD response.
  ........
................
  r81698 | martin.v.loewis | 2010-06-04 11:14:42 -0700 (Fri, 04 Jun 2010) | 9 lines
  
  Merged revisions 81697 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81697 | martin.v.loewis | 2010-06-04 20:04:42 +0200 (Fr, 04 Jun 2010) | 2 lines
    
    Issue #5464: Implement plural forms in msgfmt.py.
  ........
................
  r81699 | martin.v.loewis | 2010-06-04 11:40:55 -0700 (Fri, 04 Jun 2010) | 2 lines
  
  Port to Python 3.
................
  r81703 | martin.v.loewis | 2010-06-04 12:50:26 -0700 (Fri, 04 Jun 2010) | 10 lines
  
  Merged revisions 81701 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81701 | martin.v.loewis | 2010-06-04 21:39:07 +0200 (Fr, 04 Jun 2010) | 2 lines
    
    Issue #6470: Drop UNC prefix in FixTk.py
    Patch by Christop Gohlke and Amaury Forgeot d'Arc.
  ........
................
  r81708 | benjamin.peterson | 2010-06-04 17:45:37 -0700 (Fri, 04 Jun 2010) | 13 lines
  
  Merged revisions 81706-81707 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81706 | benjamin.peterson | 2010-06-04 19:32:50 -0500 (Fri, 04 Jun 2010) | 1 line
    
    properly lookup the __format__ special method
  ........
    r81707 | benjamin.peterson | 2010-06-04 19:38:22 -0500 (Fri, 04 Jun 2010) | 1 line
    
    remove PyType_Ready call; float should be initialized in interpreter startup
  ........
................
  r81711 | benjamin.peterson | 2010-06-04 18:03:24 -0700 (Fri, 04 Jun 2010) | 13 lines
  
  Merged revisions 81709-81710 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81709 | benjamin.peterson | 2010-06-04 19:56:46 -0500 (Fri, 04 Jun 2010) | 1 line
    
    implement object.__format__ with PyObject_Format
  ........
    r81710 | benjamin.peterson | 2010-06-04 20:00:10 -0500 (Fri, 04 Jun 2010) | 1 line
    
    fix ref counting
  ........
................
  r81713 | benjamin.peterson | 2010-06-04 19:11:45 -0700 (Fri, 04 Jun 2010) | 9 lines
  
  Merged revisions 81712 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81712 | benjamin.peterson | 2010-06-04 21:07:01 -0500 (Fri, 04 Jun 2010) | 1 line
    
    _PyObject_LookupSpecial returns a new reference
  ........
................
  r81725 | michael.foord | 2010-06-05 03:45:41 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81724 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81724 | michael.foord | 2010-06-05 11:39:42 +0100 (Sat, 05 Jun 2010) | 1 line
    
    unittest TestLoader test discovery filename matching done in a method. This makes it easier to override the matching strategy in subclasses. No behaviour change in actual implementation.
  ........
................
  r81730 | michael.foord | 2010-06-05 04:27:52 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81728 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81728 | michael.foord | 2010-06-05 12:23:51 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Issue 8351. Suppress large diffs in unittest.TestCase.assertSequenceEqual.
  ........
................
  r81731 | michael.foord | 2010-06-05 04:30:23 -0700 (Sat, 05 Jun 2010) | 1 line
  
  Test fix to use floor division. Correction from merge in previous commit.
................
  r81737 | mark.dickinson | 2010-06-05 04:53:11 -0700 (Sat, 05 Jun 2010) | 8 lines
  
  Blocked revisions 81736 via svnmerge
  
  ........
    r81736 | mark.dickinson | 2010-06-05 12:52:24 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Issue #8627: remove out-of-date warning about overriding __cmp__
  ........
................
  r81742 | michael.foord | 2010-06-05 05:17:02 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81739 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81739 | michael.foord | 2010-06-05 13:10:52 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Removed the new max_diff argument to assertSequenceEqual. All unittest.TestCase assert methods that use difflib to produce failure messages now truncate overly long messages. New class attribute unittest.TestCase.maxDiff to configure this if necessary. Issue 8351.
  ........
................
  r81743 | mark.dickinson | 2010-06-05 05:38:00 -0700 (Sat, 05 Jun 2010) | 10 lines
  
  Blocked revisions 81740 via svnmerge
  
  ........
    r81740 | mark.dickinson | 2010-06-05 13:14:43 +0100 (Sat, 05 Jun 2010) | 5 lines
    
    Issue #8627: Fix "XXX undetected error" from unchecked PyErr_WarnPy3k return.
    This is just a quick fix:  if the warning is turned into an exception, the
    exception simply gets ignored.
  ........
................
  r81746 | mark.dickinson | 2010-06-05 05:52:23 -0700 (Sat, 05 Jun 2010) | 8 lines
  
  Blocked revisions 81744 via svnmerge
  
  ........
    r81744 | mark.dickinson | 2010-06-05 13:51:21 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Fix comment typo.
  ........
................
  r81748 | michael.foord | 2010-06-05 06:14:43 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81747 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81747 | michael.foord | 2010-06-05 13:58:39 +0100 (Sat, 05 Jun 2010) | 1 line
    
    unittest.TestCase.assertDictEqual and assertMultilineEqual provide better default failure messages in the event of long diffs.
  ........
................
  r81751 | mark.dickinson | 2010-06-05 06:27:17 -0700 (Sat, 05 Jun 2010) | 8 lines
  
  Blocked revisions 81749 via svnmerge
  
  ........
    r81749 | mark.dickinson | 2010-06-05 14:18:33 +0100 (Sat, 05 Jun 2010) | 2 lines
    
    Fix test_py3kwarn not to test for __cmp__-related DeprecationWarning.
  ........
................
  r81754 | michael.foord | 2010-06-05 06:49:56 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81752 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81752 | michael.foord | 2010-06-05 14:38:16 +0100 (Sat, 05 Jun 2010) | 1 line
    
    unittest.TestCase assertion methods inform you when they have omitted an over long diff on failure. Issue 8351.
  ........
................
  r81755 | michael.foord | 2010-06-05 06:57:23 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81753 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81753 | michael.foord | 2010-06-05 14:48:27 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Fix unittest tests after previous commit.
  ........
................
  r81757 | alexander.belopolsky | 2010-06-05 08:04:51 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81756 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81756 | alexander.belopolsky | 2010-06-05 10:54:26 -0400 (Sat, 05 Jun 2010) | 1 line
    
    Issue #8899: time.struct_time now has class and atribute docstrings.
  ........
................
  r81762 | michael.foord | 2010-06-05 12:58:25 -0700 (Sat, 05 Jun 2010) | 8 lines
  
  Blocked revisions 81761 via svnmerge
  
  ........
    r81761 | michael.foord | 2010-06-05 20:51:38 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Updated NEWS file.
  ........
................
  r81765 | michael.foord | 2010-06-05 14:01:08 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81763 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81763 | michael.foord | 2010-06-05 21:33:43 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Tests for unittest.TestCase.maxDiff.
  ........
................
  r81766 | michael.foord | 2010-06-05 14:12:23 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81764 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81764 | michael.foord | 2010-06-05 21:59:00 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Tests for issue 8302, skipped test in a setUpClass or a setUpModule are reported as skips rather than errors.
  ........
................
  r81768 | michael.foord | 2010-06-05 14:59:55 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81767 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81767 | michael.foord | 2010-06-05 22:57:03 +0100 (Sat, 05 Jun 2010) | 1 line
    
    Documentation updates for issues 8302 and 8351 (truncating excessive diffs in unittest failure messages and reporting SkipTest exceptions in setUpClass and setUpModule as skips rather than errors).
  ........
................
  r81771 | michael.foord | 2010-06-05 16:59:34 -0700 (Sat, 05 Jun 2010) | 9 lines
  
  Merged revisions 81770 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81770 | michael.foord | 2010-06-06 00:58:40 +0100 (Sun, 06 Jun 2010) | 1 line
    
    Code formatting change.
  ........
................
  r81778 | benjamin.peterson | 2010-06-05 19:14:27 -0700 (Sat, 05 Jun 2010) | 16 lines
  
  Blocked revisions 81772-81773,81777 via svnmerge
  
  ........
    r81772 | benjamin.peterson | 2010-06-05 19:22:09 -0500 (Sat, 05 Jun 2010) | 1 line
    
    bump version to 2.7 rc1
  ........
    r81773 | benjamin.peterson | 2010-06-05 19:49:27 -0500 (Sat, 05 Jun 2010) | 1 line
    
    update pydoc-topics
  ........
    r81777 | benjamin.peterson | 2010-06-05 21:09:33 -0500 (Sat, 05 Jun 2010) | 1 line
    
    careening towards 2.7rc2 we go
  ........
................
  r81779 | benjamin.peterson | 2010-06-05 19:32:09 -0700 (Sat, 05 Jun 2010) | 13 lines
  
  Merged revisions 81774-81775 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81774 | benjamin.peterson | 2010-06-05 19:50:58 -0500 (Sat, 05 Jun 2010) | 1 line
    
    remove extra space
  ........
    r81775 | benjamin.peterson | 2010-06-05 19:54:29 -0500 (Sat, 05 Jun 2010) | 1 line
    
    fix sphinx warning with an extra space
  ........
................
  r81780 | benjamin.peterson | 2010-06-05 19:40:38 -0700 (Sat, 05 Jun 2010) | 1 line
  
  fix typo
................
  r81781 | benjamin.peterson | 2010-06-05 19:41:24 -0700 (Sat, 05 Jun 2010) | 1 line
  
  reST indentation nit
................
  r81782 | benjamin.peterson | 2010-06-05 19:44:41 -0700 (Sat, 05 Jun 2010) | 1 line
  
  bltn-file-objects don't exist in python3
................
  r81790 | tarek.ziade | 2010-06-06 13:18:42 -0700 (Sun, 06 Jun 2010) | 9 lines
  
  Merged revisions 81788 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81788 | tarek.ziade | 2010-06-06 22:05:20 +0200 (Sun, 06 Jun 2010) | 1 line
    
    Fixed #8909: now the doc details the size of the bitmap used in distutils' bdist_wininst
  ........
................
  r81792 | victor.stinner | 2010-06-06 13:27:51 -0700 (Sun, 06 Jun 2010) | 2 lines
  
  Simplify getbuffer(): convertbuffer() fails anyway if bf_getbuffer is NULL
................
  r81794 | victor.stinner | 2010-06-06 13:38:02 -0700 (Sun, 06 Jun 2010) | 4 lines
  
  convertsimple(): call PyErr_NoMemory() on PyMem_NEW() failure
  
  Raise a more revelant error (MemoryError instead of TypeError)
................
  r81806 | mark.dickinson | 2010-06-07 11:47:09 -0700 (Mon, 07 Jun 2010) | 1 line
  
  Fix naming inconsistency.
................
  r81807 | victor.stinner | 2010-06-07 12:57:46 -0700 (Mon, 07 Jun 2010) | 2 lines
  
  Issue #8848: U / U# formats of Py_BuildValue() are just alias to s / s#
................
  r81809 | victor.stinner | 2010-06-07 13:14:04 -0700 (Mon, 07 Jun 2010) | 3 lines
  
  Issue #8897: Fix sunau module, use bytes to write the header. Patch written by
  Thomas Jollans.
................
  r81811 | victor.stinner | 2010-06-07 14:20:41 -0700 (Mon, 07 Jun 2010) | 9 lines
  
  Issue #8925: fix types of Py_Parse*() and Py_BuildValue() functions
  
   * Add links to Python types
   * Replace "string" by bytes or str
   * Replace "long" by "int"
   * Specify the default encoding
   * Fix reST syntax ("..note ::")
   * etc.
................
  r81814 | benjamin.peterson | 2010-06-07 14:41:35 -0700 (Mon, 07 Jun 2010) | 9 lines
  
  Merged revisions 81813 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81813 | benjamin.peterson | 2010-06-07 16:37:09 -0500 (Mon, 07 Jun 2010) | 2 lines
    
    locale grouping strings should end in '\0'
  ........
................
  r81816 | ezio.melotti | 2010-06-07 14:57:18 -0700 (Mon, 07 Jun 2010) | 8 lines
  
  Blocked revisions 81769 via svnmerge
  
  ........
    r81769 | ezio.melotti | 2010-06-06 01:28:10 +0300 (Sun, 06 Jun 2010) | 1 line
    
    Replace deprecated fail* methods with the equivalent assert* ones.
  ........
................
  r81818 | ezio.melotti | 2010-06-07 15:02:50 -0700 (Mon, 07 Jun 2010) | 8 lines
  
  Blocked revisions 81817 via svnmerge
  
  ........
    r81817 | ezio.melotti | 2010-06-08 01:00:18 +0300 (Tue, 08 Jun 2010) | 1 line
    
    Silence deprecation warning in test___all__ caused by an import bsddb.
  ........
................
  r81821 | benjamin.peterson | 2010-06-07 15:24:18 -0700 (Mon, 07 Jun 2010) | 1 line
  
  use the 's' format code instead of 'U'
................
  r81823 | benjamin.peterson | 2010-06-07 15:31:26 -0700 (Mon, 07 Jun 2010) | 9 lines
  
  Merged revisions 81820 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81820 | benjamin.peterson | 2010-06-07 17:23:23 -0500 (Mon, 07 Jun 2010) | 1 line
    
    correctly overflow when indexes are too large
  ........
................
  r81826 | benjamin.peterson | 2010-06-07 15:35:08 -0700 (Mon, 07 Jun 2010) | 9 lines
  
  Merged revisions 81824 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81824 | benjamin.peterson | 2010-06-07 17:32:44 -0500 (Mon, 07 Jun 2010) | 1 line
    
    remove extra byte and fix comment
  ........
................
  r81827 | benjamin.peterson | 2010-06-07 15:36:44 -0700 (Mon, 07 Jun 2010) | 8 lines
  
  Blocked revisions 81825 via svnmerge
  
  ........
    r81825 | benjamin.peterson | 2010-06-07 17:33:09 -0500 (Mon, 07 Jun 2010) | 1 line
    
    use unicode literals
  ........
................
  r81829 | stefan.krah | 2010-06-08 06:26:49 -0700 (Tue, 08 Jun 2010) | 21 lines
  
  Blocked revisions 81669,81672,81683 via svnmerge
  
  ........
    r81669 | stefan.krah | 2010-06-03 14:39:50 +0200 (Thu, 03 Jun 2010) | 9 lines
    
    Issue #7384: If the system readline library is linked against ncurses,
    the curses module must be linked against ncurses as well. Otherwise it 
    is not safe to load both the readline and curses modules in an application.
    
    Thanks Thomas Dickey for answering questions about ncurses/ncursesw
    and readline!
  ........
    r81672 | stefan.krah | 2010-06-03 16:25:16 +0200 (Thu, 03 Jun 2010) | 3 lines
    
    Use compiler rather than compiler_obj. Thanks Michael Foord for noticing.
  ........
    r81683 | stefan.krah | 2010-06-04 11:49:20 +0200 (Fri, 04 Jun 2010) | 1 line
    
    Detect missing ldd on all systems.
  ........
................
  r81830 | stefan.krah | 2010-06-08 06:41:44 -0700 (Tue, 08 Jun 2010) | 9 lines
  
  Issue #7384: If the system readline library is linked against ncurses,
  the curses module must be linked against ncurses as well. Otherwise it
  is not safe to load both the readline and curses modules in an application.
  
  Thanks Thomas Dickey for answering questions about ncurses/ncursesw
  and readline!
................
  r81831 | stefan.krah | 2010-06-08 07:00:52 -0700 (Tue, 08 Jun 2010) | 1 line
  
  Add note for r81830.
................
  r81832 | r.david.murray | 2010-06-08 07:41:45 -0700 (Tue, 08 Jun 2010) | 2 lines
  
  Now that sunau has some tests, remove it from test_sundry.
................
  r81835 | benjamin.peterson | 2010-06-08 07:57:22 -0700 (Tue, 08 Jun 2010) | 9 lines
  
  Merged revisions 81834 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81834 | benjamin.peterson | 2010-06-08 09:53:29 -0500 (Tue, 08 Jun 2010) | 1 line
    
    kill extra word
  ........
................
  r81838 | alexander.belopolsky | 2010-06-08 10:06:48 -0700 (Tue, 08 Jun 2010) | 1 line
  
  Added myself as a maintainer of time and datetime modules.
................
  r81840 | alexander.belopolsky | 2010-06-08 11:59:20 -0700 (Tue, 08 Jun 2010) | 9 lines
  
  Merged revisions 81489 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81489 | georg.brandl | 2010-05-23 17:29:29 -0400 (Sun, 23 May 2010) | 1 line
    
    #1436346: make it more obvious that timetuple[7] is yday.
  ........
................
  r81841 | victor.stinner | 2010-06-08 13:46:00 -0700 (Tue, 08 Jun 2010) | 6 lines
  
  sys_pyfile_write() does nothing if file is NULL
  
  mywrite() falls back to the C file object if sys_pyfile_write() returns an
  error. This patch fixes a segfault is Py_FatalError() is called in an early
  stage of Python initialization.
................
  r81843 | brian.curtin | 2010-06-08 13:57:52 -0700 (Tue, 08 Jun 2010) | 3 lines
  
  Fix a compile warning missed during porting (wchar_t/char) and move a 
  variable declaration outside of a loop. #2810 was when this first went in.
................
  r81844 | victor.stinner | 2010-06-08 14:00:13 -0700 (Tue, 08 Jun 2010) | 6 lines
  
  Py_FatalError(): don't sys sys.last_xxx variables
  
  Call PyErr_PrintEx(0) instead of PyErr_Print() to avoid a crash if
  Py_FatalError() is called in an early stage of Python initialization (if PySys
  is not yet initialized).
................
  r81849 | victor.stinner | 2010-06-08 14:45:51 -0700 (Tue, 08 Jun 2010) | 7 lines
  
  PyArg_Parse*("Z#") raises an error for unknown type
  
  instead of ignoring the error and leave the pointer to the string and the size
  unchanged (not initialized).
  
  Fix also the type in the error message of "Z", "Z#" and "Y" formats.
................
  r81851 | brian.curtin | 2010-06-08 15:27:07 -0700 (Tue, 08 Jun 2010) | 2 lines
  
  Fix #8946. Extra PyObject* parameter documented which doesn't exist.
................
  r81854 | victor.stinner | 2010-06-08 15:54:19 -0700 (Tue, 08 Jun 2010) | 5 lines
  
  Issue #8838, #8339: Remove codecs.charbuffer_encode() and "t#" parsing format
  
  Remove last references to the "char buffer" of the buffer protocol from
  Python3.
................
  r81856 | kristjan.jonsson | 2010-06-09 01:13:42 -0700 (Wed, 09 Jun 2010) | 2 lines
  
  http://bugs.python.org/issue8832
  Issue minidom.unlink with a context manager
................
  r81857 | stefan.krah | 2010-06-09 01:56:28 -0700 (Wed, 09 Jun 2010) | 3 lines
  
  Issue #8932: Skip required when compiled --without-threads.
................
  r81862 | antoine.pitrou | 2010-06-09 09:38:55 -0700 (Wed, 09 Jun 2010) | 9 lines
  
  Merged revisions 81860 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81860 | antoine.pitrou | 2010-06-09 18:24:00 +0200 (mer., 09 juin 2010) | 3 lines
    
    Issue #8930: fix some C code indentation
  ........
................
  r81865 | alexander.belopolsky | 2010-06-09 10:11:01 -0700 (Wed, 09 Jun 2010) | 9 lines
  
  Merged revisions 81864 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81864 | alexander.belopolsky | 2010-06-09 13:08:11 -0400 (Wed, 09 Jun 2010) | 1 line
    
    Fixed markup of tm_isdst attribute.
  ........
................
  r81869 | victor.stinner | 2010-06-10 05:00:55 -0700 (Thu, 10 Jun 2010) | 4 lines
  
  Issue #8922: Normalize the encoding name in PyUnicode_AsEncodedString() to
  enable shortcuts for upper case encoding name. Add also a shortcut for
  "iso-8859-1" in PyUnicode_AsEncodedString() and PyUnicode_Decode().
................
  r81871 | victor.stinner | 2010-06-10 06:36:23 -0700 (Thu, 10 Jun 2010) | 4 lines
  
  Fix r81869: ISO-8859-15 was seen as an alias to ISO-8859-1
  
  Don't use normalize_encoding() result if it is truncated.
................
  r81873 | mark.dickinson | 2010-06-10 09:05:10 -0700 (Thu, 10 Jun 2010) | 4 lines
  
  Issue #8950: Make PyArg_Parse* with 'L' code raise for float inputs,
  instead of warning.  This makes it consistent with the other integer
  codes.
................
  r81874 | michael.foord | 2010-06-10 09:16:08 -0700 (Thu, 10 Jun 2010) | 9 lines
  
  Merged revisions 81853 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81853 | michael.foord | 2010-06-08 23:44:52 +0100 (Tue, 08 Jun 2010) | 1 line
    
    Issue 8948. cleanup functions are not run by unittest.TestCase.debug(), plus class and module teardowns are not run by unittest.TestSuite.debug().
  ........
................
  r81875 | michael.foord | 2010-06-10 09:17:07 -0700 (Thu, 10 Jun 2010) | 9 lines
  
  Merged revisions 81859 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81859 | michael.foord | 2010-06-09 13:29:56 +0100 (Wed, 09 Jun 2010) | 1 line
    
    Typo correction.
  ........
................
  r81877 | michael.foord | 2010-06-10 09:33:34 -0700 (Thu, 10 Jun 2010) | 8 lines
  
  Blocked revisions 81876 via svnmerge
  
  ........
    r81876 | michael.foord | 2010-06-10 17:32:00 +0100 (Thu, 10 Jun 2010) | 1 line
    
    NEWS update for issue 8948.
  ........
................
  r81879 | michael.foord | 2010-06-10 13:41:54 -0700 (Thu, 10 Jun 2010) | 9 lines
  
  Merged revisions 81878 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81878 | michael.foord | 2010-06-10 21:40:21 +0100 (Thu, 10 Jun 2010) | 2 lines
    
    Fix issue with nested test suites debug method and module setups. (unittest)
  ........
................
  r81883 | victor.stinner | 2010-06-10 17:36:33 -0700 (Thu, 10 Jun 2010) | 5 lines
  
  Issue #8965: initfsencoding() doesn't change the encoding on Mac OS X
  
  File system encoding have to be hardcoded to "utf-8" on Mac OS X. r81190
  introduced a regression: the encoding was changed depending on the locale.
................
  r81885 | victor.stinner | 2010-06-10 17:41:41 -0700 (Thu, 10 Jun 2010) | 2 lines
  
  test_sys: add a test on the file system encoding for darwin
................
  r81891 | ezio.melotti | 2010-06-10 19:26:42 -0700 (Thu, 10 Jun 2010) | 9 lines
  
  Merged revisions 81889 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81889 | ezio.melotti | 2010-06-11 05:21:25 +0300 (Fri, 11 Jun 2010) | 1 line
    
    Remove extra ] from itertools.count docstring.
  ........
................
  r81893 | mark.dickinson | 2010-06-11 03:44:52 -0700 (Fri, 11 Jun 2010) | 3 lines
  
  Issue #8188: Comparisons between Decimal objects and other numeric
  objects (Fraction, float, complex, int) now all function as expected.
................
  r81894 | mark.dickinson | 2010-06-11 03:46:57 -0700 (Fri, 11 Jun 2010) | 1 line
  
  Fix issue number typo.
................
  r81895 | alexander.belopolsky | 2010-06-11 09:04:59 -0700 (Fri, 11 Jun 2010) | 2 lines
  
  Issue #3129: Trailing digits in format string are no longer ignored.
................
  r81896 | mark.dickinson | 2010-06-11 09:49:20 -0700 (Fri, 11 Jun 2010) | 1 line
  
  Fix typo in docstring.
................
  r81897 | mark.dickinson | 2010-06-11 09:56:34 -0700 (Fri, 11 Jun 2010) | 1 line
  
  Avoid possible undefined behaviour from signed overflow.
................
  r81898 | mark.dickinson | 2010-06-11 12:05:08 -0700 (Fri, 11 Jun 2010) | 1 line
  
  Fix an incorrect return type.
................
  r81901 | victor.stinner | 2010-06-11 12:24:36 -0700 (Fri, 11 Jun 2010) | 8 lines
  
  Blocked revisions 81899 via svnmerge
  
  ........
    r81899 | victor.stinner | 2010-06-11 21:22:28 +0200 (ven., 11 juin 2010) | 2 lines
    
    Issue #8362: Add Misc/maintainers.rst: list of module maintainers
  ........
................
  r81902 | mark.dickinson | 2010-06-11 12:50:30 -0700 (Fri, 11 Jun 2010) | 1 line
  
  Fix more undefined-behaviour inducing overflow checks in struct module.
................
  r81905 | mark.dickinson | 2010-06-11 13:29:09 -0700 (Fri, 11 Jun 2010) | 10 lines
  
  Blocked revisions 81904 via svnmerge
  
  ........
    r81904 | mark.dickinson | 2010-06-11 21:27:05 +0100 (Fri, 11 Jun 2010) | 4 lines
    
    Fix possible undefined behaviour from signed overflow in struct module.
    
    Backport of revisions 81897, 81898 and 81902 from py3k.
  ........
................
  r81908 | antoine.pitrou | 2010-06-11 14:46:32 -0700 (Fri, 11 Jun 2010) | 11 lines
  
  Merged revisions 81907 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81907 | antoine.pitrou | 2010-06-11 23:42:26 +0200 (ven., 11 juin 2010) | 5 lines
    
    Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash
    the interpreter with characters outside the Basic Multilingual Plane
    (higher than 0x10000).
  ........
................
  r81911 | victor.stinner | 2010-06-11 14:50:30 -0700 (Fri, 11 Jun 2010) | 3 lines
  
  Issue #8966: If a ctypes structure field is an array of c_char, convert its
  value to bytes instead of str (as done for c_char and c_char_p).
................
  r81912 | benjamin.peterson | 2010-06-11 14:53:07 -0700 (Fri, 11 Jun 2010) | 9 lines
  
  Merged revisions 81906 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81906 | benjamin.peterson | 2010-06-11 16:40:37 -0500 (Fri, 11 Jun 2010) | 1 line
    
    different spellings are just unacceptable
  ........
................
  r81914 | victor.stinner | 2010-06-11 15:09:51 -0700 (Fri, 11 Jun 2010) | 2 lines
  
  locale.bindtextdomain(): use PyUnicode_FSConverter() to parse the filename
................
  r81916 | victor.stinner | 2010-06-11 15:17:52 -0700 (Fri, 11 Jun 2010) | 2 lines
  
  Issue #8965: Add a regression test to test_sys with LANG=C
................
  r81918 | victor.stinner | 2010-06-11 15:27:14 -0700 (Fri, 11 Jun 2010) | 2 lines
  
  readline: use PyUnicode_FSConverter() to parse filenames
................
  r81920 | victor.stinner | 2010-06-11 16:06:13 -0700 (Fri, 11 Jun 2010) | 2 lines
  
  Issue #8965: Write more tests for sys.getfilesystemencoding()
................
  r81923 | victor.stinner | 2010-06-11 16:30:12 -0700 (Fri, 11 Jun 2010) | 16 lines
  
  Fix some bugs in c-api/arg.rst documentation
  
   * replace "the default encoding" by "'utf-8' encoding"
   * fix "w" / "w*" / "w#" doc: similar to "y" / "y*" / "y#"
     and not "s" / "s*" / "s#"
   * "u#": remove "Non-Unicode objects are handled by interpreting their
     read-buffer pointer ...", it's no more true
   * "es", "es#": remove "... and objects convertible to Unicode into a character
     buffer", it's no more true
   * Py_BuildValue(), "K" and "L" formats: specify the name of the C type on
     Windows (_int64 / unsigned _int64) as done for PyArg_Parse*() long long
     types
  --CETTE ligne, et les suivantes ci-dessous, seront ignorées--
  
  M    Doc/c-api/arg.rst
................
  r81925 | victor.stinner | 2010-06-11 16:46:47 -0700 (Fri, 11 Jun 2010) | 4 lines
  
  Issue #8784: Set tarfile default encoding to 'utf-8' on Windows.
  
  Note: file system encoding cannot be None anymore (since r81190, issue #8610).
................
  r81927 | victor.stinner | 2010-06-11 16:56:51 -0700 (Fri, 11 Jun 2010) | 3 lines
  
  Issue #8969: On Windows, use mbcs codec in strict mode to encode and decode
  filenames and enable os.fsencode().
................
  r81929 | brett.cannon | 2010-06-11 17:38:29 -0700 (Fri, 11 Jun 2010) | 5 lines
  
  When dealing with __import__ for detecting a global state change made by a
  test, make sure to check if __builtins__ is a dict or not.
  
  Discovered when running importlib.test.regrtest.
................
  r81930 | brett.cannon | 2010-06-11 17:39:28 -0700 (Fri, 11 Jun 2010) | 4 lines
  
  Calling __import__ as a method technically works, but really should be wrapped
  in a staticmethod. This is important for when __import__ is set to a function
  defined in Python instead of C.
................
  r81936 | mark.dickinson | 2010-06-12 02:10:14 -0700 (Sat, 12 Jun 2010) | 2 lines
  
  Silence 'unused variable' gcc warning.  Patch by Éric Araujo.
................
  r81937 | mark.dickinson | 2010-06-12 02:24:01 -0700 (Sat, 12 Jun 2010) | 2 lines
  
  Issue #8981:  Remove _struct.__version__.
................
  r81938 | mark.dickinson | 2010-06-12 02:25:13 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Remove unused variable.
................
  r81944 | nick.coghlan | 2010-06-12 06:42:46 -0700 (Sat, 12 Jun 2010) | 9 lines
  
  Merged revisions 80578 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r80578 | nick.coghlan | 2010-04-29 00:29:06 +1000 (Thu, 29 Apr 2010) | 1 line
    
    Issue 7490: make IGNORE_EXCEPTION_DETAIL also ignore details of the module containing the exception under test (original patch by Lennart Regebro)
  ........
................
  r81946 | nick.coghlan | 2010-06-12 06:46:56 -0700 (Sat, 12 Jun 2010) | 8 lines
  
  Blocked revisions 81945 via svnmerge
  
  ........
    r81945 | nick.coghlan | 2010-06-12 23:45:37 +1000 (Sat, 12 Jun 2010) | 1 line
    
    Backport a fix from Py3k for a potentially misleading example
  ........
................
  r81947 | mark.dickinson | 2010-06-12 08:17:02 -0700 (Sat, 12 Jun 2010) | 3 lines
  
  Issue #8973:  Add __all__ to struct module, so that help(struct) correctly
  displays information for the struct.Struct class.
................
  r81948 | mark.dickinson | 2010-06-12 08:19:23 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Remove accidental (yet-to-be-reviewed) docstring changes included in r81947.
................
  r81949 | mark.dickinson | 2010-06-12 08:43:45 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Issue #8973:  Improve struct module docstrings.
................
  r81950 | mark.dickinson | 2010-06-12 09:30:53 -0700 (Sat, 12 Jun 2010) | 1 line
  
  More struct module docs and docstring tweaks.
................
  r81951 | mark.dickinson | 2010-06-12 09:37:53 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Fix mild type confusion in decimal module docstring.
................
  r81952 | alexander.belopolsky | 2010-06-12 10:18:45 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Added acknowlegement for Issue #3129
................
  r81954 | benjamin.peterson | 2010-06-12 10:54:44 -0700 (Sat, 12 Jun 2010) | 9 lines
  
  Merged revisions 81953 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81953 | benjamin.peterson | 2010-06-12 12:47:06 -0500 (Sat, 12 Jun 2010) | 1 line
    
    fix warning with ucs4
  ........
................
  r81955 | mark.dickinson | 2010-06-12 11:20:47 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Issue #8469: add standard sizes to struct docs table.
................
  r81956 | mark.dickinson | 2010-06-12 11:37:54 -0700 (Sat, 12 Jun 2010) | 2 lines
  
  Issue #8469:  Reorder struct module sections for clarity;  other minor tweaks.
................
  r81958 | mark.dickinson | 2010-06-12 11:54:20 -0700 (Sat, 12 Jun 2010) | 11 lines
  
  Blocked revisions 81957 via svnmerge
  
  ........
    r81957 | mark.dickinson | 2010-06-12 19:50:34 +0100 (Sat, 12 Jun 2010) | 5 lines
    
    Issue #8469:  Add standard sizes to table in struct documentation; additional
    clarifications and documentation tweaks.
    
    Backport of revisions 81955-81956 from py3k.
  ........
................
  r81961 | alexander.belopolsky | 2010-06-12 12:36:28 -0700 (Sat, 12 Jun 2010) | 1 line
  
  Issue #8973: Expanded Struct.__doc__.
................
  r81965 | mark.dickinson | 2010-06-13 02:17:13 -0700 (Sun, 13 Jun 2010) | 1 line
  
  Remove unnecessary brackets from docstring optional arguments.
................
  r81968 | mark.dickinson | 2010-06-13 03:52:38 -0700 (Sun, 13 Jun 2010) | 11 lines
  
  Merged revisions 81967 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81967 | mark.dickinson | 2010-06-13 11:50:29 +0100 (Sun, 13 Jun 2010) | 4 lines
    
    Issue #8986: erfc was raising OverflowError on Linux for arguments in
    the (approximate) range (-27.3, 30.0), as a result of an escaped errno
    value.
  ........
................
  r81970 | mark.dickinson | 2010-06-13 04:07:57 -0700 (Sun, 13 Jun 2010) | 9 lines
  
  Merged revisions 81969 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81969 | mark.dickinson | 2010-06-13 12:07:00 +0100 (Sun, 13 Jun 2010) | 1 line
    
    Add Éric Araujo to Misc/ACKS for doc work and many patch and commit reviews.
  ........
................
  r81972 | mark.dickinson | 2010-06-13 05:02:07 -0700 (Sun, 13 Jun 2010) | 9 lines
  
  Merged revisions 81971 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81971 | mark.dickinson | 2010-06-13 13:01:34 +0100 (Sun, 13 Jun 2010) | 1 line
    
    Ezio Melotti was missing from Misc/ACKS.
  ........
................
  r81973 | victor.stinner | 2010-06-13 11:21:50 -0700 (Sun, 13 Jun 2010) | 4 lines
  
  Issue #8592: PyArg_Parse*() functions raise a TypeError for "y", "u" and "Z"
  formats if the string contains a null byte/character. Write unit tests for
  string formats.
................
  r81974 | victor.stinner | 2010-06-13 13:31:26 -0700 (Sun, 13 Jun 2010) | 4 lines
  
  getargs.c: remove last reference to "t#" format
  
  "t#" format was removed from convertitem() (convertsimple) but not skipitem().
................
  r81981 | alexander.belopolsky | 2010-06-14 07:15:50 -0700 (Mon, 14 Jun 2010) | 3 lines
  
  Issue #5094: The ``datetime`` module now has a simple concrete class
  implementing ``datetime.tzinfo`` interface.
................
  r81988 | alexander.belopolsky | 2010-06-14 10:32:03 -0700 (Mon, 14 Jun 2010) | 1 line
  
  Issue 6280: Tests and simpler implementation for calendar.timegm
................
  r81989 | alexander.belopolsky | 2010-06-14 11:33:19 -0700 (Mon, 14 Jun 2010) | 1 line
  
  Undo r81988 code change leaving added test.
................


Added:
   python/branches/py3k-jit/Lib/test/test_sunau.py
      - copied unchanged from r81989, /python/branches/py3k/Lib/test/test_sunau.py
Modified:
   python/branches/py3k-jit/   (props changed)
   python/branches/py3k-jit/Doc/c-api/arg.rst
   python/branches/py3k-jit/Doc/c-api/buffer.rst
   python/branches/py3k-jit/Doc/distutils/builtdist.rst
   python/branches/py3k-jit/Doc/extending/newtypes.rst
   python/branches/py3k-jit/Doc/library/argparse.rst
   python/branches/py3k-jit/Doc/library/datetime.rst
   python/branches/py3k-jit/Doc/library/decimal.rst
   python/branches/py3k-jit/Doc/library/dis.rst
   python/branches/py3k-jit/Doc/library/doctest.rst
   python/branches/py3k-jit/Doc/library/ftplib.rst
   python/branches/py3k-jit/Doc/library/functions.rst
   python/branches/py3k-jit/Doc/library/io.rst
   python/branches/py3k-jit/Doc/library/os.rst
   python/branches/py3k-jit/Doc/library/socket.rst
   python/branches/py3k-jit/Doc/library/sqlite3.rst
   python/branches/py3k-jit/Doc/library/ssl.rst
   python/branches/py3k-jit/Doc/library/struct.rst
   python/branches/py3k-jit/Doc/library/subprocess.rst
   python/branches/py3k-jit/Doc/library/sysconfig.rst
   python/branches/py3k-jit/Doc/library/tarfile.rst
   python/branches/py3k-jit/Doc/library/time.rst
   python/branches/py3k-jit/Doc/library/unittest.rst
   python/branches/py3k-jit/Doc/library/urllib.parse.rst
   python/branches/py3k-jit/Doc/library/winreg.rst
   python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst
   python/branches/py3k-jit/Doc/tools/sphinxext/pyspecific.py
   python/branches/py3k-jit/Doc/whatsnew/3.2.rst
   python/branches/py3k-jit/Include/longobject.h
   python/branches/py3k-jit/Lib/base64.py
   python/branches/py3k-jit/Lib/ctypes/test/test_bytes.py
   python/branches/py3k-jit/Lib/ctypes/test/test_structures.py
   python/branches/py3k-jit/Lib/decimal.py
   python/branches/py3k-jit/Lib/distutils/unixccompiler.py
   python/branches/py3k-jit/Lib/doctest.py
   python/branches/py3k-jit/Lib/email/charset.py
   python/branches/py3k-jit/Lib/email/encoders.py
   python/branches/py3k-jit/Lib/email/test/test_email.py
   python/branches/py3k-jit/Lib/ftplib.py
   python/branches/py3k-jit/Lib/html/parser.py
   python/branches/py3k-jit/Lib/http/client.py
   python/branches/py3k-jit/Lib/logging/config.py
   python/branches/py3k-jit/Lib/os.py
   python/branches/py3k-jit/Lib/sqlite3/test/dbapi.py
   python/branches/py3k-jit/Lib/struct.py
   python/branches/py3k-jit/Lib/sunau.py
   python/branches/py3k-jit/Lib/sysconfig.py
   python/branches/py3k-jit/Lib/tarfile.py
   python/branches/py3k-jit/Lib/test/math_testcases.txt
   python/branches/py3k-jit/Lib/test/regrtest.py
   python/branches/py3k-jit/Lib/test/test_base64.py
   python/branches/py3k-jit/Lib/test/test_builtin.py
   python/branches/py3k-jit/Lib/test/test_calendar.py
   python/branches/py3k-jit/Lib/test/test_capi.py
   python/branches/py3k-jit/Lib/test/test_codecs.py
   python/branches/py3k-jit/Lib/test/test_curses.py
   python/branches/py3k-jit/Lib/test/test_datetime.py
   python/branches/py3k-jit/Lib/test/test_descr.py
   python/branches/py3k-jit/Lib/test/test_doctest.py
   python/branches/py3k-jit/Lib/test/test_enumerate.py
   python/branches/py3k-jit/Lib/test/test_fractions.py
   python/branches/py3k-jit/Lib/test/test_ftplib.py
   python/branches/py3k-jit/Lib/test/test_getargs2.py
   python/branches/py3k-jit/Lib/test/test_htmlparser.py
   python/branches/py3k-jit/Lib/test/test_httplib.py
   python/branches/py3k-jit/Lib/test/test_long.py
   python/branches/py3k-jit/Lib/test/test_math.py
   python/branches/py3k-jit/Lib/test/test_minidom.py
   python/branches/py3k-jit/Lib/test/test_numeric_tower.py
   python/branches/py3k-jit/Lib/test/test_os.py
   python/branches/py3k-jit/Lib/test/test_socketserver.py
   python/branches/py3k-jit/Lib/test/test_ssl.py
   python/branches/py3k-jit/Lib/test/test_struct.py
   python/branches/py3k-jit/Lib/test/test_sundry.py
   python/branches/py3k-jit/Lib/test/test_sys.py
   python/branches/py3k-jit/Lib/test/test_sysconfig.py
   python/branches/py3k-jit/Lib/test/test_tarfile.py
   python/branches/py3k-jit/Lib/test/test_tcl.py
   python/branches/py3k-jit/Lib/test/test_unicode.py
   python/branches/py3k-jit/Lib/test/test_urllib2.py
   python/branches/py3k-jit/Lib/test/test_winreg.py
   python/branches/py3k-jit/Lib/test/test_winsound.py
   python/branches/py3k-jit/Lib/test/testtar.tar
   python/branches/py3k-jit/Lib/tkinter/_fix.py
   python/branches/py3k-jit/Lib/unittest/case.py
   python/branches/py3k-jit/Lib/unittest/loader.py
   python/branches/py3k-jit/Lib/unittest/suite.py
   python/branches/py3k-jit/Lib/unittest/test/test_case.py
   python/branches/py3k-jit/Lib/unittest/test/test_runner.py
   python/branches/py3k-jit/Lib/unittest/test/test_setups.py
   python/branches/py3k-jit/Lib/unittest/util.py
   python/branches/py3k-jit/Lib/urllib/request.py
   python/branches/py3k-jit/Lib/webbrowser.py
   python/branches/py3k-jit/Lib/xml/dom/minidom.py
   python/branches/py3k-jit/Mac/Tools/pythonw.c
   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/_codecsmodule.c
   python/branches/py3k-jit/Modules/_ctypes/_ctypes.c
   python/branches/py3k-jit/Modules/_ctypes/cfield.c
   python/branches/py3k-jit/Modules/_localemodule.c
   python/branches/py3k-jit/Modules/_multiprocessing/multiprocessing.h
   python/branches/py3k-jit/Modules/_sqlite/connection.c
   python/branches/py3k-jit/Modules/_struct.c
   python/branches/py3k-jit/Modules/_testcapimodule.c
   python/branches/py3k-jit/Modules/config.c.in
   python/branches/py3k-jit/Modules/datetimemodule.c
   python/branches/py3k-jit/Modules/itertoolsmodule.c
   python/branches/py3k-jit/Modules/mathmodule.c
   python/branches/py3k-jit/Modules/readline.c
   python/branches/py3k-jit/Modules/timemodule.c
   python/branches/py3k-jit/Objects/abstract.c
   python/branches/py3k-jit/Objects/bytearrayobject.c
   python/branches/py3k-jit/Objects/bytesobject.c
   python/branches/py3k-jit/Objects/exceptions.c
   python/branches/py3k-jit/Objects/longobject.c
   python/branches/py3k-jit/Objects/stringlib/formatter.h
   python/branches/py3k-jit/Objects/stringlib/string_format.h
   python/branches/py3k-jit/Objects/typeobject.c
   python/branches/py3k-jit/Objects/unicodeobject.c
   python/branches/py3k-jit/PC/winreg.c
   python/branches/py3k-jit/Parser/asdl_c.py
   python/branches/py3k-jit/Python/Python-ast.c
   python/branches/py3k-jit/Python/ceval.c
   python/branches/py3k-jit/Python/errors.c
   python/branches/py3k-jit/Python/getargs.c
   python/branches/py3k-jit/Python/modsupport.c
   python/branches/py3k-jit/Python/pythonrun.c
   python/branches/py3k-jit/Python/symtable.c
   python/branches/py3k-jit/Python/sysmodule.c
   python/branches/py3k-jit/Tools/i18n/msgfmt.py
   python/branches/py3k-jit/Tools/scripts/serve.py
   python/branches/py3k-jit/configure
   python/branches/py3k-jit/configure.in
   python/branches/py3k-jit/setup.py

Modified: python/branches/py3k-jit/Doc/c-api/arg.rst
==============================================================================
--- python/branches/py3k-jit/Doc/c-api/arg.rst	(original)
+++ python/branches/py3k-jit/Doc/c-api/arg.rst	Wed Jun 16 18:21:24 2010
@@ -53,13 +53,13 @@
    drop int support.  It is best to always define :cmacro:`PY_SSIZE_T_CLEAN`.
 
 
-``s`` (Unicode object) [const char \*]
+``s`` (:class:`str`) [const char \*]
    Convert a Unicode object to a C pointer to a character string.
    A pointer to an existing string is stored in the character pointer
    variable whose address you pass.  The C string is NUL-terminated.
    The Python string must not contain embedded NUL bytes; if it does,
    a :exc:`TypeError` exception is raised. Unicode objects are converted
-   to C strings using the default encoding.  If this conversion fails, a
+   to C strings using ``'utf-8'`` encoding. If this conversion fails, a
    :exc:`UnicodeError` is raised.
 
    .. note::
@@ -68,118 +68,111 @@
       preferrable to use the ``O&`` format with :cfunc:`PyUnicode_FSConverter`
       as *converter*.
 
-``s*`` (Unicode object or any buffer compatible object) [Py_buffer]
+``s*`` (:class:`str`, :class:`bytes`, :class:`bytearray` or buffer compatible object) [Py_buffer]
    This format accepts Unicode objects as well as objects supporting the
-   buffer protocol (such as :class:`bytes` or :class:`bytearray` objects).
+   buffer protocol.
    It fills a :ctype:`Py_buffer` structure provided by the caller.
-   Unicode objects are converted to C strings using the default encoding.
    In this case the resulting C string may contain embedded NUL bytes.
+   Unicode objects are converted to C strings using ``'utf-8'`` encoding.
 
-``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int or :ctype:`Py_ssize_t`]
+``s#`` (:class:`str`, :class:`bytes` or read-only buffer compatible object) [const char \*, int or :ctype:`Py_ssize_t`]
    Like ``s*``, except that it doesn't accept mutable buffer-like objects
    such as :class:`bytearray`.  The result is stored into two C variables,
    the first one a pointer to a C string, the second one its length.
-   The string may contain embedded null bytes.
+   The string may contain embedded null bytes. Unicode objects are converted
+   to C strings using ``'utf-8'`` encoding.
 
-``z`` (Unicode object or ``None``) [const char \*]
+``z`` (:class:`str` or ``None``) [const char \*]
    Like ``s``, but the Python object may also be ``None``, in which case the C
    pointer is set to *NULL*.
 
-``z*`` (Unicode object or ``None`` or any buffer compatible object) [Py_buffer]
+``z*`` (:class:`str`, :class:`bytes`, :class:`bytearray`, buffer compatible object or ``None``) [Py_buffer]
    Like ``s*``, but the Python object may also be ``None``, in which case the
    ``buf`` member of the :ctype:`Py_buffer` structure is set to *NULL*.
 
-``z#`` (Unicode object or ``None`` or any read buffer compatible object) [const char \*, int]
+``z#`` (:class:`str`, :class:`bytes`, read-only buffer compatible object or ``None``) [const char \*, int]
    Like ``s#``, but the Python object may also be ``None``, in which case the C
    pointer is set to *NULL*.
 
-``y`` (bytes object) [const char \*]
+``y`` (:class:`bytes`) [const char \*]
    This format converts a bytes-like object to a C pointer to a character
    string; it does not accept Unicode objects.  The bytes buffer must not
    contain embedded NUL bytes; if it does, a :exc:`TypeError`
    exception is raised.
 
-``y*`` (any buffer compatible object) [Py_buffer \*]
+``y*`` (:class:`bytes`, :class:`bytearray` or buffer compatible object) [Py_buffer \*]
    This variant on ``s*`` doesn't accept Unicode objects, only objects
    supporting the buffer protocol.  **This is the recommended way to accept
    binary data.**
 
-``y#`` (bytes object) [const char \*, int]
+``y#`` (:class:`bytes`) [const char \*, int]
    This variant on ``s#`` doesn't accept Unicode objects, only bytes-like
    objects.
 
-``S`` (bytes object) [PyBytesObject \*]
+``S`` (:class:`bytes`) [PyBytesObject \*]
    Requires that the Python object is a :class:`bytes` object, without
    attempting any conversion.  Raises :exc:`TypeError` if the object is not
    a bytes object.  The C variable may also be declared as :ctype:`PyObject\*`.
 
-``Y`` (bytearray object) [PyByteArrayObject \*]
+``Y`` (:class:`bytearray`) [PyByteArrayObject \*]
    Requires that the Python object is a :class:`bytearray` object, without
    attempting any conversion.  Raises :exc:`TypeError` if the object is not
-   a bytearray object.  The C variable may also be declared as :ctype:`PyObject\*`.
+   a :class:`bytearray` object. The C variable may also be declared as :ctype:`PyObject\*`.
 
-``u`` (Unicode object) [Py_UNICODE \*]
+``u`` (:class:`str`) [Py_UNICODE \*]
    Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of
    Unicode characters.  You must pass the address of a :ctype:`Py_UNICODE`
    pointer variable, which will be filled with the pointer to an existing
    Unicode buffer.  Please note that the width of a :ctype:`Py_UNICODE`
    character depends on compilation options (it is either 16 or 32 bits).
+   The Python string must not contain embedded NUL characters; if it does,
+   a :exc:`TypeError` exception is raised.
 
-   ..note ::
+   .. note::
       Since ``u`` doesn't give you back the length of the string, and it
       may contain embedded NUL characters, it is recommended to use ``u#``
       or ``U`` instead.
 
-``u#`` (Unicode object) [Py_UNICODE \*, int]
+``u#`` (:class:`str`) [Py_UNICODE \*, int]
    This variant on ``u`` stores into two C variables, the first one a pointer to a
-   Unicode data buffer, the second one its length. Non-Unicode objects are handled
-   by interpreting their read-buffer pointer as pointer to a :ctype:`Py_UNICODE`
-   array.
+   Unicode data buffer, the second one its length.
 
-``Z`` (Unicode or ``None``) [Py_UNICODE \*]
+``Z`` (:class:`str` or ``None``) [Py_UNICODE \*]
    Like ``u``, but the Python object may also be ``None``, in which case the
    :ctype:`Py_UNICODE` pointer is set to *NULL*.
 
-``Z#`` (Unicode or ``None``) [Py_UNICODE \*, int]
+``Z#`` (:class:`str` or ``None``) [Py_UNICODE \*, int]
    Like ``u#``, but the Python object may also be ``None``, in which case the
    :ctype:`Py_UNICODE` pointer is set to *NULL*.
 
-``U`` (Unicode object) [PyUnicodeObject \*]
+``U`` (:class:`str`) [PyUnicodeObject \*]
    Requires that the Python object is a Unicode object, without attempting
    any conversion.  Raises :exc:`TypeError` if the object is not a Unicode
    object.  The C variable may also be declared as :ctype:`PyObject\*`.
 
-``t#`` (read-only character buffer) [char \*, int]
-   Like ``s#``, but accepts any object which implements the read-only buffer
-   interface.  The :ctype:`char\*` variable is set to point to the first byte of
-   the buffer, and the :ctype:`int` is set to the length of the buffer.  Only
-   single-segment buffer objects are accepted; :exc:`TypeError` is raised for all
-   others.
-
-``w`` (read-write character buffer) [char \*]
-   Similar to ``s``, but accepts any object which implements the read-write buffer
+``w`` (:class:`bytearray` or read-write character buffer) [char \*]
+   Similar to ``y``, but accepts any object which implements the read-write buffer
    interface.  The caller must determine the length of the buffer by other means,
    or use ``w#`` instead.  Only single-segment buffer objects are accepted;
    :exc:`TypeError` is raised for all others.
 
-``w*`` (read-write byte-oriented buffer) [Py_buffer]
-   This is to ``w`` what ``s*`` is to ``s``.
+``w*`` (:class:`bytearray` or read-write byte-oriented buffer) [Py_buffer]
+   This is to ``w`` what ``y*`` is to ``y``.
 
-``w#`` (read-write character buffer) [char \*, int]
-   Like ``s#``, but accepts any object which implements the read-write buffer
+``w#`` (:class:`bytearray` or read-write character buffer) [char \*, int]
+   Like ``y#``, but accepts any object which implements the read-write buffer
    interface.  The :ctype:`char \*` variable is set to point to the first byte
    of the buffer, and the :ctype:`int` is set to the length of the buffer.
    Only single-segment buffer objects are accepted; :exc:`TypeError` is raised
    for all others.
 
-``es`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
-   This variant on ``s`` is used for encoding Unicode and objects convertible to
-   Unicode into a character buffer. It only works for encoded data without embedded
-   NUL bytes.
+``es`` (:class:`str`) [const char \*encoding, char \*\*buffer]
+   This variant on ``s`` is used for encoding Unicode into a character buffer.
+   It only works for encoded data without embedded NUL bytes.
 
    This format requires two arguments.  The first is only used as input, and
    must be a :ctype:`const char\*` which points to the name of an encoding as a
-   NUL-terminated string, or *NULL*, in which case the default encoding is used.
+   NUL-terminated string, or *NULL*, in which case ``'utf-8'`` encoding is used.
    An exception is raised if the named encoding is not known to Python.  The
    second argument must be a :ctype:`char\*\*`; the value of the pointer it
    references will be set to a buffer with the contents of the argument text.
@@ -190,19 +183,19 @@
    allocated storage.  The caller is responsible for calling :cfunc:`PyMem_Free` to
    free the allocated buffer after use.
 
-``et`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
-   Same as ``es`` except that 8-bit string objects are passed through without
-   recoding them.  Instead, the implementation assumes that the string object uses
+``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer]
+   Same as ``es`` except that byte string objects are passed through without
+   recoding them.  Instead, the implementation assumes that the byte string object uses
    the encoding passed in as parameter.
 
-``es#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
-   This variant on ``s#`` is used for encoding Unicode and objects convertible to
-   Unicode into a character buffer.  Unlike the ``es`` format, this variant allows
-   input data which contains NUL characters.
+``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+   This variant on ``s#`` is used for encoding Unicode into a character buffer.
+   Unlike the ``es`` format, this variant allows input data which contains NUL
+   characters.
 
    It requires three arguments.  The first is only used as input, and must be a
    :ctype:`const char\*` which points to the name of an encoding as a
-   NUL-terminated string, or *NULL*, in which case the default encoding is used.
+   NUL-terminated string, or *NULL*, in which case ``'utf-8'`` encoding is used.
    An exception is raised if the named encoding is not known to Python.  The
    second argument must be a :ctype:`char\*\*`; the value of the pointer it
    references will be set to a buffer with the contents of the argument text.
@@ -226,71 +219,71 @@
    In both cases, *\*buffer_length* is set to the length of the encoded data
    without the trailing NUL byte.
 
-``et#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
-   Same as ``es#`` except that string objects are passed through without recoding
-   them. Instead, the implementation assumes that the string object uses the
+``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+   Same as ``es#`` except that byte string objects are passed through without recoding
+   them. Instead, the implementation assumes that the byte string object uses the
    encoding passed in as parameter.
 
 Numbers
 -------
 
-``b`` (integer) [unsigned char]
+``b`` (:class:`int`) [unsigned char]
    Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
    :ctype:`unsigned char`.
 
-``B`` (integer) [unsigned char]
+``B`` (:class:`int`) [unsigned char]
    Convert a Python integer to a tiny int without overflow checking, stored in a C
    :ctype:`unsigned char`.
 
-``h`` (integer) [short int]
+``h`` (:class:`int`) [short int]
    Convert a Python integer to a C :ctype:`short int`.
 
-``H`` (integer) [unsigned short int]
+``H`` (:class:`int`) [unsigned short int]
    Convert a Python integer to a C :ctype:`unsigned short int`, without overflow
    checking.
 
-``i`` (integer) [int]
+``i`` (:class:`int`) [int]
    Convert a Python integer to a plain C :ctype:`int`.
 
-``I`` (integer) [unsigned int]
+``I`` (:class:`int`) [unsigned int]
    Convert a Python integer to a C :ctype:`unsigned int`, without overflow
    checking.
 
-``l`` (integer) [long int]
+``l`` (:class:`int`) [long int]
    Convert a Python integer to a C :ctype:`long int`.
 
-``k`` (integer) [unsigned long]
+``k`` (:class:`int`) [unsigned long]
    Convert a Python integer to a C :ctype:`unsigned long` without
    overflow checking.
 
-``L`` (integer) [PY_LONG_LONG]
+``L`` (:class:`int`) [PY_LONG_LONG]
    Convert a Python integer to a C :ctype:`long long`.  This format is only
    available on platforms that support :ctype:`long long` (or :ctype:`_int64` on
    Windows).
 
-``K`` (integer) [unsigned PY_LONG_LONG]
+``K`` (:class:`int`) [unsigned PY_LONG_LONG]
    Convert a Python integer to a C :ctype:`unsigned long long`
    without overflow checking.  This format is only available on platforms that
    support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on Windows).
 
-``n`` (integer) [Py_ssize_t]
+``n`` (:class:`int`) [Py_ssize_t]
    Convert a Python integer to a C :ctype:`Py_ssize_t`.
 
-``c`` (bytes object of length 1) [char]
+``c`` (:class:`bytes` of length 1) [char]
    Convert a Python byte, represented as a :class:`bytes` object of length 1,
    to a C :ctype:`char`.
 
-``C`` (Unicode object of length 1) [int]
-   Convert a Python character, represented as a :class:`str`: object of
+``C`` (:class:`str` of length 1) [int]
+   Convert a Python character, represented as a :class:`str` object of
    length 1, to a C :ctype:`int`.
 
-``f`` (float) [float]
+``f`` (:class:`float`) [float]
    Convert a Python floating point number to a C :ctype:`float`.
 
-``d`` (float) [double]
+``d`` (:class:`float`) [double]
    Convert a Python floating point number to a C :ctype:`double`.
 
-``D`` (complex) [Py_complex]
+``D`` (:class:`complex`) [Py_complex]
    Convert a Python complex number to a C :ctype:`Py_complex` structure.
 
 Other objects
@@ -330,7 +323,7 @@
    .. versionchanged:: 3.1
       Py_CLEANUP_SUPPORTED was added.
 
-``(items)`` (tuple) [*matching-items*]
+``(items)`` (:class:`tuple`) [*matching-items*]
    The object must be a Python sequence whose length is the number of format units
    in *items*.  The C arguments must correspond to the individual format units in
    *items*.  Format units for sequences may be nested.
@@ -498,95 +491,96 @@
    not within format units such as ``s#``).  This can be used to make long format
    strings a tad more readable.
 
-   ``s`` (string) [char \*]
-      Convert a null-terminated C string to a Python object.  If the C string pointer
-      is *NULL*, ``None`` is used.
-
-   ``s#`` (string) [char \*, int]
-      Convert a C string and its length to a Python object.  If the C string pointer
-      is *NULL*, the length is ignored and ``None`` is returned.
+   ``s`` (:class:`str` or ``None``) [char \*]
+      Convert a null-terminated C string to a Python object using ``'utf-8'``
+      encoding. If the C string pointer is *NULL*, ``None`` is used.
+
+   ``s#`` (:class:`str` or ``None``) [char \*, int]
+      Convert a C string and its length to a Python object using ``'utf-8'``
+      encoding. If the C string pointer is *NULL*, the length is ignored and
+      ``None`` is returned.
 
-   ``y`` (bytes) [char \*]
+   ``y`` (:class:`bytes`) [char \*]
       This converts a C string to a Python :func:`bytes` object.  If the C
       string pointer is *NULL*, ``None`` is returned.
 
-   ``y#`` (bytes) [char \*, int]
+   ``y#`` (:class:`bytes`) [char \*, int]
       This converts a C string and its lengths to a Python object.  If the C
       string pointer is *NULL*, ``None`` is returned.
 
-   ``z`` (string or ``None``) [char \*]
+   ``z`` (:class:`str` or ``None``) [char \*]
       Same as ``s``.
 
-   ``z#`` (string or ``None``) [char \*, int]
+   ``z#`` (:class:`str` or ``None``) [char \*, int]
       Same as ``s#``.
 
-   ``u`` (Unicode string) [Py_UNICODE \*]
+   ``u`` (:class:`str`) [Py_UNICODE \*]
       Convert a null-terminated buffer of Unicode (UCS-2 or UCS-4) data to a Python
       Unicode object.  If the Unicode buffer pointer is *NULL*, ``None`` is returned.
 
-   ``u#`` (Unicode string) [Py_UNICODE \*, int]
+   ``u#`` (:class:`str`) [Py_UNICODE \*, int]
       Convert a Unicode (UCS-2 or UCS-4) data buffer and its length to a Python
       Unicode object.   If the Unicode buffer pointer is *NULL*, the length is ignored
       and ``None`` is returned.
 
-   ``U`` (string) [char \*]
-      Convert a null-terminated C string to a Python unicode object. If the C string
-      pointer is *NULL*, ``None`` is used.
-
-   ``U#`` (string) [char \*, int]
-      Convert a C string and its length to a Python unicode object. If the C string
-      pointer is *NULL*, the length is ignored and ``None`` is returned.
+   ``U`` (:class:`str` or ``None``) [char \*]
+      Same as ``s``.
+
+   ``U#`` (:class:`str` or ``None``) [char \*, int]
+      Same as ``s#``.
 
-   ``i`` (integer) [int]
+   ``i`` (:class:`int`) [int]
       Convert a plain C :ctype:`int` to a Python integer object.
 
-   ``b`` (integer) [char]
+   ``b`` (:class:`int`) [char]
       Convert a plain C :ctype:`char` to a Python integer object.
 
-   ``h`` (integer) [short int]
+   ``h`` (:class:`int`) [short int]
       Convert a plain C :ctype:`short int` to a Python integer object.
 
-   ``l`` (integer) [long int]
+   ``l`` (:class:`int`) [long int]
       Convert a C :ctype:`long int` to a Python integer object.
 
-   ``B`` (integer) [unsigned char]
+   ``B`` (:class:`int`) [unsigned char]
       Convert a C :ctype:`unsigned char` to a Python integer object.
 
-   ``H`` (integer) [unsigned short int]
+   ``H`` (:class:`int`) [unsigned short int]
       Convert a C :ctype:`unsigned short int` to a Python integer object.
 
-   ``I`` (integer) [unsigned int]
+   ``I`` (:class:`int`) [unsigned int]
       Convert a C :ctype:`unsigned int` to a Python integer object.
 
-   ``k`` (integer) [unsigned long]
+   ``k`` (:class:`int`) [unsigned long]
       Convert a C :ctype:`unsigned long` to a Python integer object.
 
-   ``L`` (long) [PY_LONG_LONG]
+   ``L`` (:class:`int`) [PY_LONG_LONG]
       Convert a C :ctype:`long long` to a Python integer object. Only available
-      on platforms that support :ctype:`long long`.
+      on platforms that support :ctype:`long long` (or :ctype:`_int64` on
+      Windows).
 
-   ``K`` (long) [unsigned PY_LONG_LONG]
+   ``K`` (:class:`int`) [unsigned PY_LONG_LONG]
       Convert a C :ctype:`unsigned long long` to a Python integer object. Only
-      available on platforms that support :ctype:`unsigned long long`.
+      available on platforms that support :ctype:`unsigned long long` (or
+      :ctype:`unsigned _int64` on Windows).
 
-   ``n`` (int) [Py_ssize_t]
+   ``n`` (:class:`int`) [Py_ssize_t]
       Convert a C :ctype:`Py_ssize_t` to a Python integer.
 
-   ``c`` (string of length 1) [char]
-      Convert a C :ctype:`int` representing a byte to a Python byte string of
+   ``c`` (:class:`bytes` of length 1) [char]
+      Convert a C :ctype:`int` representing a byte to a Python :class:`bytes` object of
       length 1.
 
-   ``C`` (string of length 1) [int]
-      Convert a C :ctype:`int` representing a character to Python unicode
-      string of length 1.
+   ``C`` (:class:`str` of length 1) [int]
+      Convert a C :ctype:`int` representing a character to Python :class:`str`
+      object of length 1.
 
-   ``d`` (float) [double]
+   ``d`` (:class:`float`) [double]
       Convert a C :ctype:`double` to a Python floating point number.
 
-   ``f`` (float) [float]
-      Same as ``d``.
+   ``f`` (:class:`float`) [float]
+      Convert a C :ctype:`float` to a Python floating point number.
 
-   ``D`` (complex) [Py_complex \*]
+   ``D`` (:class:`complex`) [Py_complex \*]
       Convert a C :ctype:`Py_complex` structure to a Python complex number.
 
    ``O`` (object) [PyObject \*]
@@ -611,13 +605,13 @@
       \*`) as its argument and should return a "new" Python object, or *NULL* if an
       error occurred.
 
-   ``(items)`` (tuple) [*matching-items*]
+   ``(items)`` (:class:`tuple`) [*matching-items*]
       Convert a sequence of C values to a Python tuple with the same number of items.
 
-   ``[items]`` (list) [*matching-items*]
+   ``[items]`` (:class:`list`) [*matching-items*]
       Convert a sequence of C values to a Python list with the same number of items.
 
-   ``{items}`` (dictionary) [*matching-items*]
+   ``{items}`` (:class:`dict`) [*matching-items*]
       Convert a sequence of C values to a Python dictionary.  Each pair of consecutive
       C values adds one item to the dictionary, serving as key and value,
       respectively.

Modified: python/branches/py3k-jit/Doc/c-api/buffer.rst
==============================================================================
--- python/branches/py3k-jit/Doc/c-api/buffer.rst	(original)
+++ python/branches/py3k-jit/Doc/c-api/buffer.rst	Wed Jun 16 18:21:24 2010
@@ -249,10 +249,10 @@
       +------------------------------+---------------------------------------------------+
 
 
-.. cfunction:: void PyBuffer_Release(PyObject *obj, Py_buffer *view)
+.. cfunction:: void PyBuffer_Release(Py_buffer *view)
 
-   Release the buffer *view* over *obj*.  This should be called when the buffer
-   is no longer being used as it may free memory from it.
+   Release the buffer *view*.  This should be called when the buffer is no
+   longer being used as it may free memory from it.
 
 
 .. cfunction:: Py_ssize_t PyBuffer_SizeFromFormat(const char *)

Modified: python/branches/py3k-jit/Doc/distutils/builtdist.rst
==============================================================================
--- python/branches/py3k-jit/Doc/distutils/builtdist.rst	(original)
+++ python/branches/py3k-jit/Doc/distutils/builtdist.rst	Wed Jun 16 18:21:24 2010
@@ -322,7 +322,7 @@
 option.
 
 By default the installer will display the cool "Python Powered" logo when it is
-run, but you can also supply your own bitmap which must be a Windows
+run, but you can also supply your own 152x161 bitmap which must be a Windows
 :file:`.bmp` file with the :option:`--bitmap` option.
 
 The installer will also display a large title on the desktop background window

Modified: python/branches/py3k-jit/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/py3k-jit/Doc/extending/newtypes.rst	(original)
+++ python/branches/py3k-jit/Doc/extending/newtypes.rst	Wed Jun 16 18:21:24 2010
@@ -430,7 +430,7 @@
    Noddy_members,             /* tp_members */
 
 Each member definition has a member name, type, offset, access flags and
-documentation string. See the "Generic Attribute Management" section below for
+documentation string. See the :ref:`Generic-Attribute-Management` section below for
 details.
 
 A disadvantage of this approach is that it doesn't provide a way to restrict the
@@ -1078,6 +1078,8 @@
 not been updated to use some of the new generic mechanism that is available.
 
 
+.. _generic-attribute-management:
+
 Generic Attribute Management
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

Modified: python/branches/py3k-jit/Doc/library/argparse.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/argparse.rst	(original)
+++ python/branches/py3k-jit/Doc/library/argparse.rst	Wed Jun 16 18:21:24 2010
@@ -452,7 +452,7 @@
 
 By default, :class:`ArgumentParser` objects uses ``sys.argv[0]`` to determine
 how to display the name of the program in help messages.  This default is almost
-always desirable because it will make the help messages match how the pgoram was
+always desirable because it will make the help messages match how the program was
 invoked on the command line.  For example, consider a file named
 ``myprogram.py`` with the following code::
 

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	Wed Jun 16 18:21:24 2010
@@ -28,11 +28,14 @@
 have an optional time zone information member, :attr:`tzinfo`, that can contain
 an instance of a subclass of the abstract :class:`tzinfo` class.  These
 :class:`tzinfo` objects capture information about the offset from UTC time, the
-time zone name, and whether Daylight Saving Time is in effect.  Note that no
-concrete :class:`tzinfo` classes are supplied by the :mod:`datetime` module.
-Supporting timezones at whatever level of detail is required is up to the
-application.  The rules for time adjustment across the world are more political
-than rational, and there is no standard suitable for every application.
+time zone name, and whether Daylight Saving Time is in effect.  Note that only
+one concrete :class:`tzinfo` class, the :class:`timezone` class, is supplied by the
+:mod:`datetime` module.  The :class:`timezone` class can reprsent simple
+timezones with fixed offset from UTC such as UTC itself or North American EST and
+EDT timezones.  Supporting timezones at whatever level of detail is
+required is up to the application.  The rules for time adjustment across the
+world are more political than rational, change frequently, and there is no
+standard suitable for every application aside from UTC.
 
 The :mod:`datetime` module exports the following constants:
 
@@ -99,6 +102,14 @@
    time adjustment (for example, to account for time zone and/or daylight saving
    time).
 
+.. class:: timezone
+
+   A class that implements the :class:`tzinfo` abstract base class as a
+   fixed offset from the UTC.
+
+   .. versionadded:: 3.2
+
+
 Objects of these types are immutable.
 
 Objects of the :class:`date` type are always naive.
@@ -116,6 +127,7 @@
    object
        timedelta
        tzinfo
+           timezone
        time
        date
            datetime
@@ -220,12 +232,20 @@
 |                                | In general, *t1* \* i == *t1* \* (i-1) + *t1* |
 |                                | is true. (1)                                  |
 +--------------------------------+-----------------------------------------------+
+| ``t1 = t2 * f or t1 = f * t2`` | Delta multiplied by a float. The result is    |
+|                                | rounded to the nearest multiple of            |
+|                                | timedelta.resolution using round-half-to-even.|
++--------------------------------+-----------------------------------------------+
 | ``f = t2 / t3``                | Division (3) of *t2* by *t3*.  Returns a      |
 |                                | :class:`float` object.                        |
 +--------------------------------+-----------------------------------------------+
+| ``t1 = t2 / f or t1 = t2 / i`` | Delta divided by a float or an int. The result|
+|                                | is rounded to the nearest multiple of         |
+|                                | timedelta.resolution using round-half-to-even.|
++--------------------------------+-----------------------------------------------+
 | ``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)                       |
+|                                | integer is returned. (3)                      |
 +--------------------------------+-----------------------------------------------+
 | ``t1 = t2 % t3``               | The remainder is computed as a                |
 |                                | :class:`timedelta` object. (3)                |
@@ -267,7 +287,9 @@
 .. 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.
+   remainder operations and the :func:`divmod` function.  True
+   division and multiplication of a :class:`timedelta` object by
+   a :class:`float` object are now supported.
 
 
 Comparisons of :class:`timedelta` objects are supported with the
@@ -470,7 +492,9 @@
    Return a :class:`time.struct_time` such as returned by :func:`time.localtime`.
    The hours, minutes and seconds are 0, and the DST flag is -1. ``d.timetuple()``
    is equivalent to ``time.struct_time((d.year, d.month, d.day, 0, 0, 0,
-   d.weekday(), d.toordinal() - date(d.year, 1, 1).toordinal() + 1, -1))``
+   d.weekday(), yday, -1))``, where ``yday = d.toordinal() - date(d.year, 1,
+   1).toordinal() + 1`` is the day number within the current year starting with
+   ``1`` for January 1st.
 
 
 .. method:: date.toordinal()
@@ -648,8 +672,8 @@
 
    Return the current UTC date and time, with :attr:`tzinfo` ``None``. This is like
    :meth:`now`, but returns the current UTC date and time, as a naive
-   :class:`datetime` object. See also :meth:`now`.
-
+   :class:`datetime` object.  An aware current UTC datetime can be obtained by
+   calling ``datetime.now(timezone.utc)``.  See also :meth:`now`.
 
 .. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
 
@@ -934,12 +958,13 @@
 
    Return a :class:`time.struct_time` such as returned by :func:`time.localtime`.
    ``d.timetuple()`` is equivalent to ``time.struct_time((d.year, d.month, d.day,
-   d.hour, d.minute, d.second, d.weekday(), d.toordinal() - date(d.year, 1,
-   1).toordinal() + 1, dst))`` The :attr:`tm_isdst` flag of the result is set
-   according to the :meth:`dst` method:  :attr:`tzinfo` is ``None`` or :meth:`dst`
-   returns ``None``, :attr:`tm_isdst` is set to  ``-1``; else if :meth:`dst`
-   returns a non-zero value, :attr:`tm_isdst` is set to ``1``; else ``tm_isdst`` is
-   set to ``0``.
+   d.hour, d.minute, d.second, d.weekday(), yday, dst))``, where ``yday =
+   d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the day number within
+   the current year starting with ``1`` for January 1st. The :attr:`tm_isdst` flag
+   of the result is set according to the :meth:`dst` method: :attr:`tzinfo` is
+   ``None`` or :meth:`dst`` returns ``None``, :attr:`tm_isdst` is set to ``-1``;
+   else if :meth:`dst` returns a non-zero value, :attr:`tm_isdst` is set to ``1``;
+   else :attr:`tm_isdst` is set to ``0``.
 
 
 .. method:: datetime.utctimetuple()
@@ -1305,8 +1330,10 @@
 :class:`tzinfo` is an abstract base class, meaning that this class should not be
 instantiated directly.  You need to derive a concrete subclass, and (at least)
 supply implementations of the standard :class:`tzinfo` methods needed by the
-:class:`datetime` methods you use.  The :mod:`datetime` module does not supply
-any concrete subclasses of :class:`tzinfo`.
+:class:`datetime` methods you use.  The :mod:`datetime` module supplies
+a simple concrete subclass of :class:`tzinfo` :class:`timezone` which can reprsent
+timezones with fixed offset from UTC such as UTC itself or North American EST and
+EDT.
 
 An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the
 constructors for :class:`datetime` and :class:`time` objects. The latter objects
@@ -1507,9 +1534,65 @@
 standard local time.
 
 Applications that can't bear such ambiguities should avoid using hybrid
-:class:`tzinfo` subclasses; there are no ambiguities when using UTC, or any
-other fixed-offset :class:`tzinfo` subclass (such as a class representing only
-EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
+:class:`tzinfo` subclasses; there are no ambiguities when using :class:`timezone`,
+or any other fixed-offset :class:`tzinfo` subclass (such as a class representing
+only EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
+
+
+.. _datetime-timezone:
+
+:class:`timezone` Objects
+--------------------------
+
+A :class:`timezone` object represents a timezone that is defined by a
+fixed offset from UTC.  Note that objects of this class cannot be used
+to represent timezone information in the locations where different
+offsets are used in different days of the year or where historical
+changes have been made to civil time.
+
+
+.. class:: timezone(offset[, name])
+
+  The ``offset`` argument must be specified as a :class:`timedelta`
+  object representing the difference between the local time and UTC.  It must
+  be within the range [``-timedelta(hours=23, minutes=59),
+  ``timedelta(hours=23, minutes=59)``] and represent whole number of minutes,
+  otherwise :exc:`ValueError` is raised.
+
+  The ``name`` argument is optional.  If specified it must be a string that
+  used as the value returned by the ``tzname(dt)`` method.  Otherwise,
+  ``tzname(dt)`` returns a string 'UTCsHH:MM', where s is the sign of
+  ``offset``, HH and MM are two digits of ``offset.hours`` and
+  ``offset.minutes`` respectively.
+
+.. method:: timezone.utcoffset(self, dt)
+
+  Returns the fixed value specified when the :class:`timezone` instance is
+  constructed.  The ``dt`` argument is ignored.  The return value is a
+  :class:`timedelta` instance equal to the difference between the
+  local time and UTC.
+
+.. method:: timezone.tzname(self, dt)
+
+  Returns the fixed value specified when the :class:`timezone` instance is
+  constructed or a string 'UTCsHH:MM', where s is the sign of
+  ``offset``, HH and MM are two digits of ``offset.hours`` and
+  ``offset.minutes`` respectively.  The ``dt`` argument is ignored.
+
+.. method:: timezone.dst(self, dt)
+
+  Always returns ``None``.
+
+.. method:: timezone.fromutc(self, dt)
+
+  Returns ``dt + offset``.  The ``dt`` argument must be aware with ``tzinfo``
+  set to ``self``.
+
+Class attributes:
+
+.. attribute:: timezone.utc
+
+   The UTC timezone, ``timezone(0, 'UTC')``.
 
 
 .. _strftime-strptime-behavior:

Modified: python/branches/py3k-jit/Doc/library/decimal.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/decimal.rst	(original)
+++ python/branches/py3k-jit/Doc/library/decimal.rst	Wed Jun 16 18:21:24 2010
@@ -363,23 +363,17 @@
    compared, sorted, and coerced to another type (such as :class:`float` or
    :class:`int`).
 
-   Decimal objects cannot generally be combined with floats in
-   arithmetic operations: an attempt to add a :class:`Decimal` to a
-   :class:`float`, for example, will raise a :exc:`TypeError`.
-   There's one exception to this rule: it's possible to use Python's
-   comparison operators to compare a :class:`float` instance ``x``
-   with a :class:`Decimal` instance ``y``.  Without this exception,
-   comparisons between :class:`Decimal` and :class:`float` instances
-   would follow the general rules for comparing objects of different
-   types described in the :ref:`expressions` section of the reference
-   manual, leading to confusing results.
+   Decimal objects cannot generally be combined with floats or
+   instances of :class:`fractions.Fraction` in arithmetic operations:
+   an attempt to add a :class:`Decimal` to a :class:`float`, for
+   example, will raise a :exc:`TypeError`.  However, it is possible to
+   use Python's comparison operators to compare a :class:`Decimal`
+   instance ``x`` with another number ``y``.  This avoids confusing results
+   when doing equality comparisons between numbers of different types.
 
    .. versionchanged:: 3.2
-      A comparison between a :class:`float` instance ``x`` and a
-      :class:`Decimal` instance ``y`` now returns a result based on
-      the values of ``x`` and ``y``.  In earlier versions ``x < y``
-      returned the same (arbitrary) result for any :class:`Decimal`
-      instance ``x`` and any :class:`float` instance ``y``.
+      Mixed-type comparisons between :class:`Decimal` instances and
+      other numeric types are now fully supported.
 
    In addition to the standard numeric properties, decimal floating point
    objects also have a number of specialized methods:
@@ -874,7 +868,7 @@
 
    This context is used by the :class:`Context` constructor as a prototype for new
    contexts.  Changing a field (such a precision) has the effect of changing the
-   default for new contexts creating by the :class:`Context` constructor.
+   default for new contexts created by the :class:`Context` constructor.
 
    This context is most useful in multi-threaded environments.  Changing one of the
    fields before threads are started has the effect of setting system-wide

Modified: python/branches/py3k-jit/Doc/library/dis.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/dis.rst	(original)
+++ python/branches/py3k-jit/Doc/library/dis.rst	Wed Jun 16 18:21:24 2010
@@ -383,13 +383,6 @@
 the stack so that it is available for further iterations of the loop.
 
 
-.. opcode:: LOAD_LOCALS ()
-
-   Pushes a reference to the locals of the current scope on the stack. This is used
-   in the code for a class definition: After the class body is evaluated, the
-   locals are passed to the class definition.
-
-
 .. opcode:: RETURN_VALUE ()
 
    Returns with TOS to the caller of the function.

Modified: python/branches/py3k-jit/Doc/library/doctest.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/doctest.rst	(original)
+++ python/branches/py3k-jit/Doc/library/doctest.rst	Wed Jun 16 18:21:24 2010
@@ -444,8 +444,9 @@
   with an alphanumeric is taken to be the start of the exception detail.  Of
   course this does the right thing for genuine tracebacks.
 
-* When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is is specified,
-  everything following the leftmost colon is ignored.
+* When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified,
+  everything following the leftmost colon and any module information in the
+  exception name is ignored.
 
 * The interactive shell omits the traceback header line for some
   :exc:`SyntaxError`\ s.  But doctest uses the traceback header line to
@@ -535,20 +536,38 @@
    exception raised is ``ValueError: 3*14``, but will fail, e.g., if
    :exc:`TypeError` is raised.
 
-   Note that a similar effect can be obtained using :const:`ELLIPSIS`, and
-   :const:`IGNORE_EXCEPTION_DETAIL` may go away when Python releases prior to 2.4
-   become uninteresting.  Until then, :const:`IGNORE_EXCEPTION_DETAIL` is the only
-   clear way to write a doctest that doesn't care about the exception detail yet
-   continues to pass under Python releases prior to 2.4 (doctest directives appear
-   to be comments to them).  For example, ::
+   It will also ignore the module name used in Python 3 doctest reports. Hence
+   both these variations will work regardless of whether the test is run under
+   Python 2.7 or Python 3.2 (or later versions):
+
+      >>> raise CustomError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
+      Traceback (most recent call last):
+      CustomError: message
+
+      >>> raise CustomError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
+      Traceback (most recent call last):
+      my_module.CustomError: message
+
+   Note that :const:`ELLIPSIS` can also be used to ignore the
+   details of the exception message, but such a test may still fail based
+   on whether or not the module details are printed as part of the
+   exception name. Using :const:`IGNORE_EXCEPTION_DETAIL` and the details
+   from Python 2.3 is also the only clear way to write a doctest that doesn't
+   care about the exception detail yet continues to pass under Python 2.3 or
+   earlier (those releases do not support doctest directives and ignore them
+   as irrelevant comments). For example, ::
 
       >>> (1, 2)[3] = 'moo' #doctest: +IGNORE_EXCEPTION_DETAIL
       Traceback (most recent call last):
         File "<stdin>", line 1, in ?
       TypeError: object doesn't support item assignment
 
-   passes under Python 2.4 and Python 2.3.  The detail changed in 2.4, to say "does
-   not" instead of "doesn't".
+   passes under Python 2.3 and later Python versions, even though the detail
+   changed in Python 2.4 to say "does not" instead of "doesn't".
+
+   .. versionchanged:: 3.2
+      :const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information
+      relating to the module containing the exception under test
 
 
 .. data:: SKIP
@@ -663,7 +682,6 @@
 functions that run doctests, establishing different defaults.  In such cases,
 disabling an option via ``-`` in a directive can be useful.
 
-
 There's also a way to register new option flag names, although this isn't useful
 unless you intend to extend :mod:`doctest` internals via subclassing:
 

Modified: python/branches/py3k-jit/Doc/library/ftplib.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/ftplib.rst	(original)
+++ python/branches/py3k-jit/Doc/library/ftplib.rst	Wed Jun 16 18:21:24 2010
@@ -65,7 +65,7 @@
       Support for the :keyword:`with` statement was added.
 
 
-.. class:: FTP_TLS(host='', user='', passwd='', acct='', [keyfile[, certfile[, timeout]]])
+.. class:: FTP_TLS(host='', user='', passwd='', acct='', [keyfile[, certfile[, context[, timeout]]]])
 
    A :class:`FTP` subclass which adds TLS support to FTP as described in
    :rfc:`4217`.
@@ -74,6 +74,9 @@
    explicitly ask for it by calling the :meth:`prot_p` method.
    *keyfile* and *certfile* are optional -- they can contain a PEM formatted
    private key and certificate chain file name for the SSL connection.
+   *context* parameter is a :class:`ssl.SSLContext` object which allows
+   bundling SSL configuration options, certificates and private keys into a
+   single (potentially long-lived) structure.
 
    .. versionadded:: 3.2
 

Modified: python/branches/py3k-jit/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/functions.rst	(original)
+++ python/branches/py3k-jit/Doc/library/functions.rst	Wed Jun 16 18:21:24 2010
@@ -1227,7 +1227,7 @@
       True
 
 
-.. function:: __import__(name, globals={}, locals={}, fromlist=[], level=-1)
+.. function:: __import__(name, globals={}, locals={}, fromlist=[], level=0)
 
    .. index::
       statement: import

Modified: python/branches/py3k-jit/Doc/library/io.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/io.rst	(original)
+++ python/branches/py3k-jit/Doc/library/io.rst	Wed Jun 16 18:21:24 2010
@@ -314,10 +314,12 @@
 
    .. method:: truncate(size=None)
 
-      Truncate the file to at most *size* bytes.  *size* defaults to the current
-      file position, as returned by :meth:`tell`.  Note that the current file
-      position isn't changed; if you want to change it to the new end of
-      file, you have to :meth:`seek()` explicitly.
+      Resize the stream to the given *size* in bytes (or the current position
+      if *size* is not specified).  The current stream position isn't changed.
+      This resizing can extend or reduce the current file size.  In case of
+      extension, the contents of the new file area depend on the platform
+      (on most systems, additional bytes are zero-filled, on Windows they're
+      undetermined).  The new file size is returned.
 
    .. method:: writable()
 

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	Wed Jun 16 18:21:24 2010
@@ -159,10 +159,10 @@
 .. function:: fsencode(value)
 
    Encode *value* to bytes for use in the file system, environment variables or
-   the command line. Uses :func:`sys.getfilesystemencoding` and
-   ``'surrogateescape'`` error handler for strings and returns bytes unchanged.
-
-   Availability: Unix.
+   the command line. Use :func:`sys.getfilesystemencoding` and
+   ``'surrogateescape'`` error handler for strings and return bytes unchanged.
+   On Windows, use ``'strict'`` error handler for strings if the file system
+   encoding is ``'mbcs'`` (which is the default encoding).
 
    .. versionadded:: 3.2
 

Modified: python/branches/py3k-jit/Doc/library/socket.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/socket.rst	(original)
+++ python/branches/py3k-jit/Doc/library/socket.rst	Wed Jun 16 18:21:24 2010
@@ -211,27 +211,44 @@
       *source_address* was added.
 
 
-.. function:: getaddrinfo(host, port[, family[, socktype[, proto[, flags]]]])
+.. function:: getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0)
 
-   Resolves the *host*/*port* argument, into a sequence of 5-tuples that contain
-   all the necessary arguments for creating the corresponding socket. *host* is a domain
-   name, a string representation of an IPv4/v6 address or ``None``. *port* is a string
-   service name such as ``'http'``, a numeric port number or ``None``.
-   The rest of the arguments are optional and must be numeric if specified.
-   By passing ``None`` as the value of *host* and *port*, , you can pass ``NULL`` to the C API.
+   Translate the *host*/*port* argument into a sequence of 5-tuples that contain
+   all the necessary arguments for creating a socket connected to that service.
+   *host* is a domain name, a string representation of an IPv4/v6 address
+   or ``None``. *port* is a string service name such as ``'http'``, a numeric
+   port number or ``None``.  By passing ``None`` as the value of *host*
+   and *port*, you can pass ``NULL`` to the underlying C API.
+
+   The *family*, *socktype* and *proto* arguments can be optionally specified
+   in order to narrow the list of addresses returned.  Passing zero as a
+   value for each of these arguments selects the full range of results.
+   The *flags* argument can be one or several of the ``AI_*`` constants,
+   and will influence how results are computed and returned.
+   For example, :const:`AI_NUMERICHOST` will disable domain name resolution
+   and will raise an error if *host* is a domain name.
 
-   The :func:`getaddrinfo` function returns a list of 5-tuples with the following
-   structure:
+   The function returns a list of 5-tuples with the following structure:
 
    ``(family, socktype, proto, canonname, sockaddr)``
 
-   *family*, *socktype*, *proto* are all integers and are meant to be passed to the
-   :func:`socket` function. *canonname* is a string representing the canonical name
-   of the *host*. It can be a numeric IPv4/v6 address when :const:`AI_CANONNAME` is
-   specified for a numeric *host*. *sockaddr* is a tuple describing a socket
-   address, as described above. See the source for :mod:`socket` and other
-   library modules for a typical usage of the function.
-
+   In these tuples, *family*, *socktype*, *proto* are all integers and are
+   meant to be passed to the :func:`socket` function.  *canonname* will be
+   a string representing the canonical name of the *host* if
+   :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname*
+   will be empty.  *sockaddr* is a tuple describing a socket address, whose
+   format depends on the returned *family* (a ``(address, port)`` 2-tuple for
+   :const:`AF_INET`, a ``(address, port, flow info, scope id)`` 4-tuple for
+   :const:`AF_INET6`), and is meant to be passed to the :meth:`socket.connect`
+   method.
+
+   The following example fetches address information for a hypothetical TCP
+   connection to ``www.python.org`` on port 80 (results may differ on your
+   system if IPv6 isn't enabled)::
+
+      >>> socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)
+      [(2, 1, 6, '', ('82.94.164.162', 80)),
+       (10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]
 
 .. function:: getfqdn([name])
 

Modified: python/branches/py3k-jit/Doc/library/sqlite3.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/sqlite3.rst	(original)
+++ python/branches/py3k-jit/Doc/library/sqlite3.rst	Wed Jun 16 18:21:24 2010
@@ -227,6 +227,13 @@
    one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section
    :ref:`sqlite3-controlling-transactions` for a more detailed explanation.
 
+.. attribute:: Connection.in_transaction
+
+   .. versionadded:: 3.2
+
+   :const:`True` if a transaction is active (there are uncommitted changes),
+   :const:`False` otherwise.  Read-only attribute.
+
 
 .. method:: Connection.cursor([cursorClass])
 
@@ -806,7 +813,8 @@
 before executing that command. There are two reasons for doing that. The first
 is that some of these commands don't work within transactions. The other reason
 is that sqlite3 needs to keep track of the transaction state (if a transaction
-is active or not).
+is active or not).  The current transaction state is exposed through the
+:attr:`Connection.in_transaction` attribute of the connection object.
 
 You can control which kind of ``BEGIN`` statements sqlite3 implicitly executes
 (or none at all) via the *isolation_level* parameter to the :func:`connect`

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	Wed Jun 16 18:21:24 2010
@@ -407,6 +407,16 @@
    other side of the connection, rather than the original socket.
 
 
+.. attribute:: SSLSocket.context
+
+   The :class:`SSLContext` object this SSL socket is tied to.  If the SSL
+   socket was created using the top-level :func:`wrap_socket` function
+   (rather than :meth:`SSLContext.wrap_socket`), this is a custom context
+   object created for this SSL socket.
+
+   .. versionadded:: 3.2
+
+
 SSL Contexts
 ------------
 

Modified: python/branches/py3k-jit/Doc/library/struct.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/struct.rst	(original)
+++ python/branches/py3k-jit/Doc/library/struct.rst	Wed Jun 16 18:21:24 2010
@@ -38,38 +38,38 @@
 
 .. function:: pack(fmt, v1, v2, ...)
 
-   Return a bytes containing the values ``v1, v2, ...`` packed according to the
-   given format.  The arguments must match the values required by the format
-   exactly.
+   Return a bytes object containing the values *v1*, *v2*, ... packed according
+   to the format string *fmt*.  The arguments must match the values required by
+   the format exactly.
 
 
 .. function:: pack_into(fmt, buffer, offset, v1, v2, ...)
 
-   Pack the values ``v1, v2, ...`` according to the given format, write the
-   packed bytes into the writable *buffer* starting at *offset*. Note that the
-   offset is a required argument.
+   Pack the values *v1*, *v2*, ... according to the format string *fmt* and
+   write the packed bytes into the writable buffer *buffer* starting at
+   position *offset*. Note that *offset* is a required argument.
 
 
-.. function:: unpack(fmt, bytes)
+.. function:: unpack(fmt, buffer)
 
-   Unpack the bytes (presumably packed by ``pack(fmt, ...)``) according to the
-   given format.  The result is a tuple even if it contains exactly one item.
-   The bytes must contain exactly the amount of data required by the format
-   (``len(bytes)`` must equal ``calcsize(fmt)``).
+   Unpack from the buffer *buffer* (presumably packed by ``pack(fmt, ...)``)
+   according to the format string *fmt*.  The result is a tuple even if it
+   contains exactly one item.  The buffer must contain exactly the amount of
+   data required by the format (``len(bytes)`` must equal ``calcsize(fmt)``).
 
 
 .. function:: unpack_from(fmt, buffer, offset=0)
 
-   Unpack the *buffer* according to the given format. The result is a tuple even
-   if it contains exactly one item. The *buffer* must contain at least the
-   amount of data required by the format (``len(buffer[offset:])`` must be at
-   least ``calcsize(fmt)``).
+   Unpack from *buffer* starting at position *offset*, according to the format
+   string *fmt*.  The result is a tuple even if it contains exactly one
+   item.  *buffer* must contain at least the amount of data required by the
+   format (``len(buffer[offset:])`` must be at least ``calcsize(fmt)``).
 
 
 .. function:: calcsize(fmt)
 
-   Return the size of the struct (and hence of the bytes) corresponding to the
-   given format.
+   Return the size of the struct (and hence of the bytes object produced by
+   ``pack(fmt, ...)``) corresponding to the format string *fmt*.
 
 .. _struct-format-strings:
 
@@ -77,9 +77,84 @@
 --------------
 
 Format strings are the mechanism used to specify the expected layout when
-packing and unpacking data.  They are built up from format characters, which
-specify the type of data being packed/unpacked.  In addition, there are
-special characters for controlling the byte order, size, and alignment.
+packing and unpacking data.  They are built up from :ref:`format-characters`,
+which specify the type of data being packed/unpacked.  In addition, there are
+special characters for controlling the :ref:`struct-alignment`.
+
+
+.. _struct-alignment:
+
+Byte Order, Size, and Alignment
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+By default, C types are represented in the machine's native format and byte
+order, and properly aligned by skipping pad bytes if necessary (according to the
+rules used by the C compiler).
+
+Alternatively, the first character of the format string can be used to indicate
+the byte order, size and alignment of the packed data, according to the
+following table:
+
++-----------+------------------------+--------------------+
+| Character | Byte order             | Size and alignment |
++===========+========================+====================+
+| ``@``     | native                 | native             |
++-----------+------------------------+--------------------+
+| ``=``     | native                 | standard           |
++-----------+------------------------+--------------------+
+| ``<``     | little-endian          | standard           |
++-----------+------------------------+--------------------+
+| ``>``     | big-endian             | standard           |
++-----------+------------------------+--------------------+
+| ``!``     | network (= big-endian) | standard           |
++-----------+------------------------+--------------------+
+
+If the first character is not one of these, ``'@'`` is assumed.
+
+Native byte order is big-endian or little-endian, depending on the host
+system. For example, Intel x86 and AMD64 (x86-64) are little-endian;
+Motorola 68000 and PowerPC G5 are big-endian; ARM and Intel Itanium feature
+switchable endianness (bi-endian). Use ``sys.byteorder`` to check the
+endianness of your system.
+
+Native size and alignment are determined using the C compiler's
+``sizeof`` expression.  This is always combined with native byte order.
+
+Standard size and alignment are as follows: no alignment is required for any
+type (so you have to use pad bytes); :ctype:`short` is 2 bytes; :ctype:`int` and
+:ctype:`long` are 4 bytes; :ctype:`long long` (:ctype:`__int64` on Windows) is 8
+bytes; :ctype:`float` and :ctype:`double` are 32-bit and 64-bit IEEE floating
+point numbers, respectively. :ctype:`_Bool` is 1 byte.
+
+Note the difference between ``'@'`` and ``'='``: both use native byte order, but
+the size and alignment of the latter is standardized.
+
+The form ``'!'`` is available for those poor souls who claim they can't remember
+whether network byte order is big-endian or little-endian.
+
+There is no way to indicate non-native byte order (force byte-swapping); use the
+appropriate choice of ``'<'`` or ``'>'``.
+
+The ``'P'`` format character is only available for the native byte ordering
+(selected as the default or with the ``'@'`` byte order character). The byte
+order character ``'='`` chooses to use little- or big-endian ordering based on
+the host system. The struct module does not interpret this as native ordering,
+so the ``'P'`` format is not available.
+
+Notes:
+
+(1) Padding is only automatically added between successive structure members.
+    No padding is added at the beginning or the end of the encoded struct.
+
+(2) No padding is added when using non-native size and alignment, e.g.
+    with '<', '>', '=', and '!'.
+
+(3) To align the end of a structure to the alignment requirement of a
+    particular type, end the format with the code for that type with a repeat
+    count of zero.  See :ref:`struct-examples`.
+
+
+.. _format-characters:
 
 Format Characters
 ^^^^^^^^^^^^^^^^^
@@ -87,46 +162,46 @@
 Format characters have the following meaning; the conversion between C and
 Python values should be obvious given their types:
 
-+--------+-------------------------+--------------------+------------+
-| Format | C Type                  | Python             | Notes      |
-+========+=========================+====================+============+
-| ``x``  | pad byte                | no value           |            |
-+--------+-------------------------+--------------------+------------+
-| ``c``  | :ctype:`char`           | bytes of length 1  |            |
-+--------+-------------------------+--------------------+------------+
-| ``b``  | :ctype:`signed char`    | integer            | \(1),\(4)  |
-+--------+-------------------------+--------------------+------------+
-| ``B``  | :ctype:`unsigned char`  | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``?``  | :ctype:`_Bool`          | bool               | \(2)       |
-+--------+-------------------------+--------------------+------------+
-| ``h``  | :ctype:`short`          | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``H``  | :ctype:`unsigned short` | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``i``  | :ctype:`int`            | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``I``  | :ctype:`unsigned int`   | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``l``  | :ctype:`long`           | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``L``  | :ctype:`unsigned long`  | integer            | \(4)       |
-+--------+-------------------------+--------------------+------------+
-| ``q``  | :ctype:`long long`      | integer            | \(3), \(4) |
-+--------+-------------------------+--------------------+------------+
-| ``Q``  | :ctype:`unsigned long   | integer            | \(3), \(4) |
-|        | long`                   |                    |            |
-+--------+-------------------------+--------------------+------------+
-| ``f``  | :ctype:`float`          | float              |            |
-+--------+-------------------------+--------------------+------------+
-| ``d``  | :ctype:`double`         | float              |            |
-+--------+-------------------------+--------------------+------------+
-| ``s``  | :ctype:`char[]`         | bytes              | \(1)       |
-+--------+-------------------------+--------------------+------------+
-| ``p``  | :ctype:`char[]`         | bytes              | \(1)       |
-+--------+-------------------------+--------------------+------------+
-| ``P``  | :ctype:`void \*`        | integer            |            |
-+--------+-------------------------+--------------------+------------+
++--------+-------------------------+--------------------+----------------+------------+
+| Format | C Type                  | Python type        | Standard size  | Notes      |
++========+=========================+====================+================+============+
+| ``x``  | pad byte                | no value           |                |            |
++--------+-------------------------+--------------------+----------------+------------+
+| ``c``  | :ctype:`char`           | bytes of length 1  | 1              |            |
++--------+-------------------------+--------------------+----------------+------------+
+| ``b``  | :ctype:`signed char`    | integer            | 1              | \(1),\(4)  |
++--------+-------------------------+--------------------+----------------+------------+
+| ``B``  | :ctype:`unsigned char`  | integer            | 1              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``?``  | :ctype:`_Bool`          | bool               | 1              | \(2)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``h``  | :ctype:`short`          | integer            | 2              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``H``  | :ctype:`unsigned short` | integer            | 2              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``i``  | :ctype:`int`            | integer            | 4              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``I``  | :ctype:`unsigned int`   | integer            | 4              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``l``  | :ctype:`long`           | integer            | 4              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``L``  | :ctype:`unsigned long`  | integer            | 4              | \(4)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``q``  | :ctype:`long long`      | integer            | 8              | \(3), \(4) |
++--------+-------------------------+--------------------+----------------+------------+
+| ``Q``  | :ctype:`unsigned long   | integer            | 8              | \(3), \(4) |
+|        | long`                   |                    |                |            |
++--------+-------------------------+--------------------+----------------+------------+
+| ``f``  | :ctype:`float`          | float              | 4              |            |
++--------+-------------------------+--------------------+----------------+------------+
+| ``d``  | :ctype:`double`         | float              | 8              |            |
++--------+-------------------------+--------------------+----------------+------------+
+| ``s``  | :ctype:`char[]`         | bytes              |                | \(1)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``p``  | :ctype:`char[]`         | bytes              |                | \(1)       |
++--------+-------------------------+--------------------+----------------+------------+
+| ``P``  | :ctype:`void \*`        | integer            |                |            |
++--------+-------------------------+--------------------+----------------+------------+
 
 Notes:
 
@@ -196,77 +271,6 @@
 any non-zero value will be True when unpacking.
 
 
-.. _struct-alignment:
-
-Byte Order, Size, and Alignment
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-By default, C types are represented in the machine's native format and byte
-order, and properly aligned by skipping pad bytes if necessary (according to the
-rules used by the C compiler).
-
-Alternatively, the first character of the format string can be used to indicate
-the byte order, size and alignment of the packed data, according to the
-following table:
-
-+-----------+------------------------+--------------------+
-| Character | Byte order             | Size and alignment |
-+===========+========================+====================+
-| ``@``     | native                 | native             |
-+-----------+------------------------+--------------------+
-| ``=``     | native                 | standard           |
-+-----------+------------------------+--------------------+
-| ``<``     | little-endian          | standard           |
-+-----------+------------------------+--------------------+
-| ``>``     | big-endian             | standard           |
-+-----------+------------------------+--------------------+
-| ``!``     | network (= big-endian) | standard           |
-+-----------+------------------------+--------------------+
-
-If the first character is not one of these, ``'@'`` is assumed.
-
-Native byte order is big-endian or little-endian, depending on the host
-system. For example, Intel x86 and AMD64 (x86-64) are little-endian;
-Motorola 68000 and PowerPC G5 are big-endian; ARM and Intel Itanium feature
-switchable endianness (bi-endian). Use ``sys.byteorder`` to check the
-endianness of your system.
-
-Native size and alignment are determined using the C compiler's
-``sizeof`` expression.  This is always combined with native byte order.
-
-Standard size and alignment are as follows: no alignment is required for any
-type (so you have to use pad bytes); :ctype:`short` is 2 bytes; :ctype:`int` and
-:ctype:`long` are 4 bytes; :ctype:`long long` (:ctype:`__int64` on Windows) is 8
-bytes; :ctype:`float` and :ctype:`double` are 32-bit and 64-bit IEEE floating
-point numbers, respectively. :ctype:`_Bool` is 1 byte.
-
-Note the difference between ``'@'`` and ``'='``: both use native byte order, but
-the size and alignment of the latter is standardized.
-
-The form ``'!'`` is available for those poor souls who claim they can't remember
-whether network byte order is big-endian or little-endian.
-
-There is no way to indicate non-native byte order (force byte-swapping); use the
-appropriate choice of ``'<'`` or ``'>'``.
-
-The ``'P'`` format character is only available for the native byte ordering
-(selected as the default or with the ``'@'`` byte order character). The byte
-order character ``'='`` chooses to use little- or big-endian ordering based on
-the host system. The struct module does not interpret this as native ordering,
-so the ``'P'`` format is not available.
-
-Notes:
-
-(1) Padding is only automatically added between successive structure members.
-    No padding is added at the beginning or the end of the encoded struct.
-
-(2) No padding is added when using non-native size and alignment, e.g.
-    with '<', '>', '=', and '!'.
-
-(3) To align the end of a structure to the alignment requirement of a
-    particular type, end the format with the code for that type with a repeat
-    count of zero.  See :ref:`struct-examples`.
-
 
 .. _struct-examples:
 
@@ -331,7 +335,7 @@
 
 .. _struct-objects:
 
-Objects
+Classes
 -------
 
 The :mod:`struct` module also defines the following type:
@@ -358,10 +362,10 @@
       Identical to the :func:`pack_into` function, using the compiled format.
 
 
-   .. method:: unpack(bytes)
+   .. method:: unpack(buffer)
 
       Identical to the :func:`unpack` function, using the compiled format.
-      (``len(bytes)`` must equal :attr:`self.size`).
+      (``len(buffer)`` must equal :attr:`self.size`).
 
 
    .. method:: unpack_from(buffer, offset=0)
@@ -376,6 +380,6 @@
 
    .. attribute:: size
 
-      The calculated size of the struct (and hence of the bytes) corresponding
-      to :attr:`format`.
+      The calculated size of the struct (and hence of the bytes object produced
+      by the :meth:`pack` method) corresponding to :attr:`format`.
 

Modified: python/branches/py3k-jit/Doc/library/subprocess.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/subprocess.rst	(original)
+++ python/branches/py3k-jit/Doc/library/subprocess.rst	Wed Jun 16 18:21:24 2010
@@ -89,6 +89,12 @@
    size.  A negative *bufsize* means to use the system default, which usually means
    fully buffered.  The default value for *bufsize* is :const:`0` (unbuffered).
 
+   .. note::
+
+      If you experience performance issues, it is recommended that you try to
+      enable buffering by setting *bufsize* to either -1 or a large enough
+      positive value (such as 4096).
+
    The *executable* argument specifies the program to execute. It is very seldom
    needed: Usually, the program to execute is defined by the *args* argument. If
    ``shell=True``, the *executable* argument specifies which shell to use. On Unix,

Modified: python/branches/py3k-jit/Doc/library/sysconfig.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/sysconfig.rst	(original)
+++ python/branches/py3k-jit/Doc/library/sysconfig.rst	Wed Jun 16 18:21:24 2010
@@ -216,3 +216,35 @@
 .. function:: get_config_h_filename()
 
    Return the path of :file:`pyconfig.h`.
+
+Using :mod:`sysconfig` as a script
+----------------------------------
+
+You can use :mod:`sysconfig` as a script with Python's *-m* option::
+
+    $ python -m sysconfig
+    Platform: "macosx-10.4-i386"
+    Python version: "3.2"
+    Current installation scheme: "posix_prefix"
+
+    Paths:
+            data = "/usr/local"
+            include = "/Users/tarek/Dev/svn.python.org/py3k/Include"
+            platinclude = "."
+            platlib = "/usr/local/lib/python3.2/site-packages"
+            platstdlib = "/usr/local/lib/python3.2"
+            purelib = "/usr/local/lib/python3.2/site-packages"
+            scripts = "/usr/local/bin"
+            stdlib = "/usr/local/lib/python3.2"
+
+    Variables:
+            AC_APPLE_UNIVERSAL_BUILD = "0"
+            AIX_GENUINE_CPLUSPLUS = "0"
+            AR = "ar"
+            ARFLAGS = "rc"
+            ASDLGEN = "./Parser/asdl_c.py"
+            ...
+
+This call will print in the standard output the information returned by
+:func:`get_platform`, :func:`get_python_version`, :func:`get_path` and
+:func:`get_config_vars`.

Modified: python/branches/py3k-jit/Doc/library/tarfile.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/tarfile.rst	(original)
+++ python/branches/py3k-jit/Doc/library/tarfile.rst	Wed Jun 16 18:21:24 2010
@@ -185,8 +185,8 @@
 
 .. data:: ENCODING
 
-   The default character encoding i.e. the value from either
-   :func:`sys.getfilesystemencoding` or :func:`sys.getdefaultencoding`.
+   The default character encoding: ``'utf-8'`` on Windows,
+   :func:`sys.getfilesystemencoding` otherwise.
 
 
 .. seealso::

Modified: python/branches/py3k-jit/Doc/library/time.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/time.rst	(original)
+++ python/branches/py3k-jit/Doc/library/time.rst	Wed Jun 16 18:21:24 2010
@@ -81,30 +81,31 @@
   :func:`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute
   names for individual fields.
 
-  +-------+------------------+------------------------------+
-  | Index | Attribute        | Values                       |
-  +=======+==================+==============================+
-  | 0     | :attr:`tm_year`  | (for example, 1993)          |
-  +-------+------------------+------------------------------+
-  | 1     | :attr:`tm_mon`   | range [1,12]                 |
-  +-------+------------------+------------------------------+
-  | 2     | :attr:`tm_mday`  | range [1,31]                 |
-  +-------+------------------+------------------------------+
-  | 3     | :attr:`tm_hour`  | range [0,23]                 |
-  +-------+------------------+------------------------------+
-  | 4     | :attr:`tm_min`   | range [0,59]                 |
-  +-------+------------------+------------------------------+
-  | 5     | :attr:`tm_sec`   | range [0,61]; see **(1)** in |
-  |       |                  | :func:`strftime` description |
-  +-------+------------------+------------------------------+
-  | 6     | :attr:`tm_wday`  | range [0,6], Monday is 0     |
-  +-------+------------------+------------------------------+
-  | 7     | :attr:`tm_yday`  | range [1,366]                |
-  +-------+------------------+------------------------------+
-  | 8     | :attr:`tm_isdst` | 0, 1 or -1; see below        |
-  +-------+------------------+------------------------------+
+  +-------+-------------------+---------------------------------+
+  | Index | Attribute         | Values                          |
+  +=======+===================+=================================+
+  | 0     | :attr:`tm_year`   | (for example, 1993)             |
+  +-------+-------------------+---------------------------------+
+  | 1     | :attr:`tm_mon`    | range [1, 12]                   |
+  +-------+-------------------+---------------------------------+
+  | 2     | :attr:`tm_mday`   | range [1, 31]                   |
+  +-------+-------------------+---------------------------------+
+  | 3     | :attr:`tm_hour`   | range [0, 23]                   |
+  +-------+-------------------+---------------------------------+
+  | 4     | :attr:`tm_min`    | range [0, 59]                   |
+  +-------+-------------------+---------------------------------+
+  | 5     | :attr:`tm_sec`    | range [0, 61]; see **(1)** in   |
+  |       |                   | :func:`strftime` description    |
+  +-------+-------------------+---------------------------------+
+  | 6     | :attr:`tm_wday`   | range [0, 6], Monday is 0       |
+  +-------+-------------------+---------------------------------+
+  | 7     | :attr:`tm_yday`   | range [1, 366]                  |
+  +-------+-------------------+---------------------------------+
+  | 8     | :attr:`tm_isdst`  | 0, 1 or -1; see below           |
+  +-------+-------------------+---------------------------------+
 
-  Note that unlike the C structure, the month value is a range of 1-12, not 0-11.
+  Note that unlike the C structure, the month value is a range of [1, 12],
+  not [0, 11].
   A year value will be handled as described under "Year 2000 (Y2K) issues" above.
   A ``-1`` argument as the daylight savings flag, passed to :func:`mktime` will
   usually result in the correct daylight savings state to be filled in.

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	Wed Jun 16 18:21:24 2010
@@ -1168,6 +1168,21 @@
       .. versionadded:: 3.1
 
 
+   .. attribute:: maxDiff
+
+      This attribute controls the maximum length of diffs output by assert
+      methods that report diffs on failure. It defaults to 80*8 characters.
+      Assert methods affected by this attribute are
+      :meth:`assertSequenceEqual` (including all the sequence comparison
+      methods that delegate to it), :meth:`assertDictEqual` and
+      :meth:`assertMultiLineEqual`.
+
+      Setting ``maxDiff`` to None means that there is no maximum length of
+      diffs.
+
+      .. versionadded:: 3.2
+
+
    Testing frameworks can use the following methods to collect information on
    the test:
 
@@ -1862,7 +1877,9 @@
 
 If an exception is raised during a ``setUpClass`` then the tests in the class
 are not run and the ``tearDownClass`` is not run. Skipped classes will not
-have ``setUpClass`` or ``tearDownClass`` run.
+have ``setUpClass`` or ``tearDownClass`` run. If the exception is a
+``SkipTest`` exception then the class will be reported as having been skipped
+instead of as an error.
 
 
 setUpModule and tearDownModule
@@ -1877,7 +1894,9 @@
         closeConnection()
 
 If an exception is raised in a ``setUpModule`` then none of the tests in the
-module will be run and the ``tearDownModule`` will not be run.
+module will be run and the ``tearDownModule`` will not be run. If the exception is a
+``SkipTest`` exception then the module will be reported as having been skipped
+instead of as an error.
 
 
 Signal Handling

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	Wed Jun 16 18:21:24 2010
@@ -26,7 +26,7 @@
 
 The :mod:`urllib.parse` module defines the following functions:
 
-.. function:: urlparse(urlstring, default_scheme='', allow_fragments=True)
+.. function:: urlparse(urlstring, scheme='', allow_fragments=True)
 
    Parse a URL into six components, returning a 6-tuple.  This corresponds to the
    general structure of a URL: ``scheme://netloc/path;parameters?query#fragment``.
@@ -48,7 +48,7 @@
       >>> o.geturl()
       'http://www.cwi.nl:80/%7Eguido/Python.html'
 
-   If the *default_scheme* argument is specified, it gives the default addressing
+   If the *scheme* argument is specified, it gives the default addressing
    scheme, to be used only if the URL does not specify one.  The default value for
    this argument is the empty string.
 
@@ -142,7 +142,7 @@
    states that these are equivalent).
 
 
-.. function:: urlsplit(urlstring, default_scheme='', allow_fragments=True)
+.. function:: urlsplit(urlstring, scheme='', allow_fragments=True)
 
    This is similar to :func:`urlparse`, but does not split the params from the URL.
    This should generally be used instead of :func:`urlparse` if the more recent URL
@@ -312,19 +312,21 @@
 
 .. function:: urlencode(query, doseq=False)
 
-   Convert a mapping object or a sequence of two-element tuples  to a "url-encoded"
-   string, suitable to pass to :func:`urlopen` above as the optional *data*
-   argument.  This is useful to pass a dictionary of form fields to a ``POST``
-   request.  The resulting string is a series of ``key=value`` pairs separated by
-   ``'&'`` characters, where both *key* and *value* are quoted using
-   :func:`quote_plus` above.  If the optional parameter *doseq* is present and
-   evaluates to true, individual ``key=value`` pairs are generated for each element
-   of the sequence. When a sequence of two-element tuples is used as the *query*
-   argument, the first element of each tuple is a key and the second is a value.
-   The order of parameters in the encoded string will match the order of parameter
-   tuples in the sequence. This module provides the functions
-   :func:`parse_qs` and :func:`parse_qsl` which are used to parse query strings
-   into Python data structures.
+   Convert a mapping object or a sequence of two-element tuples to a
+   "url-encoded" string, suitable to pass to :func:`urlopen` above as the
+   optional *data* argument.  This is useful to pass a dictionary of form
+   fields to a ``POST`` request.  The resulting string is a series of
+   ``key=value`` pairs separated by ``'&'`` characters, where both *key* and
+   *value* are quoted using :func:`quote_plus` above. When a sequence of
+   two-element tuples is used as the *query* argument, the first element of
+   each tuple is a key and the second is a value. The value element in itself
+   can be a sequence and in that case, if the optional parameter *doseq* is
+   evaluates to *True*, individual ``key=value`` pairs separated by ``'&'`` are
+   generated for each element of the value sequence for the key.  The order of
+   parameters in the encoded string will match the order of parameter tuples in
+   the sequence. This module provides the functions :func:`parse_qs` and
+   :func:`parse_qsl` which are used to parse query strings into Python data
+   structures.
 
 
 .. seealso::

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	Wed Jun 16 18:21:24 2010
@@ -111,7 +111,7 @@
       The :func:`DeleteKeyEx` function is implemented with the RegDeleteKeyEx
       Windows API function, which is specific to 64-bit versions of Windows.
       See the `RegDeleteKeyEx documentation
-     <http://msdn.microsoft.com/en-us/library/ms724847%28VS.85%29.aspx>`__.
+      <http://msdn.microsoft.com/en-us/library/ms724847%28VS.85%29.aspx>`__.
 
    *key* is an already open key, or one of the predefined
    :ref:`HKEY_* constants <hkey-constants>`.

Modified: python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst	(original)
+++ python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst	Wed Jun 16 18:21:24 2010
@@ -114,6 +114,13 @@
    to be called on the :class:`Document` object, but may be called on child nodes
    to discard children of that node.
 
+   You can avoid calling this method explicitly by using the :keyword:`with`
+   statement. The following code will automatically unlink *dom* when the
+   :keyword:`with` block is exited::
+
+      with xml.dom.minidom.parse(datasource) as dom:
+          ... # Work with dom.
+
 
 .. method:: Node.writexml(writer, indent="", addindent="", newl="", encoding="")
 

Modified: python/branches/py3k-jit/Doc/tools/sphinxext/pyspecific.py
==============================================================================
--- python/branches/py3k-jit/Doc/tools/sphinxext/pyspecific.py	(original)
+++ python/branches/py3k-jit/Doc/tools/sphinxext/pyspecific.py	Wed Jun 16 18:21:24 2010
@@ -78,7 +78,7 @@
     'assert', 'assignment', 'atom-identifiers', 'atom-literals',
     'attribute-access', 'attribute-references', 'augassign', 'binary',
     'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object',
-    'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans',
+    'bltin-null-object', 'bltin-type-objects', 'booleans',
     'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound',
     'context-managers', 'continue', 'conversions', 'customization', 'debugger',
     'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel',

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	Wed Jun 16 18:21:24 2010
@@ -100,6 +100,18 @@
 
   (Contributed by Tarek Ziade.)
 
+* The *sqlite3* module has some new features:
+
+  * XXX *enable_load_extension*
+
+  * XXX *load_extension*
+
+  * New :class:`~sqlite3.Connection` attribute
+    :attr:`~sqlite3.Connection.in_transaction` is :const:`True` when there
+    are uncommitted changes, and :const:`False` otherwise.  (Contributed
+    by R. David Murray and Shashwat Anand, :issue:`8845`.)
+
+
 Multi-threading
 ===============
 
@@ -161,4 +173,7 @@
 
 * bytearray objects cannot be used anymore as filenames: convert them to bytes
 
+* "t#" format of PyArg_Parse*() functions has been removed: use "s#" or "s*"
+  instead
+
 * Stub

Modified: python/branches/py3k-jit/Include/longobject.h
==============================================================================
--- python/branches/py3k-jit/Include/longobject.h	(original)
+++ python/branches/py3k-jit/Include/longobject.h	Wed Jun 16 18:21:24 2010
@@ -101,6 +101,14 @@
 */
 PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
 
+/* _PyLong_DivmodNear.  Given integers a and b, compute the nearest
+   integer q to the exact quotient a / b, rounding to the nearest even integer
+   in the case of a tie.  Return (q, r), where r = a - q*b.  The remainder r
+   will satisfy abs(r) <= abs(b)/2, with equality possible only if q is
+   even.
+*/
+PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *);
+
 /* _PyLong_FromByteArray:  View the n unsigned bytes as a binary integer in
    base 256, and return a Python long with the same numeric value.
    If n is 0, the integer is 0.  Else:

Modified: python/branches/py3k-jit/Lib/base64.py
==============================================================================
--- python/branches/py3k-jit/Lib/base64.py	(original)
+++ python/branches/py3k-jit/Lib/base64.py	Wed Jun 16 18:21:24 2010
@@ -383,9 +383,9 @@
         if o == '-u': func = decode
         if o == '-t': test(); return
     if args and args[0] != '-':
-        func(open(args[0], 'rb'), sys.stdout)
+        func(open(args[0], 'rb'), sys.stdout.buffer)
     else:
-        func(sys.stdin, sys.stdout)
+        func(sys.stdin.buffer, sys.stdout.buffer)
 
 
 def test():

Modified: python/branches/py3k-jit/Lib/ctypes/test/test_bytes.py
==============================================================================
--- python/branches/py3k-jit/Lib/ctypes/test/test_bytes.py	(original)
+++ python/branches/py3k-jit/Lib/ctypes/test/test_bytes.py	Wed Jun 16 18:21:24 2010
@@ -30,8 +30,8 @@
 
         X("abc")
         x = X(b"abc")
-        self.assertEqual(x.a, "abc")
-        self.assertEqual(type(x.a), str)
+        self.assertEqual(x.a, b"abc")
+        self.assertEqual(type(x.a), bytes)
 
     def test_struct_W(self):
         class X(Structure):

Modified: python/branches/py3k-jit/Lib/ctypes/test/test_structures.py
==============================================================================
--- python/branches/py3k-jit/Lib/ctypes/test/test_structures.py	(original)
+++ python/branches/py3k-jit/Lib/ctypes/test/test_structures.py	Wed Jun 16 18:21:24 2010
@@ -209,9 +209,9 @@
         self.assertRaises(TypeError, Person, "Name", "HI")
 
         # short enough
-        self.assertEqual(Person("12345", 5).name, "12345")
+        self.assertEqual(Person("12345", 5).name, b"12345")
         # exact fit
-        self.assertEqual(Person("123456", 5).name, "123456")
+        self.assertEqual(Person("123456", 5).name, b"123456")
         # too long
         self.assertRaises(ValueError, Person, "1234567", 5)
 
@@ -269,9 +269,9 @@
 
         p = Person("Someone", ("1234", "5678"), 5)
 
-        self.assertEqual(p.name, "Someone")
-        self.assertEqual(p.phone.areacode, "1234")
-        self.assertEqual(p.phone.number, "5678")
+        self.assertEqual(p.name, b"Someone")
+        self.assertEqual(p.phone.areacode, b"1234")
+        self.assertEqual(p.phone.number, b"5678")
         self.assertEqual(p.age, 5)
 
     def test_structures_with_wchar(self):

Modified: python/branches/py3k-jit/Lib/decimal.py
==============================================================================
--- python/branches/py3k-jit/Lib/decimal.py	(original)
+++ python/branches/py3k-jit/Lib/decimal.py	Wed Jun 16 18:21:24 2010
@@ -31,7 +31,8 @@
 useful for financial applications or for contexts where users have
 expectations that are at odds with binary floating point (for instance,
 in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
-of the expected Decimal('0.00') returned by decimal floating point).
+of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
+Decimal('0.00')).
 
 Here are some examples of using the decimal module:
 
@@ -862,7 +863,7 @@
     # that specified by IEEE 754.
 
     def __eq__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other, equality_op=True)
         if other is NotImplemented:
             return other
         if self._check_nans(other, context):
@@ -870,7 +871,7 @@
         return self._cmp(other) == 0
 
     def __ne__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other, equality_op=True)
         if other is NotImplemented:
             return other
         if self._check_nans(other, context):
@@ -879,7 +880,7 @@
 
 
     def __lt__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -888,7 +889,7 @@
         return self._cmp(other) < 0
 
     def __le__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -897,7 +898,7 @@
         return self._cmp(other) <= 0
 
     def __gt__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -906,7 +907,7 @@
         return self._cmp(other) > 0
 
     def __ge__(self, other, context=None):
-        other = _convert_other(other, allow_float = True)
+        self, other = _convert_for_comparison(self, other)
         if other is NotImplemented:
             return other
         ans = self._compare_check_nans(other, context)
@@ -5860,6 +5861,37 @@
         raise TypeError("Unable to convert %s to Decimal" % other)
     return NotImplemented
 
+def _convert_for_comparison(self, other, equality_op=False):
+    """Given a Decimal instance self and a Python object other, return
+    a pair (s, o) of Decimal instances such that "s op o" is
+    equivalent to "self op other" for any of the 6 comparison
+    operators "op".
+
+    """
+    if isinstance(other, Decimal):
+        return self, other
+
+    # Comparison with a Rational instance (also includes integers):
+    # self op n/d <=> self*d op n (for n and d integers, d positive).
+    # A NaN or infinity can be left unchanged without affecting the
+    # comparison result.
+    if isinstance(other, _numbers.Rational):
+        if not self._is_special:
+            self = _dec_from_triple(self._sign,
+                                    str(int(self._int) * other.denominator),
+                                    self._exp)
+        return self, Decimal(other.numerator)
+
+    # Comparisons with float and complex types.  == and != comparisons
+    # with complex numbers should succeed, returning either True or False
+    # as appropriate.  Other comparisons return NotImplemented.
+    if equality_op and isinstance(other, _numbers.Complex) and other.imag == 0:
+        other = other.real
+    if isinstance(other, float):
+        return self, Decimal.from_float(other)
+    return NotImplemented, NotImplemented
+
+
 ##### Setup Specific Contexts ############################################
 
 # The default context prototype used by Context()

Modified: python/branches/py3k-jit/Lib/distutils/unixccompiler.py
==============================================================================
--- python/branches/py3k-jit/Lib/distutils/unixccompiler.py	(original)
+++ python/branches/py3k-jit/Lib/distutils/unixccompiler.py	Wed Jun 16 18:21:24 2010
@@ -15,7 +15,7 @@
 
 __revision__ = "$Id$"
 
-import os, sys
+import os, sys, re
 
 from distutils.dep_util import newer
 from distutils.ccompiler import \
@@ -320,10 +320,31 @@
         dylib_f = self.library_filename(lib, lib_type='dylib')
         static_f = self.library_filename(lib, lib_type='static')
 
+        if sys.platform == 'darwin':
+            # On OSX users can specify an alternate SDK using
+            # '-isysroot', calculate the SDK root if it is specified
+            # (and use it further on)
+            _sysconfig = __import__('sysconfig')
+            cflags = _sysconfig.get_config_var('CFLAGS')
+            m = re.search(r'-isysroot\s+(\S+)', cflags)
+            if m is None:
+                sysroot = '/'
+            else:
+                sysroot = m.group(1)
+
+
+
         for dir in dirs:
             shared = os.path.join(dir, shared_f)
             dylib = os.path.join(dir, dylib_f)
             static = os.path.join(dir, static_f)
+
+            if sys.platform == 'darwin' and (
+                    dir.startswith('/System/') or dir.startswith('/usr/')):
+                shared = os.path.join(sysroot, dir[1:], shared_f)
+                dylib = os.path.join(sysroot, dir[1:], dylib_f)
+                static = os.path.join(sysroot, dir[1:], static_f)
+
             # We're second-guessing the linker here, with not much hard
             # data to go on: GCC seems to prefer the shared library, so I'm
             # assuming that *all* Unix C compilers do.  And of course I'm

Modified: python/branches/py3k-jit/Lib/doctest.py
==============================================================================
--- python/branches/py3k-jit/Lib/doctest.py	(original)
+++ python/branches/py3k-jit/Lib/doctest.py	Wed Jun 16 18:21:24 2010
@@ -1277,9 +1277,9 @@
 
                 # Another chance if they didn't care about the detail.
                 elif self.optionflags & IGNORE_EXCEPTION_DETAIL:
-                    m1 = re.match(r'[^:]*:', example.exc_msg)
-                    m2 = re.match(r'[^:]*:', exc_msg)
-                    if m1 and m2 and check(m1.group(0), m2.group(0),
+                    m1 = re.match(r'(?:[^:]*\.)?([^:]*:)', example.exc_msg)
+                    m2 = re.match(r'(?:[^:]*\.)?([^:]*:)', exc_msg)
+                    if m1 and m2 and check(m1.group(1), m2.group(1),
                                            self.optionflags):
                         outcome = SUCCESS
 

Modified: python/branches/py3k-jit/Lib/email/charset.py
==============================================================================
--- python/branches/py3k-jit/Lib/email/charset.py	(original)
+++ python/branches/py3k-jit/Lib/email/charset.py	Wed Jun 16 18:21:24 2010
@@ -377,6 +377,8 @@
         """
         # 7bit/8bit encodings return the string unchanged (module conversions)
         if self.body_encoding is BASE64:
+            if isinstance(string, str):
+                string = string.encode(self.output_charset)
             return email.base64mime.body_encode(string)
         elif self.body_encoding is QP:
             return email.quoprimime.body_encode(string)

Modified: python/branches/py3k-jit/Lib/email/encoders.py
==============================================================================
--- python/branches/py3k-jit/Lib/email/encoders.py	(original)
+++ python/branches/py3k-jit/Lib/email/encoders.py	Wed Jun 16 18:21:24 2010
@@ -29,7 +29,7 @@
     Also, add an appropriate Content-Transfer-Encoding header.
     """
     orig = msg.get_payload()
-    encdata = _bencode(orig)
+    encdata = str(_bencode(orig), 'ascii')
     msg.set_payload(encdata)
     msg['Content-Transfer-Encoding'] = 'base64'
 

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	Wed Jun 16 18:21:24 2010
@@ -535,7 +535,7 @@
         # whose output character set is 7bit gets a transfer-encoding
         # of 7bit.
         eq = self.assertEqual
-        msg = MIMEText('\xca\xb8', _charset='euc-jp')
+        msg = MIMEText('文', _charset='euc-jp')
         eq(msg['content-transfer-encoding'], '7bit')
 
 
@@ -970,7 +970,8 @@
 
     def test_encoding(self):
         payload = self._au.get_payload()
-        self.assertEqual(base64.decodebytes(payload), self._audiodata)
+        self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
+                self._audiodata)
 
     def test_checkSetMinor(self):
         au = MIMEAudio(self._audiodata, 'fish')
@@ -1010,7 +1011,8 @@
 
     def test_encoding(self):
         payload = self._im.get_payload()
-        self.assertEqual(base64.decodebytes(payload), self._imgdata)
+        self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
+                self._imgdata)
 
     def test_checkSetMinor(self):
         im = MIMEImage(self._imgdata, 'fish')
@@ -1050,7 +1052,7 @@
         eq = self.assertEqual
         bytes = b'\xfa\xfb\xfc\xfd\xfe\xff'
         msg = MIMEApplication(bytes)
-        eq(msg.get_payload(), b'+vv8/f7/')
+        eq(msg.get_payload(), '+vv8/f7/')
         eq(msg.get_payload(decode=True), bytes)
 
 
@@ -1080,6 +1082,33 @@
         eq(msg.get_charset().input_charset, 'us-ascii')
         eq(msg['content-type'], 'text/plain; charset="us-ascii"')
 
+    def test_7bit_input(self):
+        eq = self.assertEqual
+        msg = MIMEText('hello there', _charset='us-ascii')
+        eq(msg.get_charset().input_charset, 'us-ascii')
+        eq(msg['content-type'], 'text/plain; charset="us-ascii"')
+
+    def test_7bit_input_no_charset(self):
+        eq = self.assertEqual
+        msg = MIMEText('hello there')
+        eq(msg.get_charset(), 'us-ascii')
+        eq(msg['content-type'], 'text/plain; charset="us-ascii"')
+        self.assertTrue('hello there' in msg.as_string())
+
+    def test_utf8_input(self):
+        teststr = '\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430'
+        eq = self.assertEqual
+        msg = MIMEText(teststr, _charset='utf-8')
+        eq(msg.get_charset().output_charset, 'utf-8')
+        eq(msg['content-type'], 'text/plain; charset="utf-8"')
+        eq(msg.get_payload(decode=True), teststr.encode('utf-8'))
+
+    @unittest.skip("can't fix because of backward compat in email5, "
+        "will fix in email6")
+    def test_utf8_input_no_charset(self):
+        teststr = '\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430'
+        self.assertRaises(UnicodeEncodeError, MIMEText, teststr)
+
 
 
 # Test complicated multipart/* messages

Modified: python/branches/py3k-jit/Lib/ftplib.py
==============================================================================
--- python/branches/py3k-jit/Lib/ftplib.py	(original)
+++ python/branches/py3k-jit/Lib/ftplib.py	Wed Jun 16 18:21:24 2010
@@ -638,9 +638,17 @@
         ssl_version = ssl.PROTOCOL_TLSv1
 
         def __init__(self, host='', user='', passwd='', acct='', keyfile=None,
-                     certfile=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
+                     certfile=None, context=None,
+                     timeout=_GLOBAL_DEFAULT_TIMEOUT):
+            if context is not None and keyfile is not None:
+                raise ValueError("context and keyfile arguments are mutually "
+                                 "exclusive")
+            if context is not None and certfile is not None:
+                raise ValueError("context and certfile arguments are mutually "
+                                 "exclusive")
             self.keyfile = keyfile
             self.certfile = certfile
+            self.context = context
             self._prot_p = False
             FTP.__init__(self, host, user, passwd, acct, timeout)
 
@@ -657,8 +665,12 @@
                 resp = self.voidcmd('AUTH TLS')
             else:
                 resp = self.voidcmd('AUTH SSL')
-            self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile,
-                                        ssl_version=self.ssl_version)
+            if self.context is not None:
+                self.sock = self.context.wrap_socket(self.sock)
+            else:
+                self.sock = ssl.wrap_socket(self.sock, self.keyfile,
+                                            self.certfile,
+                                            ssl_version=self.ssl_version)
             self.file = self.sock.makefile(mode='r', encoding=self.encoding)
             return resp
 
@@ -689,8 +701,11 @@
         def ntransfercmd(self, cmd, rest=None):
             conn, size = FTP.ntransfercmd(self, cmd, rest)
             if self._prot_p:
-                conn = ssl.wrap_socket(conn, self.keyfile, self.certfile,
-                                       ssl_version=self.ssl_version)
+                if self.context is not None:
+                    conn = self.context.wrap_socket(conn)
+                else:
+                    conn = ssl.wrap_socket(conn, self.keyfile, self.certfile,
+                                           ssl_version=self.ssl_version)
             return conn, size
 
         def retrbinary(self, cmd, callback, blocksize=8192, rest=None):

Modified: python/branches/py3k-jit/Lib/html/parser.py
==============================================================================
--- python/branches/py3k-jit/Lib/html/parser.py	(original)
+++ python/branches/py3k-jit/Lib/html/parser.py	Wed Jun 16 18:21:24 2010
@@ -175,6 +175,9 @@
                     i = self.updatepos(i, k)
                     continue
                 else:
+                    if ";" in rawdata[i:]: #bail by consuming &#
+                        self.handle_data(rawdata[0:2])
+                        i = self.updatepos(i, 2)
                     break
             elif startswith('&', i):
                 match = entityref.match(rawdata, i)

Modified: python/branches/py3k-jit/Lib/http/client.py
==============================================================================
--- python/branches/py3k-jit/Lib/http/client.py	(original)
+++ python/branches/py3k-jit/Lib/http/client.py	Wed Jun 16 18:21:24 2010
@@ -488,6 +488,7 @@
             return b""
 
         if self._method == "HEAD":
+            self.close()
             return b""
 
         if self.chunked:

Modified: python/branches/py3k-jit/Lib/logging/config.py
==============================================================================
--- python/branches/py3k-jit/Lib/logging/config.py	(original)
+++ python/branches/py3k-jit/Lib/logging/config.py	Wed Jun 16 18:21:24 2010
@@ -373,7 +373,7 @@
     }
 
     # We might want to use a different one, e.g. importlib
-    importer = __import__
+    importer = staticmethod(__import__)
 
     def __init__(self, config):
         self.config = ConvertingDict(config)

Modified: python/branches/py3k-jit/Lib/os.py
==============================================================================
--- python/branches/py3k-jit/Lib/os.py	(original)
+++ python/branches/py3k-jit/Lib/os.py	Wed Jun 16 18:21:24 2010
@@ -533,16 +533,19 @@
         return environb.get(key, default)
     __all__.append("getenvb")
 
-if name != 'nt':
-    def fsencode(value):
-        """Encode value for use in the file system, environment variables
-        or the command line."""
-        if isinstance(value, bytes):
-            return value
-        elif isinstance(value, str):
-            return value.encode(sys.getfilesystemencoding(), 'surrogateescape')
+def fsencode(value):
+    """Encode value for use in the file system, environment variables
+    or the command line."""
+    if isinstance(value, bytes):
+        return value
+    elif isinstance(value, str):
+        encoding = sys.getfilesystemencoding()
+        if encoding == 'mbcs':
+            return value.encode(encoding)
         else:
-            raise TypeError("expect bytes or str, not %s" % type(value).__name__)
+            return value.encode(encoding, 'surrogateescape')
+    else:
+        raise TypeError("expect bytes or str, not %s" % type(value).__name__)
 
 def _exists(name):
     return name in globals()

Modified: python/branches/py3k-jit/Lib/sqlite3/test/dbapi.py
==============================================================================
--- python/branches/py3k-jit/Lib/sqlite3/test/dbapi.py	(original)
+++ python/branches/py3k-jit/Lib/sqlite3/test/dbapi.py	Wed Jun 16 18:21:24 2010
@@ -84,6 +84,7 @@
                         "NotSupportedError is not a subclass of DatabaseError")
 
 class ConnectionTests(unittest.TestCase):
+
     def setUp(self):
         self.cx = sqlite.connect(":memory:")
         cu = self.cx.cursor()
@@ -140,6 +141,28 @@
         self.assertEqual(self.cx.ProgrammingError, sqlite.ProgrammingError)
         self.assertEqual(self.cx.NotSupportedError, sqlite.NotSupportedError)
 
+    def CheckInTransaction(self):
+        # Can't use db from setUp because we want to test initial state.
+        cx = sqlite.connect(":memory:")
+        cu = cx.cursor()
+        self.assertEqual(cx.in_transaction, False)
+        cu.execute("create table transactiontest(id integer primary key, name text)")
+        self.assertEqual(cx.in_transaction, False)
+        cu.execute("insert into transactiontest(name) values (?)", ("foo",))
+        self.assertEqual(cx.in_transaction, True)
+        cu.execute("select name from transactiontest where name=?", ["foo"])
+        row = cu.fetchone()
+        self.assertEqual(cx.in_transaction, True)
+        cx.commit()
+        self.assertEqual(cx.in_transaction, False)
+        cu.execute("select name from transactiontest where name=?", ["foo"])
+        row = cu.fetchone()
+        self.assertEqual(cx.in_transaction, False)
+
+    def CheckInTransactionRO(self):
+        with self.assertRaises(AttributeError):
+            self.cx.in_transaction = True
+
 class CursorTests(unittest.TestCase):
     def setUp(self):
         self.cx = sqlite.connect(":memory:")

Modified: python/branches/py3k-jit/Lib/struct.py
==============================================================================
--- python/branches/py3k-jit/Lib/struct.py	(original)
+++ python/branches/py3k-jit/Lib/struct.py	Wed Jun 16 18:21:24 2010
@@ -1,3 +1,14 @@
+__all__ = [
+    # Functions
+    'calcsize', 'pack', 'unpack', 'unpack', 'unpack_from',
+
+    # Classes
+    'Struct',
+
+    # Exceptions
+    'error'
+    ]
+
 from _struct import *
 from _struct import _clearcache
 from _struct import __doc__

Modified: python/branches/py3k-jit/Lib/sunau.py
==============================================================================
--- python/branches/py3k-jit/Lib/sunau.py	(original)
+++ python/branches/py3k-jit/Lib/sunau.py	Wed Jun 16 18:21:24 2010
@@ -299,7 +299,7 @@
         self._nframeswritten = 0
         self._datawritten = 0
         self._datalength = 0
-        self._info = ''
+        self._info = b''
         self._comptype = 'ULAW' # default is U-law
 
     def setnchannels(self, nchannels):

Modified: python/branches/py3k-jit/Lib/sysconfig.py
==============================================================================
--- python/branches/py3k-jit/Lib/sysconfig.py	(original)
+++ python/branches/py3k-jit/Lib/sysconfig.py	Wed Jun 16 18:21:24 2010
@@ -5,6 +5,10 @@
 import os
 from os.path import pardir, realpath
 
+__all__ = ['parse_config_h', 'get_config_h_filename', 'get_scheme_names',
+           'get_path_names', 'get_paths', 'get_path', 'get_config_vars',
+           'get_config_var', 'get_platform', 'get_python_version']
+
 _INSTALL_SCHEMES = {
     'posix_prefix': {
         'stdlib': '{base}/lib/python{py_version_short}',
@@ -712,3 +716,22 @@
 
 def get_python_version():
     return _PY_VERSION_SHORT
+
+def _print_dict(title, data):
+    for index, (key, value) in enumerate(sorted(data.items())):
+        if index == 0:
+            print('{0}: '.format(title))
+        print('\t{0} = "{1}"'.format(key, value))
+
+def _main():
+    """Displays all information sysconfig detains."""
+    print('Platform: "{0}"'.format(get_platform()))
+    print('Python version: "{0}"'.format(get_python_version()))
+    print('Current installation scheme: "{0}"'.format(_get_default_scheme()))
+    print('')
+    _print_dict('Paths', get_paths())
+    print('')
+    _print_dict('Variables', get_config_vars())
+
+if __name__ == '__main__':
+    _main()

Modified: python/branches/py3k-jit/Lib/tarfile.py
==============================================================================
--- python/branches/py3k-jit/Lib/tarfile.py	(original)
+++ python/branches/py3k-jit/Lib/tarfile.py	Wed Jun 16 18:21:24 2010
@@ -159,9 +159,10 @@
 #---------------------------------------------------------
 # initialization
 #---------------------------------------------------------
-ENCODING = sys.getfilesystemencoding()
-if ENCODING is None:
-    ENCODING = "ascii"
+if os.name in ("nt", "ce"):
+    ENCODING = "utf-8"
+else:
+    ENCODING = sys.getfilesystemencoding()
 
 #---------------------------------------------------------
 # Some useful functions
@@ -1920,7 +1921,7 @@
         tarinfo.mode = stmd
         tarinfo.uid = statres.st_uid
         tarinfo.gid = statres.st_gid
-        if stat.S_ISREG(stmd):
+        if type == REGTYPE:
             tarinfo.size = statres.st_size
         else:
             tarinfo.size = 0
@@ -2163,8 +2164,7 @@
                 raise StreamError("cannot extract (sym)link as file object")
             else:
                 # A (sym)link's file object is its target's file object.
-                return self.extractfile(self._getmember(tarinfo.linkname,
-                                                        tarinfo))
+                return self.extractfile(self._find_link_target(tarinfo))
         else:
             # If there's no data associated with the member (directory, chrdev,
             # blkdev, etc.), return None instead of a file object.
@@ -2273,27 +2273,21 @@
           (platform limitation), we try to make a copy of the referenced file
           instead of a link.
         """
-        try:
+        if hasattr(os, "symlink") and hasattr(os, "link"):
+            # For systems that support symbolic and hard links.
             if tarinfo.issym():
                 os.symlink(tarinfo.linkname, targetpath)
             else:
                 # See extract().
-                os.link(tarinfo._link_target, targetpath)
-        except AttributeError:
-            if tarinfo.issym():
-                linkpath = os.path.dirname(tarinfo.name) + "/" + \
-                                        tarinfo.linkname
-            else:
-                linkpath = tarinfo.linkname
-
+                if os.path.exists(tarinfo._link_target):
+                    os.link(tarinfo._link_target, targetpath)
+                else:
+                    self._extract_member(self._find_link_target(tarinfo), targetpath)
+        else:
             try:
-                self._extract_member(self.getmember(linkpath), targetpath)
-            except (EnvironmentError, KeyError) as e:
-                linkpath = linkpath.replace("/", os.sep)
-                try:
-                    shutil.copy2(linkpath, targetpath)
-                except EnvironmentError as e:
-                    raise IOError("link could not be created")
+                self._extract_member(self._find_link_target(tarinfo), targetpath)
+            except KeyError:
+                raise ExtractError("unable to resolve link inside archive")
 
     def chown(self, tarinfo, targetpath):
         """Set owner of targetpath according to tarinfo.
@@ -2392,21 +2386,28 @@
     #--------------------------------------------------------------------------
     # Little helper methods:
 
-    def _getmember(self, name, tarinfo=None):
+    def _getmember(self, name, tarinfo=None, normalize=False):
         """Find an archive member by name from bottom to top.
            If tarinfo is given, it is used as the starting point.
         """
         # Ensure that all members have been loaded.
         members = self.getmembers()
 
-        if tarinfo is None:
-            end = len(members)
-        else:
-            end = members.index(tarinfo)
+        # Limit the member search list up to tarinfo.
+        if tarinfo is not None:
+            members = members[:members.index(tarinfo)]
 
-        for i in range(end - 1, -1, -1):
-            if name == members[i].name:
-                return members[i]
+        if normalize:
+            name = os.path.normpath(name)
+
+        for member in reversed(members):
+            if normalize:
+                member_name = os.path.normpath(member.name)
+            else:
+                member_name = member.name
+
+            if name == member_name:
+                return member
 
     def _load(self):
         """Read through the entire archive file and look for readable
@@ -2427,6 +2428,25 @@
         if mode is not None and self.mode not in mode:
             raise IOError("bad operation for mode %r" % self.mode)
 
+    def _find_link_target(self, tarinfo):
+        """Find the target member of a symlink or hardlink member in the
+           archive.
+        """
+        if tarinfo.issym():
+            # Always search the entire archive.
+            linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
+            limit = None
+        else:
+            # Search the archive before the link, because a hard link is
+            # just a reference to an already archived file.
+            linkname = tarinfo.linkname
+            limit = tarinfo
+
+        member = self._getmember(linkname, tarinfo=limit, normalize=True)
+        if member is None:
+            raise KeyError("linkname %r not found" % linkname)
+        return member
+
     def __iter__(self):
         """Provide an iterator object.
         """

Modified: python/branches/py3k-jit/Lib/test/math_testcases.txt
==============================================================================
--- python/branches/py3k-jit/Lib/test/math_testcases.txt	(original)
+++ python/branches/py3k-jit/Lib/test/math_testcases.txt	Wed Jun 16 18:21:24 2010
@@ -84,6 +84,25 @@
 erf0042 erf -1e150 -> -1.0
 erf0043 erf 1.7e308 -> 1.0
 
+-- Issue 8986: inputs x with exp(-x*x) near the underflow threshold
+-- incorrectly signalled overflow on some platforms.
+erf0100 erf 26.2 -> 1.0
+erf0101 erf 26.4 -> 1.0
+erf0102 erf 26.6 -> 1.0
+erf0103 erf 26.8 -> 1.0
+erf0104 erf 27.0 -> 1.0
+erf0105 erf 27.2 -> 1.0
+erf0106 erf 27.4 -> 1.0
+erf0107 erf 27.6 -> 1.0
+
+erf0110 erf -26.2 -> -1.0
+erf0111 erf -26.4 -> -1.0
+erf0112 erf -26.6 -> -1.0
+erf0113 erf -26.8 -> -1.0
+erf0114 erf -27.0 -> -1.0
+erf0115 erf -27.2 -> -1.0
+erf0116 erf -27.4 -> -1.0
+erf0117 erf -27.6 -> -1.0
 
 ----------------------------------------
 -- erfc: complementary error function --
@@ -127,6 +146,25 @@
 erfc0052 erfc -1e150 -> 2.0
 erfc0053 erfc 1.7e308 -> 0.0
 
+-- Issue 8986: inputs x with exp(-x*x) near the underflow threshold
+-- incorrectly signalled overflow on some platforms.
+erfc0100 erfc 26.2 -> 1.6432507924389461e-300
+erfc0101 erfc 26.4 -> 4.4017768588035426e-305
+erfc0102 erfc 26.6 -> 1.0885125885442269e-309
+erfc0103 erfc 26.8 -> 2.4849621571966629e-314
+erfc0104 erfc 27.0 -> 5.2370464393526292e-319
+erfc0105 erfc 27.2 -> 9.8813129168249309e-324
+erfc0106 erfc 27.4 -> 0.0
+erfc0107 erfc 27.6 -> 0.0
+
+erfc0110 erfc -26.2 -> 2.0
+erfc0111 erfc -26.4 -> 2.0
+erfc0112 erfc -26.6 -> 2.0
+erfc0113 erfc -26.8 -> 2.0
+erfc0114 erfc -27.0 -> 2.0
+erfc0115 erfc -27.2 -> 2.0
+erfc0116 erfc -27.4 -> 2.0
+erfc0117 erfc -27.6 -> 2.0
 
 ---------------------------------------------------------
 -- lgamma: log of absolute value of the gamma function --

Modified: python/branches/py3k-jit/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/regrtest.py	(original)
+++ python/branches/py3k-jit/Lib/test/regrtest.py	Wed Jun 16 18:21:24 2010
@@ -859,9 +859,15 @@
         sys.path_hooks[:] = saved_hooks[2]
 
     def get___import__(self):
-        return __builtins__.__import__
+        if isinstance(__builtins__, dict):
+            return __builtins__['__import__']
+        else:
+            return __builtins__.__import__
     def restore___import__(self, import_):
-        __builtins__.__import__ = import_
+        if isinstance(__builtins__, dict):
+            __builtins__['__import__'] = import_
+        else:
+            __builtins__.__import__ = import_
 
     def get_warnings_filters(self):
         return id(warnings.filters), warnings.filters, warnings.filters[:]

Modified: python/branches/py3k-jit/Lib/test/test_base64.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_base64.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_base64.py	Wed Jun 16 18:21:24 2010
@@ -2,6 +2,8 @@
 from test import support
 import base64
 import binascii
+import sys
+import subprocess
 
 
 
@@ -208,6 +210,38 @@
 
 
 
+class TestMain(unittest.TestCase):
+    def get_output(self, *args, **options):
+        args = (sys.executable, '-m', 'base64') + args
+        return subprocess.check_output(args, **options)
+
+    def test_encode_decode(self):
+        output = self.get_output('-t')
+        self.assertSequenceEqual(output.splitlines(), (
+            b"b'Aladdin:open sesame'",
+            br"b'QWxhZGRpbjpvcGVuIHNlc2FtZQ==\n'",
+            b"b'Aladdin:open sesame'",
+        ))
+
+    def test_encode_file(self):
+        with open(support.TESTFN, 'wb') as fp:
+            fp.write(b'a\xffb\n')
+
+        output = self.get_output('-e', support.TESTFN)
+        self.assertEquals(output.rstrip(), b'Yf9iCg==')
+
+        with open(support.TESTFN, 'rb') as fp:
+            output = self.get_output('-e', stdin=fp)
+        self.assertEquals(output.rstrip(), b'Yf9iCg==')
+
+    def test_decode(self):
+        with open(support.TESTFN, 'wb') as fp:
+            fp.write(b'Yf9iCg==')
+        output = self.get_output('-d', support.TESTFN)
+        self.assertEquals(output.rstrip(), b'a\xffb')
+
+
+
 def test_main():
     support.run_unittest(__name__)
 

Modified: python/branches/py3k-jit/Lib/test/test_builtin.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_builtin.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_builtin.py	Wed Jun 16 18:21:24 2010
@@ -124,6 +124,16 @@
         self.assertEqual(abs(-3.14), 3.14)
         # str
         self.assertRaises(TypeError, abs, 'a')
+        # bool
+        self.assertEqual(abs(True), 1)
+        self.assertEqual(abs(False), 0)
+        # other
+        self.assertRaises(TypeError, abs)
+        self.assertRaises(TypeError, abs, None)
+        class AbsClass(object):
+            def __abs__(self):
+                return -5
+        self.assertEqual(abs(AbsClass()), -5)
 
     def test_all(self):
         self.assertEqual(all([2, 4, 6]), True)
@@ -600,6 +610,8 @@
             def __len__(self):
                 return sys.maxsize + 1
         self.assertRaises(OverflowError, len, HugeLen())
+        class NoLenMethod(object): pass
+        self.assertRaises(TypeError, len, NoLenMethod())
 
     def test_map(self):
         self.assertEqual(
@@ -1187,6 +1199,11 @@
         b = 2
         return vars()
 
+    class C_get_vars(object):
+        def getDict(self):
+            return {'a':2}
+        __dict__ = property(fget=getDict)
+
     def test_vars(self):
         self.assertEqual(set(vars()), set(dir()))
         import sys
@@ -1195,6 +1212,7 @@
         self.assertEqual(self.get_vars_f2(), {'a': 1, 'b': 2})
         self.assertRaises(TypeError, vars, 42, 42)
         self.assertRaises(TypeError, vars, 42)
+        self.assertEqual(vars(self.C_get_vars()), {'a':2})
 
     def test_zip(self):
         a = (1, 2, 3)

Modified: python/branches/py3k-jit/Lib/test/test_calendar.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_calendar.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_calendar.py	Wed Jun 16 18:21:24 2010
@@ -2,7 +2,7 @@
 import unittest
 
 from test import support
-
+import time
 
 result_2004_text = """
                                   2004
@@ -381,13 +381,21 @@
         # A 31-day december starting on friday (2+7+7+7+7+1 days)
         self.check_weeks(1995, 12, (2, 7, 7, 7, 7, 1))
 
+class TimegmTestCase(unittest.TestCase):
+    TIMESTAMPS = [0, 10, 100, 1000, 10000, 100000, 1000000,
+                  1234567890, 1262304000, 1275785153,]
+    def test_timegm(self):
+        for secs in self.TIMESTAMPS:
+            tuple = time.gmtime(secs)
+            self.assertEqual(secs, calendar.timegm(tuple))
 
 def test_main():
     support.run_unittest(
         OutputTestCase,
         CalendarTestCase,
         MondayTestCase,
-        SundayTestCase
+        SundayTestCase,
+        TimegmTestCase,
     )
 
 

Modified: python/branches/py3k-jit/Lib/test/test_capi.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_capi.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_capi.py	Wed Jun 16 18:21:24 2010
@@ -36,6 +36,7 @@
         self.assertEqual(testfunction.attribute, "test")
         self.assertRaises(AttributeError, setattr, inst.testfunction, "attribute", "test")
 
+    @unittest.skipUnless(threading, 'Threading required for this test.')
     def test_no_FatalError_infinite_loop(self):
         p = subprocess.Popen([sys.executable, "-c",
                               'import _testcapi;'

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	Wed Jun 16 18:21:24 2010
@@ -72,7 +72,6 @@
         # check that there's nothing left in the buffers
         self.assertEqual(r.read(), "")
         self.assertEqual(r.bytebuffer, b"")
-        self.assertEqual(r.charbuffer, "")
 
         # do the check again, this time using a incremental decoder
         d = codecs.getincrementaldecoder(self.encoding)()
@@ -354,6 +353,16 @@
         self.check_state_handling_decode(self.encoding,
                                          "spamspam", self.spambe)
 
+    def test_issue8941(self):
+        # Issue #8941: insufficient result allocation when decoding into
+        # surrogate pairs on UCS-2 builds.
+        encoded_le = b'\xff\xfe\x00\x00' + b'\x00\x00\x01\x00' * 1024
+        self.assertEqual('\U00010000' * 1024,
+                         codecs.utf_32_decode(encoded_le)[0])
+        encoded_be = b'\x00\x00\xfe\xff' + b'\x00\x01\x00\x00' * 1024
+        self.assertEqual('\U00010000' * 1024,
+                         codecs.utf_32_decode(encoded_be)[0])
+
 class UTF32LETest(ReadTest):
     encoding = "utf-32-le"
 
@@ -387,6 +396,13 @@
         self.assertRaises(UnicodeDecodeError, codecs.utf_32_le_decode,
                           b"\xff", "strict", True)
 
+    def test_issue8941(self):
+        # Issue #8941: insufficient result allocation when decoding into
+        # surrogate pairs on UCS-2 builds.
+        encoded = b'\x00\x00\x01\x00' * 1024
+        self.assertEqual('\U00010000' * 1024,
+                         codecs.utf_32_le_decode(encoded)[0])
+
 class UTF32BETest(ReadTest):
     encoding = "utf-32-be"
 
@@ -420,6 +436,14 @@
         self.assertRaises(UnicodeDecodeError, codecs.utf_32_be_decode,
                           b"\xff", "strict", True)
 
+    def test_issue8941(self):
+        # Issue #8941: insufficient result allocation when decoding into
+        # surrogate pairs on UCS-2 builds.
+        encoded = b'\x00\x01\x00\x00' * 1024
+        self.assertEqual('\U00010000' * 1024,
+                         codecs.utf_32_be_decode(encoded)[0])
+
+
 class UTF16Test(ReadTest):
     encoding = "utf-16"
 
@@ -628,18 +652,6 @@
         self.assertRaises(TypeError, codecs.readbuffer_encode)
         self.assertRaises(TypeError, codecs.readbuffer_encode, 42)
 
-class CharBufferTest(unittest.TestCase):
-
-    def test_string(self):
-        self.assertEqual(codecs.charbuffer_encode(b"spam"), (b"spam", 4))
-
-    def test_empty(self):
-        self.assertEqual(codecs.charbuffer_encode(b""), (b"", 0))
-
-    def test_bad_args(self):
-        self.assertRaises(TypeError, codecs.charbuffer_encode)
-        self.assertRaises(TypeError, codecs.charbuffer_encode, 42)
-
 class UTF8SigTest(ReadTest):
     encoding = "utf-8-sig"
 
@@ -1663,7 +1675,6 @@
         UTF7Test,
         UTF16ExTest,
         ReadBufferTest,
-        CharBufferTest,
         RecodingTest,
         PunycodeTest,
         UnicodeInternalTest,

Modified: python/branches/py3k-jit/Lib/test/test_curses.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_curses.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_curses.py	Wed Jun 16 18:21:24 2010
@@ -23,11 +23,6 @@
 curses = import_module('curses')
 curses.panel = import_module('curses.panel')
 
-# skip all these tests on FreeBSD: test_curses currently hangs the
-# FreeBSD buildbots, preventing other tests from running.  See issue
-# #7384.
-if 'freebsd' in sys.platform:
-    raise unittest.SkipTest('The curses module is broken on FreeBSD.  See http://bugs.python.org/issue7384.')
 
 # XXX: if newterm was supported we could use it instead of initscr and not exit
 term = os.environ.get('TERM')

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	Wed Jun 16 18:21:24 2010
@@ -3,7 +3,7 @@
 See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
 """
 
-import os
+import sys
 import pickle
 import unittest
 
@@ -15,6 +15,7 @@
 from datetime import timedelta
 from datetime import tzinfo
 from datetime import time
+from datetime import timezone
 from datetime import date, datetime
 
 pickle_choices = [(pickle, pickle, proto) for proto in range(3)]
@@ -25,6 +26,16 @@
 OTHERSTUFF = (10, 34.5, "abc", {}, [], ())
 
 
+# XXX Copied from test_float.
+INF = float("inf")
+NAN = float("nan")
+
+# decorator for skipping tests on non-IEEE 754 platforms
+requires_IEEE_754 = unittest.skipUnless(
+    float.__getformat__("double").startswith("IEEE"),
+    "test requires IEEE 754 doubles")
+
+
 #############################################################################
 # module tests
 
@@ -39,6 +50,7 @@
 # tzinfo tests
 
 class FixedOffset(tzinfo):
+
     def __init__(self, offset, name, dstoffset=42):
         if isinstance(offset, int):
             offset = timedelta(minutes=offset)
@@ -57,6 +69,7 @@
         return self.__dstoffset
 
 class PicklableFixedOffset(FixedOffset):
+
     def __init__(self, offset=None, name=None, dstoffset=None):
         FixedOffset.__init__(self, offset, name, dstoffset)
 
@@ -121,6 +134,97 @@
             self.assertEqual(derived.utcoffset(None), offset)
             self.assertEqual(derived.tzname(None), 'cookie')
 
+class TestTimeZone(unittest.TestCase):
+
+    def setUp(self):
+        self.ACDT = timezone(timedelta(hours=9.5), 'ACDT')
+        self.EST = timezone(-timedelta(hours=5), 'EST')
+        self.DT = datetime(2010, 1, 1)
+
+    def test_str(self):
+        for tz in [self.ACDT, self.EST, timezone.utc,
+                   timezone.min, timezone.max]:
+            self.assertEqual(str(tz), tz.tzname(None))
+
+    def test_class_members(self):
+        limit = timedelta(hours=23, minutes=59)
+        self.assertEquals(timezone.utc.utcoffset(None), ZERO)
+        self.assertEquals(timezone.min.utcoffset(None), -limit)
+        self.assertEquals(timezone.max.utcoffset(None), limit)
+
+
+    def test_constructor(self):
+        self.assertEquals(timezone.utc, timezone(timedelta(0)))
+        # invalid offsets
+        for invalid in [timedelta(microseconds=1), timedelta(1, 1),
+                        timedelta(seconds=1), timedelta(1), -timedelta(1)]:
+            self.assertRaises(ValueError, timezone, invalid)
+            self.assertRaises(ValueError, timezone, -invalid)
+
+        with self.assertRaises(TypeError): timezone(None)
+        with self.assertRaises(TypeError): timezone(42)
+        with self.assertRaises(TypeError): timezone(ZERO, None)
+        with self.assertRaises(TypeError): timezone(ZERO, 42)
+
+    def test_inheritance(self):
+        self.assertTrue(isinstance(timezone.utc, tzinfo))
+        self.assertTrue(isinstance(self.EST, tzinfo))
+
+    def test_utcoffset(self):
+        dummy = self.DT
+        for h in [0, 1.5, 12]:
+            offset = h * HOUR
+            self.assertEquals(offset, timezone(offset).utcoffset(dummy))
+            self.assertEquals(-offset, timezone(-offset).utcoffset(dummy))
+
+        with self.assertRaises(TypeError): self.EST.utcoffset('')
+        with self.assertRaises(TypeError): self.EST.utcoffset(5)
+
+
+    def test_dst(self):
+        self.assertEquals(None, timezone.utc.dst(self.DT))
+
+        with self.assertRaises(TypeError): self.EST.dst('')
+        with self.assertRaises(TypeError): self.EST.dst(5)
+
+    def test_tzname(self):
+        self.assertEquals('UTC+00:00', timezone(ZERO).tzname(None))
+        self.assertEquals('UTC-05:00', timezone(-5 * HOUR).tzname(None))
+        self.assertEquals('UTC+09:30', timezone(9.5 * HOUR).tzname(None))
+        self.assertEquals('UTC-00:01', timezone(timedelta(minutes=-1)).tzname(None))
+        self.assertEquals('XYZ', timezone(-5 * HOUR, 'XYZ').tzname(None))
+
+        with self.assertRaises(TypeError): self.EST.tzname('')
+        with self.assertRaises(TypeError): self.EST.tzname(5)
+
+    def test_fromutc(self):
+        with self.assertRaises(ValueError):
+            timezone.utc.fromutc(self.DT)
+        for tz in [self.EST, self.ACDT, Eastern]:
+            utctime = self.DT.replace(tzinfo=tz)
+            local = tz.fromutc(utctime)
+            self.assertEquals(local - utctime, tz.utcoffset(local))
+            self.assertEquals(local,
+                              self.DT.replace(tzinfo=timezone.utc))
+
+    def test_comparison(self):
+        self.assertNotEqual(timezone(ZERO), timezone(HOUR))
+        self.assertEqual(timezone(HOUR), timezone(HOUR))
+        self.assertEqual(timezone(-5 * HOUR), timezone(-5 * HOUR, 'EST'))
+        with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO)
+        self.assertIn(timezone(ZERO), {timezone(ZERO)})
+
+    def test_aware_datetime(self):
+        # test that timezone instances can be used by datetime
+        t = datetime(1, 1, 1)
+        for tz in [timezone.min, timezone.max, timezone.utc]:
+            self.assertEquals(tz.tzname(t),
+                              t.replace(tzinfo=tz).tzname())
+            self.assertEquals(tz.utcoffset(t),
+                              t.replace(tzinfo=tz).utcoffset())
+            self.assertEquals(tz.dst(t),
+                              t.replace(tzinfo=tz).dst())
+
 #############################################################################
 # Base clase for testing a particular aspect of timedelta, time, date and
 # datetime comparisons.
@@ -225,6 +329,36 @@
         eq(c//1000, td(0, 0, 1))
         eq(a//10, td(0, 7*24*360))
         eq(a//3600000, td(0, 0, 7*24*1000))
+        eq(a/0.5, td(14))
+        eq(b/0.5, td(0, 120))
+        eq(a/7, td(1))
+        eq(b/10, td(0, 6))
+        eq(c/1000, td(0, 0, 1))
+        eq(a/10, td(0, 7*24*360))
+        eq(a/3600000, td(0, 0, 7*24*1000))
+
+        # Multiplication by float
+        us = td(microseconds=1)
+        eq((3*us) * 0.5, 2*us)
+        eq((5*us) * 0.5, 2*us)
+        eq(0.5 * (3*us), 2*us)
+        eq(0.5 * (5*us), 2*us)
+        eq((-3*us) * 0.5, -2*us)
+        eq((-5*us) * 0.5, -2*us)
+
+        # Division by int and float
+        eq((3*us) / 2, 2*us)
+        eq((5*us) / 2, 2*us)
+        eq((-3*us) / 2.0, -2*us)
+        eq((-5*us) / 2.0, -2*us)
+        eq((3*us) / -2, -2*us)
+        eq((5*us) / -2, -2*us)
+        eq((3*us) / -2.0, -2*us)
+        eq((5*us) / -2.0, -2*us)
+        for i in range(-10, 10):
+            eq((i*us/3)//us, round(i/3))
+        for i in range(-10, 10):
+            eq((i*us/-3)//us, round(i/-3))
 
     def test_disallowed_computations(self):
         a = timedelta(42)
@@ -236,20 +370,19 @@
             self.assertRaises(TypeError, lambda: i+a)
             self.assertRaises(TypeError, lambda: i-a)
 
-        # Mul/div by float isn't supported.
-        x = 2.3
-        self.assertRaises(TypeError, lambda: a*x)
-        self.assertRaises(TypeError, lambda: x*a)
-        self.assertRaises(TypeError, lambda: a/x)
-        self.assertRaises(TypeError, lambda: x/a)
-        self.assertRaises(TypeError, lambda: a // x)
-        self.assertRaises(TypeError, lambda: x // a)
-
         # Division of int by timedelta doesn't make sense.
         # Division by zero doesn't make sense.
         zero = 0
         self.assertRaises(TypeError, lambda: zero // a)
         self.assertRaises(ZeroDivisionError, lambda: a // zero)
+        self.assertRaises(ZeroDivisionError, lambda: a / zero)
+        self.assertRaises(ZeroDivisionError, lambda: a / 0.0)
+
+    @requires_IEEE_754
+    def test_disallowed_special(self):
+        a = timedelta(42)
+        self.assertRaises(ValueError, a.__mul__, NAN)
+        self.assertRaises(ValueError, a.__truediv__, NAN)
 
     def test_basic_attributes(self):
         days, seconds, us = 1, 7, 31
@@ -410,6 +543,19 @@
 
         self.assertRaises(OverflowError, lambda: -timedelta.max)
 
+        day = timedelta(1)
+        self.assertRaises(OverflowError, day.__mul__, 10**9)
+        self.assertRaises(OverflowError, day.__mul__, 1e9)
+        self.assertRaises(OverflowError, day.__truediv__, 1e-20)
+        self.assertRaises(OverflowError, day.__truediv__, 1e-10)
+        self.assertRaises(OverflowError, day.__truediv__, 9e-10)
+
+    @requires_IEEE_754
+    def _test_overflow_special(self):
+        day = timedelta(1)
+        self.assertRaises(OverflowError, day.__mul__, INF)
+        self.assertRaises(OverflowError, day.__mul__, -INF)
+
     def test_microsecond_rounding(self):
         td = timedelta
         eq = self.assertEqual
@@ -489,7 +635,7 @@
         self.assertRaises(ZeroDivisionError, truediv, t, zerotd)
         self.assertRaises(ZeroDivisionError, floordiv, t, zerotd)
 
-        self.assertRaises(TypeError, truediv, t, 2)
+        # self.assertRaises(TypeError, truediv, t, 2)
         # note: floor division of a timedelta by an integer *is*
         # currently permitted.
 
@@ -761,15 +907,16 @@
     def test_overflow(self):
         tiny = self.theclass.resolution
 
-        dt = self.theclass.min + tiny
-        dt -= tiny  # no problem
-        self.assertRaises(OverflowError, dt.__sub__, tiny)
-        self.assertRaises(OverflowError, dt.__add__, -tiny)
-
-        dt = self.theclass.max - tiny
-        dt += tiny  # no problem
-        self.assertRaises(OverflowError, dt.__add__, tiny)
-        self.assertRaises(OverflowError, dt.__sub__, -tiny)
+        for delta in [tiny, timedelta(1), timedelta(2)]:
+            dt = self.theclass.min + delta
+            dt -= delta  # no problem
+            self.assertRaises(OverflowError, dt.__sub__, delta)
+            self.assertRaises(OverflowError, dt.__add__, -delta)
+
+            dt = self.theclass.max - delta
+            dt += delta  # no problem
+            self.assertRaises(OverflowError, dt.__add__, delta)
+            self.assertRaises(OverflowError, dt.__sub__, -delta)
 
     def test_fromtimestamp(self):
         import time
@@ -1554,19 +1701,14 @@
         for insane in -1e200, 1e200:
             self.assertRaises(ValueError, self.theclass.utcfromtimestamp,
                               insane)
-
+    @unittest.skipIf(sys.platform == "win32", "Windows doesn't accept negative timestamps")
     def test_negative_float_fromtimestamp(self):
-        # Windows doesn't accept negative timestamps
-        if os.name == "nt":
-            return
         # The result is tz-dependent; at least test that this doesn't
         # fail (like it did before bug 1646728 was fixed).
         self.theclass.fromtimestamp(-1.05)
 
+    @unittest.skipIf(sys.platform == "win32", "Windows doesn't accept negative timestamps")
     def test_negative_float_utcfromtimestamp(self):
-        # Windows doesn't accept negative timestamps
-        if os.name == "nt":
-            return
         d = self.theclass.utcfromtimestamp(-1.05)
         self.assertEquals(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000))
 
@@ -2681,20 +2823,21 @@
         # We don't know which time zone we're in, and don't have a tzinfo
         # class to represent it, so seeing whether a tz argument actually
         # does a conversion is tricky.
-        weirdtz = FixedOffset(timedelta(hours=15, minutes=58), "weirdtz", 0)
         utc = FixedOffset(0, "utc", 0)
-        for dummy in range(3):
-            now = datetime.now(weirdtz)
-            self.assertTrue(now.tzinfo is weirdtz)
-            utcnow = datetime.utcnow().replace(tzinfo=utc)
-            now2 = utcnow.astimezone(weirdtz)
-            if abs(now - now2) < timedelta(seconds=30):
-                break
-            # Else the code is broken, or more than 30 seconds passed between
-            # calls; assuming the latter, just try again.
-        else:
-            # Three strikes and we're out.
-            self.fail("utcnow(), now(tz), or astimezone() may be broken")
+        for weirdtz in [FixedOffset(timedelta(hours=15, minutes=58), "weirdtz", 0),
+                        timezone(timedelta(hours=15, minutes=58), "weirdtz"),]:
+            for dummy in range(3):
+                now = datetime.now(weirdtz)
+                self.assertTrue(now.tzinfo is weirdtz)
+                utcnow = datetime.utcnow().replace(tzinfo=utc)
+                now2 = utcnow.astimezone(weirdtz)
+                if abs(now - now2) < timedelta(seconds=30):
+                    break
+                # Else the code is broken, or more than 30 seconds passed between
+                # calls; assuming the latter, just try again.
+            else:
+                # Three strikes and we're out.
+                self.fail("utcnow(), now(tz), or astimezone() may be broken")
 
     def test_tzinfo_fromtimestamp(self):
         import time

Modified: python/branches/py3k-jit/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_descr.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_descr.py	Wed Jun 16 18:21:24 2010
@@ -1557,6 +1557,8 @@
             self.assertEqual(key, "hi")
             return 4
         def swallow(*args): pass
+        def format_impl(self, spec):
+            return "hello"
 
         # It would be nice to have every special method tested here, but I'm
         # only listing the ones I can remember outside of typeobject.c, since it
@@ -1575,6 +1577,7 @@
             ("__enter__", run_context, iden, set(), {"__exit__" : swallow}),
             ("__exit__", run_context, swallow, set(), {"__enter__" : iden}),
             ("__complex__", complex, complex_num, set(), {}),
+            ("__format__", format, format_impl, set(), {}),
             ]
 
         class Checker(object):

Modified: python/branches/py3k-jit/Lib/test/test_doctest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_doctest.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_doctest.py	Wed Jun 16 18:21:24 2010
@@ -864,6 +864,77 @@
     >>> doctest.DocTestRunner(verbose=False).run(test)
     TestResults(failed=0, attempted=1)
 
+IGNORE_EXCEPTION_DETAIL also ignores difference in exception formatting
+between Python versions. For example, in Python 2.x, the module path of
+the exception is not in the output, but this will fail under Python 3:
+
+    >>> def f(x):
+    ...     r'''
+    ...     >>> from http.client import HTTPException
+    ...     >>> raise HTTPException('message')
+    ...     Traceback (most recent call last):
+    ...     HTTPException: message
+    ...     '''
+    >>> test = doctest.DocTestFinder().find(f)[0]
+    >>> doctest.DocTestRunner(verbose=False).run(test)
+    ... # doctest: +ELLIPSIS
+    **********************************************************************
+    File ..., line 4, in f
+    Failed example:
+        raise HTTPException('message')
+    Expected:
+        Traceback (most recent call last):
+        HTTPException: message
+    Got:
+        Traceback (most recent call last):
+        ...
+        http.client.HTTPException: message
+    TestResults(failed=1, attempted=2)
+
+But in Python 3 the module path is included, and therefore a test must look
+like the following test to succeed in Python 3. But that test will fail under
+Python 2.
+
+    >>> def f(x):
+    ...     r'''
+    ...     >>> from http.client import HTTPException
+    ...     >>> raise HTTPException('message')
+    ...     Traceback (most recent call last):
+    ...     http.client.HTTPException: message
+    ...     '''
+    >>> test = doctest.DocTestFinder().find(f)[0]
+    >>> doctest.DocTestRunner(verbose=False).run(test)
+    TestResults(failed=0, attempted=2)
+
+However, with IGNORE_EXCEPTION_DETAIL, the module name of the exception
+(or its unexpected absence) will be ignored:
+
+    >>> def f(x):
+    ...     r'''
+    ...     >>> from http.client import HTTPException
+    ...     >>> raise HTTPException('message') #doctest: +IGNORE_EXCEPTION_DETAIL
+    ...     Traceback (most recent call last):
+    ...     HTTPException: message
+    ...     '''
+    >>> test = doctest.DocTestFinder().find(f)[0]
+    >>> doctest.DocTestRunner(verbose=False).run(test)
+    TestResults(failed=0, attempted=2)
+
+The module path will be completely ignored, so two different module paths will
+still pass if IGNORE_EXCEPTION_DETAIL is given. This is intentional, so it can
+be used when exceptions have changed module.
+
+    >>> def f(x):
+    ...     r'''
+    ...     >>> from http.client import HTTPException
+    ...     >>> raise HTTPException('message') #doctest: +IGNORE_EXCEPTION_DETAIL
+    ...     Traceback (most recent call last):
+    ...     foo.bar.HTTPException: message
+    ...     '''
+    >>> test = doctest.DocTestFinder().find(f)[0]
+    >>> doctest.DocTestRunner(verbose=False).run(test)
+    TestResults(failed=0, attempted=2)
+
 But IGNORE_EXCEPTION_DETAIL does not allow a mismatch in the exception type:
 
     >>> def f(x):

Modified: python/branches/py3k-jit/Lib/test/test_enumerate.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_enumerate.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_enumerate.py	Wed Jun 16 18:21:24 2010
@@ -198,6 +198,18 @@
                 self.fail("non-callable __reversed__ didn't raise!")
         self.assertEqual(rc, sys.getrefcount(r))
 
+    def test_objmethods(self):
+        # Objects must have __len__() and __getitem__() implemented.
+        class NoLen(object):
+            def __getitem__(self): return 1
+        nl = NoLen()
+        self.assertRaises(TypeError, reversed, nl)
+
+        class NoGetItem(object):
+            def __len__(self): return 2
+        ngi = NoGetItem()
+        self.assertRaises(TypeError, reversed, ngi)
+
 
 class EnumerateStartTestCase(EnumerateTestCase):
 
@@ -227,7 +239,7 @@
     if verbose and hasattr(sys, "gettotalrefcount"):
         counts = [None] * 5
         for i in range(len(counts)):
-            support.run_unittest(*testclasses)
+            support.run_unittest(__name__)
             counts[i] = sys.gettotalrefcount()
         print(counts)
 

Modified: python/branches/py3k-jit/Lib/test/test_fractions.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_fractions.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_fractions.py	Wed Jun 16 18:21:24 2010
@@ -395,12 +395,11 @@
         self.assertTypedEquals(1.0 + 0j, (1.0 + 0j) ** F(1, 10))
 
     def testMixingWithDecimal(self):
-        # Decimal refuses mixed comparisons.
+        # Decimal refuses mixed arithmetic (but not mixed comparisons)
         self.assertRaisesMessage(
             TypeError,
             "unsupported operand type(s) for +: 'Fraction' and 'Decimal'",
             operator.add, F(3,11), Decimal('3.1415926'))
-        self.assertNotEquals(F(5, 2), Decimal('2.5'))
 
     def testComparisons(self):
         self.assertTrue(F(1, 2) < F(2, 3))

Modified: python/branches/py3k-jit/Lib/test/test_ftplib.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_ftplib.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_ftplib.py	Wed Jun 16 18:21:24 2010
@@ -719,6 +719,29 @@
         finally:
             self.client.ssl_version = ssl.PROTOCOL_TLSv1
 
+    def test_context(self):
+        self.client.quit()
+        ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+        self.assertRaises(ValueError, ftplib.FTP_TLS, keyfile=CERTFILE,
+                          context=ctx)
+        self.assertRaises(ValueError, ftplib.FTP_TLS, certfile=CERTFILE,
+                          context=ctx)
+        self.assertRaises(ValueError, ftplib.FTP_TLS, certfile=CERTFILE,
+                          keyfile=CERTFILE, context=ctx)
+
+        self.client = ftplib.FTP_TLS(context=ctx, timeout=2)
+        self.client.connect(self.server.host, self.server.port)
+        self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
+        self.client.auth()
+        self.assertIs(self.client.sock.context, ctx)
+        self.assertIsInstance(self.client.sock, ssl.SSLSocket)
+
+        self.client.prot_p()
+        sock = self.client.transfercmd('list')
+        self.assertIs(sock.context, ctx)
+        self.assertIsInstance(sock, ssl.SSLSocket)
+        sock.close()
+
 
 class TestTimeouts(TestCase):
 

Modified: python/branches/py3k-jit/Lib/test/test_getargs2.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_getargs2.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_getargs2.py	Wed Jun 16 18:21:24 2010
@@ -1,7 +1,6 @@
 import unittest
 from test import support
 from _testcapi import getargs_keywords
-import warnings
 
 """
 > How about the following counterproposal. This also changes some of
@@ -190,21 +189,7 @@
         from _testcapi import getargs_L
         # L returns 'long long', and does range checking (LLONG_MIN
         # ... LLONG_MAX)
-        with warnings.catch_warnings():
-            warnings.filterwarnings(
-                "ignore",
-                category=DeprecationWarning,
-                message=".*integer argument expected, got float",
-                module=__name__)
-            self.assertEqual(3, getargs_L(3.14))
-        with warnings.catch_warnings():
-            warnings.filterwarnings(
-                "error",
-                category=DeprecationWarning,
-                message=".*integer argument expected, got float",
-                module="unittest")
-            self.assertRaises(DeprecationWarning, getargs_L, 3.14)
-
+        self.assertRaises(TypeError, getargs_L, 3.14)
         self.assertRaises(TypeError, getargs_L, "Hello")
         self.assertEqual(99, getargs_L(Int()))
 
@@ -308,8 +293,136 @@
         else:
             self.fail('TypeError should have been raised')
 
+class Bytes_TestCase(unittest.TestCase):
+    def test_s(self):
+        from _testcapi import getargs_s
+        self.assertEqual(getargs_s('abc\xe9'), b'abc\xc3\xa9')
+        self.assertRaises(TypeError, getargs_s, 'nul:\0')
+        self.assertRaises(TypeError, getargs_s, b'bytes')
+        self.assertRaises(TypeError, getargs_s, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_s, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_s, None)
+
+    def test_s_star(self):
+        from _testcapi import getargs_s_star
+        self.assertEqual(getargs_s_star('abc\xe9'), b'abc\xc3\xa9')
+        self.assertEqual(getargs_s_star('nul:\0'), b'nul:\0')
+        self.assertEqual(getargs_s_star(b'bytes'), b'bytes')
+        self.assertEqual(getargs_s_star(bytearray(b'bytearray')), b'bytearray')
+        self.assertEqual(getargs_s_star(memoryview(b'memoryview')), b'memoryview')
+        self.assertRaises(TypeError, getargs_s_star, None)
+
+    def test_s_hash(self):
+        from _testcapi import getargs_s_hash
+        self.assertEqual(getargs_s_hash('abc\xe9'), b'abc\xc3\xa9')
+        self.assertEqual(getargs_s_hash('nul:\0'), b'nul:\0')
+        self.assertEqual(getargs_s_hash(b'bytes'), b'bytes')
+        self.assertRaises(TypeError, getargs_s_hash, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_s_hash, None)
+
+    def test_z(self):
+        from _testcapi import getargs_z
+        self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
+        self.assertRaises(TypeError, getargs_z, 'nul:\0')
+        self.assertEqual(getargs_z(b'bytes'), b'bytes')
+        self.assertRaises(TypeError, getargs_z, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_z, memoryview(b'memoryview'))
+        self.assertIsNone(getargs_z(None))
+
+    def test_z_star(self):
+        from _testcapi import getargs_z_star
+        self.assertEqual(getargs_z_star('abc\xe9'), b'abc\xc3\xa9')
+        self.assertEqual(getargs_z_star('nul:\0'), b'nul:\0')
+        self.assertEqual(getargs_z_star(b'bytes'), b'bytes')
+        self.assertEqual(getargs_z_star(bytearray(b'bytearray')), b'bytearray')
+        self.assertEqual(getargs_z_star(memoryview(b'memoryview')), b'memoryview')
+        self.assertIsNone(getargs_z_star(None))
+
+    def test_z_hash(self):
+        from _testcapi import getargs_z_hash
+        self.assertEqual(getargs_z_hash('abc\xe9'), b'abc\xc3\xa9')
+        self.assertEqual(getargs_z_hash('nul:\0'), b'nul:\0')
+        self.assertEqual(getargs_z_hash(b'bytes'), b'bytes')
+        self.assertRaises(TypeError, getargs_z_hash, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_z_hash, memoryview(b'memoryview'))
+        self.assertIsNone(getargs_z_hash(None))
+
+    def test_y(self):
+        from _testcapi import getargs_y
+        self.assertRaises(TypeError, getargs_y, 'abc\xe9')
+        self.assertEqual(getargs_y(b'bytes'), b'bytes')
+        self.assertRaises(TypeError, getargs_y, b'nul:\0')
+        self.assertRaises(TypeError, getargs_y, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_y, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_y, None)
+
+    def test_y_star(self):
+        from _testcapi import getargs_y_star
+        self.assertRaises(TypeError, getargs_y_star, 'abc\xe9')
+        self.assertEqual(getargs_y_star(b'bytes'), b'bytes')
+        self.assertEqual(getargs_y_star(b'nul:\0'), b'nul:\0')
+        self.assertEqual(getargs_y_star(bytearray(b'bytearray')), b'bytearray')
+        self.assertEqual(getargs_y_star(memoryview(b'memoryview')), b'memoryview')
+        self.assertRaises(TypeError, getargs_y_star, None)
+
+    def test_y_hash(self):
+        from _testcapi import getargs_y_hash
+        self.assertRaises(TypeError, getargs_y_hash, 'abc\xe9')
+        self.assertEqual(getargs_y_hash(b'bytes'), b'bytes')
+        self.assertEqual(getargs_y_hash(b'nul:\0'), b'nul:\0')
+        self.assertRaises(TypeError, getargs_y_hash, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_y_hash, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_y_hash, None)
+
+
+class Unicode_TestCase(unittest.TestCase):
+    def test_u(self):
+        from _testcapi import getargs_u
+        self.assertEqual(getargs_u('abc\xe9'), 'abc\xe9')
+        self.assertRaises(TypeError, getargs_u, 'nul:\0')
+        self.assertRaises(TypeError, getargs_u, b'bytes')
+        self.assertRaises(TypeError, getargs_u, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_u, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_u, None)
+
+    def test_u_hash(self):
+        from _testcapi import getargs_u_hash
+        self.assertEqual(getargs_u_hash('abc\xe9'), 'abc\xe9')
+        self.assertEqual(getargs_u_hash('nul:\0'), 'nul:\0')
+        self.assertRaises(TypeError, getargs_u_hash, b'bytes')
+        self.assertRaises(TypeError, getargs_u_hash, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_u_hash, memoryview(b'memoryview'))
+        self.assertRaises(TypeError, getargs_u_hash, None)
+
+    def test_Z(self):
+        from _testcapi import getargs_Z
+        self.assertEqual(getargs_Z('abc\xe9'), 'abc\xe9')
+        self.assertRaises(TypeError, getargs_Z, 'nul:\0')
+        self.assertRaises(TypeError, getargs_Z, b'bytes')
+        self.assertRaises(TypeError, getargs_Z, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_Z, memoryview(b'memoryview'))
+        self.assertIsNone(getargs_Z(None))
+
+    def test_Z_hash(self):
+        from _testcapi import getargs_Z_hash
+        self.assertEqual(getargs_Z_hash('abc\xe9'), 'abc\xe9')
+        self.assertEqual(getargs_Z_hash('nul:\0'), 'nul:\0')
+        self.assertRaises(TypeError, getargs_Z_hash, b'bytes')
+        self.assertRaises(TypeError, getargs_Z_hash, bytearray(b'bytearray'))
+        self.assertRaises(TypeError, getargs_Z_hash, memoryview(b'memoryview'))
+        self.assertIsNone(getargs_Z_hash(None))
+
+
 def test_main():
-    tests = [Signed_TestCase, Unsigned_TestCase, Tuple_TestCase, Keywords_TestCase]
+    tests = [
+        Signed_TestCase,
+        Unsigned_TestCase,
+        Tuple_TestCase,
+        Keywords_TestCase,
+        Bytes_TestCase,
+        Unicode_TestCase,
+    ]
     try:
         from _testcapi import getargs_L, getargs_K
     except ImportError:

Modified: python/branches/py3k-jit/Lib/test/test_htmlparser.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_htmlparser.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_htmlparser.py	Wed Jun 16 18:21:24 2010
@@ -136,6 +136,13 @@
     ("data", "\n"),
     ])
 
+    def test_malformatted_charref(self):
+        self._run_check("<p>&#bad;</p>", [
+            ("starttag", "p", []),
+            ("data", "&#bad;"),
+            ("endtag", "p"),
+        ])
+
     def test_unclosed_entityref(self):
         self._run_check("&entityref foo", [
             ("entityref", "entityref"),

Modified: python/branches/py3k-jit/Lib/test/test_httplib.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_httplib.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_httplib.py	Wed Jun 16 18:21:24 2010
@@ -239,7 +239,7 @@
         self.assertEquals(resp.read(), b'')
         self.assertEquals(resp.status, 200)
         self.assertEquals(resp.reason, 'OK')
-        resp.close()
+        self.assertTrue(resp.isclosed())
 
     def test_negative_content_length(self):
         sock = FakeSocket(

Modified: python/branches/py3k-jit/Lib/test/test_long.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_long.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_long.py	Wed Jun 16 18:21:24 2010
@@ -330,6 +330,31 @@
         # ... but it's just a normal digit if base >= 22
         self.assertEqual(int('1L', 22), 43)
 
+        # tests with base 0
+        self.assertEqual(int('000', 0), 0)
+        self.assertEqual(int('0o123', 0), 83)
+        self.assertEqual(int('0x123', 0), 291)
+        self.assertEqual(int('0b100', 0), 4)
+        self.assertEqual(int(' 0O123   ', 0), 83)
+        self.assertEqual(int(' 0X123  ', 0), 291)
+        self.assertEqual(int(' 0B100 ', 0), 4)
+        self.assertEqual(int('0', 0), 0)
+        self.assertEqual(int('+0', 0), 0)
+        self.assertEqual(int('-0', 0), 0)
+        self.assertEqual(int('00', 0), 0)
+        self.assertRaises(ValueError, int, '08', 0)
+        self.assertRaises(ValueError, int, '-012395', 0)
+
+        # invalid bases
+        invalid_bases = [-909,
+                          2**31-1, 2**31, -2**31, -2**31-1,
+                          2**63-1, 2**63, -2**63, -2**63-1,
+                          2**100, -2**100,
+                          ]
+        for base in invalid_bases:
+            self.assertRaises(ValueError, int, '42', base)
+
+
     def test_conversion(self):
 
         class JustLong:

Modified: python/branches/py3k-jit/Lib/test/test_math.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_math.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_math.py	Wed Jun 16 18:21:24 2010
@@ -1042,6 +1042,15 @@
                         accuracy_failure = acc_check(expected, got,
                                                   rel_err = 5e-15,
                                                   abs_err = 5e-15)
+                    elif fn == 'erfc':
+                        # erfc has less-than-ideal accuracy for large
+                        # arguments (x ~ 25 or so), mainly due to the
+                        # error involved in computing exp(-x*x).
+                        #
+                        # XXX Would be better to weaken this test only
+                        # for large x, instead of for all x.
+                        accuracy_failure = ulps_check(expected, got, 2000)
+
                     else:
                         accuracy_failure = ulps_check(expected, got, 20)
                     if accuracy_failure is None:

Modified: python/branches/py3k-jit/Lib/test/test_minidom.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_minidom.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_minidom.py	Wed Jun 16 18:21:24 2010
@@ -228,7 +228,14 @@
 
     def testUnlink(self):
         dom = parse(tstfile)
+        self.assertTrue(dom.childNodes)
         dom.unlink()
+        self.assertFalse(dom.childNodes)
+
+    def testContext(self):
+        with parse(tstfile) as dom:
+            self.assertTrue(dom.childNodes)
+        self.assertFalse(dom.childNodes)
 
     def testElement(self):
         dom = Document()

Modified: python/branches/py3k-jit/Lib/test/test_numeric_tower.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_numeric_tower.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_numeric_tower.py	Wed Jun 16 18:21:24 2010
@@ -143,9 +143,64 @@
         x = {'halibut', HalibutProxy()}
         self.assertEqual(len(x), 1)
 
+class ComparisonTest(unittest.TestCase):
+    def test_mixed_comparisons(self):
+
+        # ordered list of distinct test values of various types:
+        # int, float, Fraction, Decimal
+        test_values = [
+            float('-inf'),
+            D('-1e999999999'),
+            -1e308,
+            F(-22, 7),
+            -3.14,
+            -2,
+            0.0,
+            1e-320,
+            True,
+            F('1.2'),
+            D('1.3'),
+            float('1.4'),
+            F(275807, 195025),
+            D('1.414213562373095048801688724'),
+            F(114243, 80782),
+            F(473596569, 84615),
+            7e200,
+            D('infinity'),
+            ]
+        for i, first in enumerate(test_values):
+            for second in test_values[i+1:]:
+                self.assertLess(first, second)
+                self.assertLessEqual(first, second)
+                self.assertGreater(second, first)
+                self.assertGreaterEqual(second, first)
+
+    def test_complex(self):
+        # comparisons with complex are special:  equality and inequality
+        # comparisons should always succeed, but order comparisons should
+        # raise TypeError.
+        z = 1.0 + 0j
+        w = -3.14 + 2.7j
+
+        for v in 1, 1.0, F(1), D(1), complex(1):
+            self.assertEqual(z, v)
+            self.assertEqual(v, z)
+
+        for v in 2, 2.0, F(2), D(2), complex(2):
+            self.assertNotEqual(z, v)
+            self.assertNotEqual(v, z)
+            self.assertNotEqual(w, v)
+            self.assertNotEqual(v, w)
+
+        for v in (1, 1.0, F(1), D(1), complex(1),
+                  2, 2.0, F(2), D(2), complex(2), w):
+            for op in operator.le, operator.lt, operator.ge, operator.gt:
+                self.assertRaises(TypeError, op, z, v)
+                self.assertRaises(TypeError, op, v, z)
+
 
 def test_main():
-    run_unittest(HashTest)
+    run_unittest(HashTest, ComparisonTest)
 
 if __name__ == '__main__':
     test_main()

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	Wed Jun 16 18:21:24 2010
@@ -933,20 +933,64 @@
 
 @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
 class Win32KillTests(unittest.TestCase):
-    def _kill(self, sig, *args):
-        # Send a subprocess a signal (or in some cases, just an int to be
-        # the return value)
-        proc = subprocess.Popen(*args)
+    def _kill(self, sig):
+        # Start sys.executable as a subprocess and communicate from the
+        # subprocess to the parent that the interpreter is ready. When it
+        # becomes ready, send *sig* via os.kill to the subprocess and check
+        # that the return code is equal to *sig*.
+        import ctypes
+        from ctypes import wintypes
+        import msvcrt
+
+        # Since we can't access the contents of the process' stdout until the
+        # process has exited, use PeekNamedPipe to see what's inside stdout
+        # without waiting. This is done so we can tell that the interpreter
+        # is started and running at a point where it could handle a signal.
+        PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
+        PeekNamedPipe.restype = wintypes.BOOL
+        PeekNamedPipe.argtypes = (wintypes.HANDLE, # Pipe handle
+                                  ctypes.POINTER(ctypes.c_char), # stdout buf
+                                  wintypes.DWORD, # Buffer size
+                                  ctypes.POINTER(wintypes.DWORD), # bytes read
+                                  ctypes.POINTER(wintypes.DWORD), # bytes avail
+                                  ctypes.POINTER(wintypes.DWORD)) # bytes left
+        msg = "running"
+        proc = subprocess.Popen([sys.executable, "-c",
+                                 "import sys;"
+                                 "sys.stdout.write('{}');"
+                                 "sys.stdout.flush();"
+                                 "input()".format(msg)],
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE,
+                                stdin=subprocess.PIPE)
+
+        count, max = 0, 100
+        while count < max and proc.poll() is None:
+            # Create a string buffer to store the result of stdout from the pipe
+            buf = ctypes.create_string_buffer(len(msg))
+            # Obtain the text currently in proc.stdout
+            # Bytes read/avail/left are left as NULL and unused
+            rslt = PeekNamedPipe(msvcrt.get_osfhandle(proc.stdout.fileno()),
+                                 buf, ctypes.sizeof(buf), None, None, None)
+            self.assertNotEqual(rslt, 0, "PeekNamedPipe failed")
+            if buf.value:
+                self.assertEqual(msg, buf.value.decode())
+                break
+            time.sleep(0.1)
+            count += 1
+        else:
+            self.fail("Did not receive communication from the subprocess")
+
         os.kill(proc.pid, sig)
         self.assertEqual(proc.wait(), sig)
 
     def test_kill_sigterm(self):
         # SIGTERM doesn't mean anything special, but make sure it works
-        self._kill(signal.SIGTERM, [sys.executable])
+        self._kill(signal.SIGTERM)
 
     def test_kill_int(self):
         # os.kill on Windows can take an int which gets set as the exit code
-        self._kill(100, [sys.executable])
+        self._kill(100)
 
     def _kill_with_event(self, event, name):
         # Run a script which has console control handling enabled.

Modified: python/branches/py3k-jit/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_socketserver.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_socketserver.py	Wed Jun 16 18:21:24 2010
@@ -61,6 +61,7 @@
     testcase.assertEquals(72 << 8, status)
 
 
+ at unittest.skipUnless(threading, 'Threading required for this test.')
 class SocketServerTest(unittest.TestCase):
     """Test all socket servers."""
 

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	Wed Jun 16 18:21:24 2010
@@ -33,16 +33,15 @@
 HOST = support.HOST
 
 data_file = lambda name: os.path.join(os.path.dirname(__file__), name)
-fsencode = lambda name: name.encode(sys.getfilesystemencoding(), "surrogateescape")
 
 CERTFILE = data_file("keycert.pem")
-BYTES_CERTFILE = fsencode(CERTFILE)
+BYTES_CERTFILE = os.fsencode(CERTFILE)
 ONLYCERT = data_file("ssl_cert.pem")
 ONLYKEY = data_file("ssl_key.pem")
-BYTES_ONLYCERT = fsencode(ONLYCERT)
-BYTES_ONLYKEY = fsencode(ONLYKEY)
+BYTES_ONLYCERT = os.fsencode(ONLYCERT)
+BYTES_ONLYKEY = os.fsencode(ONLYKEY)
 CAPATH = data_file("capath")
-BYTES_CAPATH = fsencode(CAPATH)
+BYTES_CAPATH = os.fsencode(CAPATH)
 
 SVN_PYTHON_ORG_ROOT_CERT = data_file("https_svn_python_org_root.pem")
 

Modified: python/branches/py3k-jit/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_struct.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_struct.py	Wed Jun 16 18:21:24 2010
@@ -443,7 +443,7 @@
 
         # Test bogus offset (issue 3694)
         sb = small_buf
-        self.assertRaises(TypeError, struct.pack_into, b'1', sb, None)
+        self.assertRaises(TypeError, struct.pack_into, b'', sb, None)
 
     def test_pack_into_fn(self):
         test_string = b'Reykjavik rocks, eow!'
@@ -506,10 +506,43 @@
             for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
                 self.assertTrue(struct.unpack('>?', c)[0])
 
+    def test_count_overflow(self):
+        hugecount = '{}b'.format(sys.maxsize+1)
+        self.assertRaises(struct.error, struct.calcsize, hugecount)
+
+        hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2)
+        self.assertRaises(struct.error, struct.calcsize, hugecount2)
+
     if IS32BIT:
         def test_crasher(self):
             self.assertRaises(MemoryError, struct.pack, "357913941b", "a")
 
+    def test_trailing_counter(self):
+        store = array.array('b', b' '*100)
+
+        # format lists containing only count spec should result in an error
+        self.assertRaises(struct.error, struct.pack, '12345')
+        self.assertRaises(struct.error, struct.unpack, '12345', '')
+        self.assertRaises(struct.error, struct.pack_into, '12345', store, 0)
+        self.assertRaises(struct.error, struct.unpack_from, '12345', store, 0)
+
+        # Format lists with trailing count spec should result in an error
+        self.assertRaises(struct.error, struct.pack, 'c12345', 'x')
+        self.assertRaises(struct.error, struct.unpack, 'c12345', 'x')
+        self.assertRaises(struct.error, struct.pack_into, 'c12345', store, 0,
+                           'x')
+        self.assertRaises(struct.error, struct.unpack_from, 'c12345', store,
+                           0)
+
+        # Mixed format tests
+        self.assertRaises(struct.error, struct.pack, '14s42', 'spam and eggs')
+        self.assertRaises(struct.error, struct.unpack, '14s42',
+                          'spam and eggs')
+        self.assertRaises(struct.error, struct.pack_into, '14s42', store, 0,
+                          'spam and eggs')
+        self.assertRaises(struct.error, struct.unpack_from, '14s42', store, 0)
+
+
 
 def test_main():
     run_unittest(StructTest)

Modified: python/branches/py3k-jit/Lib/test/test_sundry.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_sundry.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_sundry.py	Wed Jun 16 18:21:24 2010
@@ -60,7 +60,6 @@
             import rlcompleter
             import sched
             import sndhdr
-            import sunau
             import symbol
             import tabnanny
             import timeit

Modified: python/branches/py3k-jit/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_sys.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_sys.py	Wed Jun 16 18:21:24 2010
@@ -867,6 +867,35 @@
         # sys.flags
         check(sys.flags, size(vh) + self.P * len(sys.flags))
 
+    def test_getfilesystemencoding(self):
+        import codecs
+
+        def check_fsencoding(fs_encoding):
+            self.assertIsNotNone(fs_encoding)
+            if sys.platform == 'darwin':
+                self.assertEqual(fs_encoding, 'utf-8')
+            codecs.lookup(fs_encoding)
+
+        fs_encoding = sys.getfilesystemencoding()
+        check_fsencoding(fs_encoding)
+
+        # Even in C locale
+        try:
+            sys.executable.encode('ascii')
+        except UnicodeEncodeError:
+            # Python doesn't start with ASCII locale if its path is not ASCII,
+            # see issue #8611
+            pass
+        else:
+            env = os.environ.copy()
+            env['LANG'] = 'C'
+            output = subprocess.check_output(
+                [sys.executable, "-c",
+                 "import sys; print(sys.getfilesystemencoding())"],
+                env=env)
+            fs_encoding = output.rstrip().decode('ascii')
+            check_fsencoding(fs_encoding)
+
     def test_setfilesystemencoding(self):
         old = sys.getfilesystemencoding()
         try:

Modified: python/branches/py3k-jit/Lib/test/test_sysconfig.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_sysconfig.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_sysconfig.py	Wed Jun 16 18:21:24 2010
@@ -11,13 +11,14 @@
 import shutil
 from copy import copy, deepcopy
 
-from test.support import run_unittest, TESTFN, unlink, get_attribute
+from test.support import (run_unittest, TESTFN, unlink, get_attribute,
+                          captured_stdout)
 
 import sysconfig
 from sysconfig import (get_paths, get_platform, get_config_vars,
                        get_path, get_path_names, _INSTALL_SCHEMES,
                        _get_default_scheme, _expand_vars,
-                       get_scheme_names, get_config_var)
+                       get_scheme_names, get_config_var, _main)
 
 class TestSysConfig(unittest.TestCase):
 
@@ -264,6 +265,13 @@
             user_path = get_path(name, 'posix_user')
             self.assertEquals(user_path, global_path.replace(base, user))
 
+    def test_main(self):
+        # just making sure _main() runs and returns things in the stdout
+        with captured_stdout() as output:
+            _main()
+        self.assertTrue(len(output.getvalue().split('\n')) > 0)
+
+
 def test_main():
     run_unittest(TestSysConfig)
 

Modified: python/branches/py3k-jit/Lib/test/test_tarfile.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_tarfile.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_tarfile.py	Wed Jun 16 18:21:24 2010
@@ -133,6 +133,26 @@
                      "read() after readline() failed")
         fobj.close()
 
+    # Test if symbolic and hard links are resolved by extractfile().  The
+    # test link members each point to a regular member whose data is
+    # supposed to be exported.
+    def _test_fileobj_link(self, lnktype, regtype):
+        a = self.tar.extractfile(lnktype)
+        b = self.tar.extractfile(regtype)
+        self.assertEqual(a.name, b.name)
+
+    def test_fileobj_link1(self):
+        self._test_fileobj_link("ustar/lnktype", "ustar/regtype")
+
+    def test_fileobj_link2(self):
+        self._test_fileobj_link("./ustar/linktest2/lnktype", "ustar/linktest1/regtype")
+
+    def test_fileobj_symlink1(self):
+        self._test_fileobj_link("ustar/symtype", "ustar/regtype")
+
+    def test_fileobj_symlink2(self):
+        self._test_fileobj_link("./ustar/linktest2/symtype", "ustar/linktest1/regtype")
+
 
 class CommonReadTest(ReadTest):
 
@@ -661,10 +681,14 @@
         if hasattr(os, "link"):
             link = os.path.join(TEMPDIR, "link")
             target = os.path.join(TEMPDIR, "link_target")
-            open(target, "wb").close()
+            fobj = open(target, "wb")
+            fobj.write(b"aaa")
+            fobj.close()
             os.link(target, link)
             try:
                 tar = tarfile.open(tmpname, self.mode)
+                # Record the link target in the inodes list.
+                tar.gettarinfo(target)
                 tarinfo = tar.gettarinfo(link)
                 self.assertEqual(tarinfo.size, 0)
             finally:
@@ -1374,6 +1398,29 @@
         fobj.close()
 
 
+class LinkEmulationTest(ReadTest):
+
+    # Test for issue #8741 regression. On platforms that do not support
+    # symbolic or hard links tarfile tries to extract these types of members as
+    # the regular files they point to.
+    def _test_link_extraction(self, name):
+        self.tar.extract(name, TEMPDIR)
+        data = open(os.path.join(TEMPDIR, name), "rb").read()
+        self.assertEqual(md5sum(data), md5_regtype)
+
+    def test_hardlink_extraction1(self):
+        self._test_link_extraction("ustar/lnktype")
+
+    def test_hardlink_extraction2(self):
+        self._test_link_extraction("./ustar/linktest2/lnktype")
+
+    def test_symlink_extraction1(self):
+        self._test_link_extraction("ustar/symtype")
+
+    def test_symlink_extraction2(self):
+        self._test_link_extraction("./ustar/linktest2/symtype")
+
+
 class GzipMiscReadTest(MiscReadTest):
     tarname = gzipname
     mode = "r:gz"
@@ -1459,6 +1506,8 @@
 
     if hasattr(os, "link"):
         tests.append(HardlinkTest)
+    else:
+        tests.append(LinkEmulationTest)
 
     fobj = open(tarname, "rb")
     data = fobj.read()

Modified: python/branches/py3k-jit/Lib/test/test_tcl.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_tcl.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_tcl.py	Wed Jun 16 18:21:24 2010
@@ -127,6 +127,31 @@
         tcl = self.interp
         self.assertRaises(TclError,tcl.eval,'package require DNE')
 
+    def testLoadWithUNC(self):
+        import sys
+        if sys.platform != 'win32':
+            return
+
+        # Build a UNC path from the regular path.
+        # Something like
+        #   \\%COMPUTERNAME%\c$\python27\python.exe
+
+        fullname = os.path.abspath(sys.executable)
+        if fullname[1] != ':':
+            return
+        unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'],
+                                    fullname[0],
+                                    fullname[3:])
+
+        with test_support.EnvironmentVarGuard() as env:
+            env.unset("TCL_LIBRARY")
+            f = os.popen('%s -c "import Tkinter; print Tkinter"' % (unc_name,))
+
+        self.assert_('Tkinter.py' in f.read())
+        # exit code must be zero
+        self.assertEqual(f.close(), None)
+
+
 
 def test_main():
     support.run_unittest(TclTest, TkinterTest)

Modified: python/branches/py3k-jit/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_unicode.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_unicode.py	Wed Jun 16 18:21:24 2010
@@ -681,6 +681,9 @@
         self.assertRaises(IndexError, "{:}".format)
         self.assertRaises(IndexError, "{:s}".format)
         self.assertRaises(IndexError, "{}".format)
+        big = "23098475029384702983476098230754973209482573"
+        self.assertRaises(ValueError, ("{" + big + "}").format)
+        self.assertRaises(ValueError, ("{[" + big + "]}").format, [0])
 
         # issue 6089
         self.assertRaises(ValueError, "{0[0]x}".format, [None])

Modified: python/branches/py3k-jit/Lib/test/test_urllib2.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_urllib2.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_urllib2.py	Wed Jun 16 18:21:24 2010
@@ -1151,7 +1151,6 @@
         self.assertEqual(len(http_handler.requests), 1)
         self.assertFalse(http_handler.requests[0].has_header(auth_header))
 
-
 class MiscTests(unittest.TestCase):
 
     def test_build_opener(self):

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	Wed Jun 16 18:21:24 2010
@@ -5,6 +5,7 @@
 import os, sys
 import unittest
 from test import support
+threading = support.import_module("threading")
 from platform import machine
 
 # Do this first so test will be skipped if module doesn't exist
@@ -227,6 +228,58 @@
         except WindowsError:
             self.assertEqual(h.handle, 0)
 
+    def test_changing_value(self):
+        # Issue2810: A race condition in 2.6 and 3.1 may cause
+        # EnumValue or QueryValue to throw "WindowsError: More data is
+        # available"
+        done = False
+
+        class VeryActiveThread(threading.Thread):
+            def run(self):
+                with CreateKey(HKEY_CURRENT_USER, test_key_name) as key:
+                    use_short = True
+                    long_string = 'x'*2000
+                    while not done:
+                        s = 'x' if use_short else long_string
+                        use_short = not use_short
+                        SetValue(key, 'changing_value', REG_SZ, s)
+
+        thread = VeryActiveThread()
+        thread.start()
+        try:
+            with CreateKey(HKEY_CURRENT_USER,
+                           test_key_name+'\\changing_value') as key:
+                for _ in range(1000):
+                    num_subkeys, num_values, t = QueryInfoKey(key)
+                    for i in range(num_values):
+                        name = EnumValue(key, i)
+                        QueryValue(key, name[0])
+        finally:
+            done = True
+            thread.join()
+            DeleteKey(HKEY_CURRENT_USER, test_key_name+'\\changing_value')
+            DeleteKey(HKEY_CURRENT_USER, test_key_name)
+
+    def test_long_key(self):
+        # Issue2810, in 2.6 and 3.1 when the key name was exactly 256
+        # characters, EnumKey threw "WindowsError: More data is
+        # available"
+        name = 'x'*256
+        try:
+            with CreateKey(HKEY_CURRENT_USER, test_key_name) as key:
+                SetValue(key, name, REG_SZ, 'x')
+                num_subkeys, num_values, t = QueryInfoKey(key)
+                EnumKey(key, 0)
+        finally:
+            DeleteKey(HKEY_CURRENT_USER, '\\'.join((test_key_name, name)))
+            DeleteKey(HKEY_CURRENT_USER, test_key_name)
+
+    def test_dynamic_key(self):
+        # Issue2810, when the value is dynamically generated, these
+        # throw "WindowsError: More data is available" in 2.6 and 3.1
+        EnumValue(HKEY_PERFORMANCE_DATA, 0)
+        QueryValueEx(HKEY_PERFORMANCE_DATA, "")
+
     # 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")

Modified: python/branches/py3k-jit/Lib/test/test_winsound.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_winsound.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_winsound.py	Wed Jun 16 18:21:24 2010
@@ -6,6 +6,7 @@
 import time
 import os
 import subprocess
+import ctypes
 
 winsound = support.import_module('winsound')
 import winreg
@@ -13,6 +14,11 @@
 def has_sound(sound):
     """Find out if a particular event is configured with a default sound"""
     try:
+        # Ask the mixer API for the number of devices it knows about.
+        # When there are no devices, PlaySound will fail.
+        if ctypes.windll.winmm.mixerGetNumDevs() is 0:
+            return False
+
         key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER,
                 "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
         value = winreg.EnumValue(key, 0)[1]

Modified: python/branches/py3k-jit/Lib/test/testtar.tar
==============================================================================
Binary files. No diff available.

Modified: python/branches/py3k-jit/Lib/tkinter/_fix.py
==============================================================================
--- python/branches/py3k-jit/Lib/tkinter/_fix.py	(original)
+++ python/branches/py3k-jit/Lib/tkinter/_fix.py	Wed Jun 16 18:21:24 2010
@@ -42,6 +42,8 @@
         # Ignore leading \\?\
         if s.startswith("\\\\?\\"):
             s = s[4:]
+        if s.startswith("UNC"):
+            s = "\\" + s[3:]
         return s
 
 prefix = os.path.join(sys.prefix,"tcl")

Modified: python/branches/py3k-jit/Lib/unittest/case.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/case.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/case.py	Wed Jun 16 18:21:24 2010
@@ -14,6 +14,9 @@
 __unittest = True
 
 
+DIFF_OMITTED = ('\nDiff is %s characters long. '
+                 'Set self.maxDiff to None to see it.')
+
 class SkipTest(Exception):
     """
     Raise this exception in a test to skip it.
@@ -169,6 +172,12 @@
 
     longMessage = False
 
+    # This attribute sets the maximum length of a diff in failure messages
+    # by assert methods using difflib. It is looked up as an instance attribute
+    # so can be configured by individual tests if required.
+
+    maxDiff = 80*8
+
     # Attribute used by TestSuite for classSetUp
 
     _classSetupFailed = False
@@ -380,6 +389,9 @@
         self.setUp()
         getattr(self, self._testMethodName)()
         self.tearDown()
+        while self._cleanups:
+            function, args, kwargs = self._cleanups.pop(-1)
+            function(*args, **kwargs)
 
     def skipTest(self, reason):
         """Skip this test."""
@@ -694,12 +706,21 @@
                 except (TypeError, IndexError, NotImplementedError):
                     differing += ('Unable to index element %d '
                                   'of second %s\n' % (len1, seq_type_name))
-        standardMsg = differing + '\n' + '\n'.join(
+        standardMsg = differing
+        diffMsg = '\n' + '\n'.join(
             difflib.ndiff(pprint.pformat(seq1).splitlines(),
                           pprint.pformat(seq2).splitlines()))
+
+        standardMsg = self._truncateMessage(standardMsg, diffMsg)
         msg = self._formatMessage(msg, standardMsg)
         self.fail(msg)
 
+    def _truncateMessage(self, message, diff):
+        max_diff = self.maxDiff
+        if max_diff is None or len(diff) <= max_diff:
+            return message + diff
+        return message + (DIFF_OMITTED % len(diff))
+
     def assertListEqual(self, list1, list2, msg=None):
         """A list-specific equality assertion.
 
@@ -798,9 +819,11 @@
         self.assert_(isinstance(d2, dict), 'Second argument is not a dictionary')
 
         if d1 != d2:
-            standardMsg = ('\n' + '\n'.join(difflib.ndiff(
+            standardMsg = '%s != %s' % (safe_repr(d1, True), safe_repr(d2, True))
+            diff = ('\n' + '\n'.join(difflib.ndiff(
                            pprint.pformat(d1).splitlines(),
                            pprint.pformat(d2).splitlines())))
+            standardMsg = self._truncateMessage(standardMsg, diff)
             self.fail(self._formatMessage(msg, standardMsg))
 
     def assertDictContainsSubset(self, expected, actual, msg=None):
@@ -917,8 +940,10 @@
                 'Second argument is not a string'))
 
         if first != second:
-            standardMsg = '\n' + ''.join(difflib.ndiff(first.splitlines(True),
+            standardMsg = '%s != %s' % (safe_repr(first, True), safe_repr(second, True))
+            diff = '\n' + ''.join(difflib.ndiff(first.splitlines(True),
                                                        second.splitlines(True)))
+            standardMsg = self._truncateMessage(standardMsg, diff)
             self.fail(self._formatMessage(msg, standardMsg))
 
     def assertLess(self, a, b, msg=None):

Modified: python/branches/py3k-jit/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/loader.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/loader.py	Wed Jun 16 18:21:24 2010
@@ -235,6 +235,10 @@
         __import__(name)
         return sys.modules[name]
 
+    def _match_path(self, path, full_path, pattern):
+        # override this method to use alternative matching strategy
+        return fnmatch(path, pattern)
+
     def _find_tests(self, start_dir, pattern):
         """Used by discovery. Yields test suites it loads."""
         paths = os.listdir(start_dir)
@@ -245,26 +249,26 @@
                 if not VALID_MODULE_NAME.match(path):
                     # valid Python identifiers only
                     continue
-
-                if fnmatch(path, pattern):
-                    # if the test file matches, load it
-                    name = self._get_name_from_path(full_path)
-                    try:
-                        module = self._get_module_from_name(name)
-                    except:
-                        yield _make_failed_import_test(name, self.suiteClass)
-                    else:
-                        mod_file = os.path.abspath(getattr(module, '__file__', full_path))
-                        realpath = os.path.splitext(mod_file)[0]
-                        fullpath_noext = os.path.splitext(full_path)[0]
-                        if realpath.lower() != fullpath_noext.lower():
-                            module_dir = os.path.dirname(realpath)
-                            mod_name = os.path.splitext(os.path.basename(full_path))[0]
-                            expected_dir = os.path.dirname(full_path)
-                            msg = ("%r module incorrectly imported from %r. Expected %r. "
-                                   "Is this module globally installed?")
-                            raise ImportError(msg % (mod_name, module_dir, expected_dir))
-                        yield self.loadTestsFromModule(module)
+                if not self._match_path(path, full_path, pattern):
+                    continue
+                # if the test file matches, load it
+                name = self._get_name_from_path(full_path)
+                try:
+                    module = self._get_module_from_name(name)
+                except:
+                    yield _make_failed_import_test(name, self.suiteClass)
+                else:
+                    mod_file = os.path.abspath(getattr(module, '__file__', full_path))
+                    realpath = os.path.splitext(mod_file)[0]
+                    fullpath_noext = os.path.splitext(full_path)[0]
+                    if realpath.lower() != fullpath_noext.lower():
+                        module_dir = os.path.dirname(realpath)
+                        mod_name = os.path.splitext(os.path.basename(full_path))[0]
+                        expected_dir = os.path.dirname(full_path)
+                        msg = ("%r module incorrectly imported from %r. Expected %r. "
+                               "Is this module globally installed?")
+                        raise ImportError(msg % (mod_name, module_dir, expected_dir))
+                    yield self.loadTestsFromModule(module)
             elif os.path.isdir(full_path):
                 if not os.path.isfile(os.path.join(full_path, '__init__.py')):
                     continue

Modified: python/branches/py3k-jit/Lib/unittest/suite.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/suite.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/suite.py	Wed Jun 16 18:21:24 2010
@@ -84,9 +84,16 @@
         self._handleModuleTearDown(result)
         return result
 
+    def debug(self):
+        """Run the tests without collecting errors in a TestResult"""
+        debug = _DebugResult()
+        self._wrapped_run(debug, True)
+        self._tearDownPreviousClass(None, debug)
+        self._handleModuleTearDown(debug)
+
     ################################
     # private methods
-    def _wrapped_run(self, result):
+    def _wrapped_run(self, result, debug=False):
         for test in self:
             if result.shouldStop:
                 break
@@ -102,9 +109,11 @@
                     continue
 
             if hasattr(test, '_wrapped_run'):
-                test._wrapped_run(result)
-            else:
+                test._wrapped_run(result, debug)
+            elif not debug:
                 test(result)
+            else:
+                test.debug()
 
     def _handleClassSetUp(self, test, result):
         previousClass = getattr(result, '_previousTestClass', None)
@@ -127,9 +136,13 @@
         if setUpClass is not None:
             try:
                 setUpClass()
-            except:
+            except Exception as e:
+                if isinstance(result, _DebugResult):
+                    raise
                 currentClass._classSetupFailed = True
-                self._addClassSetUpError(result, currentClass)
+                className = util.strclass(currentClass)
+                errorName = 'setUpClass (%s)' % className
+                self._addClassOrModuleLevelException(result, e, errorName)
 
     def _get_previous_module(self, result):
         previousModule = None
@@ -157,10 +170,20 @@
         if setUpModule is not None:
             try:
                 setUpModule()
-            except:
+            except Exception as e:
+                if isinstance(result, _DebugResult):
+                    raise
                 result._moduleSetUpFailed = True
-                error = _ErrorHolder('setUpModule (%s)' % currentModule)
-                result.addError(error, sys.exc_info())
+                errorName = 'setUpModule (%s)' % currentModule
+                self._addClassOrModuleLevelException(result, e, errorName)
+
+    def _addClassOrModuleLevelException(self, result, exception, errorName):
+        error = _ErrorHolder(errorName)
+        addSkip = getattr(result, 'addSkip', None)
+        if addSkip is not None and isinstance(exception, case.SkipTest):
+            addSkip(error, str(exception))
+        else:
+            result.addError(error, sys.exc_info())
 
     def _handleModuleTearDown(self, result):
         previousModule = self._get_previous_module(result)
@@ -178,9 +201,11 @@
         if tearDownModule is not None:
             try:
                 tearDownModule()
-            except:
-                error = _ErrorHolder('tearDownModule (%s)' % previousModule)
-                result.addError(error, sys.exc_info())
+            except Exception as e:
+                if isinstance(result, _DebugResult):
+                    raise
+                errorName = 'tearDownModule (%s)' % previousModule
+                self._addClassOrModuleLevelException(result, e, errorName)
 
     def _tearDownPreviousClass(self, test, result):
         previousClass = getattr(result, '_previousTestClass', None)
@@ -198,18 +223,13 @@
         if tearDownClass is not None:
             try:
                 tearDownClass()
-            except:
-                self._addClassTearDownError(result)
+            except Exception as e:
+                if isinstance(result, _DebugResult):
+                    raise
+                className = util.strclass(previousClass)
+                errorName = 'tearDownClass (%s)' % className
+                self._addClassOrModuleLevelException(result, e, errorName)
 
-    def _addClassTearDownError(self, result):
-        className = util.strclass(result._previousTestClass)
-        error = _ErrorHolder('classTearDown (%s)' % className)
-        result.addError(error, sys.exc_info())
-
-    def _addClassSetUpError(self, result, klass):
-        className = util.strclass(klass)
-        error = _ErrorHolder('classSetUp (%s)' % className)
-        result.addError(error, sys.exc_info())
 
 
 class _ErrorHolder(object):
@@ -257,3 +277,10 @@
     except TypeError:
         return True
     return False
+
+
+class _DebugResult(object):
+    "Used by the TestSuite to hold previous class when running in debug."
+    _previousTestClass = None
+    _moduleSetUpFailed = False
+    shouldStop = False

Modified: python/branches/py3k-jit/Lib/unittest/test/test_case.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/test/test_case.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/test/test_case.py	Wed Jun 16 18:21:24 2010
@@ -1,3 +1,5 @@
+import difflib
+import pprint
 import re
 import sys
 
@@ -589,6 +591,84 @@
         self.assertRaises(self.failureException, self.assertDictEqual, [], d)
         self.assertRaises(self.failureException, self.assertDictEqual, 1, 1)
 
+    def testAssertSequenceEqualMaxDiff(self):
+        self.assertEqual(self.maxDiff, 80*8)
+        seq1 = 'a' + 'x' * 80**2
+        seq2 = 'b' + 'x' * 80**2
+        diff = '\n'.join(difflib.ndiff(pprint.pformat(seq1).splitlines(),
+                                       pprint.pformat(seq2).splitlines()))
+        # the +1 is the leading \n added by assertSequenceEqual
+        omitted = unittest.case.DIFF_OMITTED % (len(diff) + 1,)
+
+        self.maxDiff = len(diff)//2
+        try:
+
+            self.assertSequenceEqual(seq1, seq2)
+        except self.failureException as e:
+            msg = e.args[0]
+        else:
+            self.fail('assertSequenceEqual did not fail.')
+        self.assertTrue(len(msg) < len(diff))
+        self.assertIn(omitted, msg)
+
+        self.maxDiff = len(diff) * 2
+        try:
+            self.assertSequenceEqual(seq1, seq2)
+        except self.failureException as e:
+            msg = e.args[0]
+        else:
+            self.fail('assertSequenceEqual did not fail.')
+        self.assertTrue(len(msg) > len(diff))
+        self.assertNotIn(omitted, msg)
+
+        self.maxDiff = None
+        try:
+            self.assertSequenceEqual(seq1, seq2)
+        except self.failureException as e:
+            msg = e.args[0]
+        else:
+            self.fail('assertSequenceEqual did not fail.')
+        self.assertTrue(len(msg) > len(diff))
+        self.assertNotIn(omitted, msg)
+
+    def testTruncateMessage(self):
+        self.maxDiff = 1
+        message = self._truncateMessage('foo', 'bar')
+        omitted = unittest.case.DIFF_OMITTED % len('bar')
+        self.assertEqual(message, 'foo' + omitted)
+
+        self.maxDiff = None
+        message = self._truncateMessage('foo', 'bar')
+        self.assertEqual(message, 'foobar')
+
+        self.maxDiff = 4
+        message = self._truncateMessage('foo', 'bar')
+        self.assertEqual(message, 'foobar')
+
+    def testAssertDictEqualTruncates(self):
+        test = unittest.TestCase('assertEqual')
+        def truncate(msg, diff):
+            return 'foo'
+        test._truncateMessage = truncate
+        try:
+            test.assertDictEqual({}, {1: 0})
+        except self.failureException as e:
+            self.assertEqual(str(e), 'foo')
+        else:
+            self.fail('assertDictEqual did not fail')
+
+    def testAssertMultiLineEqualTruncates(self):
+        test = unittest.TestCase('assertEqual')
+        def truncate(msg, diff):
+            return 'foo'
+        test._truncateMessage = truncate
+        try:
+            test.assertMultiLineEqual('foo', 'bar')
+        except self.failureException as e:
+            self.assertEqual(str(e), 'foo')
+        else:
+            self.fail('assertMultiLineEqual did not fail')
+
     def testAssertItemsEqual(self):
         a = object()
         self.assertItemsEqual([1, 2, 3], [3, 2, 1])
@@ -739,7 +819,7 @@
     A test case is the smallest unit of testing. [...] You may provide your
     own implementation that does not subclass from TestCase, of course.
 """
-        sample_text_error = """
+        sample_text_error = """\
 - http://www.python.org/doc/2.3/lib/module-unittest.html
 ?                             ^
 + http://www.python.org/doc/2.4.1/lib/module-unittest.html
@@ -750,13 +830,16 @@
 ?                                                       +++++++++++++++++++++
 +     own implementation that does not subclass from TestCase, of course.
 """
-
+        self.maxDiff = None
         try:
             self.assertMultiLineEqual(sample_text, revised_sample_text)
         except self.failureException as e:
+            # need to remove the first line of the error message
+            error = str(e).split('\n', 1)[1]
+
             # no fair testing ourself with ourself, and assertEqual is used for strings
             # so can't use assertEqual either. Just use assertTrue.
-            self.assertTrue(sample_text_error == str(e))
+            self.assertTrue(sample_text_error == error)
 
     def testAssertIsNone(self):
         self.assertIsNone(None)

Modified: python/branches/py3k-jit/Lib/unittest/test/test_runner.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/test/test_runner.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/test/test_runner.py	Wed Jun 16 18:21:24 2010
@@ -110,6 +110,31 @@
         test.run(result)
         self.assertEqual(ordering, ['setUp', 'cleanup1'])
 
+    def testTestCaseDebugExecutesCleanups(self):
+        ordering = []
+
+        class TestableTest(unittest.TestCase):
+            def setUp(self):
+                ordering.append('setUp')
+                self.addCleanup(cleanup1)
+
+            def testNothing(self):
+                ordering.append('test')
+
+            def tearDown(self):
+                ordering.append('tearDown')
+
+        test = TestableTest('testNothing')
+
+        def cleanup1():
+            ordering.append('cleanup1')
+            test.addCleanup(cleanup2)
+        def cleanup2():
+            ordering.append('cleanup2')
+
+        test.debug()
+        self.assertEqual(ordering, ['setUp', 'test', 'tearDown', 'cleanup1', 'cleanup2'])
+
 
 class Test_TextTestRunner(unittest.TestCase):
     """Tests for TextTestRunner."""

Modified: python/branches/py3k-jit/Lib/unittest/test/test_setups.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/test/test_setups.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/test/test_setups.py	Wed Jun 16 18:21:24 2010
@@ -111,7 +111,7 @@
         self.assertEqual(len(result.errors), 1)
         error, _ = result.errors[0]
         self.assertEqual(str(error),
-                    'classSetUp (%s.BrokenTest)' % __name__)
+                    'setUpClass (%s.BrokenTest)' % __name__)
 
     def test_error_in_teardown_class(self):
         class Test(unittest.TestCase):
@@ -144,7 +144,7 @@
 
         error, _ = result.errors[0]
         self.assertEqual(str(error),
-                    'classTearDown (%s.Test)' % __name__)
+                    'tearDownClass (%s.Test)' % __name__)
 
     def test_class_not_torndown_when_setup_fails(self):
         class Test(unittest.TestCase):
@@ -398,3 +398,110 @@
         self.assertEqual(len(result.errors), 1)
         error, _ = result.errors[0]
         self.assertEqual(str(error), 'tearDownModule (Module)')
+
+    def test_skiptest_in_setupclass(self):
+        class Test(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                raise unittest.SkipTest('foo')
+            def test_one(self):
+                pass
+            def test_two(self):
+                pass
+
+        result = self.runTests(Test)
+        self.assertEqual(result.testsRun, 0)
+        self.assertEqual(len(result.errors), 0)
+        self.assertEqual(len(result.skipped), 1)
+        skipped = result.skipped[0][0]
+        self.assertEqual(str(skipped), 'setUpClass (%s.Test)' % __name__)
+
+    def test_skiptest_in_setupmodule(self):
+        class Test(unittest.TestCase):
+            def test_one(self):
+                pass
+            def test_two(self):
+                pass
+
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                raise unittest.SkipTest('foo')
+
+        Test.__module__ = 'Module'
+        sys.modules['Module'] = Module
+
+        result = self.runTests(Test)
+        self.assertEqual(result.testsRun, 0)
+        self.assertEqual(len(result.errors), 0)
+        self.assertEqual(len(result.skipped), 1)
+        skipped = result.skipped[0][0]
+        self.assertEqual(str(skipped), 'setUpModule (Module)')
+
+    def test_suite_debug_executes_setups_and_teardowns(self):
+        ordering = []
+
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                ordering.append('setUpModule')
+            @staticmethod
+            def tearDownModule():
+                ordering.append('tearDownModule')
+
+        class Test(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                ordering.append('setUpClass')
+            @classmethod
+            def tearDownClass(cls):
+                ordering.append('tearDownClass')
+            def test_something(self):
+                ordering.append('test_something')
+
+        Test.__module__ = 'Module'
+        sys.modules['Module'] = Module
+
+        suite = unittest.defaultTestLoader.loadTestsFromTestCase(Test)
+        suite.debug()
+        expectedOrder = ['setUpModule', 'setUpClass', 'test_something', 'tearDownClass', 'tearDownModule']
+        self.assertEqual(ordering, expectedOrder)
+
+    def test_suite_debug_propagates_exceptions(self):
+        class Module(object):
+            @staticmethod
+            def setUpModule():
+                if phase == 0:
+                    raise Exception('setUpModule')
+            @staticmethod
+            def tearDownModule():
+                if phase == 1:
+                    raise Exception('tearDownModule')
+
+        class Test(unittest.TestCase):
+            @classmethod
+            def setUpClass(cls):
+                if phase == 2:
+                    raise Exception('setUpClass')
+            @classmethod
+            def tearDownClass(cls):
+                if phase == 3:
+                    raise Exception('tearDownClass')
+            def test_something(self):
+                if phase == 4:
+                    raise Exception('test_something')
+
+        Test.__module__ = 'Module'
+        sys.modules['Module'] = Module
+
+        _suite = unittest.defaultTestLoader.loadTestsFromTestCase(Test)
+        suite = unittest.TestSuite()
+        suite.addTest(_suite)
+
+        messages = ('setUpModule', 'tearDownModule', 'setUpClass', 'tearDownClass', 'test_something')
+        for phase, msg in enumerate(messages):
+            with self.assertRaisesRegexp(Exception, msg):
+                suite.debug()
+
+if __name__ == '__main__':
+    unittest.main()

Modified: python/branches/py3k-jit/Lib/unittest/util.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/util.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/util.py	Wed Jun 16 18:21:24 2010
@@ -2,12 +2,16 @@
 
 __unittest = True
 
-
-def safe_repr(obj):
+_MAX_LENGTH = 80
+def safe_repr(obj, short=False):
     try:
-        return repr(obj)
+        result = repr(obj)
     except Exception:
-        return object.__repr__(obj)
+        result = object.__repr__(obj)
+    if not short or len(result) < _MAX_LENGTH:
+        return result
+    return result[:_MAX_LENGTH] + ' [truncated]...'
+
 
 def strclass(cls):
     return "%s.%s" % (cls.__module__, cls.__name__)

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	Wed Jun 16 18:21:24 2010
@@ -775,12 +775,21 @@
             password_mgr = HTTPPasswordMgr()
         self.passwd = password_mgr
         self.add_password = self.passwd.add_password
+        self.retried = 0
 
     def http_error_auth_reqed(self, authreq, host, req, headers):
         # host may be an authority (without userinfo) or a URL with an
         # authority
         # XXX could be multiple headers
         authreq = headers.get(authreq, None)
+
+        if self.retried > 5:
+            # retry sending the username:password 5 times before failing.
+            raise HTTPError(req.get_full_url(), 401, "basic auth failed",
+                    headers, None)
+        else:
+            self.retried += 1
+
         if authreq:
             mo = AbstractBasicAuthHandler.rx.search(authreq)
             if mo:

Modified: python/branches/py3k-jit/Lib/webbrowser.py
==============================================================================
--- python/branches/py3k-jit/Lib/webbrowser.py	(original)
+++ python/branches/py3k-jit/Lib/webbrowser.py	Wed Jun 16 18:21:24 2010
@@ -540,18 +540,6 @@
 # Platform support for MacOS
 #
 
-try:
-    import ic
-except ImportError:
-    pass
-else:
-    class InternetConfig(BaseBrowser):
-        def open(self, url, new=0, autoraise=True):
-            ic.launchurl(url)
-            return True # Any way to get status?
-
-    register("internet-config", InternetConfig, update_tryorder=-1)
-
 if sys.platform == 'darwin':
     # Adapted from patch submitted to SourceForge by Steven J. Burr
     class MacOSX(BaseBrowser):

Modified: python/branches/py3k-jit/Lib/xml/dom/minidom.py
==============================================================================
--- python/branches/py3k-jit/Lib/xml/dom/minidom.py	(original)
+++ python/branches/py3k-jit/Lib/xml/dom/minidom.py	Wed Jun 16 18:21:24 2010
@@ -268,6 +268,14 @@
         self.previousSibling = None
         self.nextSibling = None
 
+    # A Node is its own context manager, to ensure that an unlink() call occurs.
+    # This is similar to how a file object works.
+    def __enter__(self):
+        return self
+
+    def __exit__(self, et, ev, tb):
+        self.unlink()
+
 defproperty(Node, "firstChild", doc="First child node, or None.")
 defproperty(Node, "lastChild",  doc="Last child node, or None.")
 defproperty(Node, "localName",  doc="Namespace-local name of this node.")

Modified: python/branches/py3k-jit/Mac/Tools/pythonw.c
==============================================================================
--- python/branches/py3k-jit/Mac/Tools/pythonw.c	(original)
+++ python/branches/py3k-jit/Mac/Tools/pythonw.c	Wed Jun 16 18:21:24 2010
@@ -151,6 +151,14 @@
 main(int argc, char **argv) {
     char* exec_path = get_python_path();
 
+    /*
+     * Let argv[0] refer to the new interpreter. This is needed to
+     * get the effect we want on OSX 10.5 or earlier. That is, without
+     * changing argv[0] the real interpreter won't have access to
+     * the Window Server.
+     */
+    argv[0] = exec_path;
+
 #ifdef HAVE_SPAWN_H
     /* We're weak-linking to posix-spawnv to ensure that
      * an executable build on 10.5 can work on 10.4.

Modified: python/branches/py3k-jit/Misc/ACKS
==============================================================================
--- python/branches/py3k-jit/Misc/ACKS	(original)
+++ python/branches/py3k-jit/Misc/ACKS	Wed Jun 16 18:21:24 2010
@@ -21,11 +21,13 @@
 Kevin Altis
 Joe Amenta
 Mark Anacker
+Shashwat Anand
 Anders Andersen
 John Anderson
 Erik Andersén
 Oliver Andrich
 Ross Andrus
+Éric Araujo
 Jason Asbahr
 David Ascher
 Chris AtLee
@@ -84,6 +86,7 @@
 Paul Boddie
 Matthew Boedicker
 David Bolen
+Forest Bond
 Gawain Bolton
 Gregory Bond
 Jurjen Bos
@@ -153,6 +156,7 @@
 Jeffery Collins
 Robert Collins
 Paul Colomiets
+Geremy Condra
 Juan José Conti
 Matt Conway
 David M. Cooke
@@ -188,6 +192,7 @@
 Erik Demaine
 Roger Dev
 Raghuram Devarakonda
+Caleb Deveraux
 Toby Dickenson
 Mark Dickinson
 Jack Diederich
@@ -366,6 +371,7 @@
 Eric Huss
 Jeremy Hylton
 Gerhard Häring
+Fredrik Håård
 Mihai Ibanescu
 Lars Immisch
 Meador Inge
@@ -390,6 +396,7 @@
 Fredrik Johansson
 Gregory K. Johnson
 Simon Johnston
+Thomas Jollans
 Evan Jones
 Jeremy Jones
 Richard Jones
@@ -403,6 +410,7 @@
 Kurt B. Kaiser
 Tamito Kajiyama
 Peter van Kampen
+Rafe Kaplan
 Jacob Kaplan-Moss
 Lou Kates
 Hiroaki Kawai
@@ -429,6 +437,7 @@
 Damon Kohler
 Joseph Koshy
 Maksim Kozyarchuk
+Stefan Krah
 Bob Kras
 Holger Krekel
 Michael Kremer
@@ -520,6 +529,7 @@
 Lambert Meertens
 Bill van Melle
 Lucas Prado Melo
+Ezio Melotti
 Brian Merrell
 Luke Mewburn
 Mike Meyer
@@ -640,6 +650,7 @@
 John Redford
 Terry Reedy
 Steve Reeves
+Lennart Regebro
 Ofir Reichenberg
 Sean Reifschneider
 Michael P. Reilly

Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS	(original)
+++ python/branches/py3k-jit/Misc/NEWS	Wed Jun 16 18:21:24 2010
@@ -31,6 +31,46 @@
 Core and Builtins
 -----------------
 
+- Issue #8592: PyArg_Parse*() functions raise a TypeError for "y", "u" and "Z"
+  formats if the string contains a null byte/character. Write unit tests for
+  string formats.
+
+- Issue #7490: to facilitate sharing of doctests between 2.x and 3.x test
+  suites, the IGNORE_EXCEPTION_DETAIL directive now also ignores the module
+  location of the raised exception.
+
+- Issue #8969: On Windows, use mbcs codec in strict mode to encode and decode
+  filenames and enable os.fsencode().
+
+- Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash
+  the interpreter with characters outside the Basic Multilingual Plane
+  (higher than 0x10000).
+
+- Issue #8950: (See also issue #5080).  Py_ArgParse*() functions now
+  raise TypeError instead of giving a DeprecationWarning when a float
+  is parsed using the 'L' code (for long long).  (All other integer
+  codes already raise TypeError in this case.)
+
+- Issue #8922: Normalize the encoding name in PyUnicode_AsEncodedString() to
+  enable shortcuts for upper case encoding name. Add also a shortcut for
+  "iso-8859-1" in PyUnicode_AsEncodedString() and PyUnicode_Decode().
+
+- Issue #8838: Remove codecs.charbuffer_encode() function. The buffer protocol
+  doesn't support "char buffer" anymore in Python3.
+
+- Issue #8339: Remove "t#" format of PyArg_Parse*() functions, use "s#" or "s*"
+  instead. codecs.charbuffer_encode() now accepts modifiable buffer objects
+  like bytearray.
+
+- Issue #8837: Remove "O?" format of PyArg_Parse*() functions. The format is no
+  used anymore and it was never documented.
+
+- In the str.format(), raise a ValueError when indexes to arguments are too
+  large.
+
+- Issue #2844: Make int('42', n) consistently raise ValueError for
+  invalid integers n (including n = -909).
+
 - Issue #8188: Introduce a new scheme for computing hashes of numbers
   (instances of int, float, complex, decimal.Decimal and
   fractions.Fraction) that makes it easy to maintain the invariant
@@ -411,6 +451,61 @@
 Library
 -------
 
+- Issue #8986: math.erfc was incorrectly raising OverflowError for
+  values between -27.3 and -30.0 on some platforms.
+
+- Issue #8784: Set tarfile default encoding to 'utf-8' on Windows.
+
+- Issue #8966: If a ctypes structure field is an array of c_char, convert its
+  value to bytes instead of str (as done for c_char and c_char_p).
+
+- Issue #8188: Comparisons between Decimal and Fraction objects are
+  now permitted, returning a result based on the exact numerical
+  values of the operands.  This builds on issue #2531, which allowed
+  Decimal-to-float comparisons;  all comparisons involving numeric
+  types (bool, int, float, complex, Decimal, Fraction) should now
+  act as expected.
+
+- Issue #8897: Fix sunau module, use bytes to write the header. Patch written
+  by Thomas Jollans.
+
+- Issue #8899: time.struct_time now has class and atribute docstrings.
+
+- Issue #6470: Drop UNC prefix in FixTk.
+
+- Issue #4768: base64 encoded email body parts were incorrectly stored as
+  binary strings.  They are now correctly converted to strings.
+
+- Issue #8833: tarfile created hard link entries with a size field != 0 by
+  mistake.
+
+- Charset.body_encode now correctly handles base64 encoding by encoding
+  with the output_charset before calling base64mime.encode.  Passes the
+  tests from 2.x issue 1368247.
+
+- Issue #8845: sqlite3 Connection objects now have a read-only in_transaction
+  attribute that is True iff there are uncommitted changes.
+
+- Issue #1289118: datetime.timedelta objects can now be multiplied by float
+  and divided by float and int objects.  Results are rounded to the nearest
+  multiple of timedelta.resolution with ties resolved using round-half-to-even
+  method.
+
+- Issue #7150: Raise OverflowError if the result of adding or subtracting
+  timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range.
+
+- Issue #8806: add SSL contexts support to ftplib.
+
+- Issue #4769: Fix main() function of the base64 module, use sys.stdin.buffer
+  and sys.stdout.buffer (instead of sys.stdin and sys.stdout) to use the bytes
+  API
+
+- Issue #8770: now sysconfig displays information when it's called as
+  a script. Initial idea by Sridhar Ratnakumar.
+
+- Issue #6662: Fix parsing of malformatted charref (&#bad;), patch written by
+  Fredrik Håård
+
 - Issue #8540: Decimal module: rename the Context._clamp attribute to
   Context.clamp and make it public.  This is useful in creating
   contexts that correspond to the decimal interchange formats
@@ -668,7 +763,8 @@
 - Issue #2531: Comparison operations between floats and Decimal
   instances now return a result based on the numeric values of the
   operands;  previously they returned an arbitrary result based on
-  the relative ordering of id(float) and id(Decimal).
+  the relative ordering of id(float) and id(Decimal).  See also
+  issue #8188, which adds Decimal-to-Fraction comparisons.
 
 - Added a subtract() method to collections.Counter().
 
@@ -1229,6 +1325,28 @@
 Extension Modules
 -----------------
 
+- Issue #5094: The ``datetime`` module now has a simple concrete class
+  implementing ``datetime.tzinfo`` interface.  Instances of the new
+  class, ``datetime.timezone``, return fixed name and UTC offset from
+  their ``tzname(dt)`` and ``utcoffset(dt)`` methods.  The ``dst(dt)``
+  method always returns ``None``.  A class attribute, ``utc`` contains
+  an instance representing the UTC timezone.  Original patch by Rafe
+  Kaplan.
+
+- Issue #8973: Add __all__ to struct module; this ensures that
+  help(struct) includes documentation for the struct.Struct class.
+
+- Issue #3129: Trailing digits in struct format string are no longer ignored.
+  For example, "1" or "ilib123" are now invalid formats and cause
+  ``struct.error`` to be raised.  Patch by Caleb Deveraux.
+
+- Issue #7384: If the system readline library is linked against ncurses,
+  the curses module must be linked against ncurses as well. Otherwise it
+  is not safe to load both the readline and curses modules in an application.
+
+- Issue #2810: Fix cases where the Windows registry API returns
+  ERROR_MORE_DATA, requiring a re-try in order to get the complete result.
+
 - Issue #8692: Optimize math.factorial: replace the previous naive
   algorithm with an improved 'binary-split' algorithm that uses fewer
   multiplications and allows many of the multiplications to be
@@ -1305,6 +1423,9 @@
 Build
 -----
 
+- Issue #1759169, #8864: Drop _XOPEN_SOURCE on Solaris, define it for
+  multiprocessing only.
+
 - Issue #8625: Turn off optimization in --with-pydebug builds with
   gcc.  (Optimization was unintentionally turned on in gcc
   --with-pydebug builds as a result of the issue #1628484 fix,
@@ -1391,9 +1512,14 @@
 - Update python manual page (options -B, -O0, -s, environment variables
   PYTHONDONTWRITEBYTECODE, PYTHONNOUSERSITE).
 
+- Issue #8909: Added the size of the bitmap used in the installer created by
+  distutils' bdist_wininst. Patch by Anatoly Techtonik.
+
 Tests
 -----
 
+- Issue #7449: Skip test_socketserver if threading support is disabled
+
 - Issue #8672: Add a zlib test ensuring that an incomplete stream can be
   handled by a decompressor object without errors (it returns incomplete
   uncompressed data).
@@ -1520,6 +1646,8 @@
 Tools/Demos
 -----------
 
+- Issue #5464: Implement plural forms in msgfmt.py.
+
 - iobench (a file I/O benchmark) and ccbench (a concurrency benchmark) were
   added to the `Tools/` directory.  They were previously living in the
   sandbox.

Modified: python/branches/py3k-jit/Misc/developers.txt
==============================================================================
--- python/branches/py3k-jit/Misc/developers.txt	(original)
+++ python/branches/py3k-jit/Misc/developers.txt	Wed Jun 16 18:21:24 2010
@@ -20,6 +20,9 @@
 Permissions History
 -------------------
 
+- Alexander Belopolsky was given commit access on May 25 2010
+  by MvL at suggestion of Mark Dickinson.
+
 - Tim Golden was given commit access on April 21 2010 by MvL,
   at suggestion of Michael Foord.
 

Modified: python/branches/py3k-jit/Misc/maintainers.rst
==============================================================================
--- python/branches/py3k-jit/Misc/maintainers.rst	(original)
+++ python/branches/py3k-jit/Misc/maintainers.rst	Wed Jun 16 18:21:24 2010
@@ -80,7 +80,7 @@
 csv
 ctypes              theller
 curses              andrew.kuchling
-datetime
+datetime            alexander.belopolsky
 dbm
 decimal             facundobatista, rhettinger, mark.dickinson
 difflib             tim_one
@@ -207,7 +207,7 @@
 test
 textwrap
 threading
-time
+time                alexander.belopolsky
 timeit
 tkinter             gpolo
 token               georg.brandl

Modified: python/branches/py3k-jit/Modules/_codecsmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_codecsmodule.c	(original)
+++ python/branches/py3k-jit/Modules/_codecsmodule.c	Wed Jun 16 18:21:24 2010
@@ -162,62 +162,62 @@
 escape_encode(PyObject *self,
               PyObject *args)
 {
-        static const char *hexdigits = "0123456789abcdef";
-        PyObject *str;
-        Py_ssize_t size;
-        Py_ssize_t newsize;
-        const char *errors = NULL;
-        PyObject *v;
-
-        if (!PyArg_ParseTuple(args, "O!|z:escape_encode",
-                              &PyBytes_Type, &str, &errors))
-                return NULL;
-
-        size = PyBytes_GET_SIZE(str);
-        newsize = 4*size;
-        if (newsize > PY_SSIZE_T_MAX || newsize / 4 != size) {
-                PyErr_SetString(PyExc_OverflowError,
-                        "string is too large to encode");
-                        return NULL;
-        }
-        v = PyBytes_FromStringAndSize(NULL, newsize);
+    static const char *hexdigits = "0123456789abcdef";
+    PyObject *str;
+    Py_ssize_t size;
+    Py_ssize_t newsize;
+    const char *errors = NULL;
+    PyObject *v;
+
+    if (!PyArg_ParseTuple(args, "O!|z:escape_encode",
+                          &PyBytes_Type, &str, &errors))
+        return NULL;
+
+    size = PyBytes_GET_SIZE(str);
+    newsize = 4*size;
+    if (newsize > PY_SSIZE_T_MAX || newsize / 4 != size) {
+        PyErr_SetString(PyExc_OverflowError,
+            "string is too large to encode");
+            return NULL;
+    }
+    v = PyBytes_FromStringAndSize(NULL, newsize);
 
-        if (v == NULL) {
-                return NULL;
+    if (v == NULL) {
+        return NULL;
+    }
+    else {
+        register Py_ssize_t i;
+        register char c;
+        register char *p = PyBytes_AS_STRING(v);
+
+        for (i = 0; i < size; i++) {
+            /* There's at least enough room for a hex escape */
+            assert(newsize - (p - PyBytes_AS_STRING(v)) >= 4);
+            c = PyBytes_AS_STRING(str)[i];
+            if (c == '\'' || c == '\\')
+                *p++ = '\\', *p++ = c;
+            else if (c == '\t')
+                *p++ = '\\', *p++ = 't';
+            else if (c == '\n')
+                *p++ = '\\', *p++ = 'n';
+            else if (c == '\r')
+                *p++ = '\\', *p++ = 'r';
+            else if (c < ' ' || c >= 0x7f) {
+                *p++ = '\\';
+                *p++ = 'x';
+                *p++ = hexdigits[(c & 0xf0) >> 4];
+                *p++ = hexdigits[c & 0xf];
+            }
+            else
+                *p++ = c;
         }
-        else {
-                register Py_ssize_t i;
-                register char c;
-                register char *p = PyBytes_AS_STRING(v);
-
-                for (i = 0; i < size; i++) {
-                        /* There's at least enough room for a hex escape */
-                        assert(newsize - (p - PyBytes_AS_STRING(v)) >= 4);
-                        c = PyBytes_AS_STRING(str)[i];
-                        if (c == '\'' || c == '\\')
-                                *p++ = '\\', *p++ = c;
-                        else if (c == '\t')
-                                *p++ = '\\', *p++ = 't';
-                        else if (c == '\n')
-                                *p++ = '\\', *p++ = 'n';
-                        else if (c == '\r')
-                                *p++ = '\\', *p++ = 'r';
-                        else if (c < ' ' || c >= 0x7f) {
-                                *p++ = '\\';
-                                *p++ = 'x';
-                                *p++ = hexdigits[(c & 0xf0) >> 4];
-                                *p++ = hexdigits[c & 0xf];
-                        }
-                        else
-                                *p++ = c;
-                }
-                *p = '\0';
-                if (_PyBytes_Resize(&v, (p - PyBytes_AS_STRING(v)))) {
-                        return NULL;
-                }
+        *p = '\0';
+        if (_PyBytes_Resize(&v, (p - PyBytes_AS_STRING(v)))) {
+            return NULL;
         }
+    }
 
-        return codec_tuple(v, size);
+    return codec_tuple(v, size);
 }
 
 /* --- Decoder ------------------------------------------------------------ */
@@ -252,7 +252,7 @@
 utf_7_decode(PyObject *self,
              PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int final = 0;
     Py_ssize_t consumed;
@@ -265,7 +265,7 @@
 
     decoded = PyUnicode_DecodeUTF7Stateful(pbuf.buf, pbuf.len, errors,
                                            final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -275,7 +275,7 @@
 utf_8_decode(PyObject *self,
             PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int final = 0;
     Py_ssize_t consumed;
@@ -288,7 +288,7 @@
 
     decoded = PyUnicode_DecodeUTF8Stateful(pbuf.buf, pbuf.len, errors,
                                            final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -298,7 +298,7 @@
 utf_16_decode(PyObject *self,
             PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 0;
     int final = 0;
@@ -311,7 +311,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -321,7 +321,7 @@
 utf_16_le_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = -1;
     int final = 0;
@@ -335,7 +335,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -345,7 +345,7 @@
 utf_16_be_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 1;
     int final = 0;
@@ -359,7 +359,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -377,7 +377,7 @@
 utf_16_ex_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 0;
     PyObject *unicode, *tuple;
@@ -390,7 +390,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     unicode = PyUnicode_DecodeUTF16Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (unicode == NULL)
         return NULL;
     tuple = Py_BuildValue("Oni", unicode, consumed, byteorder);
@@ -402,7 +402,7 @@
 utf_32_decode(PyObject *self,
             PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 0;
     int final = 0;
@@ -415,7 +415,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -425,7 +425,7 @@
 utf_32_le_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = -1;
     int final = 0;
@@ -438,7 +438,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -448,7 +448,7 @@
 utf_32_be_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 1;
     int final = 0;
@@ -461,7 +461,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     decoded = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -479,7 +479,7 @@
 utf_32_ex_decode(PyObject *self,
                  PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int byteorder = 0;
     PyObject *unicode, *tuple;
@@ -492,7 +492,7 @@
     consumed = pbuf.len; /* This is overwritten unless final is true. */
     unicode = PyUnicode_DecodeUTF32Stateful(pbuf.buf, pbuf.len, errors,
                                         &byteorder, final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (unicode == NULL)
         return NULL;
     tuple = Py_BuildValue("Oni", unicode, consumed, byteorder);
@@ -504,7 +504,7 @@
 unicode_escape_decode(PyObject *self,
                      PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
         PyObject *unicode;
 
@@ -512,68 +512,68 @@
                           &pbuf, &errors))
         return NULL;
 
-        unicode = PyUnicode_DecodeUnicodeEscape(pbuf.buf, pbuf.len, errors);
-        PyBuffer_Release(&pbuf);
-        return codec_tuple(unicode, pbuf.len);
+    unicode = PyUnicode_DecodeUnicodeEscape(pbuf.buf, pbuf.len, errors);
+    PyBuffer_Release(&pbuf);
+    return codec_tuple(unicode, pbuf.len);
 }
 
 static PyObject *
 raw_unicode_escape_decode(PyObject *self,
                         PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
-        PyObject *unicode;
+    PyObject *unicode;
 
     if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode",
                           &pbuf, &errors))
         return NULL;
 
-        unicode = PyUnicode_DecodeRawUnicodeEscape(pbuf.buf, pbuf.len, errors);
-        PyBuffer_Release(&pbuf);
-        return codec_tuple(unicode, pbuf.len);
+    unicode = PyUnicode_DecodeRawUnicodeEscape(pbuf.buf, pbuf.len, errors);
+    PyBuffer_Release(&pbuf);
+    return codec_tuple(unicode, pbuf.len);
 }
 
 static PyObject *
 latin_1_decode(PyObject *self,
                PyObject *args)
 {
-        Py_buffer pbuf;
-        PyObject *unicode;
+    Py_buffer pbuf;
+    PyObject *unicode;
     const char *errors = NULL;
 
     if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode",
                           &pbuf, &errors))
         return NULL;
 
-        unicode = PyUnicode_DecodeLatin1(pbuf.buf, pbuf.len, errors);
-        PyBuffer_Release(&pbuf);
-        return codec_tuple(unicode, pbuf.len);
+    unicode = PyUnicode_DecodeLatin1(pbuf.buf, pbuf.len, errors);
+    PyBuffer_Release(&pbuf);
+    return codec_tuple(unicode, pbuf.len);
 }
 
 static PyObject *
 ascii_decode(PyObject *self,
              PyObject *args)
 {
-        Py_buffer pbuf;
-        PyObject *unicode;
+    Py_buffer pbuf;
+    PyObject *unicode;
     const char *errors = NULL;
 
     if (!PyArg_ParseTuple(args, "y*|z:ascii_decode",
                           &pbuf, &errors))
         return NULL;
 
-        unicode = PyUnicode_DecodeASCII(pbuf.buf, pbuf.len, errors);
-        PyBuffer_Release(&pbuf);
-        return codec_tuple(unicode, pbuf.len);
+    unicode = PyUnicode_DecodeASCII(pbuf.buf, pbuf.len, errors);
+    PyBuffer_Release(&pbuf);
+    return codec_tuple(unicode, pbuf.len);
 }
 
 static PyObject *
 charmap_decode(PyObject *self,
                PyObject *args)
 {
-        Py_buffer pbuf;
-        PyObject *unicode;
+    Py_buffer pbuf;
+    PyObject *unicode;
     const char *errors = NULL;
     PyObject *mapping = NULL;
 
@@ -583,9 +583,9 @@
     if (mapping == Py_None)
         mapping = NULL;
 
-        unicode = PyUnicode_DecodeCharmap(pbuf.buf, pbuf.len, mapping, errors);
-        PyBuffer_Release(&pbuf);
-        return codec_tuple(unicode, pbuf.len);
+    unicode = PyUnicode_DecodeCharmap(pbuf.buf, pbuf.len, mapping, errors);
+    PyBuffer_Release(&pbuf);
+    return codec_tuple(unicode, pbuf.len);
 }
 
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
@@ -594,7 +594,7 @@
 mbcs_decode(PyObject *self,
             PyObject *args)
 {
-        Py_buffer pbuf;
+    Py_buffer pbuf;
     const char *errors = NULL;
     int final = 0;
     Py_ssize_t consumed;
@@ -607,7 +607,7 @@
 
     decoded = PyUnicode_DecodeMBCSStateful(pbuf.buf, pbuf.len, errors,
                                            final ? NULL : &consumed);
-        PyBuffer_Release(&pbuf);
+    PyBuffer_Release(&pbuf);
     if (decoded == NULL)
         return NULL;
     return codec_tuple(decoded, consumed);
@@ -639,21 +639,6 @@
 }
 
 static PyObject *
-charbuffer_encode(PyObject *self,
-                  PyObject *args)
-{
-    const char *data;
-    Py_ssize_t size;
-    const char *errors = NULL;
-
-    if (!PyArg_ParseTuple(args, "t#|z:charbuffer_encode",
-                          &data, &size, &errors))
-        return NULL;
-
-    return codec_tuple(PyBytes_FromStringAndSize(data, size), size);
-}
-
-static PyObject *
 unicode_internal_encode(PyObject *self,
                         PyObject *args)
 {
@@ -1116,7 +1101,6 @@
     {"charmap_decode",          charmap_decode,                 METH_VARARGS},
     {"charmap_build",           charmap_build,                  METH_VARARGS},
     {"readbuffer_encode",       readbuffer_encode,              METH_VARARGS},
-    {"charbuffer_encode",       charbuffer_encode,              METH_VARARGS},
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
     {"mbcs_encode",             mbcs_encode,                    METH_VARARGS},
     {"mbcs_decode",             mbcs_decode,                    METH_VARARGS},

Modified: python/branches/py3k-jit/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k-jit/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/py3k-jit/Modules/_ctypes/_ctypes.c	Wed Jun 16 18:21:24 2010
@@ -4467,7 +4467,7 @@
 #endif
 
     result = PyObject_CallFunction((PyObject *)&PyCArrayType_Type,
-                                   "U(O){s:n,s:O}",
+                                   "s(O){s:n,s:O}",
                                    name,
                                    &PyCArray_Type,
                                    "_length_",

Modified: python/branches/py3k-jit/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/py3k-jit/Modules/_ctypes/cfield.c	(original)
+++ python/branches/py3k-jit/Modules/_ctypes/cfield.c	Wed Jun 16 18:21:24 2010
@@ -1333,7 +1333,7 @@
             break;
     }
 
-    return PyUnicode_FromStringAndSize((char *)ptr, (Py_ssize_t)i);
+    return PyBytes_FromStringAndSize((char *)ptr, (Py_ssize_t)i);
 }
 
 static PyObject *

Modified: python/branches/py3k-jit/Modules/_localemodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_localemodule.c	(original)
+++ python/branches/py3k-jit/Modules/_localemodule.c	Wed Jun 16 18:21:24 2010
@@ -572,19 +572,31 @@
 static PyObject*
 PyIntl_bindtextdomain(PyObject* self,PyObject*args)
 {
-    char *domain, *dirname;
-    if (!PyArg_ParseTuple(args, "sz", &domain, &dirname))
+    char *domain, *dirname, *current_dirname;
+    PyObject *dirname_obj, *dirname_bytes = NULL, *result;
+    if (!PyArg_ParseTuple(args, "sO", &domain, &dirname_obj))
         return 0;
     if (!strlen(domain)) {
         PyErr_SetString(Error, "domain must be a non-empty string");
         return 0;
     }
-    dirname = bindtextdomain(domain, dirname);
-    if (!dirname) {
+    if (dirname_obj != Py_None) {
+        if (!PyUnicode_FSConverter(dirname_obj, &dirname_bytes))
+            return NULL;
+        dirname = PyBytes_AsString(dirname_bytes);
+    } else {
+        dirname_bytes = NULL;
+        dirname = NULL;
+    }
+    current_dirname = bindtextdomain(domain, dirname);
+    if (current_dirname == NULL) {
+        Py_XDECREF(dirname_bytes);
         PyErr_SetFromErrno(PyExc_OSError);
         return NULL;
     }
-    return str2uni(dirname);
+    result = str2uni(current_dirname);
+    Py_XDECREF(dirname_bytes);
+    return result;
 }
 
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET

Modified: python/branches/py3k-jit/Modules/_multiprocessing/multiprocessing.h
==============================================================================
--- python/branches/py3k-jit/Modules/_multiprocessing/multiprocessing.h	(original)
+++ python/branches/py3k-jit/Modules/_multiprocessing/multiprocessing.h	Wed Jun 16 18:21:24 2010
@@ -3,6 +3,12 @@
 
 #define PY_SSIZE_T_CLEAN
 
+#ifdef __sun
+/* The control message API is only available on Solaris 
+   if XPG 4.2 or later is requested. */
+#define _XOPEN_SOURCE 500
+#endif
+
 #include "Python.h"
 #include "structmember.h"
 #include "pythread.h"

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	Wed Jun 16 18:21:24 2010
@@ -23,6 +23,7 @@
 
 #include "cache.h"
 #include "module.h"
+#include "structmember.h"
 #include "connection.h"
 #include "statement.h"
 #include "cursor.h"
@@ -1551,6 +1552,7 @@
     {"NotSupportedError", T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), READONLY},
     {"row_factory", T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
     {"text_factory", T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
+    {"in_transaction", T_BOOL, offsetof(pysqlite_Connection, inTransaction), READONLY},
     {NULL}
 };
 

Modified: python/branches/py3k-jit/Modules/_struct.c
==============================================================================
--- python/branches/py3k-jit/Modules/_struct.c	(original)
+++ python/branches/py3k-jit/Modules/_struct.c	Wed Jun 16 18:21:24 2010
@@ -1143,16 +1143,19 @@
 }
 
 
-/* Align a size according to a format code */
+/* Align a size according to a format code.  Return -1 on overflow. */
 
-static int
+static Py_ssize_t
 align(Py_ssize_t size, char c, const formatdef *e)
 {
+    Py_ssize_t extra;
+
     if (e->format == c) {
-        if (e->alignment) {
-            size = ((size + e->alignment - 1)
-                / e->alignment)
-                * e->alignment;
+        if (e->alignment && size > 0) {
+            extra = (e->alignment - 1) - (size - 1) % (e->alignment);
+            if (extra > PY_SSIZE_T_MAX - size)
+                return -1;
+            size += extra;
         }
     }
     return size;
@@ -1171,7 +1174,7 @@
     const char *s;
     const char *fmt;
     char c;
-    Py_ssize_t size, len, num, itemsize, x;
+    Py_ssize_t size, len, num, itemsize;
 
     fmt = PyBytes_AS_STRING(self->s_format);
 
@@ -1186,17 +1189,19 @@
         if ('0' <= c && c <= '9') {
             num = c - '0';
             while ('0' <= (c = *s++) && c <= '9') {
-                x = num*10 + (c - '0');
-                if (x/10 != num) {
-                    PyErr_SetString(
-                        StructError,
-                        "overflow in item count");
-                    return -1;
-                }
-                num = x;
+                /* overflow-safe version of
+                   if (num*10 + (c - '0') > PY_SSIZE_T_MAX) { ... } */
+                if (num >= PY_SSIZE_T_MAX / 10 && (
+                        num > PY_SSIZE_T_MAX / 10 ||
+                        (c - '0') > PY_SSIZE_T_MAX % 10))
+                    goto overflow;
+                num = num*10 + (c - '0');
+            }
+            if (c == '\0') {
+                PyErr_SetString(StructError,
+                                "repeat count given without format specifier");
+                return -1;
             }
-            if (c == '\0')
-                break;
         }
         else
             num = 1;
@@ -1214,13 +1219,13 @@
 
         itemsize = e->size;
         size = align(size, c, e);
-        x = num * itemsize;
-        size += x;
-        if (x/itemsize != num || size < 0) {
-            PyErr_SetString(StructError,
-                            "total struct size too long");
-            return -1;
-        }
+        if (size == -1)
+            goto overflow;
+
+        /* if (size + num * itemsize > PY_SSIZE_T_MAX) { ... } */
+        if (num > (PY_SSIZE_T_MAX - size) / itemsize)
+            goto overflow;
+        size += num * itemsize;
     }
 
     /* check for overflow */
@@ -1279,6 +1284,11 @@
     codes->size = 0;
 
     return 0;
+
+  overflow:
+    PyErr_SetString(StructError,
+                    "total struct size too long");
+    return -1;
 }
 
 static PyObject *
@@ -1388,9 +1398,9 @@
 PyDoc_STRVAR(s_unpack__doc__,
 "S.unpack(buffer) -> (v1, v2, ...)\n\
 \n\
-Return tuple containing values unpacked according to this Struct's format.\n\
-Requires len(buffer) == self.size. See struct.__doc__ for more on format\n\
-strings.");
+Return a tuple containing values unpacked according to the format\n\
+string S.format.  Requires len(buffer) == S.size.  See help(struct)\n\
+for more on format strings.");
 
 static PyObject *
 s_unpack(PyObject *self, PyObject *input)
@@ -1416,12 +1426,11 @@
 }
 
 PyDoc_STRVAR(s_unpack_from__doc__,
-"S.unpack_from(buffer[, offset]) -> (v1, v2, ...)\n\
+"S.unpack_from(buffer, offset=0) -> (v1, v2, ...)\n\
 \n\
-Return tuple containing values unpacked according to this Struct's format.\n\
-Unlike unpack, unpack_from can unpack values from any object supporting\n\
-the buffer API, not just str. Requires len(buffer[offset:]) >= self.size.\n\
-See struct.__doc__ for more on format strings.");
+Return a tuple containing values unpacked according to the format\n\
+string S.format.  Requires len(buffer[offset:]) >= S.size.  See\n\
+help(struct) for more on format strings.");
 
 static PyObject *
 s_unpack_from(PyObject *self, PyObject *args, PyObject *kwds)
@@ -1556,8 +1565,9 @@
 PyDoc_STRVAR(s_pack__doc__,
 "S.pack(v1, v2, ...) -> bytes\n\
 \n\
-Return a bytes containing values v1, v2, ... packed according to this\n\
-Struct's format. See struct.__doc__ for more on format strings.");
+Return a bytes object containing values v1, v2, ... packed according\n\
+to the format string S.format.  See help(struct) for more on format\n\
+strings.");
 
 static PyObject *
 s_pack(PyObject *self, PyObject *args)
@@ -1593,10 +1603,10 @@
 PyDoc_STRVAR(s_pack_into__doc__,
 "S.pack_into(buffer, offset, v1, v2, ...)\n\
 \n\
-Pack the values v1, v2, ... according to this Struct's format, write \n\
-the packed bytes into the writable buffer buf starting at offset.  Note\n\
-that the offset is not an optional argument.  See struct.__doc__ for \n\
-more on format strings.");
+Pack the values v1, v2, ... according to the format string S.format\n\
+and write the packed bytes into the writable buffer buf starting at\n\
+offset.  Note that the offset is a required argument.  See\n\
+help(struct) for more on format strings.");
 
 static PyObject *
 s_pack_into(PyObject *self, PyObject *args)
@@ -1673,7 +1683,11 @@
     {NULL,       NULL}          /* sentinel */
 };
 
-PyDoc_STRVAR(s__doc__, "Compiled struct object");
+PyDoc_STRVAR(s__doc__, 
+"Struct(fmt) --> compiled struct object\n"
+"\n"
+"Return a new Struct object which writes and reads binary data according to\n"
+"the format string fmt.  See help(struct) for more on format strings.");
 
 #define OFF(x) offsetof(PyStructObject, x)
 
@@ -1771,7 +1785,9 @@
 }
 
 PyDoc_STRVAR(calcsize_doc,
-"Return size of C struct described by format string fmt.");
+"calcsize(fmt) -> integer\n\
+\n\
+Return size in bytes of the struct described by the format string fmt.");
 
 static PyObject *
 calcsize(PyObject *self, PyObject *fmt)
@@ -1786,7 +1802,10 @@
 }
 
 PyDoc_STRVAR(pack_doc,
-"Return bytes containing values v1, v2, ... packed according to fmt.");
+"pack(fmt, v1, v2, ...) -> bytes\n\
+\n\
+Return a bytes object containing the values v1, v2, ... packed according\n\
+to the format string fmt.  See help(struct) for more on format strings.");
 
 static PyObject *
 pack(PyObject *self, PyObject *args)
@@ -1815,8 +1834,12 @@
 }
 
 PyDoc_STRVAR(pack_into_doc,
-"Pack the values v1, v2, ... according to fmt.\n\
-Write the packed bytes into the writable buffer buf starting at offset.");
+"pack_into(fmt, buffer, offset, v1, v2, ...)\n\
+\n\
+Pack the values v1, v2, ... according to the format string fmt and write\n\
+the packed bytes into the writable buffer buf starting at offset.  Note\n\
+that the offset is a required argument.  See help(struct) for more\n\
+on format strings.");
 
 static PyObject *
 pack_into(PyObject *self, PyObject *args)
@@ -1845,8 +1868,11 @@
 }
 
 PyDoc_STRVAR(unpack_doc,
-"Unpack the bytes containing packed C structure data, according to fmt.\n\
-Requires len(bytes) == calcsize(fmt).");
+"unpack(fmt, buffer) -> (v1, v2, ...)\n\
+\n\
+Return a tuple containing values unpacked according to the format string\n\
+fmt.  Requires len(buffer) == calcsize(fmt). See help(struct) for more\n\
+on format strings.");
 
 static PyObject *
 unpack(PyObject *self, PyObject *args)
@@ -1865,8 +1891,11 @@
 }
 
 PyDoc_STRVAR(unpack_from_doc,
-"Unpack the buffer, containing packed C structure data, according to\n\
-fmt, starting at offset. Requires len(buffer[offset:]) >= calcsize(fmt).");
+"unpack_from(fmt, buffer, offset=0) -> (v1, v2, ...)\n\
+\n\
+Return a tuple containing values unpacked according to the format string\n\
+fmt.  Requires len(buffer[offset:]) >= calcsize(fmt).  See help(struct)\n\
+for more on format strings.");
 
 static PyObject *
 unpack_from(PyObject *self, PyObject *args, PyObject *kwds)
@@ -1953,11 +1982,7 @@
 PyMODINIT_FUNC
 PyInit__struct(void)
 {
-    PyObject *ver, *m;
-
-    ver = PyBytes_FromString("0.3");
-    if (ver == NULL)
-        return NULL;
+    PyObject *m;
 
     m = PyModule_Create(&_structmodule);
     if (m == NULL)
@@ -2019,7 +2044,5 @@
     Py_INCREF((PyObject*)&PyStructType);
     PyModule_AddObject(m, "Struct", (PyObject*)&PyStructType);
 
-    PyModule_AddObject(m, "__version__", ver);
-
     return m;
 }

Modified: python/branches/py3k-jit/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-jit/Modules/_testcapimodule.c	Wed Jun 16 18:21:24 2010
@@ -807,8 +807,161 @@
 }
 #endif
 
+static PyObject *
+getargs_s(PyObject *self, PyObject *args)
+{
+    char *str;
+    if (!PyArg_ParseTuple(args, "s", &str))
+        return NULL;
+    return PyBytes_FromString(str);
+}
+
+static PyObject *
+getargs_s_star(PyObject *self, PyObject *args)
+{
+    Py_buffer buffer;
+    PyObject *bytes;
+    if (!PyArg_ParseTuple(args, "s*", &buffer))
+        return NULL;
+    bytes = PyBytes_FromStringAndSize(buffer.buf, buffer.len);
+    PyBuffer_Release(&buffer);
+    return bytes;
+}
+
+static PyObject *
+getargs_s_hash(PyObject *self, PyObject *args)
+{
+    char *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "s#", &str, &size))
+        return NULL;
+    return PyBytes_FromStringAndSize(str, size);
+}
+
+static PyObject *
+getargs_z(PyObject *self, PyObject *args)
+{
+    char *str;
+    if (!PyArg_ParseTuple(args, "z", &str))
+        return NULL;
+    if (str != NULL)
+        return PyBytes_FromString(str);
+    else
+        Py_RETURN_NONE;
+}
+
+static PyObject *
+getargs_z_star(PyObject *self, PyObject *args)
+{
+    Py_buffer buffer;
+    PyObject *bytes;
+    if (!PyArg_ParseTuple(args, "z*", &buffer))
+        return NULL;
+    if (buffer.buf != NULL)
+        bytes = PyBytes_FromStringAndSize(buffer.buf, buffer.len);
+    else {
+        Py_INCREF(Py_None);
+        bytes = Py_None;
+    }
+    PyBuffer_Release(&buffer);
+    return bytes;
+}
+
+static PyObject *
+getargs_z_hash(PyObject *self, PyObject *args)
+{
+    char *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "z#", &str, &size))
+        return NULL;
+    if (str != NULL)
+        return PyBytes_FromStringAndSize(str, size);
+    else
+        Py_RETURN_NONE;
+}
+
+static PyObject *
+getargs_y(PyObject *self, PyObject *args)
+{
+    char *str;
+    if (!PyArg_ParseTuple(args, "y", &str))
+        return NULL;
+    return PyBytes_FromString(str);
+}
+
+static PyObject *
+getargs_y_star(PyObject *self, PyObject *args)
+{
+    Py_buffer buffer;
+    PyObject *bytes;
+    if (!PyArg_ParseTuple(args, "y*", &buffer))
+        return NULL;
+    bytes = PyBytes_FromStringAndSize(buffer.buf, buffer.len);
+    PyBuffer_Release(&buffer);
+    return bytes;
+}
+
+static PyObject *
+getargs_y_hash(PyObject *self, PyObject *args)
+{
+    char *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "y#", &str, &size))
+        return NULL;
+    return PyBytes_FromStringAndSize(str, size);
+}
+
+static PyObject *
+getargs_u(PyObject *self, PyObject *args)
+{
+    Py_UNICODE *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "u", &str))
+        return NULL;
+    size = Py_UNICODE_strlen(str);
+    return PyUnicode_FromUnicode(str, size);
+}
 
 static PyObject *
+getargs_u_hash(PyObject *self, PyObject *args)
+{
+    Py_UNICODE *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "u#", &str, &size))
+        return NULL;
+    return PyUnicode_FromUnicode(str, size);
+}
+
+static PyObject *
+getargs_Z(PyObject *self, PyObject *args)
+{
+    Py_UNICODE *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "Z", &str))
+        return NULL;
+    if (str != NULL) {
+        size = Py_UNICODE_strlen(str);
+        return PyUnicode_FromUnicode(str, size);
+    } else
+        Py_RETURN_NONE;
+}
+
+static PyObject *
+getargs_Z_hash(PyObject *self, PyObject *args)
+{
+    Py_UNICODE *str;
+    Py_ssize_t size;
+    if (!PyArg_ParseTuple(args, "Z#", &str, &size))
+        return NULL;
+    if (str != NULL)
+        return PyUnicode_FromUnicode(str, size);
+    else
+        Py_RETURN_NONE;
+}
+
+/* Test the s and z codes for PyArg_ParseTuple.
+*/
+static PyObject *
 test_widechar(PyObject *self)
 {
 #if defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4)
@@ -1593,11 +1746,24 @@
     {"test_longlong_api",       test_longlong_api,               METH_NOARGS},
     {"test_long_long_and_overflow",
         (PyCFunction)test_long_long_and_overflow, METH_NOARGS},
+#endif
+    {"getargs_s",               getargs_s,                       METH_VARARGS},
+    {"getargs_s_star",          getargs_s_star,                  METH_VARARGS},
+    {"getargs_s_hash",          getargs_s_hash,                  METH_VARARGS},
+    {"getargs_z",               getargs_z,                       METH_VARARGS},
+    {"getargs_z_star",          getargs_z_star,                  METH_VARARGS},
+    {"getargs_z_hash",          getargs_z_hash,                  METH_VARARGS},
+    {"getargs_y",               getargs_y,                       METH_VARARGS},
+    {"getargs_y_star",          getargs_y_star,                  METH_VARARGS},
+    {"getargs_y_hash",          getargs_y_hash,                  METH_VARARGS},
+    {"getargs_u",               getargs_u,                       METH_VARARGS},
+    {"getargs_u_hash",          getargs_u_hash,                  METH_VARARGS},
+    {"getargs_Z",               getargs_Z,                       METH_VARARGS},
+    {"getargs_Z_hash",          getargs_Z_hash,                  METH_VARARGS},
     {"codec_incrementalencoder",
      (PyCFunction)codec_incrementalencoder,      METH_VARARGS},
     {"codec_incrementaldecoder",
      (PyCFunction)codec_incrementaldecoder,      METH_VARARGS},
-#endif
     {"test_widechar",           (PyCFunction)test_widechar,      METH_NOARGS},
 #ifdef WITH_THREAD
     {"_test_thread_state",  test_thread_state,                   METH_VARARGS},

Modified: python/branches/py3k-jit/Modules/config.c.in
==============================================================================
--- python/branches/py3k-jit/Modules/config.c.in	(original)
+++ python/branches/py3k-jit/Modules/config.c.in	Wed Jun 16 18:21:24 2010
@@ -34,28 +34,28 @@
 
 /* -- ADDMODULE MARKER 2 -- */
 
-	/* This module lives in marshal.c */
-	{"marshal", PyMarshal_Init},
+    /* This module lives in marshal.c */
+    {"marshal", PyMarshal_Init},
 
-	/* This lives in import.c */
-	{"imp", PyInit_imp},
+    /* This lives in import.c */
+    {"imp", PyInit_imp},
 
-	/* This lives in Python/Python-ast.c */
-	{"_ast", PyInit__ast},
+    /* This lives in Python/Python-ast.c */
+    {"_ast", PyInit__ast},
 
-	/* These entries are here for sys.builtin_module_names */
-	{"__main__", NULL},
-	{"builtins", NULL},
-	{"sys", NULL},
+    /* These entries are here for sys.builtin_module_names */
+    {"__main__", NULL},
+    {"builtins", NULL},
+    {"sys", NULL},
 
-	/* This lives in gcmodule.c */
-	{"gc", PyInit_gc},
+    /* This lives in gcmodule.c */
+    {"gc", PyInit_gc},
 
-	/* This lives in _warnings.c */
-	{"_warnings", _PyWarnings_Init},
+    /* This lives in _warnings.c */
+    {"_warnings", _PyWarnings_Init},
 
-	/* Sentinel */
-	{0, 0}
+    /* Sentinel */
+    {0, 0}
 };
 
 

Modified: python/branches/py3k-jit/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/datetimemodule.c	(original)
+++ python/branches/py3k-jit/Modules/datetimemodule.c	Wed Jun 16 18:21:24 2010
@@ -30,6 +30,7 @@
 
 #define MINYEAR 1
 #define MAXYEAR 9999
+#define MAXORDINAL 3652059 /* date(9999,12,31).toordinal() */
 
 /* Nine decimal digits is easy to communicate, and leaves enough room
  * so that two delta days can be added w/o fear of overflowing a signed
@@ -101,6 +102,7 @@
 static PyTypeObject PyDateTime_DeltaType;
 static PyTypeObject PyDateTime_TimeType;
 static PyTypeObject PyDateTime_TZInfoType;
+static PyTypeObject PyDateTime_TimeZoneType;
 
 /* ---------------------------------------------------------------------------
  * Math utilities.
@@ -151,6 +153,25 @@
     return (long)x;
 }
 
+/* Nearest integer to m / n for integers m and n. Half-integer results
+ * are rounded to even.
+ */
+static PyObject *
+divide_nearest(PyObject *m, PyObject *n)
+{
+    PyObject *result;
+    PyObject *temp;
+
+    temp = _PyLong_DivmodNear(m, n);
+    if (temp == NULL)
+        return NULL;
+    result = PyTuple_GET_ITEM(temp, 0);
+    Py_INCREF(result);
+    Py_DECREF(temp);
+
+    return result;
+}
+
 /* ---------------------------------------------------------------------------
  * General calendrical helper functions
  */
@@ -480,7 +501,7 @@
  * The input values must be such that the internals don't overflow.
  * The way this routine is used, we don't get close.
  */
-static void
+static int
 normalize_y_m_d(int *y, int *m, int *d)
 {
     int dim;            /* # of days in month */
@@ -534,11 +555,23 @@
         else {
             int ordinal = ymd_to_ord(*y, *m, 1) +
                                       *d - 1;
-            ord_to_ymd(ordinal, y, m, d);
+            if (ordinal < 1 || ordinal > MAXORDINAL) {
+                goto error;
+            } else {
+                ord_to_ymd(ordinal, y, m, d);
+                return 0;
+            }
         }
     }
     assert(*m > 0);
     assert(*d > 0);
+    if (MINYEAR <= *y && *y <= MAXYEAR)
+        return 0;
+ error:
+    PyErr_SetString(PyExc_OverflowError,
+            "date value out of range");
+    return -1;
+
 }
 
 /* Fiddle out-of-bounds months and days so that the result makes some kind
@@ -548,17 +581,7 @@
 static int
 normalize_date(int *year, int *month, int *day)
 {
-    int result;
-
-    normalize_y_m_d(year, month, day);
-    if (MINYEAR <= *year && *year <= MAXYEAR)
-        result = 0;
-    else {
-        PyErr_SetString(PyExc_OverflowError,
-                        "date value out of range");
-        result = -1;
-    }
-    return result;
+    return normalize_y_m_d(year, month, day);
 }
 
 /* Force all the datetime fields into range.  The parameters are both
@@ -749,6 +772,52 @@
 #define new_delta(d, s, us, normalize)  \
     new_delta_ex(d, s, us, normalize, &PyDateTime_DeltaType)
 
+
+typedef struct
+{
+    PyObject_HEAD
+    PyObject *offset;
+    PyObject *name;
+} PyDateTime_TimeZone;
+
+/* Create new timezone instance checking offset range.  This
+   function does not check the name argument.  Caller must assure
+   that offset is a timedelta instance and name is either NULL
+   or a unicode object. */
+static PyObject *
+new_timezone(PyObject *offset, PyObject *name)
+{
+    PyDateTime_TimeZone *self;
+    PyTypeObject *type = &PyDateTime_TimeZoneType;
+
+    assert(offset != NULL);
+    assert(PyDelta_Check(offset));
+    assert(name == NULL || PyUnicode_Check(name));
+
+    if (GET_TD_MICROSECONDS(offset) != 0 || GET_TD_SECONDS(offset) % 60 != 0) {
+        PyErr_Format(PyExc_ValueError, "offset must be a timedelta"
+                     " representing a whole number of minutes");
+        return NULL;
+    }
+    if ((GET_TD_DAYS(offset) == -1 && GET_TD_SECONDS(offset) == 0) ||
+        GET_TD_DAYS(offset) < -1 || GET_TD_DAYS(offset) >= 1) {
+        PyErr_Format(PyExc_ValueError, "offset must be a timedelta"
+                     " strictly between -timedelta(hours=24) and"
+                     " timedelta(hours=24).");
+        return NULL;
+    }
+
+    self = (PyDateTime_TimeZone *)(type->tp_alloc(type, 0));
+    if (self == NULL) {
+        return NULL;
+    }
+    Py_INCREF(offset);
+    self->offset = offset;
+    Py_XINCREF(name);
+    self->name = name;
+    return (PyObject *)self;
+}
+
 /* ---------------------------------------------------------------------------
  * tzinfo helpers.
  */
@@ -1645,6 +1714,37 @@
 }
 
 static PyObject *
+multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta)
+{
+    PyObject *result = NULL;
+    PyObject *pyus_in = NULL, *temp, *pyus_out;
+    PyObject *ratio = NULL;
+
+    pyus_in = delta_to_microseconds(delta);
+    if (pyus_in == NULL)
+        return NULL;
+    ratio = PyObject_CallMethod(floatobj, "as_integer_ratio", NULL);
+    if (ratio == NULL)
+        goto error;
+    temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 0));
+    Py_DECREF(pyus_in);
+    pyus_in = NULL;
+    if (temp == NULL)
+        goto error;
+    pyus_out = divide_nearest(temp, PyTuple_GET_ITEM(ratio, 1));
+    Py_DECREF(temp);
+    if (pyus_out == NULL)
+        goto error;
+    result = microseconds_to_delta(pyus_out);
+    Py_DECREF(pyus_out);
+ error:
+    Py_XDECREF(pyus_in);
+    Py_XDECREF(ratio);
+
+    return result;
+}
+
+static PyObject *
 divide_timedelta_int(PyDateTime_Delta *delta, PyObject *intobj)
 {
     PyObject *pyus_in;
@@ -1712,6 +1812,55 @@
 }
 
 static PyObject *
+truedivide_timedelta_float(PyDateTime_Delta *delta, PyObject *f)
+{
+    PyObject *result = NULL;
+    PyObject *pyus_in = NULL, *temp, *pyus_out;
+    PyObject *ratio = NULL;
+
+    pyus_in = delta_to_microseconds(delta);
+    if (pyus_in == NULL)
+        return NULL;
+    ratio = PyObject_CallMethod(f, "as_integer_ratio", NULL);
+    if (ratio == NULL)
+        goto error;
+    temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 1));
+    Py_DECREF(pyus_in);
+    pyus_in = NULL;
+    if (temp == NULL)
+        goto error;
+    pyus_out = divide_nearest(temp, PyTuple_GET_ITEM(ratio, 0));
+    Py_DECREF(temp);
+    if (pyus_out == NULL)
+        goto error;
+    result = microseconds_to_delta(pyus_out);
+    Py_DECREF(pyus_out);
+ error:
+    Py_XDECREF(pyus_in);
+    Py_XDECREF(ratio);
+
+    return result;
+}
+
+static PyObject *
+truedivide_timedelta_int(PyDateTime_Delta *delta, PyObject *i)
+{
+    PyObject *result;
+    PyObject *pyus_in, *pyus_out;
+    pyus_in = delta_to_microseconds(delta);
+    if (pyus_in == NULL)
+        return NULL;
+    pyus_out = divide_nearest(pyus_in, i);
+    Py_DECREF(pyus_in);
+    if (pyus_out == NULL)
+        return NULL;
+    result = microseconds_to_delta(pyus_out);
+    Py_DECREF(pyus_out);
+
+    return result;
+}
+
+static PyObject *
 delta_add(PyObject *left, PyObject *right)
 {
     PyObject *result = Py_NotImplemented;
@@ -1835,10 +1984,16 @@
         if (PyLong_Check(right))
             result = multiply_int_timedelta(right,
                             (PyDateTime_Delta *) left);
+        else if (PyFloat_Check(right))
+            result = multiply_float_timedelta(right,
+                            (PyDateTime_Delta *) left);
     }
     else if (PyLong_Check(left))
         result = multiply_int_timedelta(left,
-                                        (PyDateTime_Delta *) right);
+                        (PyDateTime_Delta *) right);
+    else if (PyFloat_Check(left))
+        result = multiply_float_timedelta(left,
+                        (PyDateTime_Delta *) right);
 
     if (result == Py_NotImplemented)
         Py_INCREF(result);
@@ -1877,6 +2032,12 @@
             result = truedivide_timedelta_timedelta(
                             (PyDateTime_Delta *)left,
                             (PyDateTime_Delta *)right);
+        else if (PyFloat_Check(right))
+            result = truedivide_timedelta_float(
+                            (PyDateTime_Delta *)left, right);
+        else if (PyLong_Check(right))
+            result = truedivide_timedelta_int(
+                            (PyDateTime_Delta *)left, right);
     }
 
     if (result == Py_NotImplemented)
@@ -3109,8 +3270,8 @@
      PyDoc_STR("datetime -> string name of time zone.")},
 
     {"utcoffset",       (PyCFunction)tzinfo_utcoffset,          METH_O,
-     PyDoc_STR("datetime -> minutes east of UTC (negative for "
-               "west of UTC).")},
+     PyDoc_STR("datetime -> timedelta showing offset from UTC, negative "
+           "values indicating West of UTC")},
 
     {"dst",             (PyCFunction)tzinfo_dst,                METH_O,
      PyDoc_STR("datetime -> DST offset in minutes east of UTC.")},
@@ -3147,7 +3308,7 @@
     PyObject_GenericGetAttr,                    /* tp_getattro */
     0,                                          /* tp_setattro */
     0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,   /* tp_flags */
     tzinfo_doc,                                 /* tp_doc */
     0,                                          /* tp_traverse */
     0,                                          /* tp_clear */
@@ -3169,6 +3330,206 @@
     0,                                          /* tp_free */
 };
 
+static char *timezone_kws[] = {"offset", "name", NULL};
+
+static PyObject *
+timezone_new(PyTypeObject *type, PyObject *args, PyObject *kw)
+{
+    PyObject *offset;
+    PyObject *name = NULL;
+    if (PyArg_ParseTupleAndKeywords(args, kw, "O!|O!:timezone", timezone_kws,
+                                    &PyDateTime_DeltaType, &offset,
+                                    &PyUnicode_Type, &name))
+        return new_timezone(offset, name);
+
+    return NULL;
+}
+
+static void
+timezone_dealloc(PyDateTime_TimeZone *self)
+{
+    Py_CLEAR(self->offset);
+    Py_CLEAR(self->name);
+    Py_TYPE(self)->tp_free((PyObject *)self);
+}
+
+static PyObject *
+timezone_richcompare(PyDateTime_TimeZone *self,
+                     PyDateTime_TimeZone *other, int op)
+{
+    if (op != Py_EQ && op != Py_NE) {
+        Py_INCREF(Py_NotImplemented);
+        return Py_NotImplemented;
+    }
+    return delta_richcompare(self->offset, other->offset, op);
+}
+
+static long
+timezone_hash(PyDateTime_TimeZone *self)
+{
+    return delta_hash((PyDateTime_Delta *)self->offset);
+}
+
+/* Check argument type passed to tzname, utcoffset, or dst methods.
+   Returns 0 for good argument.  Returns -1 and sets exception info
+   otherwise.
+ */
+static int
+_timezone_check_argument(PyObject *dt, const char *meth)
+{
+    if (dt == Py_None || PyDateTime_Check(dt))
+        return 0;
+    PyErr_Format(PyExc_TypeError, "%s(dt) argument must be a datetime instance"
+                 " or None, not %.200s", meth, Py_TYPE(dt)->tp_name);
+    return -1;
+}
+
+static PyObject *
+timezone_str(PyDateTime_TimeZone *self)
+{
+    char buf[10];
+    int hours, minutes, seconds;
+    PyObject *offset;
+    char sign;
+
+    if (self->name != NULL) {
+        Py_INCREF(self->name);
+        return self->name;
+    }
+    /* Offset is normalized, so it is negative if days < 0 */
+    if (GET_TD_DAYS(self->offset) < 0) {
+        sign = '-';
+        offset = delta_negative((PyDateTime_Delta *)self->offset);
+        if (offset == NULL)
+            return NULL;
+    }
+    else {
+        sign = '+';
+        offset = self->offset;
+        Py_INCREF(offset);
+    }
+    /* Offset is not negative here. */
+    seconds = GET_TD_SECONDS(offset);
+    Py_DECREF(offset);
+    minutes = divmod(seconds, 60, &seconds);
+    hours = divmod(minutes, 60, &minutes);
+    assert(seconds == 0);
+    /* XXX ignore sub-minute data, curently not allowed. */
+    PyOS_snprintf(buf, sizeof(buf), "UTC%c%02d:%02d", sign, hours, minutes);
+
+    return PyUnicode_FromString(buf);
+}
+
+static PyObject *
+timezone_tzname(PyDateTime_TimeZone *self, PyObject *dt)
+{
+    if (_timezone_check_argument(dt, "tzname") == -1)
+        return NULL;
+
+    return timezone_str(self);
+}
+
+static PyObject *
+timezone_utcoffset(PyDateTime_TimeZone *self, PyObject *dt)
+{
+    if (_timezone_check_argument(dt, "utcoffset") == -1)
+        return NULL;
+
+    Py_INCREF(self->offset);
+    return self->offset;
+}
+
+static PyObject *
+timezone_dst(PyObject *self, PyObject *dt)
+{
+    if (_timezone_check_argument(dt, "dst") == -1)
+        return NULL;
+
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+add_datetime_timedelta(PyDateTime_DateTime *date, PyDateTime_Delta *delta,
+                       int factor);
+
+static PyObject *
+timezone_fromutc(PyDateTime_TimeZone *self, PyDateTime_DateTime *dt)
+{
+    if (! PyDateTime_Check(dt)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "fromutc: argument must be a datetime");
+        return NULL;
+    }
+    if (! HASTZINFO(dt) || dt->tzinfo != (PyObject *)self) {
+        PyErr_SetString(PyExc_ValueError, "fromutc: dt.tzinfo "
+                        "is not self");
+        return NULL;
+    }
+
+    return add_datetime_timedelta(dt, (PyDateTime_Delta *)self->offset, 1);
+}
+
+static PyMethodDef timezone_methods[] = {
+    {"tzname", (PyCFunction)timezone_tzname, METH_O,
+     PyDoc_STR("If name is specified when timezone is created, returns the name."
+               "  Otherwise returns offset as 'UTC(+|-)HHMM'.")},
+
+    {"utcoffset", (PyCFunction)timezone_utcoffset, METH_O,
+     PyDoc_STR("Returns fixed offset.  Ignores its argument.")},
+
+    {"dst", (PyCFunction)timezone_dst, METH_O,
+     PyDoc_STR("Returns None.  Ignores its argument.")},
+
+    {"fromutc", (PyCFunction)timezone_fromutc, METH_O,
+     PyDoc_STR("datetime in UTC -> datetime in local time.")},
+
+    {NULL, NULL}
+};
+
+static char timezone_doc[] =
+PyDoc_STR("Fixed offset from UTC implementation of tzinfo.");
+
+static PyTypeObject PyDateTime_TimeZoneType = {
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "datetime.timezone",              /* tp_name */
+    sizeof(PyDateTime_TimeZone),      /* tp_basicsize */
+    0,                                /* tp_itemsize */
+    (destructor)timezone_dealloc,     /* tp_dealloc */
+    0,                                /* tp_print */
+    0,                                /* tp_getattr */
+    0,                                /* tp_setattr */
+    0,                                /* tp_reserved */
+    0,                                /* tp_repr */
+    0,                                /* tp_as_number */
+    0,                                /* tp_as_sequence */
+    0,                                /* tp_as_mapping */
+    (hashfunc)timezone_hash,          /* tp_hash */
+    0,                                /* tp_call */
+    (reprfunc)timezone_str,           /* tp_str */
+    0,                                /* tp_getattro */
+    0,                                /* tp_setattro */
+    0,                                /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT,               /* tp_flags */
+    timezone_doc,                     /* tp_doc */
+    0,                                /* tp_traverse */
+    0,                                /* tp_clear */
+    (richcmpfunc)timezone_richcompare,/* tp_richcompare */
+    0,                                /* tp_weaklistoffset */
+    0,                                /* tp_iter */
+    0,                                /* tp_iternext */
+    timezone_methods,                 /* tp_methods */
+    0,                                /* tp_members */
+    0,                                /* tp_getset */
+    &PyDateTime_TZInfoType,           /* tp_base */
+    0,                                /* tp_dict */
+    0,                                /* tp_descr_get */
+    0,                                /* tp_descr_set */
+    0,                                /* tp_dictoffset */
+    0,                                /* tp_init */
+    0,                                /* tp_alloc */
+    timezone_new,                     /* tp_new */
+};
+
 /*
  * PyDateTime_Time implementation.
  */
@@ -4857,6 +5218,7 @@
     PyObject *m;        /* a module object */
     PyObject *d;        /* its dict */
     PyObject *x;
+    PyObject *delta;
 
     m = PyModule_Create(&datetimemodule);
     if (m == NULL)
@@ -4872,6 +5234,8 @@
         return NULL;
     if (PyType_Ready(&PyDateTime_TZInfoType) < 0)
         return NULL;
+    if (PyType_Ready(&PyDateTime_TimeZoneType) < 0)
+        return NULL;
 
     /* timedelta values */
     d = PyDateTime_DeltaType.tp_dict;
@@ -4945,6 +5309,36 @@
         return NULL;
     Py_DECREF(x);
 
+    /* timezone values */
+    d = PyDateTime_TimeZoneType.tp_dict;
+
+    delta = new_delta(0, 0, 0, 0);
+    if (delta == NULL)
+        return NULL;
+    x = new_timezone(delta, NULL);
+    Py_DECREF(delta);
+    if (x == NULL || PyDict_SetItemString(d, "utc", x) < 0)
+        return NULL;
+    Py_DECREF(x);
+
+    delta = new_delta(-1, 60, 0, 1); /* -23:59 */
+    if (delta == NULL)
+        return NULL;
+    x = new_timezone(delta, NULL);
+    Py_DECREF(delta);
+    if (x == NULL || PyDict_SetItemString(d, "min", x) < 0)
+        return NULL;
+    Py_DECREF(x);
+
+    delta = new_delta(0, (23 * 60 + 59) * 60, 0, 0); /* +23:59 */
+    if (delta == NULL)
+        return NULL;
+    x = new_timezone(delta, NULL);
+    Py_DECREF(delta);
+    if (x == NULL || PyDict_SetItemString(d, "max", x) < 0)
+        return NULL;
+    Py_DECREF(x);
+
     /* module initialization */
     PyModule_AddIntConstant(m, "MINYEAR", MINYEAR);
     PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR);
@@ -4965,6 +5359,9 @@
     Py_INCREF(&PyDateTime_TZInfoType);
     PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType);
 
+    Py_INCREF(&PyDateTime_TimeZoneType);
+    PyModule_AddObject(m, "timezone", (PyObject *) &PyDateTime_TimeZoneType);
+
     x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL);
     if (x == NULL)
         return NULL;

Modified: python/branches/py3k-jit/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/itertoolsmodule.c	(original)
+++ python/branches/py3k-jit/Modules/itertoolsmodule.c	Wed Jun 16 18:21:24 2010
@@ -3066,7 +3066,7 @@
 };
 
 PyDoc_STRVAR(count_doc,
-                         "count(start=0, step=1]) --> count object\n\
+                         "count(start=0, step=1) --> count object\n\
 \n\
 Return a count object whose .__next__() method returns consecutive values.\n\
 Equivalent to:\n\n\

Modified: python/branches/py3k-jit/Modules/mathmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/mathmodule.c	(original)
+++ python/branches/py3k-jit/Modules/mathmodule.c	Wed Jun 16 18:21:24 2010
@@ -428,8 +428,8 @@
 static double
 m_erf_series(double x)
 {
-    double x2, acc, fk;
-    int i;
+    double x2, acc, fk, result;
+    int i, saved_errno;
 
     x2 = x * x;
     acc = 0.0;
@@ -438,7 +438,12 @@
         acc = 2.0 + x2 * acc / fk;
         fk -= 1.0;
     }
-    return acc * x * exp(-x2) / sqrtpi;
+    /* Make sure the exp call doesn't affect errno;
+       see m_erfc_contfrac for more. */
+    saved_errno = errno;
+    result = acc * x * exp(-x2) / sqrtpi;
+    errno = saved_errno;
+    return result;
 }
 
 /*
@@ -453,8 +458,8 @@
 static double
 m_erfc_contfrac(double x)
 {
-    double x2, a, da, p, p_last, q, q_last, b;
-    int i;
+    double x2, a, da, p, p_last, q, q_last, b, result;
+    int i, saved_errno;
 
     if (x >= ERFC_CONTFRAC_CUTOFF)
         return 0.0;
@@ -472,7 +477,12 @@
         temp = p; p = b*p - a*p_last; p_last = temp;
         temp = q; q = b*q - a*q_last; q_last = temp;
     }
-    return p / q * x * exp(-x2) / sqrtpi;
+    /* Issue #8986: On some platforms, exp sets errno on underflow to zero;
+       save the current errno value so that we can restore it later. */
+    saved_errno = errno;
+    result = p / q * x * exp(-x2) / sqrtpi;
+    errno = saved_errno;
+    return result;
 }
 
 /* Error function erf(x), for general x */

Modified: python/branches/py3k-jit/Modules/readline.c
==============================================================================
--- python/branches/py3k-jit/Modules/readline.c	(original)
+++ python/branches/py3k-jit/Modules/readline.c	Wed Jun 16 18:21:24 2010
@@ -98,10 +98,16 @@
 static PyObject *
 read_init_file(PyObject *self, PyObject *args)
 {
-    char *s = NULL;
-    if (!PyArg_ParseTuple(args, "|z:read_init_file", &s))
+    PyObject *filename_obj = Py_None, *filename_bytes;
+    if (!PyArg_ParseTuple(args, "|O:read_init_file", &filename_obj))
         return NULL;
-    errno = rl_read_init_file(s);
+    if (filename_obj != Py_None) {
+        if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
+            return NULL;
+        errno = rl_read_init_file(PyBytes_AsString(filename_bytes));
+        Py_DECREF(filename_bytes);
+    } else
+        errno = rl_read_init_file(NULL);
     if (errno)
         return PyErr_SetFromErrno(PyExc_IOError);
     Py_RETURN_NONE;
@@ -118,10 +124,16 @@
 static PyObject *
 read_history_file(PyObject *self, PyObject *args)
 {
-    char *s = NULL;
-    if (!PyArg_ParseTuple(args, "|z:read_history_file", &s))
+    PyObject *filename_obj = Py_None, *filename_bytes;
+    if (!PyArg_ParseTuple(args, "|O:read_history_file", &filename_obj))
         return NULL;
-    errno = read_history(s);
+    if (filename_obj != Py_None) {
+        if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
+            return NULL;
+        errno = read_history(PyBytes_AsString(filename_bytes));
+        Py_DECREF(filename_bytes);
+    } else
+        errno = read_history(NULL);
     if (errno)
         return PyErr_SetFromErrno(PyExc_IOError);
     Py_RETURN_NONE;
@@ -139,12 +151,22 @@
 static PyObject *
 write_history_file(PyObject *self, PyObject *args)
 {
-    char *s = NULL;
-    if (!PyArg_ParseTuple(args, "|z:write_history_file", &s))
+    PyObject *filename_obj = Py_None, *filename_bytes;
+    char *filename;
+    if (!PyArg_ParseTuple(args, "|O:write_history_file", &filename_obj))
         return NULL;
-    errno = write_history(s);
+    if (filename_obj != Py_None) {
+        if (!PyUnicode_FSConverter(filename_obj, &filename_bytes))
+            return NULL;
+        filename = PyBytes_AsString(filename_bytes);
+    } else {
+        filename_bytes = NULL;
+        filename = NULL;
+    }
+    errno = write_history(filename);
     if (!errno && _history_length >= 0)
-        history_truncate_file(s, _history_length);
+        history_truncate_file(filename, _history_length);
+    Py_XDECREF(filename_bytes);
     if (errno)
         return PyErr_SetFromErrno(PyExc_IOError);
     Py_RETURN_NONE;

Modified: python/branches/py3k-jit/Modules/timemodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/timemodule.c	(original)
+++ python/branches/py3k-jit/Modules/timemodule.c	Wed Jun 16 18:21:24 2010
@@ -208,21 +208,27 @@
 a floating point number for subsecond precision.");
 
 static PyStructSequence_Field struct_time_type_fields[] = {
-    {"tm_year", NULL},
-    {"tm_mon", NULL},
-    {"tm_mday", NULL},
-    {"tm_hour", NULL},
-    {"tm_min", NULL},
-    {"tm_sec", NULL},
-    {"tm_wday", NULL},
-    {"tm_yday", NULL},
-    {"tm_isdst", NULL},
+    {"tm_year", "year, for example, 1993"},
+    {"tm_mon", "month of year, range [1, 12]"},
+    {"tm_mday", "day of month, range [1, 31]"},
+    {"tm_hour", "hours, range [0, 23]"},
+    {"tm_min", "minutes, range [0, 59]"},
+    {"tm_sec", "seconds, range [0, 61])"},
+    {"tm_wday", "day of week, range [0, 6], Monday is 0"},
+    {"tm_yday", "day of year, range [1, 366]"},
+    {"tm_isdst", "1 if summer time is in effect, 0 if not, and -1 if unknown"},
     {0}
 };
 
 static PyStructSequence_Desc struct_time_type_desc = {
     "time.struct_time",
-    NULL,
+    "The time value as returned by gmtime(), localtime(), and strptime(), and\n"
+    " accepted by asctime(), mktime() and strftime().  May be considered as a\n"
+    " sequence of 9 integers.\n\n"
+    " Note that several fields' values are not the same as those defined by\n"
+    " the C language standard for struct tm.  For example, the value of the\n"
+    " field tm_year is the actual year, not year - 1900.  See individual\n"
+    " fields' descriptions for details.",
     struct_time_type_fields,
     9,
 };

Modified: python/branches/py3k-jit/Objects/abstract.c
==============================================================================
--- python/branches/py3k-jit/Objects/abstract.c	(original)
+++ python/branches/py3k-jit/Objects/abstract.c	Wed Jun 16 18:21:24 2010
@@ -693,48 +693,37 @@
 PyObject *
 PyObject_Format(PyObject *obj, PyObject *format_spec)
 {
-    static PyObject * str__format__ = NULL;
     PyObject *meth;
     PyObject *empty = NULL;
     PyObject *result = NULL;
-
-    /* Initialize cached value */
-    if (str__format__ == NULL) {
-    /* Initialize static variable needed by _PyType_Lookup */
-    str__format__ = PyUnicode_FromString("__format__");
-    if (str__format__ == NULL)
-        goto done;
-    }
+    static PyObject *format_cache = NULL;
 
     /* If no format_spec is provided, use an empty string */
     if (format_spec == NULL) {
-    empty = PyUnicode_FromUnicode(NULL, 0);
-    format_spec = empty;
+        empty = PyUnicode_FromUnicode(NULL, 0);
+        format_spec = empty;
     }
 
-    /* Make sure the type is initialized.  float gets initialized late */
-    if (Py_TYPE(obj)->tp_dict == NULL)
-    if (PyType_Ready(Py_TYPE(obj)) < 0)
-        goto done;
-
     /* Find the (unbound!) __format__ method (a borrowed reference) */
-    meth = _PyType_Lookup(Py_TYPE(obj), str__format__);
+    meth = _PyObject_LookupSpecial(obj, "__format__", &format_cache);
     if (meth == NULL) {
-    PyErr_Format(PyExc_TypeError,
-        "Type %.100s doesn't define __format__",
-        Py_TYPE(obj)->tp_name);
+        if (!PyErr_Occurred())
+            PyErr_Format(PyExc_TypeError,
+                         "Type %.100s doesn't define __format__",
+                         Py_TYPE(obj)->tp_name);
         goto done;
     }
 
-    /* And call it, binding it to the value */
-    result = PyObject_CallFunctionObjArgs(meth, obj, format_spec, NULL);
+    /* And call it. */
+    result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL);
+    Py_DECREF(meth);
 
     if (result && !PyUnicode_Check(result)) {
-    PyErr_SetString(PyExc_TypeError,
-        "__format__ method did not return string");
-    Py_DECREF(result);
-    result = NULL;
-    goto done;
+        PyErr_SetString(PyExc_TypeError,
+                        "__format__ method did not return string");
+        Py_DECREF(result);
+        result = NULL;
+        goto done;
     }
 
 done:

Modified: python/branches/py3k-jit/Objects/bytearrayobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/bytearrayobject.c	(original)
+++ python/branches/py3k-jit/Objects/bytearrayobject.c	Wed Jun 16 18:21:24 2010
@@ -1650,43 +1650,43 @@
                                   char from_c, char to_c,
                                   Py_ssize_t maxcount)
 {
-        char *self_s, *result_s, *start, *end, *next;
-        Py_ssize_t self_len;
-        PyByteArrayObject *result;
-
-        /* The result string will be the same size */
-        self_s = PyByteArray_AS_STRING(self);
-        self_len = PyByteArray_GET_SIZE(self);
-
-        next = findchar(self_s, self_len, from_c);
-
-        if (next == NULL) {
-                /* No matches; return the original bytes */
-                return return_self(self);
-        }
+    char *self_s, *result_s, *start, *end, *next;
+    Py_ssize_t self_len;
+    PyByteArrayObject *result;
 
-        /* Need to make a new bytes */
-        result = (PyByteArrayObject *) PyByteArray_FromStringAndSize(NULL, self_len);
-        if (result == NULL)
-                return NULL;
-        result_s = PyByteArray_AS_STRING(result);
-        Py_MEMCPY(result_s, self_s, self_len);
+    /* The result string will be the same size */
+    self_s = PyByteArray_AS_STRING(self);
+    self_len = PyByteArray_GET_SIZE(self);
 
-        /* change everything in-place, starting with this one */
-        start =  result_s + (next-self_s);
-        *start = to_c;
-        start++;
-        end = result_s + self_len;
-
-        while (--maxcount > 0) {
-                next = findchar(start, end-start, from_c);
-                if (next == NULL)
-                        break;
-                *next = to_c;
-                start = next+1;
-        }
+    next = findchar(self_s, self_len, from_c);
+
+    if (next == NULL) {
+        /* No matches; return the original bytes */
+        return return_self(self);
+    }
+
+    /* Need to make a new bytes */
+    result = (PyByteArrayObject *) PyByteArray_FromStringAndSize(NULL, self_len);
+    if (result == NULL)
+        return NULL;
+    result_s = PyByteArray_AS_STRING(result);
+    Py_MEMCPY(result_s, self_s, self_len);
+
+    /* change everything in-place, starting with this one */
+    start =  result_s + (next-self_s);
+    *start = to_c;
+    start++;
+    end = result_s + self_len;
 
-        return result;
+    while (--maxcount > 0) {
+        next = findchar(start, end-start, from_c);
+        if (next == NULL)
+            break;
+        *next = to_c;
+        start = next+1;
+    }
+
+    return result;
 }
 
 /* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */

Modified: python/branches/py3k-jit/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/bytesobject.c	(original)
+++ python/branches/py3k-jit/Objects/bytesobject.c	Wed Jun 16 18:21:24 2010
@@ -14,10 +14,10 @@
 
     if (buffer == NULL || buffer->bf_getbuffer == NULL)
     {
-    PyErr_Format(PyExc_TypeError,
-                 "Type %.100s doesn't support the buffer API",
-                 Py_TYPE(obj)->tp_name);
-    return -1;
+        PyErr_Format(PyExc_TypeError,
+                     "Type %.100s doesn't support the buffer API",
+                     Py_TYPE(obj)->tp_name);
+        return -1;
     }
 
     if (buffer->bf_getbuffer(obj, view, PyBUF_SIMPLE) < 0)
@@ -776,19 +776,19 @@
 {
     Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError);
     if (ival == -1 && PyErr_Occurred()) {
-    Py_buffer varg;
-    int pos;
-    PyErr_Clear();
-    if (_getbuffer(arg, &varg) < 0)
-        return -1;
-    pos = stringlib_find(PyBytes_AS_STRING(self), Py_SIZE(self),
-                         varg.buf, varg.len, 0);
-    PyBuffer_Release(&varg);
-    return pos >= 0;
+        Py_buffer varg;
+        int pos;
+        PyErr_Clear();
+        if (_getbuffer(arg, &varg) < 0)
+            return -1;
+        pos = stringlib_find(PyBytes_AS_STRING(self), Py_SIZE(self),
+                             varg.buf, varg.len, 0);
+        PyBuffer_Release(&varg);
+        return pos >= 0;
     }
     if (ival < 0 || ival >= 256) {
-    PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
-    return -1;
+        PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
+        return -1;
     }
 
     return memchr(PyBytes_AS_STRING(self), ival, Py_SIZE(self)) != NULL;
@@ -2345,12 +2345,12 @@
     int keepends = 0;
 
     if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends))
-    return NULL;
+        return NULL;
 
     return stringlib_splitlines(
-    (PyObject*) self, PyBytes_AS_STRING(self),
-    PyBytes_GET_SIZE(self), keepends
-    );
+        (PyObject*) self, PyBytes_AS_STRING(self),
+        PyBytes_GET_SIZE(self), keepends
+        );
 }
 
 

Modified: python/branches/py3k-jit/Objects/exceptions.c
==============================================================================
--- python/branches/py3k-jit/Objects/exceptions.c	(original)
+++ python/branches/py3k-jit/Objects/exceptions.c	Wed Jun 16 18:21:24 2010
@@ -1510,7 +1510,7 @@
     const char *encoding, const Py_UNICODE *object, Py_ssize_t length,
     Py_ssize_t start, Py_ssize_t end, const char *reason)
 {
-    return PyObject_CallFunction(PyExc_UnicodeEncodeError, "Uu#nnU",
+    return PyObject_CallFunction(PyExc_UnicodeEncodeError, "su#nns",
                                  encoding, object, length, start, end, reason);
 }
 
@@ -1625,7 +1625,7 @@
     assert(length < INT_MAX);
     assert(start < INT_MAX);
     assert(end < INT_MAX);
-    return PyObject_CallFunction(PyExc_UnicodeDecodeError, "Uy#nnU",
+    return PyObject_CallFunction(PyExc_UnicodeDecodeError, "sy#nns",
                                  encoding, object, length, start, end, reason);
 }
 

Modified: python/branches/py3k-jit/Objects/longobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/longobject.c	(original)
+++ python/branches/py3k-jit/Objects/longobject.c	Wed Jun 16 18:21:24 2010
@@ -4098,23 +4098,34 @@
 static PyObject *
 long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-    PyObject *x = NULL;
-    int base = -909;                         /* unlikely! */
+    PyObject *obase = NULL, *x = NULL;
+    long base;
+    int overflow;
     static char *kwlist[] = {"x", "base", 0};
 
     if (type != &PyLong_Type)
         return long_subtype_new(type, args, kwds); /* Wimp out */
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:int", kwlist,
-                                     &x, &base))
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:int", kwlist,
+                                     &x, &obase))
         return NULL;
     if (x == NULL)
         return PyLong_FromLong(0L);
-    if (base == -909)
+    if (obase == NULL)
         return PyNumber_Long(x);
-    else if (PyUnicode_Check(x))
+
+    base = PyLong_AsLongAndOverflow(obase, &overflow);
+    if (base == -1 && PyErr_Occurred())
+        return NULL;
+    if (overflow || (base != 0 && base < 2) || base > 36) {
+        PyErr_SetString(PyExc_ValueError,
+                        "int() arg 2 must be >= 2 and <= 36");
+        return NULL;
+    }
+
+    if (PyUnicode_Check(x))
         return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x),
                                   PyUnicode_GET_SIZE(x),
-                                  base);
+                                  (int)base);
     else if (PyByteArray_Check(x) || PyBytes_Check(x)) {
         /* Since PyLong_FromString doesn't have a length parameter,
          * check here for possible NULs in the string. */
@@ -4129,10 +4140,10 @@
                x is a bytes or buffer, *and* a base is given. */
             PyErr_Format(PyExc_ValueError,
                          "invalid literal for int() with base %d: %R",
-                         base, x);
+                         (int)base, x);
             return NULL;
         }
-        return PyLong_FromString(string, NULL, base);
+        return PyLong_FromString(string, NULL, (int)base);
     }
     else {
         PyErr_SetString(PyExc_TypeError,
@@ -4201,140 +4212,169 @@
                                   PyUnicode_GET_SIZE(format_spec));
 }
 
+/* Return a pair (q, r) such that a = b * q + r, and
+   abs(r) <= abs(b)/2, with equality possible only if q is even.
+   In other words, q == a / b, rounded to the nearest integer using
+   round-half-to-even. */
+
+PyObject *
+_PyLong_DivmodNear(PyObject *a, PyObject *b)
+{
+    PyLongObject *quo = NULL, *rem = NULL;
+    PyObject *one = NULL, *twice_rem, *result, *temp;
+    int cmp, quo_is_odd, quo_is_neg;
+
+    /* Equivalent Python code:
+
+       def divmod_near(a, b):
+           q, r = divmod(a, b)
+           # round up if either r / b > 0.5, or r / b == 0.5 and q is odd.
+           # The expression r / b > 0.5 is equivalent to 2 * r > b if b is
+           # positive, 2 * r < b if b negative.
+           greater_than_half = 2*r > b if b > 0 else 2*r < b
+           exactly_half = 2*r == b
+           if greater_than_half or exactly_half and q % 2 == 1:
+               q += 1
+               r -= b
+           return q, r
+
+    */
+    if (!PyLong_Check(a) || !PyLong_Check(b)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "non-integer arguments in division");
+        return NULL;
+    }
+
+    /* Do a and b have different signs?  If so, quotient is negative. */
+    quo_is_neg = (Py_SIZE(a) < 0) != (Py_SIZE(b) < 0);
+
+    one = PyLong_FromLong(1L);
+    if (one == NULL)
+        return NULL;
+
+    if (long_divrem((PyLongObject*)a, (PyLongObject*)b, &quo, &rem) < 0)
+        goto error;
+
+    /* compare twice the remainder with the divisor, to see
+       if we need to adjust the quotient and remainder */
+    twice_rem = long_lshift((PyObject *)rem, one);
+    if (twice_rem == NULL)
+        goto error;
+    if (quo_is_neg) {
+        temp = long_neg((PyLongObject*)twice_rem);
+        Py_DECREF(twice_rem);
+        twice_rem = temp;
+        if (twice_rem == NULL)
+            goto error;
+    }
+    cmp = long_compare((PyLongObject *)twice_rem, (PyLongObject *)b);
+    Py_DECREF(twice_rem);
+
+    quo_is_odd = Py_SIZE(quo) != 0 && ((quo->ob_digit[0] & 1) != 0);
+    if ((Py_SIZE(b) < 0 ? cmp < 0 : cmp > 0) || (cmp == 0 && quo_is_odd)) {
+        /* fix up quotient */
+        if (quo_is_neg)
+            temp = long_sub(quo, (PyLongObject *)one);
+        else
+            temp = long_add(quo, (PyLongObject *)one);
+        Py_DECREF(quo);
+        quo = (PyLongObject *)temp;
+        if (quo == NULL)
+            goto error;
+        /* and remainder */
+        if (quo_is_neg)
+            temp = long_add(rem, (PyLongObject *)b);
+        else
+            temp = long_sub(rem, (PyLongObject *)b);
+        Py_DECREF(rem);
+        rem = (PyLongObject *)temp;
+        if (rem == NULL)
+            goto error;
+    }
+
+    result = PyTuple_New(2);
+    if (result == NULL)
+        goto error;
+
+    /* PyTuple_SET_ITEM steals references */
+    PyTuple_SET_ITEM(result, 0, (PyObject *)quo);
+    PyTuple_SET_ITEM(result, 1, (PyObject *)rem);
+    Py_DECREF(one);
+    return result;
+
+  error:
+    Py_XDECREF(quo);
+    Py_XDECREF(rem);
+    Py_XDECREF(one);
+    return NULL;
+}
+
 static PyObject *
 long_round(PyObject *self, PyObject *args)
 {
-    PyObject *o_ndigits=NULL, *temp;
-    PyLongObject *pow=NULL, *q=NULL, *r=NULL, *ndigits=NULL, *one;
-    int errcode;
-    digit q_mod_4;
-
-    /* Notes on the algorithm: to round to the nearest 10**n (n positive),
-       the straightforward method is:
-
-          (1) divide by 10**n
-          (2) round to nearest integer (round to even in case of tie)
-          (3) multiply result by 10**n.
-
-       But the rounding step involves examining the fractional part of the
-       quotient to see whether it's greater than 0.5 or not.  Since we
-       want to do the whole calculation in integer arithmetic, it's
-       simpler to do:
-
-          (1) divide by (10**n)/2
-          (2) round to nearest multiple of 2 (multiple of 4 in case of tie)
-          (3) multiply result by (10**n)/2.
-
-       Then all we need to know about the fractional part of the quotient
-       arising in step (2) is whether it's zero or not.
-
-       Doing both a multiplication and division is wasteful, and is easily
-       avoided if we just figure out how much to adjust the original input
-       by to do the rounding.
-
-       Here's the whole algorithm expressed in Python.
-
-        def round(self, ndigits = None):
-        """round(int, int) -> int"""
-        if ndigits is None or ndigits >= 0:
-            return self
-        pow = 10**-ndigits >> 1
-        q, r = divmod(self, pow)
-        self -= r
-        if (q & 1 != 0):
-            if (q & 2 == r == 0):
-            self -= pow
-            else:
-            self += pow
-        return self
+    PyObject *o_ndigits=NULL, *temp, *result, *ndigits;
 
-    */
+    /* To round an integer m to the nearest 10**n (n positive), we make use of
+     * the divmod_near operation, defined by:
+     *
+     *   divmod_near(a, b) = (q, r)
+     *
+     * where q is the nearest integer to the quotient a / b (the
+     * nearest even integer in the case of a tie) and r == a - q * b.
+     * Hence q * b = a - r is the nearest multiple of b to a,
+     * preferring even multiples in the case of a tie.
+     *
+     * So the nearest multiple of 10**n to m is:
+     *
+     *   m - divmod_near(m, 10**n)[1].
+     */
     if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
         return NULL;
     if (o_ndigits == NULL)
         return long_long(self);
 
-    ndigits = (PyLongObject *)PyNumber_Index(o_ndigits);
+    ndigits = PyNumber_Index(o_ndigits);
     if (ndigits == NULL)
         return NULL;
 
+    /* if ndigits >= 0 then no rounding is necessary; return self unchanged */
     if (Py_SIZE(ndigits) >= 0) {
         Py_DECREF(ndigits);
         return long_long(self);
     }
 
-    Py_INCREF(self); /* to keep refcounting simple */
-    /* we now own references to self, ndigits */
-
-    /* pow = 10 ** -ndigits >> 1 */
-    pow = (PyLongObject *)PyLong_FromLong(10L);
-    if (pow == NULL)
-        goto error;
-    temp = long_neg(ndigits);
+    /* result = self - divmod_near(self, 10 ** -ndigits)[1] */
+    temp = long_neg((PyLongObject*)ndigits);
     Py_DECREF(ndigits);
-    ndigits = (PyLongObject *)temp;
+    ndigits = temp;
     if (ndigits == NULL)
-        goto error;
-    temp = long_pow((PyObject *)pow, (PyObject *)ndigits, Py_None);
-    Py_DECREF(pow);
-    pow = (PyLongObject *)temp;
-    if (pow == NULL)
-        goto error;
-    assert(PyLong_Check(pow)); /* check long_pow returned a long */
-    one = (PyLongObject *)PyLong_FromLong(1L);
-    if (one == NULL)
-        goto error;
-    temp = long_rshift(pow, one);
-    Py_DECREF(one);
-    Py_DECREF(pow);
-    pow = (PyLongObject *)temp;
-    if (pow == NULL)
-        goto error;
-
-    /* q, r = divmod(self, pow) */
-    errcode = l_divmod((PyLongObject *)self, pow, &q, &r);
-    if (errcode == -1)
-        goto error;
-
-    /* self -= r */
-    temp = long_sub((PyLongObject *)self, r);
-    Py_DECREF(self);
-    self = temp;
-    if (self == NULL)
-        goto error;
+        return NULL;
 
-    /* get value of quotient modulo 4 */
-    if (Py_SIZE(q) == 0)
-        q_mod_4 = 0;
-    else if (Py_SIZE(q) > 0)
-        q_mod_4 = q->ob_digit[0] & 3;
-    else
-        q_mod_4 = (PyLong_BASE-q->ob_digit[0]) & 3;
-
-    if ((q_mod_4 & 1) == 1) {
-        /* q is odd; round self up or down by adding or subtracting pow */
-        if (q_mod_4 == 1 && Py_SIZE(r) == 0)
-            temp = (PyObject *)long_sub((PyLongObject *)self, pow);
-        else
-            temp = (PyObject *)long_add((PyLongObject *)self, pow);
-        Py_DECREF(self);
-        self = temp;
-        if (self == NULL)
-            goto error;
+    result = PyLong_FromLong(10L);
+    if (result == NULL) {
+        Py_DECREF(ndigits);
+        return NULL;
     }
-    Py_DECREF(q);
-    Py_DECREF(r);
-    Py_DECREF(pow);
+
+    temp = long_pow(result, ndigits, Py_None);
     Py_DECREF(ndigits);
-    return self;
+    Py_DECREF(result);
+    result = temp;
+    if (result == NULL)
+        return NULL;
 
-  error:
-    Py_XDECREF(q);
-    Py_XDECREF(r);
-    Py_XDECREF(pow);
-    Py_XDECREF(self);
-    Py_XDECREF(ndigits);
-    return NULL;
+    temp = _PyLong_DivmodNear(self, result);
+    Py_DECREF(result);
+    result = temp;
+    if (result == NULL)
+        return NULL;
+
+    temp = long_sub((PyLongObject *)self,
+                    (PyLongObject *)PyTuple_GET_ITEM(result, 1));
+    Py_DECREF(result);
+    result = temp;
+
+    return result;
 }
 
 static PyObject *

Modified: python/branches/py3k-jit/Objects/stringlib/formatter.h
==============================================================================
--- python/branches/py3k-jit/Objects/stringlib/formatter.h	(original)
+++ python/branches/py3k-jit/Objects/stringlib/formatter.h	Wed Jun 16 18:21:24 2010
@@ -649,8 +649,8 @@
     case LT_DEFAULT_LOCALE:
         locale_info->decimal_point = ".";
         locale_info->thousands_sep = ",";
-        locale_info->grouping = "\3"; /* Group every 3 characters,
-                                         trailing 0 means repeat
+        locale_info->grouping = "\3"; /* Group every 3 characters.  The
+                                         (implicit) trailing 0 means repeat
                                          infinitely. */
         break;
     case LT_NO_LOCALE:

Modified: python/branches/py3k-jit/Objects/stringlib/string_format.h
==============================================================================
--- python/branches/py3k-jit/Objects/stringlib/string_format.h	(original)
+++ python/branches/py3k-jit/Objects/stringlib/string_format.h	Wed Jun 16 18:21:24 2010
@@ -373,6 +373,8 @@
         if (_FieldNameIterator_item(self, name) == 0)
             return 0;
         *name_idx = get_integer(name);
+        if (*name_idx == -1 && PyErr_Occurred())
+            return 0;
         break;
     default:
         /* Invalid character follows ']' */
@@ -429,6 +431,8 @@
 
     /* see if "first" is an integer, in which case it's used as an index */
     *first_idx = get_integer(first);
+    if (*first_idx == -1 && PyErr_Occurred())
+        return 0;
 
     field_name_is_empty = first->ptr >= first->end;
 

Modified: python/branches/py3k-jit/Objects/typeobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/typeobject.c	(original)
+++ python/branches/py3k-jit/Objects/typeobject.c	Wed Jun 16 18:21:24 2010
@@ -3310,23 +3310,15 @@
     PyObject *format_spec;
     PyObject *self_as_str = NULL;
     PyObject *result = NULL;
-    PyObject *format_meth = NULL;
 
     if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
         return NULL;
 
     self_as_str = PyObject_Str(self);
-    if (self_as_str != NULL) {
-        /* find the format function */
-        format_meth = PyObject_GetAttrString(self_as_str, "__format__");
-        if (format_meth != NULL) {
-               /* and call it */
-            result = PyObject_CallFunctionObjArgs(format_meth, format_spec, NULL);
-        }
-    }
+    if (self_as_str != NULL)
+        result = PyObject_Format(self_as_str, format_spec);
 
     Py_XDECREF(self_as_str);
-    Py_XDECREF(format_meth);
 
     return result;
 }

Modified: python/branches/py3k-jit/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/unicodeobject.c	(original)
+++ python/branches/py3k-jit/Objects/unicodeobject.c	Wed Jun 16 18:21:24 2010
@@ -1293,25 +1293,24 @@
     return NULL;
 }
 
-PyObject *PyUnicode_Decode(const char *s,
-                           Py_ssize_t size,
-                           const char *encoding,
-                           const char *errors)
+/* Convert encoding to lower case and replace '_' with '-' in order to
+   catch e.g. UTF_8. Return 0 on error (encoding is longer than lower_len-1),
+   1 on success. */
+static int
+normalize_encoding(const char *encoding,
+                   char *lower,
+                   size_t lower_len)
 {
-    PyObject *buffer = NULL, *unicode;
-    Py_buffer info;
-    char lower[20];  /* Enough for any encoding name we recognize */
-    char *l;
     const char *e;
+    char *l;
+    char *l_end;
 
-    if (encoding == NULL)
-        encoding = PyUnicode_GetDefaultEncoding();
-
-    /* Convert encoding to lower case and replace '_' with '-' in order to
-       catch e.g. UTF_8 */
     e = encoding;
     l = lower;
-    while (*e && l < &lower[(sizeof lower) - 2]) {
+    l_end = &lower[lower_len - 1];
+    while (*e) {
+        if (l == l_end)
+            return 0;
         if (ISUPPER(*e)) {
             *l++ = TOLOWER(*e++);
         }
@@ -1324,23 +1323,39 @@
         }
     }
     *l = '\0';
+    return 1;
+}
+
+PyObject *PyUnicode_Decode(const char *s,
+                           Py_ssize_t size,
+                           const char *encoding,
+                           const char *errors)
+{
+    PyObject *buffer = NULL, *unicode;
+    Py_buffer info;
+    char lower[11];  /* Enough for any encoding shortcut */
+
+    if (encoding == NULL)
+        encoding = PyUnicode_GetDefaultEncoding();
 
     /* Shortcuts for common default encodings */
-    if (strcmp(lower, "utf-8") == 0)
-        return PyUnicode_DecodeUTF8(s, size, errors);
-    else if ((strcmp(lower, "latin-1") == 0) ||
-             (strcmp(lower, "iso-8859-1") == 0))
-        return PyUnicode_DecodeLatin1(s, size, errors);
+    if (normalize_encoding(encoding, lower, sizeof(lower))) {
+        if (strcmp(lower, "utf-8") == 0)
+            return PyUnicode_DecodeUTF8(s, size, errors);
+        else if ((strcmp(lower, "latin-1") == 0) ||
+                 (strcmp(lower, "iso-8859-1") == 0))
+            return PyUnicode_DecodeLatin1(s, size, errors);
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
-    else if (strcmp(lower, "mbcs") == 0)
-        return PyUnicode_DecodeMBCS(s, size, errors);
+        else if (strcmp(lower, "mbcs") == 0)
+            return PyUnicode_DecodeMBCS(s, size, errors);
 #endif
-    else if (strcmp(lower, "ascii") == 0)
-        return PyUnicode_DecodeASCII(s, size, errors);
-    else if (strcmp(lower, "utf-16") == 0)
-        return PyUnicode_DecodeUTF16(s, size, errors, 0);
-    else if (strcmp(lower, "utf-32") == 0)
-        return PyUnicode_DecodeUTF32(s, size, errors, 0);
+        else if (strcmp(lower, "ascii") == 0)
+            return PyUnicode_DecodeASCII(s, size, errors);
+        else if (strcmp(lower, "utf-16") == 0)
+            return PyUnicode_DecodeUTF16(s, size, errors, 0);
+        else if (strcmp(lower, "utf-32") == 0)
+            return PyUnicode_DecodeUTF32(s, size, errors, 0);
+    }
 
     /* Decode via the codec registry */
     buffer = NULL;
@@ -1463,11 +1478,17 @@
 
 PyObject *PyUnicode_EncodeFSDefault(PyObject *unicode)
 {
-    if (Py_FileSystemDefaultEncoding)
+    if (Py_FileSystemDefaultEncoding) {
+#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
+        if (strcmp(Py_FileSystemDefaultEncoding, "mbcs") == 0)
+            return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode),
+                                        PyUnicode_GET_SIZE(unicode),
+                                        NULL);
+#endif
         return PyUnicode_AsEncodedString(unicode,
                                          Py_FileSystemDefaultEncoding,
                                          "surrogateescape");
-    else
+    } else
         return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
                                      PyUnicode_GET_SIZE(unicode),
                                      "surrogateescape");
@@ -1478,6 +1499,7 @@
                                     const char *errors)
 {
     PyObject *v;
+    char lower[11];  /* Enough for any encoding shortcut */
 
     if (!PyUnicode_Check(unicode)) {
         PyErr_BadArgument();
@@ -1488,24 +1510,27 @@
         encoding = PyUnicode_GetDefaultEncoding();
 
     /* Shortcuts for common default encodings */
-    if (strcmp(encoding, "utf-8") == 0)
-        return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
-                                    PyUnicode_GET_SIZE(unicode),
-                                    errors);
-    else if (strcmp(encoding, "latin-1") == 0)
-        return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(unicode),
-                                      PyUnicode_GET_SIZE(unicode),
-                                      errors);
+    if (normalize_encoding(encoding, lower, sizeof(lower))) {
+        if (strcmp(lower, "utf-8") == 0)
+            return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
+                                        PyUnicode_GET_SIZE(unicode),
+                                        errors);
+        else if ((strcmp(lower, "latin-1") == 0) ||
+                 (strcmp(lower, "iso-8859-1") == 0))
+            return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(unicode),
+                                          PyUnicode_GET_SIZE(unicode),
+                                          errors);
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
-    else if (strcmp(encoding, "mbcs") == 0)
-        return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode),
-                                    PyUnicode_GET_SIZE(unicode),
-                                    errors);
+        else if (strcmp(lower, "mbcs") == 0)
+            return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode),
+                                        PyUnicode_GET_SIZE(unicode),
+                                        errors);
 #endif
-    else if (strcmp(encoding, "ascii") == 0)
-        return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode),
-                                     PyUnicode_GET_SIZE(unicode),
-                                     errors);
+        else if (strcmp(lower, "ascii") == 0)
+            return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode),
+                                         PyUnicode_GET_SIZE(unicode),
+                                         errors);
+    }
     /* During bootstrap, we may need to find the encodings
        package, to load the file system encoding, and require the
        file system encoding in order to load the encodings
@@ -1515,7 +1540,7 @@
        the encodings module is ASCII-only.  XXX could try wcstombs
        instead, if the file system encoding is the locale's
        encoding. */
-    else if (Py_FileSystemDefaultEncoding &&
+    if (Py_FileSystemDefaultEncoding &&
              strcmp(encoding, Py_FileSystemDefaultEncoding) == 0 &&
              !PyThreadState_GET()->interp->codecs_initialized)
         return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode),
@@ -1620,7 +1645,7 @@
     if (Py_FileSystemDefaultEncoding) {
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
         if (strcmp(Py_FileSystemDefaultEncoding, "mbcs") == 0) {
-            return PyUnicode_DecodeMBCS(s, size, "surrogateescape");
+            return PyUnicode_DecodeMBCS(s, size, NULL);
         }
 #elif defined(__APPLE__)
         if (strcmp(Py_FileSystemDefaultEncoding, "utf-8") == 0) {
@@ -2711,7 +2736,8 @@
     PyUnicodeObject *unicode;
     Py_UNICODE *p;
 #ifndef Py_UNICODE_WIDE
-    int i, pairs;
+    int pairs = 0;
+    const unsigned char *qq;
 #else
     const int pairs = 0;
 #endif
@@ -2726,23 +2752,7 @@
 #endif
     PyObject *errorHandler = NULL;
     PyObject *exc = NULL;
-    /* On narrow builds we split characters outside the BMP into two
-       codepoints => count how much extra space we need. */
-#ifndef Py_UNICODE_WIDE
-    for (i = pairs = 0; i < size/4; i++)
-        if (((Py_UCS4 *)s)[i] >= 0x10000)
-            pairs++;
-#endif
 
-    /* This might be one to much, because of a BOM */
-    unicode = _PyUnicode_New((size+3)/4+pairs);
-    if (!unicode)
-        return NULL;
-    if (size == 0)
-        return (PyObject *)unicode;
-
-    /* Unpack UTF-32 encoded data */
-    p = unicode->str;
     q = (unsigned char *)s;
     e = q + size;
 
@@ -2794,6 +2804,24 @@
         iorder[3] = 0;
     }
 
+    /* On narrow builds we split characters outside the BMP into two
+       codepoints => count how much extra space we need. */
+#ifndef Py_UNICODE_WIDE
+    for (qq = q; qq < e; qq += 4)
+        if (qq[iorder[2]] != 0 || qq[iorder[3]] != 0)
+            pairs++;
+#endif
+
+    /* This might be one to much, because of a BOM */
+    unicode = _PyUnicode_New((size+3)/4+pairs);
+    if (!unicode)
+        return NULL;
+    if (size == 0)
+        return (PyObject *)unicode;
+
+    /* Unpack UTF-32 encoded data */
+    p = unicode->str;
+
     while (q < e) {
         Py_UCS4 ch;
         /* remaining bytes at the end? (size should be divisible by 4) */

Modified: python/branches/py3k-jit/PC/winreg.c
==============================================================================
--- python/branches/py3k-jit/PC/winreg.c	(original)
+++ python/branches/py3k-jit/PC/winreg.c	Wed Jun 16 18:21:24 2010
@@ -1096,7 +1096,14 @@
     int index;
     long rc;
     PyObject *retStr;
-    wchar_t tmpbuf[256]; /* max key name length is 255 */
+
+    /* The Windows docs claim that the max key name length is 255
+     * characters, plus a terminating nul character.  However,
+     * empirical testing demonstrates that it is possible to
+     * create a 256 character key that is missing the terminating
+     * nul.  RegEnumKeyEx requires a 257 character buffer to
+     * retrieve such a key name. */
+    wchar_t tmpbuf[257];
     DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
 
     if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
@@ -1122,9 +1129,10 @@
     int index;
     long rc;
     wchar_t *retValueBuf;
+    wchar_t *tmpBuf;
     BYTE *retDataBuf;
-    DWORD retValueSize;
-    DWORD retDataSize;
+    DWORD retValueSize, bufValueSize;
+    DWORD retDataSize, bufDataSize;
     DWORD typ;
     PyObject *obData;
     PyObject *retVal;
@@ -1142,6 +1150,8 @@
                                                    "RegQueryInfoKey");
     ++retValueSize;    /* include null terminators */
     ++retDataSize;
+    bufDataSize = retDataSize;
+    bufValueSize = retValueSize;
     retValueBuf = (wchar_t *)PyMem_Malloc(sizeof(wchar_t) * retValueSize);
     if (retValueBuf == NULL)
         return PyErr_NoMemory();
@@ -1151,16 +1161,32 @@
         return PyErr_NoMemory();
     }
 
-    Py_BEGIN_ALLOW_THREADS
-    rc = RegEnumValueW(hKey,
-                      index,
-                      retValueBuf,
-                      &retValueSize,
-                      NULL,
-                      &typ,
-                      retDataBuf,
-                      &retDataSize);
-    Py_END_ALLOW_THREADS
+    while (1) {
+        Py_BEGIN_ALLOW_THREADS
+        rc = RegEnumValueW(hKey,
+                  index,
+                  retValueBuf,
+                  &retValueSize,
+                  NULL,
+                  &typ,
+                  (BYTE *)retDataBuf,
+                  &retDataSize);
+        Py_END_ALLOW_THREADS
+
+        if (rc != ERROR_MORE_DATA)
+            break;
+
+        bufDataSize *= 2;
+        tmpBuf = (wchar_t *)PyMem_Realloc(retDataBuf, bufDataSize);
+        if (tmpBuf == NULL) {
+            PyErr_NoMemory();
+            retVal = NULL;
+            goto fail;
+        }
+        retDataBuf = tmpBuf;
+        retDataSize = bufDataSize;
+        retValueSize = bufValueSize;
+    }
 
     if (rc != ERROR_SUCCESS) {
         retVal = PyErr_SetFromWindowsErrWithFunction(rc,
@@ -1317,23 +1343,44 @@
     long rc;
     PyObject *retStr;
     wchar_t *retBuf;
-    long bufSize = 0;
+    DWORD bufSize = 0;
+    DWORD retSize = 0;
+    wchar_t *tmp;
 
     if (!PyArg_ParseTuple(args, "OZ:QueryValue", &obKey, &subKey))
         return NULL;
 
     if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
         return NULL;
-    if ((rc = RegQueryValueW(hKey, subKey, NULL, &bufSize))
-        != ERROR_SUCCESS)
+
+    rc = RegQueryValueW(hKey, subKey, NULL, &retSize);
+    if (rc == ERROR_MORE_DATA)
+        retSize = 256;
+    else if (rc != ERROR_SUCCESS)
         return PyErr_SetFromWindowsErrWithFunction(rc,
                                                    "RegQueryValue");
-    retBuf = (wchar_t *)PyMem_Malloc(bufSize);
+
+    bufSize = retSize;
+    retBuf = (wchar_t *) PyMem_Malloc(bufSize);
     if (retBuf == NULL)
         return PyErr_NoMemory();
 
-    if ((rc = RegQueryValueW(hKey, subKey, retBuf, &bufSize))
-        != ERROR_SUCCESS) {
+    while (1) {
+        retSize = bufSize;
+        rc = RegQueryValueW(hKey, subKey, retBuf, &retSize);
+        if (rc != ERROR_MORE_DATA)
+            break;
+
+        bufSize *= 2;
+        tmp = (wchar_t *) PyMem_Realloc(retBuf, bufSize);
+        if (tmp == NULL) {
+            PyMem_Free(retBuf);
+            return PyErr_NoMemory();
+        }
+        retBuf = tmp;
+    }
+
+    if (rc != ERROR_SUCCESS) {
         PyMem_Free(retBuf);
         return PyErr_SetFromWindowsErrWithFunction(rc,
                                                    "RegQueryValue");
@@ -1352,8 +1399,8 @@
     wchar_t *valueName;
 
     long rc;
-    BYTE *retBuf;
-    DWORD bufSize = 0;
+    BYTE *retBuf, *tmp;
+    DWORD bufSize = 0, retSize;
     DWORD typ;
     PyObject *obData;
     PyObject *result;
@@ -1363,18 +1410,34 @@
 
     if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
         return NULL;
-    if ((rc = RegQueryValueExW(hKey, valueName,
-                              NULL, NULL, NULL,
-                              &bufSize))
-        != ERROR_SUCCESS)
+
+    rc = RegQueryValueExW(hKey, valueName, NULL, NULL, NULL, &bufSize);
+    if (rc == ERROR_MORE_DATA)
+        bufSize = 256;
+    else if (rc != ERROR_SUCCESS)
         return PyErr_SetFromWindowsErrWithFunction(rc,
                                                    "RegQueryValueEx");
     retBuf = (BYTE *)PyMem_Malloc(bufSize);
     if (retBuf == NULL)
         return PyErr_NoMemory();
-    if ((rc = RegQueryValueExW(hKey, valueName, NULL,
-                              &typ, retBuf, &bufSize))
-        != ERROR_SUCCESS) {
+
+    while (1) {
+        retSize = bufSize;
+        rc = RegQueryValueExW(hKey, valueName, NULL, &typ,
+                             (BYTE *)retBuf, &retSize);
+        if (rc != ERROR_MORE_DATA)
+            break;
+
+        bufSize *= 2;
+        tmp = (char *) PyMem_Realloc(retBuf, bufSize);
+        if (tmp == NULL) {
+            PyMem_Free(retBuf);
+            return PyErr_NoMemory();
+        }
+       retBuf = tmp;
+    }
+
+    if (rc != ERROR_SUCCESS) {
         PyMem_Free(retBuf);
         return PyErr_SetFromWindowsErrWithFunction(rc,
                                                    "RegQueryValueEx");

Modified: python/branches/py3k-jit/Parser/asdl_c.py
==============================================================================
--- python/branches/py3k-jit/Parser/asdl_c.py	(original)
+++ python/branches/py3k-jit/Parser/asdl_c.py	Wed Jun 16 18:21:24 2010
@@ -722,7 +722,7 @@
         }
         PyTuple_SET_ITEM(fnames, i, field);
     }
-    result = PyObject_CallFunction((PyObject*)&PyType_Type, "U(O){sOss}",
+    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
                     type, base, "_fields", fnames, "__module__", "_ast");
     Py_DECREF(fnames);
     return (PyTypeObject*)result;

Modified: python/branches/py3k-jit/Python/Python-ast.c
==============================================================================
--- python/branches/py3k-jit/Python/Python-ast.c	(original)
+++ python/branches/py3k-jit/Python/Python-ast.c	Wed Jun 16 18:21:24 2010
@@ -527,7 +527,7 @@
         }
         PyTuple_SET_ITEM(fnames, i, field);
     }
-    result = PyObject_CallFunction((PyObject*)&PyType_Type, "U(O){sOss}",
+    result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}",
                     type, base, "_fields", fnames, "__module__", "_ast");
     Py_DECREF(fnames);
     return (PyTypeObject*)result;

Modified: python/branches/py3k-jit/Python/ceval.c
==============================================================================
--- python/branches/py3k-jit/Python/ceval.c	(original)
+++ python/branches/py3k-jit/Python/ceval.c	Wed Jun 16 18:21:24 2010
@@ -655,7 +655,7 @@
 } pendingcalls[NPENDINGCALLS];
 static volatile int pendingfirst = 0;
 static volatile int pendinglast = 0;
-static volatile int pendingcalls_to_do = 0;
+static _Py_atomic_int pendingcalls_to_do = {0};
 
 int
 Py_AddPendingCall(int (*func)(void *), void *arg)

Modified: python/branches/py3k-jit/Python/errors.c
==============================================================================
--- python/branches/py3k-jit/Python/errors.c	(original)
+++ python/branches/py3k-jit/Python/errors.c	Wed Jun 16 18:21:24 2010
@@ -679,7 +679,7 @@
             goto failure;
     }
     /* Create a real new-style class. */
-    result = PyObject_CallFunction((PyObject *)&PyType_Type, "UOO",
+    result = PyObject_CallFunction((PyObject *)&PyType_Type, "sOO",
                                    dot+1, bases, dict);
   failure:
     Py_XDECREF(bases);

Modified: python/branches/py3k-jit/Python/getargs.c
==============================================================================
--- python/branches/py3k-jit/Python/getargs.c	(original)
+++ python/branches/py3k-jit/Python/getargs.c	Wed Jun 16 18:21:24 2010
@@ -582,19 +582,6 @@
 
 #define CONV_UNICODE "(unicode conversion error)"
 
-/* explicitly check for float arguments when integers are expected.  For now
- * signal a warning.  Returns true if an exception was raised. */
-static int
-float_argument_warning(PyObject *arg)
-{
-    if (PyFloat_Check(arg) &&
-        PyErr_Warn(PyExc_DeprecationWarning,
-                   "integer argument expected, got float" ))
-        return 1;
-    else
-        return 0;
-}
-
 /* Explicitly check for float arguments when integers are expected.
    Return 1 for error, 0 if ok. */
 static int
@@ -791,14 +778,13 @@
     case 'L': {/* PY_LONG_LONG */
         PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * );
         PY_LONG_LONG ival;
-        if (float_argument_warning(arg))
+        if (float_argument_error(arg))
             return converterr("long<L>", arg, msgbuf, bufsize);
         ival = PyLong_AsLongLong(arg);
-        if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred() ) {
+        if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred())
             return converterr("long<L>", arg, msgbuf, bufsize);
-        } else {
+        else
             *p = ival;
-        }
         break;
     }
 
@@ -864,7 +850,7 @@
         break;
     }
 
-    /* XXX WAAAAH!  's', 'y', 'z', 'u', 'Z', 'e', 'w', 't' codes all
+    /* XXX WAAAAH!  's', 'y', 'z', 'u', 'Z', 'e', 'w' codes all
        need to be cleaned up! */
 
     case 's': {/* text string */
@@ -949,10 +935,15 @@
         count = convertbuffer(arg, p, &buf);
         if (count < 0)
             return converterr(buf, arg, msgbuf, bufsize);
-        else if (*format == '#') {
+        if (*format == '#') {
             FETCH_SIZE;
             STORE_SIZE(count);
             format++;
+        } else {
+            if (strlen(*p) != count)
+                return converterr(
+                    "bytes without null bytes",
+                    arg, msgbuf, bufsize);
         }
         break;
     }
@@ -1029,18 +1020,7 @@
             else
                 return converterr("string or None",
                                   arg, msgbuf, bufsize);
-            if (*format == '#') {
-                FETCH_SIZE;
-                assert(0); /* XXX redundant with if-case */
-                if (arg == Py_None) {
-                    STORE_SIZE(0);
-                }
-                else {
-                    STORE_SIZE(PyBytes_Size(arg));
-                }
-                format++;
-            }
-            else if (*p != NULL && uarg != NULL &&
+            if (*p != NULL && uarg != NULL &&
                 (Py_ssize_t) strlen(*p) != PyBytes_GET_SIZE(uarg))
                 return converterr(
                     "string without null bytes or None",
@@ -1062,17 +1042,22 @@
                 *p = PyUnicode_AS_UNICODE(arg);
                 STORE_SIZE(PyUnicode_GET_SIZE(arg));
             }
+            else
+                return converterr("str or None", arg, msgbuf, bufsize);
             format++;
         } else {
             Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
 
             if (arg == Py_None)
                 *p = 0;
-            else if (PyUnicode_Check(arg))
+            else if (PyUnicode_Check(arg)) {
                 *p = PyUnicode_AS_UNICODE(arg);
-            else
-                return converterr("string or None",
-                                  arg, msgbuf, bufsize);
+                if (Py_UNICODE_strlen(*p) != PyUnicode_GET_SIZE(arg))
+                    return converterr(
+                        "str without null character or None",
+                        arg, msgbuf, bufsize);
+            } else
+                return converterr("str or None", arg, msgbuf, bufsize);
         }
         break;
     }
@@ -1183,6 +1168,7 @@
                 *buffer = PyMem_NEW(char, size + 1);
                 if (*buffer == NULL) {
                     Py_DECREF(s);
+                    PyErr_NoMemory();
                     return converterr(
                         "(memory error)",
                         arg, msgbuf, bufsize);
@@ -1226,6 +1212,7 @@
             *buffer = PyMem_NEW(char, size + 1);
             if (*buffer == NULL) {
                 Py_DECREF(s);
+                PyErr_NoMemory();
                 return converterr("(memory error)",
                                   arg, msgbuf, bufsize);
             }
@@ -1249,6 +1236,11 @@
             FETCH_SIZE;
             STORE_SIZE(PyUnicode_GET_SIZE(arg));
             format++;
+        } else {
+            if (Py_UNICODE_strlen(*p) != PyUnicode_GET_SIZE(arg))
+                return converterr(
+                    "str without null character",
+                    arg, msgbuf, bufsize);
         }
         break;
     }
@@ -1267,7 +1259,7 @@
         if (PyByteArray_Check(arg))
             *p = arg;
         else
-            return converterr("buffer", arg, msgbuf, bufsize);
+            return converterr("bytearray", arg, msgbuf, bufsize);
         break;
     }
 
@@ -1293,17 +1285,6 @@
                 return converterr(type->tp_name, arg, msgbuf, bufsize);
 
         }
-        else if (*format == '?') {
-            inquiry pred = va_arg(*p_va, inquiry);
-            p = va_arg(*p_va, PyObject **);
-            format++;
-            if ((*pred)(arg))
-                *p = arg;
-            else
-                return converterr("(unspecified)",
-                                  arg, msgbuf, bufsize);
-
-        }
         else if (*format == '&') {
             typedef int (*converter)(PyObject *, void *);
             converter convert = va_arg(*p_va, converter);
@@ -1381,45 +1362,6 @@
         break;
     }
 
-      /*TEO: This can be eliminated --- here only for backward
-        compatibility */
-    case 't': { /* 8-bit character buffer, read-only access */
-        char **p = va_arg(*p_va, char **);
-        PyBufferProcs *pb = arg->ob_type->tp_as_buffer;
-        Py_ssize_t count;
-        Py_buffer view;
-
-        if (*format++ != '#')
-            return converterr(
-                "invalid use of 't' format character",
-                arg, msgbuf, bufsize);
-        if (pb == NULL || pb->bf_getbuffer == NULL)
-            return converterr(
-                "bytes or read-only character buffer",
-                arg, msgbuf, bufsize);
-
-        if (PyObject_GetBuffer(arg, &view, PyBUF_SIMPLE) != 0)
-            return converterr("string or single-segment read-only buffer",
-                              arg, msgbuf, bufsize);
-
-        count = view.len;
-        *p = view.buf;
-        if (pb->bf_releasebuffer)
-            return converterr(
-                "string or pinned buffer",
-                arg, msgbuf, bufsize);
-
-        PyBuffer_Release(&view);
-
-        if (count < 0)
-            return converterr("(unspecified)", arg, msgbuf, bufsize);
-        {
-            FETCH_SIZE;
-            STORE_SIZE(count);
-        }
-        break;
-    }
-
     default:
         return converterr("impossible<bad format char>", arg, msgbuf, bufsize);
 
@@ -1432,7 +1374,7 @@
 static Py_ssize_t
 convertbuffer(PyObject *arg, void **p, char **errmsg)
 {
-    PyBufferProcs *pb = arg->ob_type->tp_as_buffer;
+    PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer;
     Py_ssize_t count;
     Py_buffer view;
 
@@ -1460,31 +1402,23 @@
 static int
 getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
 {
-    void *buf;
-    Py_ssize_t count;
-    PyBufferProcs *pb = arg->ob_type->tp_as_buffer;
+    PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer;
     if (pb == NULL) {
         *errmsg = "bytes or buffer";
         return -1;
     }
-    if (pb->bf_getbuffer) {
-        if (PyObject_GetBuffer(arg, view, 0) < 0) {
-            *errmsg = "convertible to a buffer";
-            return -1;
-        }
-        if (!PyBuffer_IsContiguous(view, 'C')) {
-            *errmsg = "contiguous buffer";
-            return -1;
-        }
-        return 0;
+    if (pb->bf_getbuffer == NULL) {
+        *errmsg = "convertible to a buffer";
+        return -1;
     }
-
-    count = convertbuffer(arg, &buf, errmsg);
-    if (count < 0) {
+    if (PyObject_GetBuffer(arg, view, 0) < 0) {
         *errmsg = "convertible to a buffer";
-        return count;
+        return -1;
+    }
+    if (!PyBuffer_IsContiguous(view, 'C')) {
+        *errmsg = "contiguous buffer";
+        return -1;
     }
-    PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
     return 0;
 }
 
@@ -1834,7 +1768,6 @@
     case 'z': /* string or None */
     case 'y': /* bytes */
     case 'u': /* unicode string */
-    case 't': /* buffer, read-only */
     case 'w': /* buffer, read-write */
         {
             (void) va_arg(*p_va, char **);

Modified: python/branches/py3k-jit/Python/modsupport.c
==============================================================================
--- python/branches/py3k-jit/Python/modsupport.c	(original)
+++ python/branches/py3k-jit/Python/modsupport.c	Wed Jun 16 18:21:24 2010
@@ -302,39 +302,7 @@
 
         case 's':
         case 'z':
-        {
-            PyObject *v;
-            char *str = va_arg(*p_va, char *);
-            Py_ssize_t n;
-            if (**p_format == '#') {
-                ++*p_format;
-                if (flags & FLAG_SIZE_T)
-                    n = va_arg(*p_va, Py_ssize_t);
-                else
-                    n = va_arg(*p_va, int);
-            }
-            else
-                n = -1;
-            if (str == NULL) {
-                v = Py_None;
-                Py_INCREF(v);
-            }
-            else {
-                if (n < 0) {
-                    size_t m = strlen(str);
-                    if (m > PY_SSIZE_T_MAX) {
-                        PyErr_SetString(PyExc_OverflowError,
-                            "string too long for Python string");
-                        return NULL;
-                    }
-                    n = (Py_ssize_t)m;
-                }
-                v = PyUnicode_FromStringAndSize(str, n);
-            }
-            return v;
-        }
-
-        case 'U':
+        case 'U':   /* XXX deprecated alias */
         {
             PyObject *v;
             char *str = va_arg(*p_va, char *);

Modified: python/branches/py3k-jit/Python/pythonrun.c
==============================================================================
--- python/branches/py3k-jit/Python/pythonrun.c	(original)
+++ python/branches/py3k-jit/Python/pythonrun.c	Wed Jun 16 18:21:24 2010
@@ -704,24 +704,26 @@
 #if defined(HAVE_LANGINFO_H) && defined(CODESET)
     char *codeset;
 
-    /* On Unix, set the file system encoding according to the
-       user's preference, if the CODESET names a well-known
-       Python codec, and Py_FileSystemDefaultEncoding isn't
-       initialized by other means. Also set the encoding of
-       stdin and stdout if these are terminals.  */
-    codeset = get_codeset();
-    if (codeset != NULL) {
-        Py_FileSystemDefaultEncoding = codeset;
-        Py_HasFileSystemDefaultEncoding = 0;
-        return;
-    }
+    if (Py_FileSystemDefaultEncoding == NULL) {
+        /* On Unix, set the file system encoding according to the
+           user's preference, if the CODESET names a well-known
+           Python codec, and Py_FileSystemDefaultEncoding isn't
+           initialized by other means. Also set the encoding of
+           stdin and stdout if these are terminals.  */
+        codeset = get_codeset();
+        if (codeset != NULL) {
+            Py_FileSystemDefaultEncoding = codeset;
+            Py_HasFileSystemDefaultEncoding = 0;
+            return;
+        }
 
-    PyErr_Clear();
-    fprintf(stderr,
-            "Unable to get the locale encoding: "
-            "fallback to utf-8\n");
-    Py_FileSystemDefaultEncoding = "utf-8";
-    Py_HasFileSystemDefaultEncoding = 1;
+        PyErr_Clear();
+        fprintf(stderr,
+                "Unable to get the locale encoding: "
+                "fallback to utf-8\n");
+        Py_FileSystemDefaultEncoding = "utf-8";
+        Py_HasFileSystemDefaultEncoding = 1;
+    }
 #endif
 
     /* the encoding is mbcs, utf-8 or ascii */
@@ -2056,7 +2058,7 @@
     fprintf(stderr, "Fatal Python error: %s\n", msg);
     fflush(stderr); /* it helps in Windows debug build */
     if (PyErr_Occurred()) {
-        PyErr_Print();
+        PyErr_PrintEx(0);
     }
 #ifdef MS_WINDOWS
     {

Modified: python/branches/py3k-jit/Python/symtable.c
==============================================================================
--- python/branches/py3k-jit/Python/symtable.c	(original)
+++ python/branches/py3k-jit/Python/symtable.c	Wed Jun 16 18:21:24 2010
@@ -1533,7 +1533,7 @@
 symtable_visit_alias(struct symtable *st, alias_ty a)
 {
     /* Compute store_name, the name actually bound by the import
-       operation.  It is diferent than a->name when a->name is a
+       operation.  It is different than a->name when a->name is a
        dotted package name (e.g. spam.eggs)
     */
     PyObject *store_name;

Modified: python/branches/py3k-jit/Python/sysmodule.c
==============================================================================
--- python/branches/py3k-jit/Python/sysmodule.c	(original)
+++ python/branches/py3k-jit/Python/sysmodule.c	Wed Jun 16 18:21:24 2010
@@ -1510,7 +1510,7 @@
                          PyLong_FromLong(PY_VERSION_HEX));
     svnversion_init();
     SET_SYS_FROM_STRING("subversion",
-                        Py_BuildValue("(UUU)", "CPython", branch,
+                        Py_BuildValue("(sss)", "CPython", branch,
                                       svn_revision));
     SET_SYS_FROM_STRING("dont_write_bytecode",
                          PyBool_FromLong(Py_DontWriteBytecodeFlag));
@@ -1839,6 +1839,9 @@
     PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL;
     int err;
 
+    if (file == NULL)
+        return -1;
+
     unicode = PyUnicode_FromString(text);
     if (unicode == NULL)
         goto error;

Modified: python/branches/py3k-jit/Tools/i18n/msgfmt.py
==============================================================================
--- python/branches/py3k-jit/Tools/i18n/msgfmt.py	(original)
+++ python/branches/py3k-jit/Tools/i18n/msgfmt.py	Wed Jun 16 18:21:24 2010
@@ -30,6 +30,7 @@
 import getopt
 import struct
 import array
+from email.parser import HeaderParser
 
 __version__ = "1.1"
 
@@ -59,13 +60,13 @@
     # the keys are sorted in the .mo file
     keys = sorted(MESSAGES.keys())
     offsets = []
-    ids = strs = ''
+    ids = strs = b''
     for id in keys:
         # For each string, we need size and file offset.  Each string is NUL
         # terminated; the NUL does not count into the size.
         offsets.append((len(ids), len(id), len(strs), len(MESSAGES[id])))
-        ids += id + '\0'
-        strs += MESSAGES[id] + '\0'
+        ids += id + b'\0'
+        strs += MESSAGES[id] + b'\0'
     output = ''
     # The header is 7 32-bit unsigned integers.  We don't use hash tables, so
     # the keys start right after the index tables.
@@ -108,7 +109,7 @@
         outfile = os.path.splitext(infile)[0] + '.mo'
 
     try:
-        lines = open(infile).readlines()
+        lines = open(infile, 'rb').readlines()
     except IOError as msg:
         print(msg, file=sys.stderr)
         sys.exit(1)
@@ -116,9 +117,14 @@
     section = None
     fuzzy = 0
 
+    # Start off assuming Latin-1, so everything decodes without failure,
+    # until we know the exact encoding
+    encoding = 'latin-1'
+
     # Parse the catalog
     lno = 0
     for l in lines:
+        l = l.decode(encoding)
         lno += 1
         # If we get a comment line after a msgstr, this is a new entry
         if l[0] == '#' and section == STR:
@@ -132,16 +138,45 @@
         if l[0] == '#':
             continue
         # Now we are in a msgid section, output previous section
-        if l.startswith('msgid'):
+        if l.startswith('msgid') and not l.startswith('msgid_plural'):
             if section == STR:
                 add(msgid, msgstr, fuzzy)
+                if not msgid:
+                    # See whether there is an encoding declaration
+                    p = HeaderParser()
+                    charset = p.parsestr(msgstr.decode(encoding)).get_content_charset()
+                    if charset:
+                        encoding = charset
             section = ID
             l = l[5:]
-            msgid = msgstr = ''
+            msgid = msgstr = b''
+            is_plural = False
+        # This is a message with plural forms
+        elif l.startswith('msgid_plural'):
+            if section != ID:
+                print('msgid_plural not preceeded by msgid on %s:%d' % (infile, lno),
+                      file=sys.stderr)
+                sys.exit(1)
+            l = l[12:]
+            msgid += b'\0' # separator of singular and plural
+            is_plural = True
         # Now we are in a msgstr section
         elif l.startswith('msgstr'):
             section = STR
-            l = l[6:]
+            if l.startswith('msgstr['):
+                if not is_plural:
+                    print(sys.stderr, 'plural without msgid_plural on %s:%d' % (infile, lno),
+                          file=sys.stderr)
+                    sys.exit(1)
+                l = l.split(']', 1)[1]
+                if msgstr:
+                    msgstr += b'\0' # Separator of the various plural forms
+            else:
+                if is_plural:
+                    print(sys.stderr, 'indexed msgstr required for plural on  %s:%d' % (infile, lno),
+                          file=sys.stderr)
+                    sys.exit(1)
+                l = l[6:]
         # Skip empty lines
         l = l.strip()
         if not l:
@@ -149,9 +184,9 @@
         # XXX: Does this always follow Python escape semantics?
         l = eval(l)
         if section == ID:
-            msgid += l
+            msgid += l.encode(encoding)
         elif section == STR:
-            msgstr += l
+            msgstr += l.encode(encoding)
         else:
             print('Syntax error on %s:%d' % (infile, lno), \
                   'before:', file=sys.stderr)

Modified: python/branches/py3k-jit/Tools/scripts/serve.py
==============================================================================
--- python/branches/py3k-jit/Tools/scripts/serve.py	(original)
+++ python/branches/py3k-jit/Tools/scripts/serve.py	Wed Jun 16 18:21:24 2010
@@ -28,5 +28,8 @@
     path = sys.argv[1]
     port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
     httpd = simple_server.make_server('', port, app)
-    print("Serving {} on port {}".format(path, port))
-    httpd.serve_forever()
+    print("Serving {} on port {}, control-C to stop".format(path, port))
+    try:
+        httpd.serve_forever()
+    except KeyboardInterrupt:
+        print("\b\bShutting down.")

Modified: python/branches/py3k-jit/configure
==============================================================================
--- python/branches/py3k-jit/configure	(original)
+++ python/branches/py3k-jit/configure	Wed Jun 16 18:21:24 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 81086 .
+# From configure.in Revision: 81078 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.65 for python 3.2.
 #
@@ -1950,11 +1950,11 @@
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-	     enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
+	     0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
 test_array [0] = 0
 
   ;
@@ -1965,11 +1965,11 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-	        enum { N = $2 / 2 - 1 };
 int
 main ()
 {
-static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 };
+		($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
 		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
 test_array [0] = 0
 
@@ -3034,9 +3034,12 @@
   # Marc Recht
   NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S])
     define_xopen_source=no;;
-  # On Solaris 2.6, sys/wait.h is inconsistent in the usage
-  # of union __?sigval. Reported by Stuart Bishop.
-  SunOS/5.6)
+  # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
+  # request to enable features supported by the standard as a request
+  # to disable features not supported by the standard.  The best way
+  # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
+  # entirely and define __EXTENSIONS__ instead.
+  SunOS/*)
     define_xopen_source=no;;
   # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
   # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
@@ -3082,38 +3085,17 @@
 
 if test $define_xopen_source = yes
 then
-  # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
-  # defined precisely as g++ defines it
-  # Furthermore, on Solaris 10, XPG6 requires the use of a C99
-  # compiler
-  case $ac_sys_system/$ac_sys_release in
-    SunOS/5.8|SunOS/5.9|SunOS/5.10)
-
-$as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h
-
-      ;;
-    *)
 
 $as_echo "#define _XOPEN_SOURCE 600" >>confdefs.h
 
-      ;;
-  esac
 
   # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
   # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
   # several APIs are not declared. Since this is also needed in some
   # cases for HP-UX, we define it globally.
-  # except for Solaris 10, where it must not be defined,
-  # as it implies XPG4.2
-  case $ac_sys_system/$ac_sys_release in
-    SunOS/5.10)
-      ;;
-    *)
 
 $as_echo "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h
 
-      ;;
-  esac
 
 
 $as_echo "#define _POSIX_C_SOURCE 200112L" >>confdefs.h

Modified: python/branches/py3k-jit/configure.in
==============================================================================
--- python/branches/py3k-jit/configure.in	(original)
+++ python/branches/py3k-jit/configure.in	Wed Jun 16 18:21:24 2010
@@ -330,9 +330,12 @@
   # Marc Recht
   NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
     define_xopen_source=no;;
-  # On Solaris 2.6, sys/wait.h is inconsistent in the usage
-  # of union __?sigval. Reported by Stuart Bishop.
-  SunOS/5.6)
+  # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
+  # request to enable features supported by the standard as a request
+  # to disable features not supported by the standard.  The best way
+  # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
+  # entirely and define __EXTENSIONS__ instead.
+  SunOS/*)
     define_xopen_source=no;;
   # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
   # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
@@ -378,35 +381,15 @@
 
 if test $define_xopen_source = yes
 then
-  # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
-  # defined precisely as g++ defines it
-  # Furthermore, on Solaris 10, XPG6 requires the use of a C99
-  # compiler
-  case $ac_sys_system/$ac_sys_release in
-    SunOS/5.8|SunOS/5.9|SunOS/5.10)
-      AC_DEFINE(_XOPEN_SOURCE, 500, 
-                Define to the level of X/Open that your system supports)
-      ;;
-    *)
-      AC_DEFINE(_XOPEN_SOURCE, 600, 
-                Define to the level of X/Open that your system supports)
-      ;;
-  esac
+  AC_DEFINE(_XOPEN_SOURCE, 600, 
+            Define to the level of X/Open that your system supports)
 
   # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
   # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
   # several APIs are not declared. Since this is also needed in some
   # cases for HP-UX, we define it globally.
-  # except for Solaris 10, where it must not be defined, 
-  # as it implies XPG4.2
-  case $ac_sys_system/$ac_sys_release in
-    SunOS/5.10)
-      ;;
-    *)
-      AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
-      		Define to activate Unix95-and-earlier features)
-      ;;
-  esac
+  AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
+   	    Define to activate Unix95-and-earlier features)
 
   AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
   

Modified: python/branches/py3k-jit/setup.py
==============================================================================
--- python/branches/py3k-jit/setup.py	(original)
+++ python/branches/py3k-jit/setup.py	Wed Jun 16 18:21:24 2010
@@ -14,6 +14,7 @@
 from distutils.command.build_ext import build_ext
 from distutils.command.install import install
 from distutils.command.install_lib import install_lib
+from distutils.spawn import find_executable
 
 # Were we compiled --with-pydebug or with #define Py_DEBUG?
 COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
@@ -28,6 +29,25 @@
     if dir is not None and os.path.isdir(dir) and dir not in dirlist:
         dirlist.insert(0, dir)
 
+def macosx_sdk_root():
+    """
+    Return the directory of the current OSX SDK,
+    or '/' if no SDK was specified.
+    """
+    cflags = sysconfig.get_config_var('CFLAGS')
+    m = re.search(r'-isysroot\s+(\S+)', cflags)
+    if m is None:
+        sysroot = '/'
+    else:
+        sysroot = m.group(1)
+    return sysroot
+
+def is_macosx_sdk_path(path):
+    """
+    Returns True if 'path' can be located in an OSX SDK
+    """
+    return path.startswith('/usr/') or path.startswith('/System/')
+
 def find_file(filename, std_dirs, paths):
     """Searches for the directory where a given file is located,
     and returns a possibly-empty list of additional directories, or None
@@ -39,15 +59,28 @@
     'paths' is a list of additional locations to check; if the file is
         found in one of them, the resulting list will contain the directory.
     """
+    if sys.platform == 'darwin':
+        # Honor the MacOSX SDK setting when one was specified.
+        # An SDK is a directory with the same structure as a real
+        # system, but with only header files and libraries.
+        sysroot = macosx_sdk_root()
 
     # Check the standard locations
     for dir in std_dirs:
         f = os.path.join(dir, filename)
+
+        if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
+            f = os.path.join(sysroot, dir[1:], filename)
+
         if os.path.exists(f): return []
 
     # Check the additional directories
     for dir in paths:
         f = os.path.join(dir, filename)
+
+        if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
+            f = os.path.join(sysroot, dir[1:], filename)
+
         if os.path.exists(f):
             return [dir]
 
@@ -59,11 +92,19 @@
     if result is None:
         return None
 
+    if sys.platform == 'darwin':
+        sysroot = macosx_sdk_root()
+
     # Check whether the found file is in one of the standard directories
     dirname = os.path.dirname(result)
     for p in std_dirs:
         # Ensure path doesn't end with path separator
         p = p.rstrip(os.sep)
+
+        if sys.platform == 'darwin' and is_macosx_sdk_path(p):
+            if os.path.join(sysroot, p[1:]) == dirname:
+                return [ ]
+
         if p == dirname:
             return [ ]
 
@@ -72,6 +113,11 @@
     for p in paths:
         # Ensure path doesn't end with path separator
         p = p.rstrip(os.sep)
+
+        if sys.platform == 'darwin' and is_macosx_sdk_path(p):
+            if os.path.join(sysroot, p[1:]) == dirname:
+                return [ p ]
+
         if p == dirname:
             return [p]
     else:
@@ -480,6 +526,38 @@
 
         # readline
         do_readline = self.compiler_obj.find_library_file(lib_dirs, 'readline')
+        readline_termcap_library = ""
+        curses_library = ""
+        # Determine if readline is already linked against curses or tinfo.
+        if do_readline and find_executable('ldd'):
+            # Cannot use os.popen here in py3k.
+            tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+            if not os.path.exists(self.build_temp):
+                os.makedirs(self.build_temp)
+            os.system("ldd %s > %s" % (do_readline, tmpfile))
+            fp = open(tmpfile)
+            for ln in fp:
+                if 'curses' in ln:
+                    readline_termcap_library = re.sub(
+                        r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+                    ).rstrip()
+                    break
+                if 'tinfo' in ln: # termcap interface split out from ncurses
+                    readline_termcap_library = 'tinfo'
+                    break
+            fp.close()
+            os.unlink(tmpfile)
+        # Issue 7384: If readline is already linked against curses,
+        # use the same library for the readline and curses modules.
+        if 'curses' in readline_termcap_library:
+            curses_library = readline_termcap_library
+        elif self.compiler_obj.find_library_file(lib_dirs, 'ncursesw'):
+            curses_library = 'ncursesw'
+        elif self.compiler_obj.find_library_file(lib_dirs, 'ncurses'):
+            curses_library = 'ncurses'
+        elif self.compiler_obj.find_library_file(lib_dirs, 'curses'):
+            curses_library = 'curses'
+
         if platform == 'darwin':
             os_release = int(os.uname()[2].split('.')[0])
             dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
@@ -497,20 +575,16 @@
                 # library and then a static library, instead of first looking
                 # for dynamic libraries on the entire path.
                 # This way a staticly linked custom readline gets picked up
-                # before the (broken) dynamic library in /usr/lib.
+                # before the (possibly broken) dynamic library in /usr/lib.
                 readline_extra_link_args = ('-Wl,-search_paths_first',)
             else:
                 readline_extra_link_args = ()
 
             readline_libs = ['readline']
-            if self.compiler_obj.find_library_file(lib_dirs,
-                                                   'ncursesw'):
-                readline_libs.append('ncursesw')
-            elif self.compiler_obj.find_library_file(lib_dirs,
-                                                     'ncurses'):
-                readline_libs.append('ncurses')
-            elif self.compiler_obj.find_library_file(lib_dirs, 'curses'):
-                readline_libs.append('curses')
+            if readline_termcap_library:
+                pass # Issue 7384: Already linked against curses or tinfo.
+            elif curses_library:
+                readline_libs.append(curses_library)
             elif self.compiler_obj.find_library_file(lib_dirs +
                                                      ['/usr/lib/termcap'],
                                                      'termcap'):
@@ -571,22 +645,23 @@
         openssl_ver = 0
         openssl_ver_re = re.compile(
             '^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' )
-        for ssl_inc_dir in inc_dirs + search_for_ssl_incs_in:
-            name = os.path.join(ssl_inc_dir, 'openssl', 'opensslv.h')
-            if os.path.isfile(name):
-                try:
-                    incfile = open(name, 'r')
-                    for line in incfile:
-                        m = openssl_ver_re.match(line)
-                        if m:
-                            openssl_ver = eval(m.group(1))
-                            break
-                except IOError:
-                    pass
 
-            # first version found is what we'll use (as the compiler should)
-            if openssl_ver:
-                break
+        # look for the openssl version header on the compiler search path.
+        opensslv_h = find_file('openssl/opensslv.h', [],
+                inc_dirs + search_for_ssl_incs_in)
+        if opensslv_h:
+            name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
+            if sys.platform == 'darwin' and is_macosx_sdk_path(name):
+                name = os.path.join(macosx_sdk_root(), name[1:])
+            try:
+                incfile = open(name, 'r')
+                for line in incfile:
+                    m = openssl_ver_re.match(line)
+                    if m:
+                        openssl_ver = eval(m.group(1))
+            except IOError as msg:
+                print("IOError while reading opensshv.h:", msg)
+                pass
 
         #print('openssl_ver = 0x%08x' % openssl_ver)
         min_openssl_ver = 0x00907000
@@ -715,12 +790,18 @@
 
         db_ver_inc_map = {}
 
+        if sys.platform == 'darwin':
+            sysroot = macosx_sdk_root()
+
         class db_found(Exception): pass
         try:
             # See whether there is a Sleepycat header in the standard
             # search path.
             for d in inc_dirs + db_inc_paths:
                 f = os.path.join(d, "db.h")
+                if sys.platform == 'darwin' and is_macosx_sdk_path(d):
+                    f = os.path.join(sysroot, d[1:], "db.h")
+
                 if db_setup_debug: print("db: looking for db.h in", f)
                 if os.path.exists(f):
                     f = open(f, "rb").read()
@@ -767,7 +848,22 @@
                     db_incdir.replace("include", 'lib64'),
                     db_incdir.replace("include", 'lib'),
                 ]
-                db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check))
+
+                if sys.platform != 'darwin':
+                    db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check))
+
+                else:
+                    # Same as other branch, but takes OSX SDK into account
+                    tmp = []
+                    for dn in db_dirs_to_check:
+                        if is_macosx_sdk_path(dn):
+                            if os.path.isdir(os.path.join(sysroot, dn[1:])):
+                                tmp.append(dn)
+                        else:
+                            if os.path.isdir(dn):
+                                tmp.append(dn)
+
+                    db_dirs_to_check = tmp
 
                 # Look for a version specific db-X.Y before an ambiguoius dbX
                 # XXX should we -ever- look for a dbX name?  Do any
@@ -816,8 +912,15 @@
         # Scan the default include directories before the SQLite specific
         # ones. This allows one to override the copy of sqlite on OSX,
         # where /usr/include contains an old version of sqlite.
+        if sys.platform == 'darwin':
+            sysroot = macosx_sdk_root()
+
         for d in inc_dirs + sqlite_inc_paths:
             f = os.path.join(d, "sqlite3.h")
+
+            if sys.platform == 'darwin' and is_macosx_sdk_path(d):
+                f = os.path.join(sysroot, d[1:], "sqlite3.h")
+
             if os.path.exists(f):
                 if sqlite_setup_debug: print("sqlite: found %s"%f)
                 incf = open(f).read()
@@ -996,19 +1099,15 @@
         # Curses support, requiring the System V version of curses, often
         # provided by the ncurses library.
         panel_library = 'panel'
-        if (self.compiler_obj.find_library_file(lib_dirs, 'ncursesw')):
-            curses_libs = ['ncursesw']
-            # Bug 1464056: If _curses.so links with ncursesw,
-            # _curses_panel.so must link with panelw.
-            panel_library = 'panelw'
+        if curses_library.startswith('ncurses'):
+            if curses_library == 'ncursesw':
+                # Bug 1464056: If _curses.so links with ncursesw,
+                # _curses_panel.so must link with panelw.
+                panel_library = 'panelw'
+            curses_libs = [curses_library]
             exts.append( Extension('_curses', ['_cursesmodule.c'],
                                    libraries = curses_libs) )
-        elif (self.compiler_obj.find_library_file(lib_dirs, 'ncurses')):
-            curses_libs = ['ncurses']
-            exts.append( Extension('_curses', ['_cursesmodule.c'],
-                                   libraries = curses_libs) )
-        elif (self.compiler_obj.find_library_file(lib_dirs, 'curses')
-              and platform != 'darwin'):
+        elif curses_library == 'curses' and platform != 'darwin':
                 # OSX has an old Berkeley curses, not good enough for
                 # the _curses module.
             if (self.compiler_obj.find_library_file(lib_dirs, 'terminfo')):
@@ -1253,14 +1352,22 @@
             join(os.getenv('HOME'), '/Library/Frameworks')
         ]
 
+        sysroot = macosx_sdk_root()
+
         # Find the directory that contains the Tcl.framework and Tk.framework
         # bundles.
         # XXX distutils should support -F!
         for F in framework_dirs:
             # both Tcl.framework and Tk.framework should be present
+
+
             for fw in 'Tcl', 'Tk':
-                if not exists(join(F, fw + '.framework')):
-                    break
+                if is_macosx_sdk_path(F):
+                    if not exists(join(sysroot, F[1:], fw + '.framework')):
+                        break
+                else:
+                    if not exists(join(F, fw + '.framework')):
+                        break
             else:
                 # ok, F is now directory with both frameworks. Continure
                 # building
@@ -1297,8 +1404,12 @@
 
         # Note: cannot use os.popen or subprocess here, that
         # requires extensions that are not available here.
-        os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile))
+        if is_macosx_sdk_path(F):
+            os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(os.path.join(sysroot, F[1:]), tmpfile))
+        else:
+            os.system("file %s/Tk.framework/Tk | grep 'for architecture' > %s"%(F, tmpfile))
         fp = open(tmpfile)
+
         detected_archs = []
         for ln in fp:
             a = ln.split()[-1]


More information about the Python-checkins mailing list