[Python-checkins] r69625 - in python/branches/io-c: Doc/ACKS.txt Doc/c-api/long.rst Doc/c-api/number.rst Doc/distutils/setupscript.rst Doc/library/2to3.rst Doc/library/collections.rst Doc/library/itertools.rst Doc/library/stdtypes.rst Doc/library/urllib.request.rst Doc/tools/sphinxext/indexsidebar.html Doc/tools/sphinxext/pyspecific.py Include/abstract.h Include/fileobject.h Include/intobject.h Include/pymath.h Lib/collections.py Lib/compileall.py Lib/distutils/command/build_scripts.py Lib/distutils/sysconfig.py Lib/distutils/tests/support.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_build_scripts.py Lib/distutils/tests/test_config.py Lib/distutils/tests/test_dir_util.py Lib/distutils/tests/test_dist.py Lib/distutils/tests/test_file_util.py Lib/distutils/tests/test_sdist.py Lib/distutils/tests/test_sysconfig.py Lib/distutils/tests/test_util.py Lib/http/client.py Lib/idlelib/Bindings.py Lib/idlelib/EditorWindow.py Lib/idlelib/MultiCall.py Lib/idlelib/configDialog.py Lib/idlelib/keybindingDialog.py Lib/idlelib/macosxSupport.py Lib/importlib/NOTES Lib/io.py Lib/logging/__init__.py Lib/numbers.py Lib/test/crashers/compiler_recursion.py Lib/test/regrtest.py Lib/test/test_builtin.py Lib/test/test_collections.py Lib/test/test_compileall.py Lib/test/test_fractions.py Lib/test/test_hashlib.py Lib/test/test_httplib.py Lib/test/test_io.py Lib/test/test_itertools.py Lib/test/test_logging.py Lib/test/test_os.py Lib/test/test_osx_env.py Lib/test/test_pep263.py Lib/test/test_socket.py Lib/test/test_struct.py Lib/test/test_tk.py Lib/test/test_urllib2_localnet.py Lib/test/test_urllib2net.py Lib/test/test_xmlrpc.py Lib/tkinter/__init__.py Lib/tkinter/test/test_tkinter Lib/tkinter/ttk.py Lib/urllib/request.py Lib/urllib/response.py Lib/xmlrpc/client.py Mac/BuildScript/build-installer.py Mac/BuildScript/resources/ReadMe.txt Mac/BuildScript/resources/Welcome.rtf Mac/BuildScript/scripts/postflight.patch-profile Mac/IDLE/IDLE.app/Contents/MacOS/IDLE Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py Mac/Makefile.in Misc/ACKS Misc/NEWS Modules/_ctypes/callproc.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_iobase.c Modules/_struct.c Modules/_tkinter.c Modules/getpath.c Modules/hashlib.h Modules/itertoolsmodule.c Modules/main.c Modules/md5module.c Modules/sha1module.c Modules/sha256module.c Modules/sha512module.c Modules/socketmodule.c Modules/testcapi_long.h Modules/tkappinit.c Modules/tkinter.h Objects/exceptions.c Objects/longobject.c Objects/object.c Objects/typeobject.c PC/VC6/_multiprocessing.dsp PC/VC6/build_tkinter.py PC/VC6/tcl852.patch PCbuild/sqlite3.vcproj PCbuild/sqlite3.vsprops Python/pymath.c Tools/msi/uuids.py setup.py

antoine.pitrou python-checkins at python.org
Sat Feb 14 21:58:33 CET 2009


Author: antoine.pitrou
Date: Sat Feb 14 21:58:31 2009
New Revision: 69625

Log:
Merged revisions 69451,69463,69465,69471,69475-69477,69482-69484,69487,69491,69497,69499,69501,69507,69512-69513,69515,69517,69523-69524,69526,69529,69531-69532,69534,69536,69538,69540,69542,69544,69547,69553,69559-69560,69565,69568,69571-69572,69574-69575,69577,69581,69584,69587,69592,69596,69600,69603,69607,69613-69614,69618 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r69451 | benjamin.peterson | 2009-02-08 22:07:20 +0100 (dim., 08 févr. 2009) | 1 line
  
  fix len() when __len__() returns a non number type #5137
................
  r69463 | guilherme.polo | 2009-02-09 17:44:24 +0100 (lun., 09 févr. 2009) | 10 lines
  
  Merged revisions 69461 via svnmerge from 
  svn+ssh://pythondev/python/trunk
  
  ........
    r69461 | guilherme.polo | 2009-02-09 14:41:09 -0200 (Mon, 09 Feb 2009) | 3 lines
    
    Fixed issue #4890: Handle empty text search pattern in 
    Tkinter.Text.search
  ........
................
  r69465 | mark.dickinson | 2009-02-09 18:15:59 +0100 (lun., 09 févr. 2009) | 10 lines
  
  Merged revisions 69459 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69459 | mark.dickinson | 2009-02-09 14:18:43 +0000 (Mon, 09 Feb 2009) | 3 lines
    
    Issue #4575: fix Py_IS_INFINITY macro to work correctly on x87 FPUs.
    It now forces its argument to double before testing for infinity.
  ........
................
  r69471 | guilherme.polo | 2009-02-09 21:40:42 +0100 (lun., 09 févr. 2009) | 17 lines
  
  Merged revisions 69460,69467,69470 via svnmerge from 
  svn+ssh://pythondev/python/trunk
  
  ........
    r69460 | guilherme.polo | 2009-02-09 14:09:17 -0200 (Mon, 09 Feb 2009) | 1 line
    
    Turned setup_master public
  ........
    r69467 | guilherme.polo | 2009-02-09 17:21:21 -0200 (Mon, 09 Feb 2009) | 2 lines
    
    Some tests for Tkinter.Text.search
  ........
    r69470 | guilherme.polo | 2009-02-09 17:57:04 -0200 (Mon, 09 Feb 2009) | 1 line
    
    Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
  ........
................
  r69475 | brett.cannon | 2009-02-09 22:51:29 +0100 (lun., 09 févr. 2009) | 3 lines
  
  Add a NOTE that alternative VMs should be supported by importlib in a nicer
  fashion by factoring out bytecode support.
................
  r69476 | guilherme.polo | 2009-02-09 23:33:59 +0100 (lun., 09 févr. 2009) | 10 lines
  
  Merged revisions 69473 via svnmerge from 
  svn+ssh://pythondev/python/trunk
  
  ........
    r69473 | guilherme.polo | 2009-02-09 18:50:27 -0200 (Mon, 09 Feb 2009) | 3 lines
    
    Fixed issue #5122: Synchronize tk load failure check to prevent a
    potential deadlock.
  ........
................
  r69477 | guilherme.polo | 2009-02-09 23:35:27 +0100 (lun., 09 févr. 2009) | 9 lines
  
  Merged revisions 69474 via svnmerge from 
  svn+ssh://pythondev/python/trunk
  
  ........
    r69474 | guilherme.polo | 2009-02-09 18:57:45 -0200 (Mon, 09 Feb 2009) | 1 line
    
    Enforcing Tk 8.3.1 requirement.
  ........
................
  r69482 | brett.cannon | 2009-02-10 03:10:16 +0100 (mar., 10 févr. 2009) | 11 lines
  
  Merged revisions 69481 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69481 | brett.cannon | 2009-02-09 18:07:38 -0800 (Mon, 09 Feb 2009) | 4 lines
    
    compileall used the ctime of bytecode and source to determine if the bytecode
    should be recreated. This created a timing hole. Fixed by just doing what
    import does; check the mtime and magic number.
  ........
................
  r69483 | guilherme.polo | 2009-02-10 03:20:49 +0100 (mar., 10 févr. 2009) | 1 line
  
  This header was supposed to be committed in r69476
................
  r69484 | benjamin.peterson | 2009-02-10 03:41:10 +0100 (mar., 10 févr. 2009) | 13 lines
  
  Merged revisions 69466,69480 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69466 | raymond.hettinger | 2009-02-09 12:39:41 -0600 (Mon, 09 Feb 2009) | 3 lines
    
    Issue 5171: itertools.product docstring missing 'repeat' argument
  ........
    r69480 | raymond.hettinger | 2009-02-09 19:24:05 -0600 (Mon, 09 Feb 2009) | 1 line
    
    Issue 1818: collections.namedtuple() to support automatic renaming of invalid fieldnames.
  ........
................
  r69487 | tarek.ziade | 2009-02-10 13:36:33 +0100 (mar., 10 févr. 2009) | 9 lines
  
  Merged revisions 69485 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69485 | tarek.ziade | 2009-02-10 13:31:09 +0100 (Tue, 10 Feb 2009) | 1 line
    
    Fixed #3386: the optional prefix argument was ignored under OS2 and NT in distutils.sysconfig.get_python_lib
  ........
................
  r69491 | martin.v.loewis | 2009-02-10 14:13:30 +0100 (mar., 10 févr. 2009) | 13 lines
  
  Merged revisions 69489-69490 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69489 | martin.v.loewis | 2009-02-10 14:09:19 +0100 (Di, 10 Feb 2009) | 1 line
    
    Issue #5134: Silence compiler warnings when compiling sqlite with VC++.
  ........
    r69490 | martin.v.loewis | 2009-02-10 14:12:12 +0100 (Di, 10 Feb 2009) | 1 line
    
    Set eol-style to native
  ........
................
  r69497 | hirokazu.yamamoto | 2009-02-10 15:27:19 +0100 (mar., 10 févr. 2009) | 9 lines
  
  Merged revisions 69494 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69494 | hirokazu.yamamoto | 2009-02-10 22:31:28 +0900 | 1 line
    
    Fixed svn:eol-style.
  ........
................
  r69499 | mark.dickinson | 2009-02-10 17:13:25 +0100 (mar., 10 févr. 2009) | 12 lines
  
  Merged revisions 69498 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69498 | mark.dickinson | 2009-02-10 15:46:50 +0000 (Tue, 10 Feb 2009) | 6 lines
    
    Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
    negative arguments.  Previously, it raised TypeError.
    
    Thanks Lisandro Dalcin.
  ........
................
  r69501 | mark.dickinson | 2009-02-10 17:18:22 +0100 (mar., 10 févr. 2009) | 11 lines
  
  Merged revisions 69500 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69500 | mark.dickinson | 2009-02-10 16:17:16 +0000 (Tue, 10 Feb 2009) | 4 lines
    
    _testcapi depends on testcapi_long.h
    
    Thanks Lisandro Dalcin.
  ........
................
  r69507 | thomas.heller | 2009-02-10 19:59:04 +0100 (mar., 10 févr. 2009) | 13 lines
  
  (The fix has been slightly adjusted.)
  
  Merged revisions 69505 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69505 | thomas.heller | 2009-02-10 19:43:01 +0100 (Di, 10 Feb 2009) | 3 lines
    
    Issue#5203: ctypes segfaults when passing a unicode string to a
    function without argtypes, if HAVE_USABLE_WCHAR_T is false.
  ........
................
  r69512 | raymond.hettinger | 2009-02-11 01:20:02 +0100 (mer., 11 févr. 2009) | 1 line
  
  Clean-up named tuple docs.
................
  r69513 | antoine.pitrou | 2009-02-11 01:39:14 +0100 (mer., 11 févr. 2009) | 3 lines
  
  Issue #4631: Fix urlopen() result when an HTTP response uses chunked encoding.
................
  r69515 | benjamin.peterson | 2009-02-11 05:10:53 +0100 (mer., 11 févr. 2009) | 8 lines
  
  Blocked revisions 69509 via svnmerge
  
  ........
    r69509 | raymond.hettinger | 2009-02-10 18:06:17 -0600 (Tue, 10 Feb 2009) | 1 line
    
    Clean-up named tuple docs.
  ........
................
  r69517 | mark.dickinson | 2009-02-11 18:04:37 +0100 (mer., 11 févr. 2009) | 2 lines
  
  Issue #4910:  PyNumber_Int is deprecated in 3.0.1; will be removed in 3.1.
................
  r69523 | raymond.hettinger | 2009-02-12 07:28:27 +0100 (jeu., 12 févr. 2009) | 3 lines
  
  Issue 5032:  added a step argument to itertools.count() and allowed non-integer arguments.
................
  r69524 | gregory.p.smith | 2009-02-12 08:35:29 +0100 (jeu., 12 févr. 2009) | 4 lines
  
  Fixes Issue #3745: Fix hashlib to always reject unicode and non
  buffer-api supporting objects as input no matter how it was compiled
  (built in implementations or external openssl library).
................
  r69526 | raymond.hettinger | 2009-02-12 11:19:59 +0100 (jeu., 12 févr. 2009) | 1 line
  
  Fix spaces/tabs in example.
................
  r69529 | raymond.hettinger | 2009-02-12 13:08:18 +0100 (jeu., 12 févr. 2009) | 1 line
  
  Add an extra testcase.
................
  r69531 | raymond.hettinger | 2009-02-12 13:53:53 +0100 (jeu., 12 févr. 2009) | 1 line
  
  One more test.
................
  r69532 | ronald.oussoren | 2009-02-12 16:01:44 +0100 (jeu., 12 févr. 2009) | 3 lines
  
  Fix for issue5194, based on a patch by Ned Deily.
................
  r69534 | ronald.oussoren | 2009-02-12 16:12:03 +0100 (jeu., 12 févr. 2009) | 2 lines
  
  Fix for issue5195, a patch by Ned Deily
................
  r69536 | ronald.oussoren | 2009-02-12 16:18:15 +0100 (jeu., 12 févr. 2009) | 2 lines
  
  Fix for issue5196, patch by Ned Deily.
................
  r69538 | ronald.oussoren | 2009-02-12 16:24:51 +0100 (jeu., 12 févr. 2009) | 3 lines
  
  Update the ReadMe and Welcome files that are used by the OSX binary 
  installer. Fixes issue5226. Patch by Ned Deily.
................
  r69540 | ronald.oussoren | 2009-02-12 16:55:38 +0100 (jeu., 12 févr. 2009) | 5 lines
  
  This fixes issue5143 and includes a test.
  
  Issue5143 notes that getpath.c and main.c pass a 'char*' where
  a 'wchar_t*' is expected on OSX.
................
  r69542 | ronald.oussoren | 2009-02-12 17:02:11 +0100 (jeu., 12 févr. 2009) | 2 lines
  
  This fixes issue3883 (text on the buttons in the preferences panel for IDLE doesn't fit on OSX)
................
  r69544 | ronald.oussoren | 2009-02-12 17:08:14 +0100 (jeu., 12 févr. 2009) | 2 lines
  
  Fix for issue5224 ("Update Shell Profile.command" contains wrong Python version on OSX)
................
  r69547 | mark.dickinson | 2009-02-12 18:58:36 +0100 (jeu., 12 févr. 2009) | 3 lines
  
  Issue 4998: restore utility of __slots__ on Fraction.
  (forward merge of r68813).
................
  r69553 | tarek.ziade | 2009-02-12 22:02:07 +0100 (jeu., 12 févr. 2009) | 9 lines
  
  Merged revisions 69551 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69551 | tarek.ziade | 2009-02-12 21:56:21 +0100 (Thu, 12 Feb 2009) | 1 line
    
    fixing the leak introduced in r69304
  ........
................
  r69559 | benjamin.peterson | 2009-02-13 02:35:28 +0100 (ven., 13 févr. 2009) | 24 lines
  
  Blocked revisions 69522,69525,69528,69530,69546 via svnmerge
  
  ........
    r69522 | raymond.hettinger | 2009-02-11 23:39:46 -0600 (Wed, 11 Feb 2009) | 3 lines
    
    Issue 5032:  added a step argument to itertools.count() and allowed non-integer arguments.
  ........
    r69525 | raymond.hettinger | 2009-02-12 04:16:19 -0600 (Thu, 12 Feb 2009) | 1 line
    
    Fix spaces/tabs in example.
  ........
    r69528 | raymond.hettinger | 2009-02-12 06:04:26 -0600 (Thu, 12 Feb 2009) | 1 line
    
    Add an extra testcase.
  ........
    r69530 | raymond.hettinger | 2009-02-12 06:43:01 -0600 (Thu, 12 Feb 2009) | 1 line
    
    One more test.
  ........
    r69546 | mark.dickinson | 2009-02-12 11:55:42 -0600 (Thu, 12 Feb 2009) | 2 lines
    
    Typo fix.
  ........
................
  r69560 | benjamin.peterson | 2009-02-13 03:50:59 +0100 (ven., 13 févr. 2009) | 60 lines
  
  Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69364 | kristjan.jonsson | 2009-02-06 04:17:34 -0600 (Fri, 06 Feb 2009) | 1 line
    
    Fix a number of Win32ErrorTests error cases.  chmod wasn't being tested.  'access' never raises an error.
  ........
    r69365 | armin.rigo | 2009-02-06 05:46:26 -0600 (Fri, 06 Feb 2009) | 2 lines
    
    Ivan on IRC in #twisted reported this crasher.
  ........
    r69409 | georg.brandl | 2009-02-07 06:21:17 -0600 (Sat, 07 Feb 2009) | 1 line
    
    #5174: fix wrong file closing in example.
  ........
    r69410 | neil.schemenauer | 2009-02-07 08:53:31 -0600 (Sat, 07 Feb 2009) | 4 lines
    
    Fix broken test in test_hotshot.  Treating the current directory as an
    empty file is sloppy and non-portable.  Use NamedTemporaryFile to make
    an empty file.
  ........
    r69413 | neil.schemenauer | 2009-02-07 12:35:16 -0600 (Sat, 07 Feb 2009) | 2 lines
    
    Add test for issue #999042, explict global statement works.
  ........
    r69417 | benjamin.peterson | 2009-02-07 17:01:19 -0600 (Sat, 07 Feb 2009) | 1 line
    
    document individual 2to3 fixers
  ........
    r69435 | benjamin.peterson | 2009-02-08 08:38:13 -0600 (Sun, 08 Feb 2009) | 1 line
    
    document numliterals fixer
  ........
    r69442 | benjamin.peterson | 2009-02-08 09:14:57 -0600 (Sun, 08 Feb 2009) | 1 line
    
    a few edits and typos
  ........
    r69447 | vinay.sajip | 2009-02-08 13:06:08 -0600 (Sun, 08 Feb 2009) | 2 lines
    
    Issue #5170: Fixed Unicode output bug in logging and added test case. This is a regression which did not occur in 2.5.
  ........
    r69495 | kristjan.jonsson | 2009-02-10 07:32:24 -0600 (Tue, 10 Feb 2009) | 1 line
    
    Issue 4804.  Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
  ........
    r69519 | gregory.p.smith | 2009-02-11 17:45:25 -0600 (Wed, 11 Feb 2009) | 3 lines
    
    Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
    on LP64 platforms (most 64-bit Linux, bsd, unix systems).
  ........
    r69520 | benjamin.peterson | 2009-02-11 21:50:00 -0600 (Wed, 11 Feb 2009) | 1 line
    
    os.fsync() should be used to ensure that data is written to disk
  ........
    r69521 | benjamin.peterson | 2009-02-11 22:17:04 -0600 (Wed, 11 Feb 2009) | 1 line
    
    no need for this __bases__ trick anymore
  ........
................
  r69565 | georg.brandl | 2009-02-13 10:11:32 +0100 (ven., 13 févr. 2009) | 9 lines
  
  Merged revisions 69562 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69562 | georg.brandl | 2009-02-13 10:08:34 +0100 (Fr, 13 Feb 2009) | 2 lines
    
    Add links to the other versions we have in stock.
  ........
................
  r69568 | tarek.ziade | 2009-02-13 10:15:20 +0100 (ven., 13 févr. 2009) | 9 lines
  
  Merged revisions 69566 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69566 | tarek.ziade | 2009-02-13 10:12:33 +0100 (Fri, 13 Feb 2009) | 1 line
    
    #5158: added documentation on the depends option in distutils extensions
  ........
................
  r69571 | georg.brandl | 2009-02-13 11:40:43 +0100 (ven., 13 févr. 2009) | 1 line
  
  #4894: document "newurl" parameter to redirect_request().
................
  r69572 | georg.brandl | 2009-02-13 11:42:52 +0100 (ven., 13 févr. 2009) | 8 lines
  
  Blocked revisions 69570 via svnmerge
  
  ........
    r69570 | georg.brandl | 2009-02-13 11:40:14 +0100 (Fr, 13 Feb 2009) | 1 line
    
    #4894: document "newurl" parameter to redirect_request().
  ........
................
  r69574 | georg.brandl | 2009-02-13 11:44:28 +0100 (ven., 13 févr. 2009) | 8 lines
  
  Blocked revisions 69573 via svnmerge
  
  ........
    r69573 | georg.brandl | 2009-02-13 11:44:17 +0100 (Fr, 13 Feb 2009) | 1 line
    
    #3734: document complex coercing behavior better.
  ........
................
  r69575 | georg.brandl | 2009-02-13 11:50:01 +0100 (ven., 13 févr. 2009) | 1 line
  
  part of #3613: fix get_host_info() usage of base64.encodestring().
................
  r69577 | georg.brandl | 2009-02-13 12:01:07 +0100 (ven., 13 févr. 2009) | 1 line
  
  #3694: fix an "XXX undetected error" leak in struct.
................
  r69581 | georg.brandl | 2009-02-13 12:10:15 +0100 (ven., 13 févr. 2009) | 8 lines
  
  Blocked revisions 69578 via svnmerge
  
  ........
    r69578 | georg.brandl | 2009-02-13 12:03:59 +0100 (Fr, 13 Feb 2009) | 1 line
    
    #3694: add test for fix committed in r66693.
  ........
................
  r69584 | antoine.pitrou | 2009-02-13 15:01:05 +0100 (ven., 13 févr. 2009) | 14 lines
  
  Merged revisions 69582-69583 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69582 | antoine.pitrou | 2009-02-13 14:52:33 +0100 (ven., 13 févr. 2009) | 4 lines
    
    Issue #5186: Reduce hash collisions for objects with no __hash__ method by
    rotating the object pointer by 4 bits to the right.
  ........
    r69583 | antoine.pitrou | 2009-02-13 14:57:40 +0100 (ven., 13 févr. 2009) | 3 lines
    
    Fix compiler warning (gcc)
  ........
................
  r69587 | tarek.ziade | 2009-02-13 17:23:57 +0100 (ven., 13 févr. 2009) | 9 lines
  
  Merged revisions 69585 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69585 | tarek.ziade | 2009-02-13 17:13:16 +0100 (Fri, 13 Feb 2009) | 1 line
    
    reverted leak fix, to use the one done in py3k branch (r67382)
  ........
................
  r69592 | martin.v.loewis | 2009-02-13 21:27:39 +0100 (ven., 13 févr. 2009) | 1 line
  
  Fix typos in version numbers.
................
  r69596 | tarek.ziade | 2009-02-13 23:26:15 +0100 (ven., 13 févr. 2009) | 9 lines
  
  Merged revisions 69594 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69594 | tarek.ziade | 2009-02-13 23:22:03 +0100 (Fri, 13 Feb 2009) | 1 line
    
    Issue #2461: added tests for distutils.util
  ........
................
  r69600 | tarek.ziade | 2009-02-14 00:04:17 +0100 (sam., 14 févr. 2009) | 9 lines
  
  Merged revisions 69598 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69598 | tarek.ziade | 2009-02-14 00:00:43 +0100 (Sat, 14 Feb 2009) | 1 line
    
    Fixed #4524: distutils build_script command failed with --with-suffix=3
  ........
................
  r69603 | tarek.ziade | 2009-02-14 00:48:11 +0100 (sam., 14 févr. 2009) | 9 lines
  
  Merged revisions 69602 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69602 | tarek.ziade | 2009-02-14 00:41:57 +0100 (Sat, 14 Feb 2009) | 1 line
    
    fix the environ for distutils test_util
  ........
................
  r69607 | raymond.hettinger | 2009-02-14 05:21:49 +0100 (sam., 14 févr. 2009) | 1 line
  
  Add keyword argument support to itertools.count().
................
  r69613 | tarek.ziade | 2009-02-14 15:35:51 +0100 (sam., 14 févr. 2009) | 9 lines
  
  Merged revisions 69609 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69609 | tarek.ziade | 2009-02-14 15:10:23 +0100 (Sat, 14 Feb 2009) | 1 line
    
    Fix for #5257: refactored all tests in distutils, so they use a temporary directory.
  ........
................
  r69614 | tarek.ziade | 2009-02-14 15:36:38 +0100 (sam., 14 févr. 2009) | 8 lines
  
  Blocked revisions 69610 via svnmerge
  
  ........
    r69610 | tarek.ziade | 2009-02-14 15:12:30 +0100 (Sat, 14 Feb 2009) | 1 line
    
    Replace variable
  ........
................
  r69618 | benjamin.peterson | 2009-02-14 18:00:16 +0100 (sam., 14 févr. 2009) | 9 lines
  
  Merged revisions 69617 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69617 | benjamin.peterson | 2009-02-14 10:51:03 -0600 (Sat, 14 Feb 2009) | 1 line
    
    we're no longer using CVS, so this doesn't have to be binary
  ........
................


Added:
   python/branches/io-c/Lib/distutils/tests/test_util.py
      - copied unchanged from r69618, /python/branches/py3k/Lib/distutils/tests/test_util.py
   python/branches/io-c/Lib/test/crashers/compiler_recursion.py
      - copied unchanged from r69618, /python/branches/py3k/Lib/test/crashers/compiler_recursion.py
   python/branches/io-c/Lib/test/test_compileall.py
      - copied unchanged from r69618, /python/branches/py3k/Lib/test/test_compileall.py
   python/branches/io-c/Lib/test/test_osx_env.py
      - copied unchanged from r69618, /python/branches/py3k/Lib/test/test_osx_env.py
   python/branches/io-c/Lib/test/test_tk.py
      - copied unchanged from r69618, /python/branches/py3k/Lib/test/test_tk.py
   python/branches/io-c/Lib/tkinter/test/test_tkinter/   (props changed)
      - copied from r69618, /python/branches/py3k/Lib/tkinter/test/test_tkinter/
   python/branches/io-c/Modules/hashlib.h
      - copied unchanged from r69618, /python/branches/py3k/Modules/hashlib.h
   python/branches/io-c/Modules/tkinter.h
      - copied unchanged from r69618, /python/branches/py3k/Modules/tkinter.h
   python/branches/io-c/PCbuild/sqlite3.vsprops
      - copied unchanged from r69618, /python/branches/py3k/PCbuild/sqlite3.vsprops
Modified:
   python/branches/io-c/   (props changed)
   python/branches/io-c/Doc/ACKS.txt
   python/branches/io-c/Doc/c-api/long.rst
   python/branches/io-c/Doc/c-api/number.rst
   python/branches/io-c/Doc/distutils/setupscript.rst
   python/branches/io-c/Doc/library/2to3.rst
   python/branches/io-c/Doc/library/collections.rst
   python/branches/io-c/Doc/library/itertools.rst
   python/branches/io-c/Doc/library/stdtypes.rst
   python/branches/io-c/Doc/library/urllib.request.rst
   python/branches/io-c/Doc/tools/sphinxext/indexsidebar.html
   python/branches/io-c/Doc/tools/sphinxext/pyspecific.py
   python/branches/io-c/Include/abstract.h
   python/branches/io-c/Include/fileobject.h
   python/branches/io-c/Include/intobject.h
   python/branches/io-c/Include/pymath.h
   python/branches/io-c/Lib/collections.py
   python/branches/io-c/Lib/compileall.py
   python/branches/io-c/Lib/distutils/command/build_scripts.py
   python/branches/io-c/Lib/distutils/sysconfig.py
   python/branches/io-c/Lib/distutils/tests/support.py
   python/branches/io-c/Lib/distutils/tests/test_build_ext.py
   python/branches/io-c/Lib/distutils/tests/test_build_scripts.py
   python/branches/io-c/Lib/distutils/tests/test_config.py
   python/branches/io-c/Lib/distutils/tests/test_dir_util.py
   python/branches/io-c/Lib/distutils/tests/test_dist.py
   python/branches/io-c/Lib/distutils/tests/test_file_util.py
   python/branches/io-c/Lib/distutils/tests/test_sdist.py
   python/branches/io-c/Lib/distutils/tests/test_sysconfig.py
   python/branches/io-c/Lib/http/client.py
   python/branches/io-c/Lib/idlelib/Bindings.py
   python/branches/io-c/Lib/idlelib/EditorWindow.py
   python/branches/io-c/Lib/idlelib/MultiCall.py
   python/branches/io-c/Lib/idlelib/configDialog.py
   python/branches/io-c/Lib/idlelib/keybindingDialog.py
   python/branches/io-c/Lib/idlelib/macosxSupport.py
   python/branches/io-c/Lib/importlib/NOTES
   python/branches/io-c/Lib/io.py
   python/branches/io-c/Lib/logging/__init__.py
   python/branches/io-c/Lib/numbers.py
   python/branches/io-c/Lib/test/regrtest.py
   python/branches/io-c/Lib/test/test_builtin.py
   python/branches/io-c/Lib/test/test_collections.py
   python/branches/io-c/Lib/test/test_fractions.py
   python/branches/io-c/Lib/test/test_hashlib.py
   python/branches/io-c/Lib/test/test_httplib.py
   python/branches/io-c/Lib/test/test_io.py
   python/branches/io-c/Lib/test/test_itertools.py
   python/branches/io-c/Lib/test/test_logging.py
   python/branches/io-c/Lib/test/test_os.py
   python/branches/io-c/Lib/test/test_pep263.py   (contents, props changed)
   python/branches/io-c/Lib/test/test_socket.py
   python/branches/io-c/Lib/test/test_struct.py
   python/branches/io-c/Lib/test/test_urllib2_localnet.py
   python/branches/io-c/Lib/test/test_urllib2net.py
   python/branches/io-c/Lib/test/test_xmlrpc.py
   python/branches/io-c/Lib/tkinter/__init__.py
   python/branches/io-c/Lib/tkinter/ttk.py
   python/branches/io-c/Lib/urllib/request.py
   python/branches/io-c/Lib/urllib/response.py
   python/branches/io-c/Lib/xmlrpc/client.py
   python/branches/io-c/Mac/BuildScript/build-installer.py
   python/branches/io-c/Mac/BuildScript/resources/ReadMe.txt
   python/branches/io-c/Mac/BuildScript/resources/Welcome.rtf
   python/branches/io-c/Mac/BuildScript/scripts/postflight.patch-profile
   python/branches/io-c/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE
   python/branches/io-c/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
   python/branches/io-c/Mac/Makefile.in
   python/branches/io-c/Misc/ACKS
   python/branches/io-c/Misc/NEWS
   python/branches/io-c/Modules/_ctypes/callproc.c
   python/branches/io-c/Modules/_fileio.c
   python/branches/io-c/Modules/_hashopenssl.c
   python/branches/io-c/Modules/_iobase.c
   python/branches/io-c/Modules/_struct.c
   python/branches/io-c/Modules/_tkinter.c
   python/branches/io-c/Modules/getpath.c
   python/branches/io-c/Modules/itertoolsmodule.c
   python/branches/io-c/Modules/main.c
   python/branches/io-c/Modules/md5module.c
   python/branches/io-c/Modules/sha1module.c
   python/branches/io-c/Modules/sha256module.c
   python/branches/io-c/Modules/sha512module.c
   python/branches/io-c/Modules/socketmodule.c
   python/branches/io-c/Modules/testcapi_long.h
   python/branches/io-c/Modules/tkappinit.c
   python/branches/io-c/Objects/exceptions.c
   python/branches/io-c/Objects/longobject.c
   python/branches/io-c/Objects/object.c
   python/branches/io-c/Objects/typeobject.c
   python/branches/io-c/PC/VC6/_multiprocessing.dsp   (contents, props changed)
   python/branches/io-c/PC/VC6/build_tkinter.py   (contents, props changed)
   python/branches/io-c/PC/VC6/tcl852.patch   (contents, props changed)
   python/branches/io-c/PCbuild/sqlite3.vcproj
   python/branches/io-c/Python/pymath.c
   python/branches/io-c/Tools/msi/uuids.py
   python/branches/io-c/setup.py

Modified: python/branches/io-c/Doc/ACKS.txt
==============================================================================
--- python/branches/io-c/Doc/ACKS.txt	(original)
+++ python/branches/io-c/Doc/ACKS.txt	Sat Feb 14 21:58:31 2009
@@ -18,6 +18,7 @@
    * Oliver Andrich
    * Heidi Annexstad
    * Jesús Cea Avión
+   * Manuel Balsera
    * Daniel Barclay
    * Chris Barker
    * Don Bashford

Modified: python/branches/io-c/Doc/c-api/long.rst
==============================================================================
--- python/branches/io-c/Doc/c-api/long.rst	(original)
+++ python/branches/io-c/Doc/c-api/long.rst	Sat Feb 14 21:58:31 2009
@@ -168,17 +168,26 @@
 
 .. cfunction:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong)
 
-   Return a C :ctype:`long long` from a Python integer.  If *pylong* cannot be
-   represented as a :ctype:`long long`, an :exc:`OverflowError` will be raised.
+   .. index::
+      single: OverflowError (built-in exception)
 
+   Return a C :ctype:`long long` from a Python integer.  If *pylong*
+   cannot be represented as a :ctype:`long long`, an
+   :exc:`OverflowError` is raised and ``-1`` is returned.
 
 .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong)
 
-   Return a C :ctype:`unsigned long long` from a Python integer. If *pylong*
-   cannot be represented as an :ctype:`unsigned long long`, an :exc:`OverflowError`
-   will be raised if the value is positive, or a :exc:`TypeError` will be raised if
-   the value is negative.
+   .. index::
+      single: OverflowError (built-in exception)
 
+   Return a C :ctype:`unsigned long long` from a Python integer. If
+   *pylong* cannot be represented as an :ctype:`unsigned long long`,
+   an :exc:`OverflowError` is raised and ``(unsigned long long)-1`` is
+   returned.
+
+   .. versionchanged:: 3.1
+      A negative *pylong* now raises :exc:`OverflowError`, not
+      :exc:`TypeError`.
 
 .. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io)
 

Modified: python/branches/io-c/Doc/c-api/number.rst
==============================================================================
--- python/branches/io-c/Doc/c-api/number.rst	(original)
+++ python/branches/io-c/Doc/c-api/number.rst	Sat Feb 14 21:58:31 2009
@@ -233,6 +233,12 @@
    Returns the *o* converted to an integer object on success, or *NULL* on
    failure.  This is the equivalent of the Python expression ``int(o)``.
 
+   .. note::
+
+     This function is defined in the transitional :file:`intobject.h`
+     header file.  It will be removed completely in Python 3.1.  Use
+     the :cfunc:`PyNumber_Long` function instead.
+
 
 .. cfunction:: PyObject* PyNumber_Long(PyObject *o)
 

Modified: python/branches/io-c/Doc/distutils/setupscript.rst
==============================================================================
--- python/branches/io-c/Doc/distutils/setupscript.rst	(original)
+++ python/branches/io-c/Doc/distutils/setupscript.rst	Sat Feb 14 21:58:31 2009
@@ -347,6 +347,10 @@
 building compiled extensions: Distutils  will automatically add ``initmodule``
 to the list of exported symbols.
 
+The :option:`depends` option is a list of files that the extension depends on
+(for example header files). The build command will call the compiler on the
+sources to rebuild extension if any on this files has been modified since the
+previous build.
 
 Relationships between Distributions and Packages
 ================================================

Modified: python/branches/io-c/Doc/library/2to3.rst
==============================================================================
--- python/branches/io-c/Doc/library/2to3.rst	(original)
+++ python/branches/io-c/Doc/library/2to3.rst	Sat Feb 14 21:58:31 2009
@@ -14,6 +14,8 @@
 automatically.
 
 
+.. _2to3-using:
+
 Using 2to3
 ----------
 
@@ -52,10 +54,10 @@
 
 Comments and exact indentation are preserved throughout the translation process.
 
-By default, 2to3 runs a set of predefined fixers.  The :option:`-l` flag lists
-all available fixers.  An explicit set of fixers to run can be given with
-:option:`-f`.  Likewise the :option:`-x` explicitly disables a fixer.  The
-following example runs only the ``imports`` and ``has_key`` fixers::
+By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`.  The
+:option:`-l` flag lists all available fixers.  An explicit set of fixers to run
+can be given with :option:`-f`.  Likewise the :option:`-x` explicitly disables a
+fixer.  The following example runs only the ``imports`` and ``has_key`` fixers::
 
    $ 2to3 -f imports -f has_key example.py
 
@@ -84,12 +86,263 @@
 The :option:`-v` option enables output of more information on the translation
 process.
 
-When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead of
-a statement.  This is useful when ``from __future__ import print_function`` is
-being used.  If this option is not given, the print fixer will surround print
-calls in an extra set of parentheses because it cannot differentiate between the
-print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
-true function call.
+When the :option:`-p` is passed, the :2to3fixer:`print` fixer ``print`` as a
+function instead of a statement.  This is useful when ``from __future__ import
+print_function`` is being used.  If this option is not given, the print fixer
+will surround print calls in an extra set of parentheses because it cannot
+differentiate between the print statement with parentheses (such as ``print
+("a" + "b" + "c")``) and a true function call.
+
+
+.. _2to3-fixers:
+
+Fixers
+------
+
+Each step of tranforming code is encapsulated in a fixer.  The command ``2to3
+-l`` lists them.  As :ref:`documented above <2to3-using>`, each can be turned on
+and off individually.  They are described here in more detail.
+
+
+.. 2to3fixer:: apply
+
+   Removes usage of :func:`apply`.  For example ``apply(function, *args,
+   **kwargs)`` is converted to ``function(*args, **kwargs)``.
+
+.. 2to3fixer:: basestring
+
+   Converts :class:`basestring` to :class:`str`.
+
+.. 2to3fixer:: buffer
+
+   Converts :class:`buffer` to :class:`memoryview`.  This fixer is optional
+   because the :class:`memoryview` API is similar but not exactly the same as
+   that of :class:`buffer`.
+
+.. 2to3fixer:: callable
+
+   Converts ``callable(x)`` to ``hasattr(x, "__call_")``.
+
+.. 2to3fixer:: dict
+
+   Fixes dictionary iteration methods.  :meth:`dict.iteritems` is converted to
+   :meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and
+   :meth:`dict.itervalues` to :meth:`dict.values`.  It also wraps existing
+   usages of :meth:`dict.items`, :meth:`dict.keys`, and :meth:`dict.values` in a
+   call to :class:`list`.
+
+.. 2to3fixer:: except
+
+   Converts ``except X, T`` to ``except X as T``.
+
+.. 2to3fixer:: exec
+
+   Converts the :keyword:`exec` statement to the :func:`exec` function.
+
+.. 2to3fixer:: execfile
+
+   Removes usage of :func:`execfile`.  The argument to :func:`execfile` is
+   wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`.
+
+.. 2to3fixer:: filter
+
+   Wraps :func:`filter` usage in a :class:`list` call.
+
+.. 2to3fixer:: funcattrs
+
+   Fixes function attributes that have been renamed.  For example,
+   ``my_function.func_closure`` is converted to ``my_function.__closure__``.
+
+.. 2to3fixer:: future
+
+   Removes ``from __future__ import new_feature`` statements.
+
+.. 2to3fixer:: getcwdu
+
+   Renames :func:`os.getcwdu` to :func:`os.getcwd`.
+
+.. 2to3fixer:: has_key
+
+   Changes ``dict.has_key(key)`` to ``key in dict``.
+
+.. 2to3fixer:: idioms
+
+   This optional fixer preforms several transformations that make Python code
+   more idiomatic.  Type comparisions like ``type(x) is SomeClass`` and
+   ``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``.
+   ``while 1`` becomes ``while True``.  This fixer also tries to make use of
+   :func:`sorted` in appropiate places.  For example, this block ::
+
+       L = list(some_iterable)
+       L.sort()
+
+   is changed to ::
+
+      L = sorted(some_iterable)
+
+.. 2to3fixer:: import
+
+   Detects sibling imports and converts them to relative imports.
+
+.. 2to3fixer:: imports
+
+   Handles module renames in the standard library.
+
+.. 2to3fixer:: imports2
+
+   Handles other modules renames in the standard library.  It is separate from
+   the :2to3fixer:`imports` fixer only because of technical limitations.
+
+.. 2to3fixer:: input
+
+   Converts ``input(prompt)`` to ``eval(input(prompt))``
+
+.. 2to3fixer:: intern
+
+   Converts :func:`intern` to :func:`sys.intern`.
+
+.. 2to3fixer:: isinstance
+
+   Fixes duplicate types in the second argument of :func:`isinstance`.  For
+   example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x,
+   (int))``.
+
+.. 2to3fixer:: itertools_imports
+
+   Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and
+   :func:`itertools.imap`.  Imports of :func:`itertools.ifilterfalse` are also
+   changed to :func:`itertools.filterfalse`.
+
+.. 2to3fixer:: itertools
+
+   Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and
+   :func:`itertools.imap` to their builtin equivalents.
+   :func:`itertools.ifilterfalse` is changed to :func:`itertools.filterfalse`.
+
+.. 2to3fixer:: long
+
+   Strips the ``L`` prefix on long literals and renames :class:`long` to
+   :class:`int`.
+
+.. 2to3fixer:: map
+
+   Wraps :func:`map` in a :class:`list` call.  It also changes ``map(None, x)``
+   to ``list(x)``.  Using ``from future_builtins import map`` disables this
+   fixer.
+
+.. 2to3fixer:: metaclass
+
+   Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class
+   body) to the new (``class X(metaclass=Meta)``).
+
+.. 2to3fixer:: methodattrs
+
+   Fixes old method attribute names.  For example, ``meth.im_func`` is converted
+   to ``meth.__func__``.
+
+.. 2to3fixer:: ne
+
+   Converts the old not-equal syntax, ``<>``, to ``!=``.
+
+.. 2to3fixer:: next
+
+   Converts the use of iterator's :meth:`next` methods to the :func:`next`
+   function.  It also renames :meth:`next` methods to :meth:`~object.__next__`.
+
+.. 2to3fixer:: nonzero
+
+   Renames :meth:`~object.__nonzero__` to :meth:`~object.__bool__`.
+
+.. 2to3fixer:: numliterals
+
+   Converts octal literals into the new syntax.
+
+.. 2to3fixer:: paren
+
+   Add extra parenthesis where they are required in list comprehensions.  For
+   example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``.
+
+.. 2to3fixer:: print
+
+   Converts the :keyword:`print` statement to the :func:`print` function.
+
+.. 2to3fixer:: raises
+
+   Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise
+   E(V).with_traceback(T)``.  If ``E`` is a tuple, the translation will be
+   incorrect because substituting tuples for exceptions has been removed in 3.0.
+
+.. 2to3fixer:: raw_input
+
+   Converts :func:`raw_input` to :func:`input`.
+
+.. 2to3fixer:: reduce
+
+   Handles the move of :func:`reduce` to :func:`functools.reduce`.
+
+.. 2to3fixer:: renames
+
+   Changes :data:`sys.maxint` to :data:`sys.maxsize`.
+
+.. 2to3fixer:: repr
+
+   Replaces backtick repr with the :func:`repr` function.
+
+.. 2to3fixer:: set_literal
+
+   Replaces use of the :class:`set` constructor with set literals.  This fixer
+   is optional.
+
+.. 2to3fixer:: standard_error
+
+   Renames :exc:`StandardError` to :exc:`Exception`.
+
+.. 2to3fixer:: sys_exc
+
+   Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`,
+   :data:`sys.exc_traceback` to use :func:`sys.exc_info`.
+
+.. 2to3fixer:: throw
+
+   Fixes the API change in generator's :meth:`throw` method.
+
+.. 2to3fixer:: tuple_params
+
+   Removes implicit tuple parameter unpacking.  This fixer inserts temporary
+   variables.
+
+.. 2to3fixer:: types
+
+   Fixes code broken from the removal of some members in the :mod:`types`
+   module.
+
+.. 2to3fixer:: unicode
+
+   Renames :class:`unicode` to :class:`str`.
+
+.. 2to3fixer:: urllib
+
+   Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib`
+   package.
+
+.. 2to3fixer:: ws_comma
+
+   Removes excess whitespace from comma separated items.  This fixer is
+   optional.
+
+.. 2to3fixer:: xrange
+
+   Renames :func:`xrange` to :func:`range` and wraps existing :func:`range`
+   calls with :class:`list`.
+
+.. 2to3fixer:: xreadlines
+
+   Changes ``for x in file.xreadlines()`` to ``for x in file``.
+
+.. 2to3fixer:: zip
+
+   Wraps :func:`zip` usage in a :class:`list` call.  This is disabled when
+   ``from future_builtins import zip`` appears.
 
 
 :mod:`lib2to3` - 2to3's library

Modified: python/branches/io-c/Doc/library/collections.rst
==============================================================================
--- python/branches/io-c/Doc/library/collections.rst	(original)
+++ python/branches/io-c/Doc/library/collections.rst	Sat Feb 14 21:58:31 2009
@@ -597,7 +597,7 @@
 self-documenting code.  They can be used wherever regular tuples are used, and
 they add the ability to access fields by name instead of position index.
 
-.. function:: namedtuple(typename, field_names, [verbose])
+.. function:: namedtuple(typename, field_names, [verbose], [rename])
 
    Returns a new tuple subclass named *typename*.  The new subclass is used to
    create tuple-like objects that have fields accessible by attribute lookup as
@@ -615,11 +615,19 @@
    a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*,
    or *raise*.
 
+   If *rename* is true, invalid fieldnames are automatically replaced
+   with positional names.  For example, ``['abc', 'def', 'ghi', 'abc']`` is
+   converted to ``['abc', '_2', 'ghi', '_4']``, eliminating the keyword
+   ``def`` and the duplicate fieldname ``abc``.
+
    If *verbose* is true, the class definition is printed just before being built.
 
    Named tuple instances do not have per-instance dictionaries, so they are
    lightweight and require no more memory than regular tuples.
 
+   .. versionchanged:: 2.7
+      added support for *rename*.
+
 Example:
 
 .. doctest::
@@ -747,7 +755,8 @@
     >>> getattr(p, 'x')
     11
 
-To convert a dictionary to a named tuple, use the double-star-operator [#]_:
+To convert a dictionary to a named tuple, use the double-star-operator
+(as described in :ref:`tut-unpacking-arguments`):
 
    >>> d = {'x': 11, 'y': 22}
    >>> Point(**d)
@@ -795,10 +804,10 @@
     >>> class Status:
     ...     open, pending, closed = range(3)
 
-.. rubric:: Footnotes
+.. seealso::
 
-.. [#] For information on the double-star-operator see
-   :ref:`tut-unpacking-arguments` and :ref:`calls`.
+   `Named tuple recipe <http://code.activestate.com/recipes/500261/>`_
+   adapted for Python 2.4.
 
 
 

Modified: python/branches/io-c/Doc/library/itertools.rst
==============================================================================
--- python/branches/io-c/Doc/library/itertools.rst	(original)
+++ python/branches/io-c/Doc/library/itertools.rst	Sat Feb 14 21:58:31 2009
@@ -178,7 +178,7 @@
 
    The number of items returned is ``(n+r-1)! / r! / (n-1)!`` when ``n > 0``.
 
-   .. versionadded:: 2.7
+   .. versionadded:: 3.1
 
 .. function:: compress(data, selectors)
 
@@ -191,22 +191,25 @@
            # compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F
            return (d for d, s in zip(data, selectors) if s)
 
-   .. versionadded:: 2.7
+   .. versionadded:: 3.1
 
 
-.. function:: count([n])
+.. function:: count(start=0, step=1)
 
-   Make an iterator that returns consecutive integers starting with *n*. If not
-   specified *n* defaults to zero.   Often used as an argument to :func:`map` to
-   generate consecutive data points. Also, used with :func:`zip` to add sequence
-   numbers.  Equivalent to::
+   Make an iterator that returns evenly spaced values starting with *n*. Often
+   used as an argument to :func:`map` to generate consecutive data points.
+   Also, used with :func:`zip` to add sequence numbers.  Equivalent to::
 
-      def count(n=0):
+      def count(start=0, step=1):
           # count(10) --> 10 11 12 13 14 ...
+          # count(2.5, 0.5) -> 3.5 3.0 4.5 ...
+          n = start
           while True:
               yield n
-              n += 1
+              n += step
 
+   .. versionchanged:: 3.1
+      added *step* argument and allowed non-integer arguments.
 
 .. function:: cycle(iterable)
 

Modified: python/branches/io-c/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/io-c/Doc/library/stdtypes.rst	(original)
+++ python/branches/io-c/Doc/library/stdtypes.rst	Sat Feb 14 21:58:31 2009
@@ -2061,6 +2061,11 @@
    Flush the internal buffer, like ``stdio``'s :cfunc:`fflush`.  This may be a
    no-op on some file-like objects.
 
+   .. note::
+
+      :meth:`flush` does not necessarily write the file's data to disk.  Use
+      :meth:`flush` followed by :func:`os.fsync` to ensure this behavior.
+
 
 .. method:: file.fileno()
 

Modified: python/branches/io-c/Doc/library/urllib.request.rst
==============================================================================
--- python/branches/io-c/Doc/library/urllib.request.rst	(original)
+++ python/branches/io-c/Doc/library/urllib.request.rst	Sat Feb 14 21:58:31 2009
@@ -741,14 +741,15 @@
    precise meanings of the various redirection codes.
 
 
-.. method:: HTTPRedirectHandler.redirect_request(req, fp, code, msg, hdrs)
+.. method:: HTTPRedirectHandler.redirect_request(req, fp, code, msg, hdrs, newurl)
 
    Return a :class:`Request` or ``None`` in response to a redirect. This is called
    by the default implementations of the :meth:`http_error_30\*` methods when a
    redirection is received from the server.  If a redirection should take place,
    return a new :class:`Request` to allow :meth:`http_error_30\*` to perform the
-   redirect.  Otherwise, raise :exc:`HTTPError` if no other handler should try to
-   handle this URL, or return ``None`` if you can't but another handler might.
+   redirect to *newurl*.  Otherwise, raise :exc:`HTTPError` if no other handler
+   should try to handle this URL, or return ``None`` if you can't but another
+   handler might.
 
    .. note::
 
@@ -761,8 +762,8 @@
 
 .. method:: HTTPRedirectHandler.http_error_301(req, fp, code, msg, hdrs)
 
-   Redirect to the ``Location:`` URL.  This method is called by the parent
-   :class:`OpenerDirector` when getting an HTTP 'moved permanently' response.
+   Redirect to the ``Location:`` or ``URI:`` URL.  This method is called by the
+   parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' response.
 
 
 .. method:: HTTPRedirectHandler.http_error_302(req, fp, code, msg, hdrs)

Modified: python/branches/io-c/Doc/tools/sphinxext/indexsidebar.html
==============================================================================
--- python/branches/io-c/Doc/tools/sphinxext/indexsidebar.html	(original)
+++ python/branches/io-c/Doc/tools/sphinxext/indexsidebar.html	Sat Feb 14 21:58:31 2009
@@ -1,5 +1,13 @@
             <h3>Download</h3>
             <p><a href="{{ pathto('download') }}">Download these documents</a></p>
+	    <h3>Docs for other versions</h3>
+	    <ul>
+	      <li><a href="http://docs.python.org/2.6/">Python 2.6 (stable)</a></li>
+	      <li><a href="http://docs.python.org/3.0/">Python 3.0 (stable)</a></li>
+	      <li><a href="http://docs.python.org/2.7/">Python 2.7 (in development)</a></li>
+              <li><a href="http://www.python.org/doc/versions/">Old versions</a></li>
+            </ul>
+
             <h3>Other resources</h3>
             <ul>
               {# XXX: many of these should probably be merged in the main docs #}
@@ -13,7 +21,4 @@
               <li><a href="http://wiki.python.org/moin/PythonBooks">Book List</a></li>
               <li><a href="http://www.python.org/doc/av/">Audio/Visual Talks</a></li>
               <li><a href="http://www.python.org/doc/other/">Other Doc Collections</a></li>
-              <li>&nbsp;</li>
-              <li><a href="http://www.python.org/doc/versions/">Previous versions</a></li>
-              <li>&nbsp;</li>
             </ul>

Modified: python/branches/io-c/Doc/tools/sphinxext/pyspecific.py
==============================================================================
--- python/branches/io-c/Doc/tools/sphinxext/pyspecific.py	(original)
+++ python/branches/io-c/Doc/tools/sphinxext/pyspecific.py	Sat Feb 14 21:58:31 2009
@@ -122,3 +122,4 @@
     app.add_builder(suspicious.CheckSuspiciousMarkupBuilder)
     app.add_description_unit('opcode', 'opcode', '%s (opcode)',
                              parse_opcode_signature)
+    app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)')

Modified: python/branches/io-c/Include/abstract.h
==============================================================================
--- python/branches/io-c/Include/abstract.h	(original)
+++ python/branches/io-c/Include/abstract.h	Sat Feb 14 21:58:31 2009
@@ -784,7 +784,11 @@
         is cleared and the value is clipped. 
        */
 
-     #define PyNumber_Int PyNumber_Long
+       /*
+         PyNumber_Int used to be found here.  It's now in Include/intobject.h,
+         where it is defined to be an alias for PyNumber_Long.  New code
+         should use PyNumber_Long instead.
+       */
 
      PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
 

Modified: python/branches/io-c/Include/fileobject.h
==============================================================================
--- python/branches/io-c/Include/fileobject.h	(original)
+++ python/branches/io-c/Include/fileobject.h	Sat Feb 14 21:58:31 2009
@@ -30,6 +30,17 @@
 PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
 PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
 
+#if defined _MSC_VER && _MSC_VER >= 1400
+/* A routine to check if a file descriptor is valid on Windows.  Returns 0
+ * and sets errno to EBADF if it isn't.  This is to avoid Assertions
+ * from various functions in the Windows CRT beginning with
+ * Visual Studio 2005
+ */
+int _PyVerify_fd(int fd);
+#else
+#define _PyVerify_fd(A) (1) /* dummy */
+#endif
+
 #ifdef __cplusplus
 }
 #endif

Modified: python/branches/io-c/Include/intobject.h
==============================================================================
--- python/branches/io-c/Include/intobject.h	(original)
+++ python/branches/io-c/Include/intobject.h	Sat Feb 14 21:58:31 2009
@@ -1,8 +1,8 @@
 /* Integer object interface
 
-   This header files exists to make porting code to Python 3.0 easier. It
-   defines aliases from PyInt_* to PyLong_*. Only PyInt_GetMax() and
-   PyInt_CheckExact() remain in longobject.h.
+   This header file exists to make porting code to Python 3.0 easier. It
+   defines aliases from PyInt_* to PyLong_* and an alias from
+   PyNumber_Int to PyNumber_Long.
  */
 
 #ifndef Py_INTOBJECT_H
@@ -28,6 +28,7 @@
 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
 #define PyInt_AS_LONG PyLong_AS_LONG
+#define PyNumber_Int PyNumber_Long
 
 #ifdef __cplusplus
 }

Modified: python/branches/io-c/Include/pymath.h
==============================================================================
--- python/branches/io-c/Include/pymath.h	(original)
+++ python/branches/io-c/Include/pymath.h	Sat Feb 14 21:58:31 2009
@@ -77,6 +77,21 @@
 #define Py_MATH_E 2.7182818284590452354
 #endif
 
+/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU
+   register and into a 64-bit memory location, rounding from extended
+   precision to double precision in the process.  On other platforms it does
+   nothing. */
+
+/* we take double rounding as evidence of x87 usage */
+#ifndef Py_FORCE_DOUBLE
+#  ifdef X87_DOUBLE_ROUNDING
+PyAPI_FUNC(double) _Py_force_double(double);
+#    define Py_FORCE_DOUBLE(X) (_Py_force_double(X))
+#  else
+#    define Py_FORCE_DOUBLE(X) (X)
+#  endif
+#endif
+
 /* Py_IS_NAN(X)
  * Return 1 if float or double arg is a NaN, else 0.
  * Caution:
@@ -101,14 +116,18 @@
  *    This implementation may set the underflow flag if |X| is very small;
  *    it really can't be implemented correctly (& easily) before C99.
  *    Override in pyconfig.h if you have a better spelling on your platform.
+ *  Py_FORCE_DOUBLE is used to avoid getting false negatives from a
+ *    non-infinite value v sitting in an 80-bit x87 register such that
+ *    v becomes infinite when spilled from the register to 64-bit memory.
  * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
  */
 #ifndef Py_IS_INFINITY
-#if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
-#define Py_IS_INFINITY(X) isinf(X)
-#else
-#define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X))
-#endif
+#  if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
+#    define Py_IS_INFINITY(X) isinf(X)
+#  else
+#    define Py_IS_INFINITY(X) ((X) &&                                   \
+                               (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
+#  endif
 #endif
 
 /* Py_IS_FINITE(X)

Modified: python/branches/io-c/Lib/collections.py
==============================================================================
--- python/branches/io-c/Lib/collections.py	(original)
+++ python/branches/io-c/Lib/collections.py	Sat Feb 14 21:58:31 2009
@@ -18,7 +18,7 @@
 ### namedtuple
 ################################################################################
 
-def namedtuple(typename, field_names, verbose=False):
+def namedtuple(typename, field_names, verbose=False, rename=False):
     """Returns a new subclass of tuple with named fields.
 
     >>> Point = namedtuple('Point', 'x y')
@@ -47,6 +47,16 @@
     if isinstance(field_names, str):
         field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas
     field_names = tuple(map(str, field_names))
+    if rename:
+        names = list(field_names)
+        seen = set()
+        for i, name in enumerate(names):
+            if (not all(c.isalnum() or c=='_' for c in name) or _iskeyword(name)
+                or not name or name[0].isdigit() or name.startswith('_')
+                or name in seen):
+                names[i] = '_%d' % (i+1)
+            seen.add(name)
+        field_names = tuple(names)
     for name in (typename,) + field_names:
         if not all(c.isalnum() or c=='_' for c in name):
             raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name)
@@ -56,7 +66,7 @@
             raise ValueError('Type names and field names cannot start with a number: %r' % name)
     seen_names = set()
     for name in field_names:
-        if name.startswith('_'):
+        if name.startswith('_') and not rename:
             raise ValueError('Field names cannot start with an underscore: %r' % name)
         if name in seen_names:
             raise ValueError('Encountered duplicate field name: %r' % name)

Modified: python/branches/io-c/Lib/compileall.py
==============================================================================
--- python/branches/io-c/Lib/compileall.py	(original)
+++ python/branches/io-c/Lib/compileall.py	Sat Feb 14 21:58:31 2009
@@ -11,10 +11,11 @@
 See module py_compile for details of the actual byte-compilation.
 
 """
-
 import os
 import sys
 import py_compile
+import struct
+import imp
 
 __all__ = ["compile_dir","compile_path"]
 
@@ -54,11 +55,17 @@
         if os.path.isfile(fullname):
             head, tail = name[:-3], name[-3:]
             if tail == '.py':
-                cfile = fullname + (__debug__ and 'c' or 'o')
-                ftime = os.stat(fullname).st_mtime
-                try: ctime = os.stat(cfile).st_mtime
-                except os.error: ctime = 0
-                if (ctime > ftime) and not force: continue
+                if not force:
+                    try:
+                        mtime = os.stat(fullname).st_mtime
+                        expect = struct.pack('<4sl', imp.get_magic(), mtime)
+                        cfile = fullname + (__debug__ and 'c' or 'o')
+                        with open(cfile, 'rb') as chandle:
+                            actual = chandle.read(8)
+                        if expect == actual:
+                            continue
+                    except IOError:
+                        pass
                 if not quiet:
                     print('Compiling', fullname, '...')
                 try:
@@ -86,7 +93,8 @@
              name != os.curdir and name != os.pardir and \
              os.path.isdir(fullname) and \
              not os.path.islink(fullname):
-            if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, quiet):
+            if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
+                               quiet):
                 success = 0
     return success
 

Modified: python/branches/io-c/Lib/distutils/command/build_scripts.py
==============================================================================
--- python/branches/io-c/Lib/distutils/command/build_scripts.py	(original)
+++ python/branches/io-c/Lib/distutils/command/build_scripts.py	Sat Feb 14 21:58:31 2009
@@ -104,8 +104,8 @@
                         outf.write("#!%s%s\n" %
                                    (os.path.join(
                             sysconfig.get_config_var("BINDIR"),
-                            "python" + sysconfig.get_config_var("VERSION")
-                                     + sysconfig.get_config_var("EXE")),
+                           "python%s%s" % (sysconfig.get_config_var("VERSION"),
+                                           sysconfig.get_config_var("EXE"))),
                                     post_interp))
                     outf.writelines(f.readlines())
                     outf.close()

Modified: python/branches/io-c/Lib/distutils/sysconfig.py
==============================================================================
--- python/branches/io-c/Lib/distutils/sysconfig.py	(original)
+++ python/branches/io-c/Lib/distutils/sysconfig.py	Sat Feb 14 21:58:31 2009
@@ -130,7 +130,7 @@
             if get_python_version() < "2.2":
                 return prefix
             else:
-                return os.path.join(PREFIX, "Lib", "site-packages")
+                return os.path.join(prefix, "Lib", "site-packages")
     elif os.name == "mac":
         if plat_specific:
             if standard_lib:
@@ -144,9 +144,9 @@
                 return os.path.join(prefix, "Lib", "site-packages")
     elif os.name == "os2":
         if standard_lib:
-            return os.path.join(PREFIX, "Lib")
+            return os.path.join(prefix, "Lib")
         else:
-            return os.path.join(PREFIX, "Lib", "site-packages")
+            return os.path.join(prefix, "Lib", "site-packages")
     else:
         raise DistutilsPlatformError(
             "I don't know where Python installs its library "

Modified: python/branches/io-c/Lib/distutils/tests/support.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/support.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/support.py	Sat Feb 14 21:58:31 2009
@@ -1,5 +1,5 @@
 """Support code for distutils test cases."""
-
+import os
 import shutil
 import tempfile
 
@@ -31,7 +31,7 @@
         super().tearDown()
         while self.tempdirs:
             d = self.tempdirs.pop()
-            shutil.rmtree(d)
+            shutil.rmtree(d, os.name in ('nt', 'cygwin'))
 
     def mkdtemp(self):
         """Create a temporary directory that will be cleaned up.

Modified: python/branches/io-c/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_build_ext.py	Sat Feb 14 21:58:31 2009
@@ -7,6 +7,7 @@
 from distutils.core import Extension, Distribution
 from distutils.command.build_ext import build_ext
 from distutils import sysconfig
+from distutils.tests.support import TempdirManager
 
 import unittest
 from test import support
@@ -19,11 +20,12 @@
     srcdir = sysconfig.get_config_var('srcdir')
     return os.path.join(srcdir, 'Modules', 'xxmodule.c')
 
-class BuildExtTestCase(unittest.TestCase):
+class BuildExtTestCase(TempdirManager, unittest.TestCase):
     def setUp(self):
         # Create a simple test environment
         # Note that we're making changes to sys.path
-        self.tmp_dir = tempfile.mkdtemp(prefix="pythontest_")
+        TempdirManager.setUp(self)
+        self.tmp_dir = self.mkdtemp()
         self.sys_path = sys.path[:]
         sys.path.append(self.tmp_dir)
         shutil.copy(_get_source_filename(), self.tmp_dir)
@@ -74,8 +76,7 @@
         # Get everything back to normal
         support.unload('xx')
         sys.path = self.sys_path
-        # XXX on Windows the test leaves a directory with xx module in TEMP
-        shutil.rmtree(self.tmp_dir, os.name == 'nt' or sys.platform == 'cygwin')
+        TempdirManager.tearDown(self)
 
     def test_solaris_enable_shared(self):
         dist = Distribution({'name': 'xx'})

Modified: python/branches/io-c/Lib/distutils/tests/test_build_scripts.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_build_scripts.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_build_scripts.py	Sat Feb 14 21:58:31 2009
@@ -5,6 +5,7 @@
 
 from distutils.command.build_scripts import build_scripts
 from distutils.core import Distribution
+from distutils import sysconfig
 
 from distutils.tests import support
 
@@ -73,6 +74,33 @@
         f.write(text)
         f.close()
 
+    def test_version_int(self):
+        source = self.mkdtemp()
+        target = self.mkdtemp()
+        expected = self.write_sample_scripts(source)
+
+
+        cmd = self.get_build_scripts_cmd(target,
+                                         [os.path.join(source, fn)
+                                          for fn in expected])
+        cmd.finalize_options()
+
+        # http://bugs.python.org/issue4524
+        #
+        # On linux-g++-32 with command line `./configure --enable-ipv6
+        # --with-suffix=3`, python is compiled okay but the build scripts
+        # failed when writing the name of the executable
+        old = sysconfig._config_vars.get('VERSION')
+        sysconfig._config_vars['VERSION'] = 4
+        try:
+            cmd.run()
+        finally:
+            if old is not None:
+                sysconfig._config_vars['VERSION'] = old
+
+        built = os.listdir(target)
+        for name in expected:
+            self.assert_(name in built)
 
 def test_suite():
     return unittest.makeSuite(BuildScriptsTestCase)

Modified: python/branches/io-c/Lib/distutils/tests/test_config.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_config.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_config.py	Sat Feb 14 21:58:31 2009
@@ -2,6 +2,7 @@
 import sys
 import os
 import unittest
+import tempfile
 
 from distutils.core import PyPIRCCommand
 from distutils.core import Distribution
@@ -49,13 +50,15 @@
 
     def setUp(self):
         """Patches the environment."""
+        support.TempdirManager.setUp(self)
+
         if 'HOME' in os.environ:
             self._old_home = os.environ['HOME']
         else:
             self._old_home = None
-        curdir = os.path.dirname(__file__)
-        os.environ['HOME'] = curdir
-        self.rc = os.path.join(curdir, '.pypirc')
+        self.tmp_dir = self.mkdtemp()
+        os.environ['HOME'] = self.tmp_dir
+        self.rc = os.path.join(self.tmp_dir, '.pypirc')
         self.dist = Distribution()
 
         class command(PyPIRCCommand):
@@ -74,9 +77,8 @@
             del os.environ['HOME']
         else:
             os.environ['HOME'] = self._old_home
-        if os.path.exists(self.rc):
-            os.remove(self.rc)
         set_threshold(self.old_threshold)
+        support.TempdirManager.tearDown(self)
 
     def test_server_registration(self):
         # This test makes sure PyPIRCCommand knows how to:

Modified: python/branches/io-c/Lib/distutils/tests/test_dir_util.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_dir_util.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_dir_util.py	Sat Feb 14 21:58:31 2009
@@ -9,8 +9,9 @@
 from distutils.dir_util import copy_tree
 
 from distutils import log
+from distutils.tests import support
 
-class DirUtilTestCase(unittest.TestCase):
+class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
 
     def _log(self, msg, *args):
         if len(args) > 0:
@@ -19,18 +20,18 @@
             self._logs.append(msg)
 
     def setUp(self):
+        support.TempdirManager.setUp(self)
         self._logs = []
-        self.root_target = os.path.join(os.path.dirname(__file__), 'deep')
+        tmp_dir = self.mkdtemp()
+        self.root_target = os.path.join(tmp_dir, 'deep')
         self.target = os.path.join(self.root_target, 'here')
-        self.target2 = os.path.join(os.path.dirname(__file__), 'deep2')
+        self.target2 = os.path.join(tmp_dir, 'deep2')
         self.old_log = log.info
         log.info = self._log
 
     def tearDown(self):
-        for target in (self.target, self.target2):
-            if os.path.exists(target):
-                shutil.rmtree(target)
         log.info = self.old_log
+        support.TempdirManager.tearDown(self)
 
     def test_mkpath_remove_tree_verbosity(self):
 

Modified: python/branches/io-c/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_dist.py	Sat Feb 14 21:58:31 2009
@@ -9,6 +9,7 @@
 import warnings
 
 from test.support import TESTFN
+from distutils.tests import support
 
 
 class test_dist(distutils.cmd.Command):
@@ -120,7 +121,7 @@
 
         self.assertEquals(len(warns), 0)
 
-class MetadataTestCase(unittest.TestCase):
+class MetadataTestCase(support.TempdirManager, unittest.TestCase):
 
     def test_simple_metadata(self):
         attrs = {"name": "package",
@@ -219,8 +220,8 @@
         else:
             user_filename = "pydistutils.cfg"
 
-        curdir = os.path.dirname(__file__)
-        user_filename = os.path.join(curdir, user_filename)
+        temp_dir = self.mkdtemp()
+        user_filename = os.path.join(temp_dir, user_filename)
         f = open(user_filename, 'w')
         f.write('.')
         f.close()
@@ -230,14 +231,14 @@
 
             # linux-style
             if sys.platform in ('linux', 'darwin'):
-                os.environ['HOME'] = curdir
+                os.environ['HOME'] = temp_dir
                 files = dist.find_config_files()
                 self.assert_(user_filename in files)
 
             # win32-style
             if sys.platform == 'win32':
                 # home drive should be found
-                os.environ['HOME'] = curdir
+                os.environ['HOME'] = temp_dir
                 files = dist.find_config_files()
                 self.assert_(user_filename in files,
                              '%r not found in %r' % (user_filename, files))

Modified: python/branches/io-c/Lib/distutils/tests/test_file_util.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_file_util.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_file_util.py	Sat Feb 14 21:58:31 2009
@@ -5,8 +5,9 @@
 
 from distutils.file_util import move_file
 from distutils import log
+from distutils.tests import support
 
-class FileUtilTestCase(unittest.TestCase):
+class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
 
     def _log(self, msg, *args):
         if len(args) > 0:
@@ -15,24 +16,20 @@
             self._logs.append(msg)
 
     def setUp(self):
+        support.TempdirManager.setUp(self)
         self._logs = []
         self.old_log = log.info
         log.info = self._log
-        self.source = os.path.join(os.path.dirname(__file__), 'f1')
-        self.target = os.path.join(os.path.dirname(__file__), 'f2')
-        self.target_dir = os.path.join(os.path.dirname(__file__), 'd1')
+        tmp_dir = self.mkdtemp()
+        self.source = os.path.join(tmp_dir, 'f1')
+        self.target = os.path.join(tmp_dir, 'f2')
+        self.target_dir = os.path.join(tmp_dir, 'd1')
 
     def tearDown(self):
         log.info = self.old_log
-        for f in (self.source, self.target, self.target_dir):
-            if os.path.exists(f):
-                if os.path.isfile(f):
-                    os.remove(f)
-                else:
-                    shutil.rmtree(f)
+        support.TempdirManager.tearDown(self)
 
     def test_move_file_verbosity(self):
-
         f = open(self.source, 'w')
         f.write('some content')
         f.close()

Modified: python/branches/io-c/Lib/distutils/tests/test_sdist.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_sdist.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_sdist.py	Sat Feb 14 21:58:31 2009
@@ -5,6 +5,7 @@
 import zipfile
 from os.path import join
 import sys
+import tempfile
 
 from distutils.command.sdist import sdist
 from distutils.core import Distribution
@@ -12,9 +13,6 @@
 from distutils.errors import DistutilsExecError
 from distutils.spawn import find_executable
 
-CURDIR = os.path.dirname(__file__)
-TEMP_PKG = join(CURDIR, 'temppkg')
-
 SETUP_PY = """
 from distutils.core import setup
 import somecode
@@ -29,28 +27,25 @@
 class sdistTestCase(PyPIRCCommandTestCase):
 
     def setUp(self):
+        # PyPIRCCommandTestCase creates a temp dir already
+        # and put it in self.tmp_dir
         PyPIRCCommandTestCase.setUp(self)
+        # setting up an environment
         self.old_path = os.getcwd()
+        os.mkdir(join(self.tmp_dir, 'somecode'))
+        os.mkdir(join(self.tmp_dir, 'dist'))
+        # creating a MANIFEST, a package, and a README
+        self._write(join(self.tmp_dir, 'MANIFEST.in'), MANIFEST_IN)
+        self._write(join(self.tmp_dir, 'README'), 'xxx')
+        self._write(join(self.tmp_dir, 'somecode', '__init__.py'), '#')
+        self._write(join(self.tmp_dir, 'setup.py'), SETUP_PY)
+        os.chdir(self.tmp_dir)
 
     def tearDown(self):
+        # back to normal
         os.chdir(self.old_path)
-        if os.path.exists(TEMP_PKG):
-            shutil.rmtree(TEMP_PKG)
         PyPIRCCommandTestCase.tearDown(self)
 
-    def _init_tmp_pkg(self):
-        if os.path.exists(TEMP_PKG):
-            shutil.rmtree(TEMP_PKG)
-        os.mkdir(TEMP_PKG)
-        os.mkdir(join(TEMP_PKG, 'somecode'))
-        os.mkdir(join(TEMP_PKG, 'dist'))
-        # creating a MANIFEST, a package, and a README
-        self._write(join(TEMP_PKG, 'MANIFEST.in'), MANIFEST_IN)
-        self._write(join(TEMP_PKG, 'README'), 'xxx')
-        self._write(join(TEMP_PKG, 'somecode', '__init__.py'), '#')
-        self._write(join(TEMP_PKG, 'setup.py'), SETUP_PY)
-        os.chdir(TEMP_PKG)
-
     def _write(self, path, content):
         f = open(path, 'w')
         try:
@@ -62,18 +57,17 @@
         # this test creates a package with some vcs dirs in it
         # and launch sdist to make sure they get pruned
         # on all systems
-        self._init_tmp_pkg()
 
         # creating VCS directories with some files in them
-        os.mkdir(join(TEMP_PKG, 'somecode', '.svn'))
-        self._write(join(TEMP_PKG, 'somecode', '.svn', 'ok.py'), 'xxx')
+        os.mkdir(join(self.tmp_dir, 'somecode', '.svn'))
+        self._write(join(self.tmp_dir, 'somecode', '.svn', 'ok.py'), 'xxx')
 
-        os.mkdir(join(TEMP_PKG, 'somecode', '.hg'))
-        self._write(join(TEMP_PKG, 'somecode', '.hg',
+        os.mkdir(join(self.tmp_dir, 'somecode', '.hg'))
+        self._write(join(self.tmp_dir, 'somecode', '.hg',
                          'ok'), 'xxx')
 
-        os.mkdir(join(TEMP_PKG, 'somecode', '.git'))
-        self._write(join(TEMP_PKG, 'somecode', '.git',
+        os.mkdir(join(self.tmp_dir, 'somecode', '.git'))
+        self._write(join(self.tmp_dir, 'somecode', '.git',
                          'ok'), 'xxx')
 
         # now building a sdist
@@ -96,7 +90,7 @@
         cmd.run()
 
         # now let's check what we have
-        dist_folder = join(TEMP_PKG, 'dist')
+        dist_folder = join(self.tmp_dir, 'dist')
         files = os.listdir(dist_folder)
         self.assertEquals(files, ['fake-1.0.zip'])
 
@@ -116,8 +110,6 @@
             find_executable('gzip') is None):
             return
 
-        self._init_tmp_pkg()
-
         # now building a sdist
         dist = Distribution()
         dist.script_name = 'setup.py'
@@ -137,7 +129,7 @@
         cmd.run()
 
         # making sure we have two files
-        dist_folder = join(TEMP_PKG, 'dist')
+        dist_folder = join(self.tmp_dir, 'dist')
         result = os.listdir(dist_folder)
         result.sort()
         self.assertEquals(result,

Modified: python/branches/io-c/Lib/distutils/tests/test_sysconfig.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_sysconfig.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_sysconfig.py	Sat Feb 14 21:58:31 2009
@@ -26,6 +26,8 @@
         # XXX doesn't work on Linux when Python was never installed before
         #self.assert_(os.path.isdir(lib_dir), lib_dir)
         # test for pythonxx.lib?
+        self.assertNotEqual(sysconfig.get_python_lib(),
+                            sysconfig.get_python_lib(prefix=TESTFN))
 
     def test_get_python_inc(self):
         inc_dir = sysconfig.get_python_inc()

Modified: python/branches/io-c/Lib/http/client.py
==============================================================================
--- python/branches/io-c/Lib/http/client.py	(original)
+++ python/branches/io-c/Lib/http/client.py	Sat Feb 14 21:58:31 2009
@@ -249,7 +249,7 @@
 
     return email.parser.Parser(_class=HTTPMessage).parsestr(hstring)
 
-class HTTPResponse:
+class HTTPResponse(io.RawIOBase):
 
     # strict: If true, raise BadStatusLine if the status line can't be
     # parsed as a valid HTTP/1.0 or 1.1 status line.  By default it is
@@ -471,8 +471,6 @@
         #          called, meaning self.isclosed() is meaningful.
         return self.fp is None
 
-    # XXX It would be nice to have readline and __iter__ for this, too.
-
     def read(self, amt=None):
         if self.fp is None:
             return b""
@@ -585,6 +583,9 @@
             amt -= len(chunk)
         return b"".join(s)
 
+    def fileno(self):
+        return self.fp.fileno()
+
     def getheader(self, name, default=None):
         if self.msg is None:
             raise ResponseNotReady()
@@ -596,6 +597,11 @@
             raise ResponseNotReady()
         return list(self.msg.items())
 
+    # We override IOBase.__iter__ so that it doesn't check for closed-ness
+
+    def __iter__(self):
+        return self
+
 
 class HTTPConnection:
 

Modified: python/branches/io-c/Lib/idlelib/Bindings.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/Bindings.py	(original)
+++ python/branches/io-c/Lib/idlelib/Bindings.py	Sat Feb 14 21:58:31 2009
@@ -10,6 +10,7 @@
 """
 import sys
 from idlelib.configHandler import idleConf
+from idlelib import macosxSupport
 
 menudefs = [
  # underscore prefixes character to underscore
@@ -80,7 +81,7 @@
    ]),
 ]
 
-if sys.platform == 'darwin' and '.app' in sys.executable:
+if macosxSupport.runningAsOSXApp():
     # Running as a proper MacOS application bundle. This block restructures
     # the menus a little to make them conform better to the HIG.
 

Modified: python/branches/io-c/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/EditorWindow.py	(original)
+++ python/branches/io-c/Lib/idlelib/EditorWindow.py	Sat Feb 14 21:58:31 2009
@@ -363,7 +363,7 @@
             underline, label = prepstr(label)
             menudict[name] = menu = Menu(mbar, name=name)
             mbar.add_cascade(label=label, menu=menu, underline=underline)
-        if sys.platform == 'darwin' and '.framework' in sys.executable:
+        if macosxSupport.runningAsOSXApp():
             # Insert the application menu
             menudict['application'] = menu = Menu(mbar, name='apple')
             mbar.add_cascade(label='IDLE', menu=menu)

Modified: python/branches/io-c/Lib/idlelib/MultiCall.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/MultiCall.py	(original)
+++ python/branches/io-c/Lib/idlelib/MultiCall.py	Sat Feb 14 21:58:31 2009
@@ -32,6 +32,7 @@
 import sys
 import re
 import tkinter
+from idlelib import macosxSupport
 
 # the event type constants, which define the meaning of mc_type
 MC_KEYPRESS=0; MC_KEYRELEASE=1; MC_BUTTONPRESS=2; MC_BUTTONRELEASE=3;
@@ -44,7 +45,7 @@
 MC_OPTION = 1<<6; MC_COMMAND = 1<<7
 
 # define the list of modifiers, to be used in complex event types.
-if sys.platform == "darwin" and sys.executable.count(".app"):
+if macosxSupport.runningAsOSXApp():
     _modifiers = (("Shift",), ("Control",), ("Option",), ("Command",))
     _modifier_masks = (MC_SHIFT, MC_CONTROL, MC_OPTION, MC_COMMAND)
 else:

Modified: python/branches/io-c/Lib/idlelib/configDialog.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/configDialog.py	(original)
+++ python/branches/io-c/Lib/idlelib/configDialog.py	Sat Feb 14 21:58:31 2009
@@ -21,6 +21,7 @@
 from idlelib.keybindingDialog import GetKeysDialog
 from idlelib.configSectionNameDialog import GetCfgSectionNameDialog
 from idlelib.configHelpSourceEdit import GetHelpSourceDialog
+from idlelib import macosxSupport
 
 class ConfigDialog(Toplevel):
 
@@ -71,18 +72,27 @@
                 page_names=['Fonts/Tabs','Highlighting','Keys','General'])
         frameActionButtons = Frame(self,pady=2)
         #action buttons
+
+        if macosxSupport.runningAsOSXApp():
+            # Surpress the padx and pady arguments when
+            # running as IDLE.app, otherwise the text
+            # on these buttons will not be readable.
+            extraKwds={}
+        else:
+            extraKwds=dict(padx=6, pady=3)
+
         self.buttonHelp = Button(frameActionButtons,text='Help',
                 command=self.Help,takefocus=FALSE,
-                padx=6,pady=3)
+                **extraKwds)
         self.buttonOk = Button(frameActionButtons,text='Ok',
                 command=self.Ok,takefocus=FALSE,
-                padx=6,pady=3)
+                **extraKwds)
         self.buttonApply = Button(frameActionButtons,text='Apply',
                 command=self.Apply,takefocus=FALSE,
-                padx=6,pady=3)
+                **extraKwds)
         self.buttonCancel = Button(frameActionButtons,text='Cancel',
                 command=self.Cancel,takefocus=FALSE,
-                padx=6,pady=3)
+                **extraKwds)
         self.CreatePageFontTab()
         self.CreatePageHighlight()
         self.CreatePageKeys()

Modified: python/branches/io-c/Lib/idlelib/keybindingDialog.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/keybindingDialog.py	(original)
+++ python/branches/io-c/Lib/idlelib/keybindingDialog.py	Sat Feb 14 21:58:31 2009
@@ -4,6 +4,7 @@
 from tkinter import *
 import tkinter.messagebox as tkMessageBox
 import string
+from idlelib import macosxSupport
 
 class GetKeysDialog(Toplevel):
     def __init__(self,parent,title,action,currentKeySequences):
@@ -133,7 +134,7 @@
         config-keys.def must use the same ordering.
         """
         import sys
-        if sys.platform == 'darwin' and sys.argv[0].count('.app'):
+        if macosxSupport.runningAsOSXApp():
             self.modifiers = ['Shift', 'Control', 'Option', 'Command']
         else:
             self.modifiers = ['Control', 'Alt', 'Shift']

Modified: python/branches/io-c/Lib/idlelib/macosxSupport.py
==============================================================================
--- python/branches/io-c/Lib/idlelib/macosxSupport.py	(original)
+++ python/branches/io-c/Lib/idlelib/macosxSupport.py	Sat Feb 14 21:58:31 2009
@@ -6,8 +6,12 @@
 import tkinter
 
 def runningAsOSXApp():
-    """ Returns True iff running from the IDLE.app bundle on OSX """
-    return (sys.platform == 'darwin' and 'IDLE.app' in sys.argv[0])
+    """
+    Returns True if Python is running from within an app on OSX.
+    If so, assume that Python was built with Aqua Tcl/Tk rather than
+    X11 Tck/Tk.
+    """
+    return (sys.platform == 'darwin' and '.app' in sys.executable)
 
 def addOpenEventSupport(root, flist):
     """

Modified: python/branches/io-c/Lib/importlib/NOTES
==============================================================================
--- python/branches/io-c/Lib/importlib/NOTES	(original)
+++ python/branches/io-c/Lib/importlib/NOTES	Sat Feb 14 21:58:31 2009
@@ -1,6 +1,10 @@
 to do
 /////
 
+* Refactor source/bytecode finder/loader code such that bytecode support is a
+  subclass of source support (makes it nicer for VMs that don't use CPython
+  bytecode).
+
 * Implement PEP 302 protocol for loaders (should just be a matter of testing).
 
     + Built-in.

Modified: python/branches/io-c/Lib/io.py
==============================================================================
--- python/branches/io-c/Lib/io.py	(original)
+++ python/branches/io-c/Lib/io.py	Sat Feb 14 21:58:31 2009
@@ -493,7 +493,6 @@
         terminator(s) recognized.
         """
         # For backwards compatibility, a (slowish) readline().
-        self._checkClosed()
         if hasattr(self, "peek"):
             def nreadahead():
                 readahead = self.peek(1)

Modified: python/branches/io-c/Lib/logging/__init__.py
==============================================================================
--- python/branches/io-c/Lib/logging/__init__.py	(original)
+++ python/branches/io-c/Lib/logging/__init__.py	Sat Feb 14 21:58:31 2009
@@ -758,17 +758,19 @@
         """
         try:
             msg = self.format(record)
+            stream = self.stream
             fs = "%s\n"
             if not _unicode: #if no unicode support...
-                self.stream.write(fs % msg)
+                stream.write(fs % msg)
             else:
                 try:
-                    if getattr(self.stream, 'encoding', None) is not None:
-                        self.stream.write(fs % msg.encode(self.stream.encoding))
+                    if (isinstance(msg, unicode) or
+                        getattr(stream, 'encoding', None) is None):
+                        stream.write(fs % msg)
                     else:
-                        self.stream.write(fs % msg)
+                        stream.write(fs % msg.encode(stream.encoding))
                 except UnicodeError:
-                    self.stream.write(fs % msg.encode("UTF-8"))
+                    stream.write(fs % msg.encode("UTF-8"))
             self.flush()
         except (KeyboardInterrupt, SystemExit):
             raise

Modified: python/branches/io-c/Lib/numbers.py
==============================================================================
--- python/branches/io-c/Lib/numbers.py	(original)
+++ python/branches/io-c/Lib/numbers.py	Sat Feb 14 21:58:31 2009
@@ -15,6 +15,8 @@
     If you just want to check if an argument x is a number, without
     caring what kind, use isinstance(x, Number).
     """
+    __slots__ = ()
+
     # Concrete numeric types must provide their own hash implementation
     __hash__ = None
 
@@ -38,6 +40,8 @@
     type as described below.
     """
 
+    __slots__ = ()
+
     @abstractmethod
     def __complex__(self):
         """Return a builtin complex instance. Called for complex(self)."""
@@ -152,6 +156,8 @@
     Real also provides defaults for the derived operations.
     """
 
+    __slots__ = ()
+
     @abstractmethod
     def __float__(self):
         """Any Real can be converted to a native float object.
@@ -264,6 +270,8 @@
 class Rational(Real):
     """.numerator and .denominator should be in lowest terms."""
 
+    __slots__ = ()
+
     @abstractproperty
     def numerator(self):
         raise NotImplementedError
@@ -287,6 +295,8 @@
 class Integral(Rational):
     """Integral adds a conversion to int and the bit-string operations."""
 
+    __slots__ = ()
+
     @abstractmethod
     def __int__(self):
         """int(self)"""

Modified: python/branches/io-c/Lib/test/regrtest.py
==============================================================================
--- python/branches/io-c/Lib/test/regrtest.py	(original)
+++ python/branches/io-c/Lib/test/regrtest.py	Sat Feb 14 21:58:31 2009
@@ -1075,6 +1075,7 @@
         test_pty
         test_socketserver
         test_tcl
+        test_tk
         test_ttk_guionly
         test_ttk_textonly
         test_timeout
@@ -1092,6 +1093,7 @@
         test_kqueue
         test_ossaudiodev
         test_tcl
+        test_tk
         test_ttk_guionly
         test_ttk_textonly
         test_zipimport
@@ -1109,6 +1111,7 @@
         test_ossaudiodev
         test_pep277
         test_tcl
+        test_tk
         test_ttk_guionly
         test_ttk_textonly
         test_multiprocessing
@@ -1125,6 +1128,7 @@
         test_ossaudiodev
         test_pep277
         test_tcl
+        test_tk
         test_ttk_guionly
         test_ttk_textonly
         test_multiprocessing

Modified: python/branches/io-c/Lib/test/test_builtin.py
==============================================================================
--- python/branches/io-c/Lib/test/test_builtin.py	(original)
+++ python/branches/io-c/Lib/test/test_builtin.py	Sat Feb 14 21:58:31 2009
@@ -611,6 +611,18 @@
             def __len__(self):
                 raise ValueError
         self.assertRaises(ValueError, len, BadSeq())
+        class InvalidLen:
+            def __len__(self):
+                return None
+        self.assertRaises(TypeError, len, InvalidLen())
+        class FloatLen:
+            def __len__(self):
+                return 4.5
+        self.assertRaises(TypeError, len, FloatLen())
+        class HugeLen:
+            def __len__(self):
+                return sys.maxsize + 1
+        self.assertRaises(OverflowError, len, HugeLen())
 
     def test_map(self):
         self.assertEqual(

Modified: python/branches/io-c/Lib/test/test_collections.py
==============================================================================
--- python/branches/io-c/Lib/test/test_collections.py	(original)
+++ python/branches/io-c/Lib/test/test_collections.py	Sat Feb 14 21:58:31 2009
@@ -47,6 +47,17 @@
         self.assertRaises(TypeError, Point._make, [11])                     # catch too few args
         self.assertRaises(TypeError, Point._make, [11, 22, 33])             # catch too many args
 
+    def test_name_fixer(self):
+        for spec, renamed in [
+            [('efg', 'g%hi'),  ('efg', '_2')],                              # field with non-alpha char
+            [('abc', 'class'), ('abc', '_2')],                              # field has keyword
+            [('8efg', '9ghi'), ('_1', '_2')],                               # field starts with digit
+            [('abc', '_efg'), ('abc', '_2')],                               # field with leading underscore
+            [('abc', 'efg', 'efg', 'ghi'), ('abc', 'efg', '_3', 'ghi')],    # duplicate field
+            [('abc', '', 'x'), ('abc', '_2', 'x')],                         # fieldname is a space
+        ]:
+            self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
+
     def test_instance(self):
         Point = namedtuple('Point', 'x y')
         p = Point(11, 22)

Modified: python/branches/io-c/Lib/test/test_fractions.py
==============================================================================
--- python/branches/io-c/Lib/test/test_fractions.py	(original)
+++ python/branches/io-c/Lib/test/test_fractions.py	Sat Feb 14 21:58:31 2009
@@ -407,6 +407,11 @@
         self.assertEqual(id(r), id(copy(r)))
         self.assertEqual(id(r), id(deepcopy(r)))
 
+    def test_slots(self):
+        # Issue 4998
+        r = F(13, 7)
+        self.assertRaises(AttributeError, setattr, r, 'a', 10)
+
 def test_main():
     run_unittest(FractionTest, GcdTest)
 

Modified: python/branches/io-c/Lib/test/test_hashlib.py
==============================================================================
--- python/branches/io-c/Lib/test/test_hashlib.py	(original)
+++ python/branches/io-c/Lib/test/test_hashlib.py	Sat Feb 14 21:58:31 2009
@@ -63,6 +63,18 @@
         computed = hashlib.new(name, data).hexdigest()
         self.assertEqual(computed, digest)
 
+    def check_no_unicode(self, algorithm_name):
+        # Unicode objects are not allowed as input.
+        self.assertRaises(TypeError, getattr(hashlib, algorithm_name), 'spam')
+        self.assertRaises(TypeError, hashlib.new, algorithm_name, 'spam')
+
+    def test_no_unicode(self):
+        self.check_no_unicode('md5')
+        self.check_no_unicode('sha1')
+        self.check_no_unicode('sha224')
+        self.check_no_unicode('sha256')
+        self.check_no_unicode('sha384')
+        self.check_no_unicode('sha512')
 
     def test_case_md5_0(self):
         self.check('md5', b'', 'd41d8cd98f00b204e9800998ecf8427e')

Modified: python/branches/io-c/Lib/test/test_httplib.py
==============================================================================
--- python/branches/io-c/Lib/test/test_httplib.py	(original)
+++ python/branches/io-c/Lib/test/test_httplib.py	Sat Feb 14 21:58:31 2009
@@ -42,7 +42,6 @@
             raise AssertionError('caller tried to read past EOF')
         return data
 
-
 class HeaderTests(TestCase):
     def test_auto_headers(self):
         # Some headers are added automatically, but should not be added by
@@ -245,7 +244,6 @@
         self.assertEqual(httpConn.sock.gettimeout(), 30)
         httpConn.close()
 
-
 class HTTPSTimeoutTest(TestCase):
 # XXX Here should be tests for HTTPS, there isn't any right now!
 
@@ -257,7 +255,7 @@
 
 def test_main(verbose=None):
     support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest,
-                              HTTPSTimeoutTest)
+                         HTTPSTimeoutTest)
 
 if __name__ == '__main__':
     test_main()

Modified: python/branches/io-c/Lib/test/test_io.py
==============================================================================
--- python/branches/io-c/Lib/test/test_io.py	(original)
+++ python/branches/io-c/Lib/test/test_io.py	Sat Feb 14 21:58:31 2009
@@ -1889,6 +1889,7 @@
             self.assertRaises(ValueError, f.fileno)
             self.assertRaises(ValueError, f.isatty)
             self.assertRaises(ValueError, f.__iter__)
+            self.assertRaises(ValueError, next, f)
             if hasattr(f, "peek"):
                 self.assertRaises(ValueError, f.peek, 1)
             self.assertRaises(ValueError, f.read)

Modified: python/branches/io-c/Lib/test/test_itertools.py
==============================================================================
--- python/branches/io-c/Lib/test/test_itertools.py	(original)
+++ python/branches/io-c/Lib/test/test_itertools.py	Sat Feb 14 21:58:31 2009
@@ -2,6 +2,8 @@
 from test import support
 from itertools import *
 from weakref import proxy
+from decimal import Decimal
+from fractions import Fraction
 import sys
 import operator
 import random
@@ -328,7 +330,7 @@
         self.assertEqual(take(2, lzip('abc',count(3))), [('a', 3), ('b', 4)])
         self.assertEqual(take(2, zip('abc',count(-1))), [('a', -1), ('b', 0)])
         self.assertEqual(take(2, zip('abc',count(-3))), [('a', -3), ('b', -2)])
-        self.assertRaises(TypeError, count, 2, 3)
+        self.assertRaises(TypeError, count, 2, 3, 4)
         self.assertRaises(TypeError, count, 'a')
         self.assertEqual(list(islice(count(maxsize-5), 10)),
                          list(range(maxsize-5, maxsize+5)))
@@ -341,6 +343,7 @@
         c = count(-9)
         self.assertEqual(repr(c), 'count(-9)')
         next(c)
+        self.assertEqual(repr(count(10.25)), 'count(10.25)')
         self.assertEqual(next(c), -8)
         for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
             # Test repr (ignoring the L in longs)
@@ -348,6 +351,45 @@
             r2 = 'count(%r)'.__mod__(i).replace('L', '')
             self.assertEqual(r1, r2)
 
+    def test_count_with_stride(self):
+        self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
+        self.assertEqual(lzip('abc',count(2,0)), [('a', 2), ('b', 2), ('c', 2)])
+        self.assertEqual(lzip('abc',count(2,1)), [('a', 2), ('b', 3), ('c', 4)])
+        self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
+        self.assertEqual(take(20, count(maxsize-15, 3)), take(20, range(maxsize-15, maxsize+100, 3)))
+        self.assertEqual(take(20, count(-maxsize-15, 3)), take(20, range(-maxsize-15,-maxsize+100, 3)))
+        self.assertEqual(take(3, count(2, 3.25-4j)), [2, 5.25-4j, 8.5-8j])
+        self.assertEqual(take(3, count(Decimal('1.1'), Decimal('.1'))),
+                         [Decimal('1.1'), Decimal('1.2'), Decimal('1.3')])
+        self.assertEqual(take(3, count(Fraction(2,3), Fraction(1,7))),
+                         [Fraction(2,3), Fraction(17,21), Fraction(20,21)])
+        self.assertEqual(repr(take(3, count(10, 2.5))), repr([10, 12.5, 15.0]))
+        c = count(3, 5)
+        self.assertEqual(repr(c), 'count(3, 5)')
+        next(c)
+        self.assertEqual(repr(c), 'count(8, 5)')
+        c = count(-9, 0)
+        self.assertEqual(repr(c), 'count(-9, 0)')
+        next(c)
+        self.assertEqual(repr(c), 'count(-9, 0)')
+        c = count(-9, -3)
+        self.assertEqual(repr(c), 'count(-9, -3)')
+        next(c)
+        self.assertEqual(repr(c), 'count(-12, -3)')
+        self.assertEqual(repr(c), 'count(-12, -3)')
+        self.assertEqual(repr(count(10.5, 1.25)), 'count(10.5, 1.25)')
+        self.assertEqual(repr(count(10.5, 1)), 'count(10.5)')           # suppress step=1 when it's an int
+        self.assertEqual(repr(count(10.5, 1.00)), 'count(10.5, 1.0)')   # do show float values lilke 1.0
+        for i in (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 10, sys.maxsize-5, sys.maxsize+5):
+            for j in  (-sys.maxsize-5, -sys.maxsize+5 ,-10, -1, 0, 1, 10, sys.maxsize-5, sys.maxsize+5):
+                # Test repr (ignoring the L in longs)
+                r1 = repr(count(i, j)).replace('L', '')
+                if j == 1:
+                    r2 = ('count(%r)' % i).replace('L', '')
+                else:
+                    r2 = ('count(%r, %r)' % (i, j)).replace('L', '')
+                self.assertEqual(r1, r2)
+
     def test_cycle(self):
         self.assertEqual(take(10, cycle('abc')), list('abcabcabca'))
         self.assertEqual(list(cycle('')), [])

Modified: python/branches/io-c/Lib/test/test_logging.py
==============================================================================
--- python/branches/io-c/Lib/test/test_logging.py	(original)
+++ python/branches/io-c/Lib/test/test_logging.py	Sat Feb 14 21:58:31 2009
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2001-2004 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2009 by Vinay Sajip. All Rights Reserved.
 #
 # Permission to use, copy, modify, and distribute this software and its
 # documentation for any purpose and without fee is hereby granted,
@@ -18,13 +18,14 @@
 
 """Test harness for the logging module. Run all tests.
 
-Copyright (C) 2001-2008 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2009 Vinay Sajip. All Rights Reserved.
 """
 
 import logging
 import logging.handlers
 import logging.config
 
+import codecs
 import copy
 import pickle
 import io
@@ -860,6 +861,7 @@
             ('foo', 'DEBUG', '3'),
         ])
 
+
 class EncodingTest(BaseTest):
     def test_encoding_plain_file(self):
         # In Python 2.x, a plain file object is treated as having no encoding.
@@ -886,6 +888,27 @@
             if os.path.isfile(fn):
                 os.remove(fn)
 
+    def test_encoding_cyrillic_unicode(self):
+        log = logging.getLogger("test")
+        #Get a message in Unicode: Do svidanya in Cyrillic (meaning goodbye)
+        message = '\u0434\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f'
+        #Ensure it's written in a Cyrillic encoding
+        writer_class = codecs.getwriter('cp1251')
+        stream = io.BytesIO()
+        writer = writer_class(stream, 'strict')
+        handler = logging.StreamHandler(writer)
+        log.addHandler(handler)
+        try:
+            log.warning(message)
+        finally:
+            log.removeHandler(handler)
+            handler.close()
+        # check we wrote exactly those bytes, ignoring trailing \n etc
+        s = stream.getvalue()
+        #Compare against what the data should be when encoded in CP-1251
+        self.assertEqual(s, b'\xe4\xee \xf1\xe2\xe8\xe4\xe0\xed\xe8\xff\n')
+
+
 class WarningsTest(BaseTest):
     def test_warnings(self):
         logging.captureWarnings(True)

Modified: python/branches/io-c/Lib/test/test_os.py
==============================================================================
--- python/branches/io-c/Lib/test/test_os.py	(original)
+++ python/branches/io-c/Lib/test/test_os.py	Sat Feb 14 21:58:31 2009
@@ -576,16 +576,18 @@
         self.assertRaises(WindowsError, os.chdir, support.TESTFN)
 
     def test_mkdir(self):
-        self.assertRaises(WindowsError, os.chdir, support.TESTFN)
+        f = open(test_support.TESTFN, "w")
+        try:
+            self.assertRaises(WindowsError, os.mkdir, support.TESTFN)
+        finally:
+            f.close()
+            os.unlink(test_support.TESTFN)
 
     def test_utime(self):
         self.assertRaises(WindowsError, os.utime, support.TESTFN, None)
 
-    def test_access(self):
-        self.assertRaises(WindowsError, os.utime, support.TESTFN, 0)
-
     def test_chmod(self):
-        self.assertRaises(WindowsError, os.utime, support.TESTFN, 0)
+        self.assertRaises(WindowsError, os.chmod, support.TESTFN, 0)
 
 class TestInvalidFD(unittest.TestCase):
     singles = ["fchdir", "dup", "fdopen", "fdatasync", "fstat",

Modified: python/branches/io-c/Lib/test/test_pep263.py
==============================================================================
Binary files. No diff available.

Modified: python/branches/io-c/Lib/test/test_socket.py
==============================================================================
--- python/branches/io-c/Lib/test/test_socket.py	(original)
+++ python/branches/io-c/Lib/test/test_socket.py	Sat Feb 14 21:58:31 2009
@@ -398,6 +398,14 @@
         # Check that setting it to an invalid type raises TypeError
         self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
 
+    def testIPv4_inet_aton_fourbytes(self):
+        if not hasattr(socket, 'inet_aton'):
+            return  # No inet_aton, nothing to check
+        # Test that issue1008086 and issue767150 are fixed.
+        # It must return 4 bytes.
+        self.assertEquals(b'\x00'*4, socket.inet_aton('0.0.0.0'))
+        self.assertEquals(b'\xff'*4, socket.inet_aton('255.255.255.255'))
+
     def testIPv4toString(self):
         if not hasattr(socket, 'inet_pton'):
             return # No inet_pton() on this platform

Modified: python/branches/io-c/Lib/test/test_struct.py
==============================================================================
--- python/branches/io-c/Lib/test/test_struct.py	(original)
+++ python/branches/io-c/Lib/test/test_struct.py	Sat Feb 14 21:58:31 2009
@@ -48,7 +48,7 @@
 def deprecated_err(func, *args):
     try:
         func(*args)
-    except (struct.error, TypeError):
+    except (struct.error, OverflowError):
         pass
     except DeprecationWarning:
         if not PY_STRUCT_OVERFLOW_MASKING:
@@ -191,7 +191,7 @@
 
     def test_native_qQ(self):
         # can't pack -1 as unsigned regardless
-        self.assertRaises((struct.error, TypeError), struct.pack, "Q", -1)
+        self.assertRaises((struct.error, OverflowError), struct.pack, "Q", -1)
         # can't pack string as 'q' regardless
         self.assertRaises(struct.error, struct.pack, "q", "a")
         # ditto, but 'Q'
@@ -524,6 +524,10 @@
         self.assertRaises(struct.error, s.pack_into, small_buf, 0, test_string)
         self.assertRaises(struct.error, s.pack_into, small_buf, 2, test_string)
 
+        # Test bogus offset (issue 3694)
+        sb = small_buf
+        self.assertRaises(TypeError, struct.pack_into, b'1', sb, None)
+
     def test_pack_into_fn(self):
         test_string = b'Reykjavik rocks, eow!'
         writable_buf = array.array('b', b' '*100)

Modified: python/branches/io-c/Lib/test/test_urllib2_localnet.py
==============================================================================
--- python/branches/io-c/Lib/test/test_urllib2_localnet.py	(original)
+++ python/branches/io-c/Lib/test/test_urllib2_localnet.py	Sat Feb 14 21:58:31 2009
@@ -310,7 +310,7 @@
             self.send_response(response_code)
 
             for (header, value) in headers:
-                self.send_header(header, value % self.port)
+                self.send_header(header, value % {'port':self.port})
             if body:
                 self.send_header("Content-type", "text/plain")
                 self.end_headers()
@@ -341,10 +341,17 @@
             self.server.stop()
 
     def urlopen(self, url, data=None):
+        l = []
         f = urllib.request.urlopen(url, data)
-        result = f.read()
-        f.close()
-        return result
+        try:
+            # Exercise various methods
+            l.extend(f.readlines(200))
+            l.append(f.readline())
+            l.append(f.read(1024))
+            l.append(f.read())
+        finally:
+            f.close()
+        return b"".join(l)
 
     def start_server(self, responses=None):
         if responses is None:
@@ -361,7 +368,8 @@
     def test_redirection(self):
         expected_response = b"We got here..."
         responses = [
-            (302, [("Location", "http://localhost:%s/somewhere_else")], ""),
+            (302, [("Location", "http://localhost:%(port)s/somewhere_else")],
+             ""),
             (200, [], expected_response)
         ]
 
@@ -370,6 +378,20 @@
         self.assertEquals(data, expected_response)
         self.assertEquals(handler.requests, ["/", "/somewhere_else"])
 
+    def test_chunked(self):
+        expected_response = b"hello world"
+        chunked_start = (
+                        b'a\r\n'
+                        b'hello worl\r\n'
+                        b'1\r\n'
+                        b'd\r\n'
+                        b'0\r\n'
+                        )
+        response = [(200, [("Transfer-Encoding", "chunked")], chunked_start)]
+        handler = self.start_server(response)
+        data = self.urlopen("http://localhost:%s/" % handler.port)
+        self.assertEquals(data, expected_response)
+
     def test_404(self):
         expected_response = b"Bad bad bad..."
         handler = self.start_server([(404, [], expected_response)])

Modified: python/branches/io-c/Lib/test/test_urllib2net.py
==============================================================================
--- python/branches/io-c/Lib/test/test_urllib2net.py	(original)
+++ python/branches/io-c/Lib/test/test_urllib2net.py	Sat Feb 14 21:58:31 2009
@@ -195,7 +195,7 @@
     def test_http_basic(self):
         self.assertTrue(socket.getdefaulttimeout() is None)
         u = _urlopen_with_retry("http://www.python.org")
-        self.assertTrue(u.fp.raw._sock.gettimeout() is None)
+        self.assertTrue(u.fp.fp.raw._sock.gettimeout() is None)
 
     def test_http_default_timeout(self):
         self.assertTrue(socket.getdefaulttimeout() is None)
@@ -204,7 +204,7 @@
             u = _urlopen_with_retry("http://www.python.org")
         finally:
             socket.setdefaulttimeout(None)
-        self.assertEqual(u.fp.raw._sock.gettimeout(), 60)
+        self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
 
     def test_http_no_timeout(self):
         self.assertTrue(socket.getdefaulttimeout() is None)
@@ -213,11 +213,11 @@
             u = _urlopen_with_retry("http://www.python.org", timeout=None)
         finally:
             socket.setdefaulttimeout(None)
-        self.assertTrue(u.fp.raw._sock.gettimeout() is None)
+        self.assertTrue(u.fp.fp.raw._sock.gettimeout() is None)
 
     def test_http_timeout(self):
         u = _urlopen_with_retry("http://www.python.org", timeout=120)
-        self.assertEqual(u.fp.raw._sock.gettimeout(), 120)
+        self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 120)
 
     FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/"
 

Modified: python/branches/io-c/Lib/test/test_xmlrpc.py
==============================================================================
--- python/branches/io-c/Lib/test/test_xmlrpc.py	(original)
+++ python/branches/io-c/Lib/test/test_xmlrpc.py	Sat Feb 14 21:58:31 2009
@@ -135,6 +135,14 @@
                           xmlrpclib.loads(strg)[0][0])
         self.assertRaises(TypeError, xmlrpclib.dumps, (arg1,))
 
+    def test_get_host_info(self):
+        # see bug #3613, this raised a TypeError
+        transp = xmlrpc.client.Transport()
+        self.assertEquals(transp.get_host_info("user at host.tld"),
+                          ('host.tld',
+                           [('Authorization', 'Basic dXNlcg==')], {}))
+
+
 class HelperTestCase(unittest.TestCase):
     def test_escape(self):
         self.assertEqual(xmlrpclib.escape("a&b"), "a&amp;b")

Modified: python/branches/io-c/Lib/tkinter/__init__.py
==============================================================================
--- python/branches/io-c/Lib/tkinter/__init__.py	(original)
+++ python/branches/io-c/Lib/tkinter/__init__.py	Sat Feb 14 21:58:31 2009
@@ -3016,7 +3016,8 @@
            forwards=None, backwards=None, exact=None,
            regexp=None, nocase=None, count=None, elide=None):
         """Search PATTERN beginning from INDEX until STOPINDEX.
-        Return the index of the first character of a match or an empty string."""
+        Return the index of the first character of a match or an
+        empty string."""
         args = [self._w, 'search']
         if forwards: args.append('-forwards')
         if backwards: args.append('-backwards')
@@ -3025,7 +3026,7 @@
         if nocase: args.append('-nocase')
         if elide: args.append('-elide')
         if count: args.append('-count'); args.append(count)
-        if pattern[0] == '-': args.append('--')
+        if pattern and pattern[0] == '-': args.append('--')
         args.append(pattern)
         args.append(index)
         if stopindex: args.append(stopindex)

Modified: python/branches/io-c/Lib/tkinter/ttk.py
==============================================================================
--- python/branches/io-c/Lib/tkinter/ttk.py	(original)
+++ python/branches/io-c/Lib/tkinter/ttk.py	Sat Feb 14 21:58:31 2009
@@ -23,7 +23,7 @@
            # Extensions
            "LabeledScale", "OptionMenu",
            # functions
-           "tclobjs_to_py"]
+           "tclobjs_to_py", "setup_master"]
 
 import tkinter
 
@@ -47,24 +47,6 @@
         master.tk.eval('package require tile') # TclError may be raised here
         master._tile_loaded = True
 
-
-def _setup_master(master=None):
-    """If master is not None, itself is returned. If master is None,
-    the default master is returned if there is one, otherwise a new
-    master is created and returned.
-
-    If it is not allowed to use the default root and master is None,
-    RuntimeError is raised."""
-    if master is None:
-        if tkinter._support_default_root:
-            master = tkinter._default_root or tkinter.Tk()
-        else:
-            raise RuntimeError(
-                    "No master specified and tkinter is "
-                    "configured to not support default root")
-    return master
-
-
 def _format_optdict(optdict, script=False, ignore=None):
     """Formats optdict to a tuple to pass it to tk.call.
 
@@ -367,6 +349,22 @@
 
     return adict
 
+def setup_master(master=None):
+    """If master is not None, itself is returned. If master is None,
+    the default master is returned if there is one, otherwise a new
+    master is created and returned.
+
+    If it is not allowed to use the default root and master is None,
+    RuntimeError is raised."""
+    if master is None:
+        if tkinter._support_default_root:
+            master = tkinter._default_root or tkinter.Tk()
+        else:
+            raise RuntimeError(
+                    "No master specified and tkinter is "
+                    "configured to not support default root")
+    return master
+
 
 class Style(object):
     """Manipulate style database."""
@@ -374,7 +372,7 @@
     _name = "ttk::style"
 
     def __init__(self, master=None):
-        master = _setup_master(master)
+        master = setup_master(master)
 
         if not getattr(master, '_tile_loaded', False):
             # Load tile now, if needed
@@ -555,7 +553,7 @@
             active, disabled, focus, pressed, selected, background,
             readonly, alternate, invalid
         """
-        master = _setup_master(master)
+        master = setup_master(master)
         if not getattr(master, '_tile_loaded', False):
             # Load tile now, if needed
             _load_tile(master)

Modified: python/branches/io-c/Lib/urllib/request.py
==============================================================================
--- python/branches/io-c/Lib/urllib/request.py	(original)
+++ python/branches/io-c/Lib/urllib/request.py	Sat Feb 14 21:58:31 2009
@@ -333,7 +333,6 @@
         handlers = chain.get(kind, ())
         for handler in handlers:
             func = getattr(handler, meth_name)
-
             result = func(*args)
             if result is not None:
                 return result
@@ -1070,7 +1069,8 @@
         except socket.error as err: # XXX what error?
             raise URLError(err)
 
-        resp = addinfourl(r.fp, r.msg, req.get_full_url())
+##        resp = addinfourl(r.fp, r.msg, req.get_full_url())
+        resp = addinfourl(r, r.msg, req.get_full_url())
         resp.code = r.status
         resp.msg = r.reason
         return resp
@@ -1606,7 +1606,7 @@
         # According to RFC 2616, "2xx" code indicates that the client's
         # request was successfully received, understood, and accepted.
         if 200 <= response.status < 300:
-            return addinfourl(response.fp, response.msg, "http:" + url,
+            return addinfourl(response, response.msg, "http:" + url,
                               response.status)
         else:
             return self.http_error(

Modified: python/branches/io-c/Lib/urllib/response.py
==============================================================================
--- python/branches/io-c/Lib/urllib/response.py	(original)
+++ python/branches/io-c/Lib/urllib/response.py	Sat Feb 14 21:58:31 2009
@@ -17,7 +17,8 @@
         self.read = self.fp.read
         self.readline = self.fp.readline
         # TODO(jhylton): Make sure an object with readlines() is also iterable
-        if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines
+        if hasattr(self.fp, "readlines"):
+            self.readlines = self.fp.readlines
         if hasattr(self.fp, "fileno"):
             self.fileno = self.fp.fileno
         else:

Modified: python/branches/io-c/Lib/xmlrpc/client.py
==============================================================================
--- python/branches/io-c/Lib/xmlrpc/client.py	(original)
+++ python/branches/io-c/Lib/xmlrpc/client.py	Sat Feb 14 21:58:31 2009
@@ -1161,7 +1161,8 @@
 
         if auth:
             import base64
-            auth = base64.encodestring(urllib.parse.unquote(auth))
+            auth = urllib.parse.unquote_to_bytes(auth)
+            auth = base64.encodestring(auth).decode("utf-8")
             auth = "".join(auth.split()) # get rid of whitespace
             extra_headers = [
                 ("Authorization", "Basic " + auth)

Modified: python/branches/io-c/Mac/BuildScript/build-installer.py
==============================================================================
--- python/branches/io-c/Mac/BuildScript/build-installer.py	(original)
+++ python/branches/io-c/Mac/BuildScript/build-installer.py	Sat Feb 14 21:58:31 2009
@@ -1033,8 +1033,7 @@
     buildPythonDocs()
     fn = os.path.join(WORKDIR, "_root", "Applications",
                 "Python %s"%(getVersion(),), "Update Shell Profile.command")
-    patchFile("scripts/postflight.patch-profile",  fn)
-    os.chmod(fn, 0755)
+    patchScript("scripts/postflight.patch-profile",  fn)
 
     folder = os.path.join(WORKDIR, "_root", "Applications", "Python %s"%(
         getVersion(),))

Modified: python/branches/io-c/Mac/BuildScript/resources/ReadMe.txt
==============================================================================
--- python/branches/io-c/Mac/BuildScript/resources/ReadMe.txt	(original)
+++ python/branches/io-c/Mac/BuildScript/resources/ReadMe.txt	Sat Feb 14 21:58:31 2009
@@ -14,10 +14,9 @@
 
 MacPython consists of the Python programming language
 interpreter, plus a set of programs to allow easy
-access to it for Mac users (an integrated development
-environment, an applet builder), plus a set of pre-built 
-extension modules that open up specific Macintosh technologies 
-to Python programs (Carbon, AppleScript, Quicktime, more).
+access to it for Mac users including an integrated development
+environment, IDLE, plus a set of pre-built extension modules
+that open up specific Macintosh technologies to Python programs.
 
 The installer puts the applications in "Python $VERSION" 
 in your Applications folder, command-line tools in
@@ -25,7 +24,7 @@
 $PYTHONFRAMEWORKINSTALLDIR.
 
 More information on MacPython can be found at
-http://www.cwi.nl/~jack/macpython and
-http://pythonmac.org/.  More information on
-Python in general can be found at
+http://www.python.org/download/mac/.
+
+More information on Python in general can be found at
 http://www.python.org.

Modified: python/branches/io-c/Mac/BuildScript/resources/Welcome.rtf
==============================================================================
--- python/branches/io-c/Mac/BuildScript/resources/Welcome.rtf	(original)
+++ python/branches/io-c/Mac/BuildScript/resources/Welcome.rtf	Sat Feb 14 21:58:31 2009
@@ -10,11 +10,10 @@
 \b Mac OS X $MACOSX_DEPLOYMENT_TARGET
 \b0 .\
 \
-MacPython consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac users (an integrated development environment, an applet builder), plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs (Carbon, AppleScript, Quicktime, more).\
+MacPython consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac users including an integrated development environment \b IDLE\b0  plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs.\
 \
 See the ReadMe file for more information.\
 \
 
 \b NOTE: 
-\b0 This package will by default update not your shell profile, and will also not install\
-files in /usr/local. }
\ No newline at end of file
+\b0 This package will by default not update your shell profile and will also not install files in /usr/local.  Double-click \b Update Shell Profile\b0  at any time to make $FULL_VERSION the default Python.}

Modified: python/branches/io-c/Mac/BuildScript/scripts/postflight.patch-profile
==============================================================================
--- python/branches/io-c/Mac/BuildScript/scripts/postflight.patch-profile	(original)
+++ python/branches/io-c/Mac/BuildScript/scripts/postflight.patch-profile	Sat Feb 14 21:58:31 2009
@@ -5,8 +5,8 @@
 echo "These changes will be effective only in shell windows that you open"
 echo "after running this script."
 
-PYVER=2.5
-PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/Current"
+PYVER=@PYVER@
+PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/@PYVER@"
 
 if [ `id -ur` = 0 ]; then
 	# Run from the installer, do some trickery to fetch the information

Modified: python/branches/io-c/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE
==============================================================================
--- python/branches/io-c/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE	(original)
+++ python/branches/io-c/Mac/IDLE/IDLE.app/Contents/MacOS/IDLE	Sat Feb 14 21:58:31 2009
@@ -1,4 +1,4 @@
-#!%prefix%/Resources/Python.app/Contents/MacOS/Python3
+#!%prefix%/Resources/Python.app/Contents/MacOS/%exe%
 
 import sys, os
 execdir = os.path.dirname(sys.argv[0])

Modified: python/branches/io-c/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py
==============================================================================
--- python/branches/io-c/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py	(original)
+++ python/branches/io-c/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py	Sat Feb 14 21:58:31 2009
@@ -3,8 +3,6 @@
 """
 import sys, os
 
-from idlelib.PyShell import main
-
 # Change the current directory the user's home directory, that way we'll get
 # a more useful default location in the open/save dialogs.
 os.chdir(os.path.expanduser('~/Documents'))
@@ -13,10 +11,54 @@
 # Make sure sys.executable points to the python interpreter inside the
 # framework, instead of at the helper executable inside the application
 # bundle (the latter works, but doesn't allow access to the window server)
-if sys.executable.endswith('-32'):
-    sys.executable = os.path.join(sys.prefix, 'bin', 'python-32')
-else:
-    sys.executable = os.path.join(sys.prefix, 'bin', 'python')
+#
+#  .../IDLE.app/
+#       Contents/
+#           MacOS/
+#               IDLE (a python script)
+#               Python{-32} (symlink)
+#           Resources/
+#               idlemain.py (this module)
+#               ...
+#
+# ../IDLE.app/Contents/MacOS/Python{-32} is symlinked to
+#       ..Library/Frameworks/Python.framework/Versions/m.n
+#                   /Resources/Python.app/Contents/MacOS/Python{-32}
+#       which is the Python interpreter executable
+#
+# The flow of control is as follows:
+# 1. IDLE.app is launched which starts python running the IDLE script
+# 2. IDLE script exports
+#       PYTHONEXECUTABLE = .../IDLE.app/Contents/MacOS/Python{-32}
+#           (the symlink to the framework python)
+# 3. IDLE script alters sys.argv and uses os.execve to replace itself with
+#       idlemain.py running under the symlinked python.
+#       This is the magic step.
+# 4. During interpreter initialization, because PYTHONEXECUTABLE is defined,
+#    sys.executable may get set to an unuseful value.
+#
+# (Note that the IDLE script and the setting of PYTHONEXECUTABLE is
+#  generated automatically by bundlebuilder in the Python 2.x build.
+#  Also, IDLE invoked via command line, i.e. bin/idle, bypasses all of
+#  this.)
+#
+# Now fix up the execution environment before importing idlelib.
+
+# Reset sys.executable to its normal value, the actual path of
+# the interpreter in the framework, by following the symlink
+# exported in PYTHONEXECUTABLE.
+pyex = os.environ['PYTHONEXECUTABLE']
+sys.executable = os.path.join(os.path.dirname(pyex), os.readlink(pyex))
+
+# Remove any sys.path entries for the Resources dir in the IDLE.app bundle.
+p = pyex.partition('.app')
+if p[2].startswith('/Contents/MacOS/Python'):
+    sys.path = [value for value in sys.path if
+            value.partition('.app') != (p[0], p[1], '/Contents/Resources')]
+
+# Unexport PYTHONEXECUTABLE so that the other Python processes started
+# by IDLE have a normal sys.executable.
+del os.environ['PYTHONEXECUTABLE']
 
 # Look for the -psn argument that the launcher adds and remove it, it will
 # only confuse the IDLE startup code.
@@ -25,6 +67,7 @@
         del sys.argv[idx]
         break
 
-#argvemulator.ArgvCollector().mainloop()
+# Now it is safe to import idlelib.
+from idlelib.PyShell import main
 if __name__ == '__main__':
     main()

Modified: python/branches/io-c/Mac/Makefile.in
==============================================================================
--- python/branches/io-c/Mac/Makefile.in	(original)
+++ python/branches/io-c/Mac/Makefile.in	Sat Feb 14 21:58:31 2009
@@ -49,7 +49,7 @@
 	checkapplepython install_pythonw install_versionedtools
 
 installapps4way: install_Python4way install_PythonLauncher \
-	install_IDLE install_pythonw4way install_versionedtools
+	install_IDLE4way install_pythonw4way install_versionedtools
 
 
 install_pythonw: pythonw
@@ -215,11 +215,33 @@
 
 install_IDLE:
 	test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
-	-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+	-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
 	/bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
-	ln -sf $(INSTALLED_PYTHONAPP) "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
+	ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
 	sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
 	sed "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`!g" < "$(srcdir)/IDLE/IDLE.app/Contents/Info.plist" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/Info.plist"
+	if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
+		/bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
+			"$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
+		sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
+			< "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
+			> "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
+		rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
+	fi
+	if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
+		/bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
+			"$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
+		sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
+			-e 's!<Alt-Key-!<Option-Key-!g' \
+			< "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
+			> "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
+		rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
+	fi
+	touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+
+install_IDLE4way: install_IDLE
+	ln -sf "$(INSTALLED_PYTHONAPP)-32" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
+	sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)-32!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
 	touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
 
 $(INSTALLED_PYTHONAPP): install_Python

Modified: python/branches/io-c/Misc/ACKS
==============================================================================
--- python/branches/io-c/Misc/ACKS	(original)
+++ python/branches/io-c/Misc/ACKS	Sat Feb 14 21:58:31 2009
@@ -152,6 +152,7 @@
 Drew Csillag
 John Cugini
 Tom Culliton
+Lisandro Dalcin
 Andrew Dalke
 Lars Damerow
 Eric Daniel
@@ -183,7 +184,7 @@
 Andy Dustman
 Gary Duzan
 Eugene Dvurechenski
-Josip Dzolonga 
+Josip Dzolonga
 Maxim Dzumanenko
 Walter Dörwald
 Hans Eckardt
@@ -234,6 +235,7 @@
 Ulisses Furquim
 Hagen Fürstenau
 Achim Gaedke
+Martin von Gagern
 Lele Gaifax
 Santiago Gala
 Yitzchak Gale

Modified: python/branches/io-c/Misc/NEWS
==============================================================================
--- python/branches/io-c/Misc/NEWS	(original)
+++ python/branches/io-c/Misc/NEWS	Sat Feb 14 21:58:31 2009
@@ -12,6 +12,15 @@
 Core and Builtins
 -----------------
 
+- Issue #5186: Reduce hash collisions for objects with no __hash__ method by
+  rotating the object pointer by 4 bits to the right.
+
+- Issue #4575: Fix Py_IS_INFINITY macro to work correctly on x87 FPUs:
+  it now forces its argument to double before testing for infinity.
+
+- Issue #5137: Make len() correctly raise a TypeError when a __len__ method
+  returns a non-number type.
+
 - Issue #5182: Removed memoryview.__str__.
 
 - Issue #1717: Removed builtin cmp() function, dropped tp_compare
@@ -157,6 +166,40 @@
 Library
 -------
 
+- Issue #5257: refactored all tests in distutils, so they use 
+  support.TempdirManager, to avoid writing in the tests directory.
+
+- Issue #4524: distutils build_script command failed with --with-suffix=3.
+  Initial patch by Amaury Forgeot d'Arc.
+
+- Issue #2461: added tests for distutils.util
+
+- Issue #4998: The memory saving effect of __slots__ had been lost on Fractions
+  which inherited from numbers.py which did not have __slots__ defined.  The
+  numbers hierarchy now has its own __slots__ declarations.
+
+- Issue #4631: Fix urlopen() result when an HTTP response uses chunked
+  encoding.
+
+- Issue #5203: Fixed ctypes segfaults when passing a unicode string to a
+  function without argtypes (only occurs if HAVE_USABLE_WCHAR_T is false).
+
+- Issue #3386: distutils.sysconfig.get_python_lib prefix argument was ignored
+  under NT and OS2. Patch by Philip Jenvey.
+
+- Issue #5128: Make compileall properly inspect bytecode to determine if needs
+  to be recreated. This avoids a timing hole thanks to the old reliance on the
+  ctime of the files involved.
+
+- Issue #5122: Synchronize tk load failure check to prevent a potential
+  deadlock.
+
+- Issue #1818: collections.namedtuple() now supports a keyword argument
+  'rename' which lets invalid fieldnames be automatically converted to
+  positional names in the form, _1, _2, ...
+
+- Issue #4890: Handle empty text search pattern in Tkinter.Text.search.
+
 - Issue #4512 (part 2): Promote ``ZipImporter._get_filename()`` to be a
   public documented method ``ZipImporter.get_filename()``.
 
@@ -213,6 +256,9 @@
 - Added a new itertools functions:  combinations_with_replacement()
   and compress().
 
+- Issue 5032:  added a step argument to itertools.count() and
+  allowed non-integer arguments.
+
 - Fix and properly document the multiprocessing module's logging
   support, expose the internal levels and provide proper usage
   examples.
@@ -415,6 +461,8 @@
 Build
 -----
 
+- Issue #5134: Silence compiler warnings when compiling sqlite with VC++.
+
 - Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows.
 
 - Issue #4895: Use _strdup on Windows CE.
@@ -443,6 +491,9 @@
 C-API
 -----
 
+- Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError
+  for negative arguments.  Previously, it raised TypeError.
+
 - Issue #4720: The format for PyArg_ParseTupleAndKeywords can begin with '|'.
 
 - Issue #3632: from the gdb debugger, the 'pyo' macro can now be called when
@@ -455,6 +506,10 @@
 Extension Modules
 -----------------
 
+- Issue #3745: Fix hashlib to always reject unicode and non buffer-api
+  supporting objects as input no matter how it was compiled (built in
+  implementations or external openssl library).
+
 - Issue #4397: Fix occasional test_socket failure on OS X.
 
 - Issue #4279: Fix build of parsermodule under Cygwin.

Modified: python/branches/io-c/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/io-c/Modules/_ctypes/callproc.c	(original)
+++ python/branches/io-c/Modules/_ctypes/callproc.c	Sat Feb 14 21:58:31 2009
@@ -645,14 +645,15 @@
 
 #ifdef CTYPES_UNICODE
 	if (PyUnicode_Check(obj)) {
-		pa->ffi_type = &ffi_type_pointer;
 #ifdef HAVE_USABLE_WCHAR_T
+		pa->ffi_type = &ffi_type_pointer;
 		pa->value.p = PyUnicode_AS_UNICODE(obj);
 		Py_INCREF(obj);
 		pa->keep = obj;
 		return 0;
 #else
 		int size = PyUnicode_GET_SIZE(obj);
+		pa->ffi_type = &ffi_type_pointer;
 		size += 1; /* terminating NUL */
 		size *= sizeof(wchar_t);
 		pa->value.p = PyMem_Malloc(size);

Modified: python/branches/io-c/Modules/_fileio.c
==============================================================================
--- python/branches/io-c/Modules/_fileio.c	(original)
+++ python/branches/io-c/Modules/_fileio.c	Sat Feb 14 21:58:31 2009
@@ -158,7 +158,7 @@
 {
 #if defined(HAVE_FSTAT)
 	struct stat buf;
-	if (fstat(fd, &buf) < 0 && errno == EBADF) {
+	if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) {
 		PyObject *exc;
 		char *msg = strerror(EBADF);
 		exc = PyObject_CallFunction(PyExc_OSError, "(is)",

Modified: python/branches/io-c/Modules/_hashopenssl.c
==============================================================================
--- python/branches/io-c/Modules/_hashopenssl.c	(original)
+++ python/branches/io-c/Modules/_hashopenssl.c	Sat Feb 14 21:58:31 2009
@@ -15,6 +15,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "hashlib.h"
 
 /* EVP is the preferred interface to hashing in OpenSSL */
 #include <openssl/evp.h>
@@ -203,28 +204,6 @@
     return retval;
 }
 
-#define MY_GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) do { \
-        if (PyUnicode_Check((obj))) { \
-            PyErr_SetString(PyExc_TypeError, \
-                            "Unicode-objects must be encoded before hashing");\
-            return NULL; \
-        } \
-        if (!PyObject_CheckBuffer((obj))) { \
-            PyErr_SetString(PyExc_TypeError, \
-                            "object supporting the buffer API required"); \
-            return NULL; \
-        } \
-        if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
-            return NULL; \
-        } \
-        if ((viewp)->ndim > 1) { \
-            PyErr_SetString(PyExc_BufferError, \
-                            "Buffer must be single dimension"); \
-            PyBuffer_Release((viewp)); \
-            return NULL; \
-        } \
-    } while(0);
-
 PyDoc_STRVAR(EVP_update__doc__,
 "Update this hash object's state with the provided string.");
 
@@ -237,7 +216,7 @@
     if (!PyArg_ParseTuple(args, "O:update", &obj))
         return NULL;
 
-    MY_GET_BUFFER_VIEW_OR_ERROUT(obj, &view);
+    GET_BUFFER_VIEW_OR_ERROUT(obj, &view);
 
 #ifdef WITH_THREAD
     if (self->lock == NULL && view.len >= HASHLIB_GIL_MINSIZE) {
@@ -344,7 +323,7 @@
     }
 
     if (data_obj)
-        MY_GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
 
     if (!PyArg_Parse(name_obj, "s", &nameStr)) {
         PyErr_SetString(PyExc_TypeError, "name must be a string");
@@ -507,7 +486,7 @@
     }
 
     if (data_obj)
-        MY_GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view);
 
     digest = EVP_get_digestbyname(name);
 
@@ -538,7 +517,7 @@
         } \
      \
         if (data_obj) \
-            MY_GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view); \
+            GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view); \
      \
         ret_obj = EVPnew( \
                     CONST_ ## NAME ## _name_obj, \

Modified: python/branches/io-c/Modules/_iobase.c
==============================================================================
--- python/branches/io-c/Modules/_iobase.c	(original)
+++ python/branches/io-c/Modules/_iobase.c	Sat Feb 14 21:58:31 2009
@@ -390,9 +390,6 @@
         return NULL;
     }
 
-    if (_PyIOBase_checkClosed(self, Py_True) == NULL)
-        return NULL;
-
     if (PyObject_HasAttrString(self, "peek"))
         has_peek = 1;
 

Modified: python/branches/io-c/Modules/_struct.c
==============================================================================
--- python/branches/io-c/Modules/_struct.c	(original)
+++ python/branches/io-c/Modules/_struct.c	Sat Feb 14 21:58:31 2009
@@ -1785,7 +1785,7 @@
 	assert( buffer_len >= 0 );
 
 	/* Extract the offset from the first argument */
-	offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1));
+	offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError);
 	if (offset == -1 && PyErr_Occurred())
 		return NULL;
 

Modified: python/branches/io-c/Modules/_tkinter.c
==============================================================================
--- python/branches/io-c/Modules/_tkinter.c	(original)
+++ python/branches/io-c/Modules/_tkinter.c	Sat Feb 14 21:58:31 2009
@@ -33,6 +33,8 @@
 #include <windows.h>
 #endif
 
+#include "tkinter.h"
+
 /* Allow using this code in Python 2.[12] */
 #ifndef PyDoc_STRVAR
 #define PyDoc_STRVAR(name,str) static char name[] = str
@@ -74,10 +76,8 @@
 #define CONST
 #endif
 
-#define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION)
-
-#if TKMAJORMINOR < 8002
-#error "Tk older than 8.2 not supported"
+#if TK_VERSION_HEX < 0x08030102
+#error "Tk older than 8.3.1 not supported"
 #endif
 
 /* Unicode conversion assumes that Tcl_UniChar is two bytes.
@@ -280,6 +280,9 @@
 static PyObject *valInCmd;
 static PyObject *trbInCmd;
 
+#ifdef TKINTER_PROTECT_LOADTK
+static int tk_load_failed;
+#endif
 
 
 static PyObject *
@@ -553,21 +556,35 @@
 int
 Tcl_AppInit(Tcl_Interp *interp)
 {
-	Tk_Window main;
 	const char * _tkinter_skip_tk_init;
 
 	if (Tcl_Init(interp) == TCL_ERROR) {
 		PySys_WriteStderr("Tcl_Init error: %s\n", Tcl_GetStringResult(interp));
 		return TCL_ERROR;
 	}
-	_tkinter_skip_tk_init =	Tcl_GetVar(interp, "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
-	if (_tkinter_skip_tk_init == NULL || strcmp(_tkinter_skip_tk_init, "1")	!= 0) {
-		main = Tk_MainWindow(interp);
-		if (Tk_Init(interp) == TCL_ERROR) {
-			PySys_WriteStderr("Tk_Init error: %s\n", Tcl_GetStringResult(interp));
-			return TCL_ERROR;
-		}
+
+	_tkinter_skip_tk_init = Tcl_GetVar(interp,
+			"_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
+	if (_tkinter_skip_tk_init != NULL &&
+			strcmp(_tkinter_skip_tk_init, "1") == 0) {
+		return TCL_OK;
+	}
+
+#ifdef TKINTER_PROTECT_LOADTK
+	if (tk_load_failed) {
+		PySys_WriteStderr("Tk_Init error: %s\n", TKINTER_LOADTK_ERRMSG);
+		return TCL_ERROR;
+	}
+#endif
+
+	if (Tk_Init(interp) == TCL_ERROR) {
+#ifdef TKINTER_PROTECT_LOADTK
+		tk_load_failed = 1;
+#endif
+		PySys_WriteStderr("Tk_Init error: %s\n", Tcl_GetStringResult(interp));
+		return TCL_ERROR;
 	}
+
 	return TCL_OK;
 }
 #endif /* !WITH_APPINIT */
@@ -650,8 +667,15 @@
 	ckfree(argv0);
 
 	if (! wantTk) {
-	    Tcl_SetVar(v->interp, "_tkinter_skip_tk_init", "1",	TCL_GLOBAL_ONLY);
+		Tcl_SetVar(v->interp,
+				"_tkinter_skip_tk_init", "1", TCL_GLOBAL_ONLY);
 	}
+#ifdef TKINTER_PROTECT_LOADTK
+	else if (tk_load_failed) {
+		Tcl_SetVar(v->interp,
+				"_tkinter_tk_failed", "1", TCL_GLOBAL_ONLY);
+	}
+#endif
 
 	/* some initial arguments need to be in argv */
 	if (sync || use) {
@@ -686,6 +710,18 @@
 
 	if (Tcl_AppInit(v->interp) != TCL_OK) {
 		PyObject *result = Tkinter_Error((PyObject *)v);
+#ifdef TKINTER_PROTECT_LOADTK
+		if (wantTk) {
+			const char *_tkinter_tk_failed;
+			_tkinter_tk_failed = Tcl_GetVar(v->interp,
+					"_tkinter_tk_failed", TCL_GLOBAL_ONLY);
+
+			if ( _tkinter_tk_failed != NULL &&
+					strcmp(_tkinter_tk_failed, "1") == 0) {
+				tk_load_failed = 1;
+			}
+		}
+#endif
 		Py_DECREF((PyObject *)v);
 		return (TkappObject *)result;
 	}
@@ -2547,22 +2583,21 @@
 static PyObject	*
 Tkapp_TkInit(PyObject *self, PyObject *args)
 {
-	static int has_failed;
 	Tcl_Interp *interp = Tkapp_Interp(self);
-	Tk_Window main_window;
 	const char * _tk_exists = NULL;
 	int err;
-	main_window = Tk_MainWindow(interp);
 
-	/* In all current versions of Tk (including 8.4.13), Tk_Init
-	   deadlocks on the second call when the first call failed.
-	   To avoid the deadlock, we just refuse the second call through
-	   a static variable. */
-	if (has_failed) {
-		PyErr_SetString(Tkinter_TclError,
-				"Calling Tk_Init again after a previous call failed might deadlock");
+#ifdef TKINTER_PROTECT_LOADTK
+	/* Up to Tk 8.4.13, Tk_Init deadlocks on the second call when the
+	 * first call failed.
+	 * To avoid the deadlock, we just refuse the second call through
+	 * a static variable.
+	 */
+	if (tk_load_failed) {
+		PyErr_SetString(Tkinter_TclError, TKINTER_LOADTK_ERRMSG);
 		return NULL;
 	}
+#endif
 
 	/* We want to guard against calling Tk_Init() multiple times */
 	CHECK_TCL_APPARTMENT;
@@ -2582,8 +2617,10 @@
 	}
 	if (_tk_exists == NULL || strcmp(_tk_exists, "1") != 0)	{
 		if (Tk_Init(interp)	== TCL_ERROR) {
-		        PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
-			has_failed = 1;
+			PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
+#ifdef TKINTER_PROTECT_LOADTK
+			tk_load_failed = 1;
+#endif
 			return NULL;
 		}
 	}

Modified: python/branches/io-c/Modules/getpath.c
==============================================================================
--- python/branches/io-c/Modules/getpath.c	(original)
+++ python/branches/io-c/Modules/getpath.c	Sat Feb 14 21:58:31 2009
@@ -457,6 +457,7 @@
 #else
     unsigned long nsexeclength = MAXPATHLEN;
 #endif
+	char execpath[MAXPATHLEN+1];
 #endif
 
     if (_path) {
@@ -486,8 +487,13 @@
       * will fail if a relative path was used. but in that case,
       * absolutize() should help us out below
       */
-     else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP)
-       ;
+	else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && execpath[0] == SEP) {
+		size_t r = mbstowcs(progpath, execpath, MAXPATHLEN+1);
+		if (r == (size_t)-1 || r > MAXPATHLEN) {
+			/* Could not convert execpath, or it's too long. */
+			progpath[0] = '\0';
+		}
+	}
 #endif /* __APPLE__ */
 	else if (path) {
 		while (1) {

Modified: python/branches/io-c/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/io-c/Modules/itertoolsmodule.c	(original)
+++ python/branches/io-c/Modules/itertoolsmodule.c	Sat Feb 14 21:58:31 2009
@@ -1791,6 +1791,9 @@
 The leftmost iterators are in the outermost for-loop, so the output tuples\n\
 cycle in a manner similar to an odometer (with the rightmost element changing\n\
 on every iteration).\n\n\
+To compute the product of an iterable with itself, specify the number\n\
+of repetitions with the optional repeat keyword argument. For example,\n\
+product(A, repeat=4) means the same as product(A, A, A, A).\n\n\
 product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)\n\
 product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ...");
 
@@ -2883,9 +2886,27 @@
 typedef struct {
 	PyObject_HEAD
 	Py_ssize_t cnt;
-	PyObject *long_cnt;	/* Arbitrarily large count when cnt >= PY_SSIZE_T_MAX */
+	PyObject *long_cnt;
+	PyObject *long_step;
 } countobject;
 
+/* Counting logic and invariants:
+
+C_add_mode:  when cnt an integer < PY_SSIZE_T_MAX and no step is specified.
+
+	assert(cnt != PY_SSIZE_T_MAX && long_cnt == NULL && long_step==PyInt(1));
+	Advances with:  cnt += 1
+	When count hits Y_SSIZE_T_MAX, switch to Py_add_mode.
+
+Py_add_mode:  when cnt == PY_SSIZE_T_MAX, step is not int(1), or cnt is a float.
+
+	assert(cnt == PY_SSIZE_T_MAX && long_cnt != NULL && long_step != NULL);
+	All counting is done with python objects (no overflows or underflows).
+	Advances with:  long_cnt += long_step
+	Step may be zero -- effectively a slow version of repeat(cnt).
+	Either long_cnt or long_step may be a float.
+*/
+
 static PyTypeObject count_type;
 
 static PyObject *
@@ -2893,28 +2914,44 @@
 {
 	countobject *lz;
 	Py_ssize_t cnt = 0;
-	PyObject *cnt_arg = NULL;
 	PyObject *long_cnt = NULL;
+	PyObject *long_step = NULL;
+	static char *kwlist[] = {"start", "step", 0};
 
-	if (type == &count_type && !_PyArg_NoKeywords("count()", kwds))
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:count",
+			kwlist, &long_cnt, &long_step))
 		return NULL;
 
-	if (!PyArg_UnpackTuple(args, "count", 0, 1, &cnt_arg))
-		return NULL;
+	if (long_cnt != NULL && !PyNumber_Check(long_cnt) ||
+		long_step != NULL && !PyNumber_Check(long_step)) {
+			PyErr_SetString(PyExc_TypeError, "a number is required");
+			return NULL;
+	}
 
-	if (cnt_arg != NULL) {
-		cnt = PyLong_AsSsize_t(cnt_arg);
-		if (cnt == -1 && PyErr_Occurred()) {
+	if (long_step == NULL) {
+		/* If not specified, step defaults to 1 */
+		long_step = PyLong_FromLong(1);
+		if (long_step == NULL)
+			return NULL;
+	} else
+		Py_INCREF(long_step);
+	assert(long_step != NULL);
+
+	if (long_cnt != NULL) {
+		cnt = PyLong_AsSsize_t(long_cnt);
+		if ((cnt == -1 && PyErr_Occurred()) || 
+				!PyIndex_Check(long_cnt)  || 
+				!PyLong_Check(long_step) ||
+				PyLong_AS_LONG(long_step) != 1) {
+			/* Switch to Py_add_mode */
 			PyErr_Clear();
-			if (!PyLong_Check(cnt_arg)) {
-				PyErr_SetString(PyExc_TypeError, "an integer is required");
-				return NULL;
-			}
-			long_cnt = cnt_arg;
 			Py_INCREF(long_cnt);
 			cnt = PY_SSIZE_T_MAX;
-		}
+		} else
+			long_cnt = NULL;
 	}
+	assert(cnt != PY_SSIZE_T_MAX && long_cnt == NULL ||
+		   cnt == PY_SSIZE_T_MAX && long_cnt != NULL);
 
 	/* create countobject structure */
 	lz = (countobject *)PyObject_New(countobject, &count_type);
@@ -2924,6 +2961,7 @@
 	}
 	lz->cnt = cnt;
 	lz->long_cnt = long_cnt;
+	lz->long_step = long_step;
 
 	return (PyObject *)lz;
 }
@@ -2931,7 +2969,8 @@
 static void
 count_dealloc(countobject *lz)
 {
-	Py_XDECREF(lz->long_cnt); 
+	Py_XDECREF(lz->long_cnt);
+	Py_XDECREF(lz->long_step);
 	PyObject_Del(lz);
 }
 
@@ -2939,32 +2978,29 @@
 count_nextlong(countobject *lz)
 {
 	static PyObject *one = NULL;
-	PyObject *cnt;
+	PyObject *long_cnt;
 	PyObject *stepped_up;
 
-	if (lz->long_cnt == NULL) {
-		lz->long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
-		if (lz->long_cnt == NULL)
-			return NULL;
-	}
-	if (one == NULL) {
-		one = PyLong_FromLong(1);
-		if (one == NULL)
+	long_cnt = lz->long_cnt;
+	if (long_cnt == NULL) {
+		/* Switch to Py_add_mode */
+		long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
+		if (long_cnt == NULL)
 			return NULL;
 	}
-	cnt = lz->long_cnt;
-	assert(cnt != NULL);
-	stepped_up = PyNumber_Add(cnt, one);
+	assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL);
+
+	stepped_up = PyNumber_Add(long_cnt, lz->long_step);
 	if (stepped_up == NULL)
 		return NULL;
 	lz->long_cnt = stepped_up;
-	return cnt;
+	return long_cnt;
 }
 
 static PyObject *
 count_next(countobject *lz)
 {
-        if (lz->cnt == PY_SSIZE_T_MAX)
+	if (lz->cnt == PY_SSIZE_T_MAX)
 		return count_nextlong(lz);
 	return PyLong_FromSsize_t(lz->cnt++);
 }
@@ -2972,17 +3008,34 @@
 static PyObject *
 count_repr(countobject *lz)
 {
-        if (lz->cnt != PY_SSIZE_T_MAX)
+	if (lz->cnt != PY_SSIZE_T_MAX)
 		return PyUnicode_FromFormat("count(%zd)", lz->cnt);
 
-	return PyUnicode_FromFormat("count(%R)", lz->long_cnt);
+	if (PyLong_Check(lz->long_step)) {
+		long step = PyLong_AsLong(lz->long_step);
+		if (step == -1 && PyErr_Occurred()) {
+			PyErr_Clear();
+		}
+		if (step == 1) {
+			/* Don't display step when it is an integer equal to 1 */
+			return PyUnicode_FromFormat("count(%R)", lz->long_cnt);
+		}
+	}
+	return PyUnicode_FromFormat("count(%R, %R)",
+								lz->long_cnt, lz->long_step);
 }
 
 PyDoc_STRVAR(count_doc,
-"count([firstval]) --> count object\n\
+			 "count([start[, step]]) --> count object\n\
 \n\
 Return a count object whose .__next__() method returns consecutive\n\
-integers starting from zero or, if specified, from firstval.");
+integers starting from zero or, if specified, from start.\n\
+If step is specified, counts by that interval.  Equivalent to:\n\n\
+    def count(firstval=0, step=1):\n\
+        x = firstval\n\
+        while 1:\n\
+            yield x\n\
+            x += step\n");
 
 static PyTypeObject count_type = {
 	PyVarObject_HEAD_INIT(NULL, 0)

Modified: python/branches/io-c/Modules/main.c
==============================================================================
--- python/branches/io-c/Modules/main.c	(original)
+++ python/branches/io-c/Modules/main.c	Sat Feb 14 21:58:31 2009
@@ -487,10 +487,23 @@
 	   so the actual executable path is passed in an environment variable.
 	   See Lib/plat-mac/bundlebuiler.py for details about the bootstrap
 	   script. */
-	if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0')
-		Py_SetProgramName(p);
-	else
+	if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') {
+		wchar_t* buffer;
+		size_t len = strlen(p);
+		size_t r;
+
+		buffer = malloc(len * sizeof(wchar_t));
+		if (buffer == NULL) {
+			Py_FatalError(
+			   "not enough memory to copy PYTHONEXECUTABLE");
+		}
+
+		r = mbstowcs(buffer, p, len);
+		Py_SetProgramName(buffer);
+		/* buffer is now handed off - do not free */
+	} else {
 		Py_SetProgramName(argv[0]);
+	}
 #else
 	Py_SetProgramName(argv[0]);
 #endif

Modified: python/branches/io-c/Modules/md5module.c
==============================================================================
--- python/branches/io-c/Modules/md5module.c	(original)
+++ python/branches/io-c/Modules/md5module.c	Sat Feb 14 21:58:31 2009
@@ -17,6 +17,7 @@
 /* MD5 objects */
 
 #include "Python.h"
+#include "hashlib.h"
 
 
 /* Some useful types */
@@ -411,11 +412,14 @@
 static PyObject *
 MD5_update(MD5object *self, PyObject *args)
 {
+    PyObject *obj;
     Py_buffer buf;
  
-    if (!PyArg_ParseTuple(args, "s*:update", &buf))
+    if (!PyArg_ParseTuple(args, "O:update", &obj))
         return NULL;
 
+    GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
+
     md5_process(&self->hash_state, buf.buf, buf.len);
 
     PyBuffer_Release(&buf);
@@ -511,14 +515,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     MD5object *new;
+    PyObject *data_obj = NULL;
     Py_buffer buf;
-    buf.buf = NULL;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist,
-                                     &buf)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newMD5object()) == NULL)
         return NULL;
 
@@ -528,7 +535,7 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (buf.buf) {
+    if (data_obj) {
         md5_process(&new->hash_state, buf.buf, buf.len);
 	PyBuffer_Release(&buf);
     }

Modified: python/branches/io-c/Modules/sha1module.c
==============================================================================
--- python/branches/io-c/Modules/sha1module.c	(original)
+++ python/branches/io-c/Modules/sha1module.c	Sat Feb 14 21:58:31 2009
@@ -17,6 +17,7 @@
 /* SHA1 objects */
 
 #include "Python.h"
+#include "hashlib.h"
 
 
 /* Some useful types */
@@ -387,11 +388,14 @@
 static PyObject *
 SHA1_update(SHA1object *self, PyObject *args)
 {
+    PyObject *obj;
     Py_buffer buf;
 
-    if (!PyArg_ParseTuple(args, "s*:update", &buf))
+    if (!PyArg_ParseTuple(args, "O:update", &obj))
         return NULL;
 
+    GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
+
     sha1_process(&self->hash_state, buf.buf, buf.len);
 
     PyBuffer_Release(&buf);
@@ -487,14 +491,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     SHA1object *new;
+    PyObject *data_obj = NULL;
     Py_buffer buf;
-    buf.buf = NULL;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist,
-                                     &buf)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newSHA1object()) == NULL)
         return NULL;
 
@@ -504,7 +511,7 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (buf.buf) {
+    if (data_obj) {
         sha1_process(&new->hash_state, buf.buf, buf.len);
 	PyBuffer_Release(&buf);
     }

Modified: python/branches/io-c/Modules/sha256module.c
==============================================================================
--- python/branches/io-c/Modules/sha256module.c	(original)
+++ python/branches/io-c/Modules/sha256module.c	Sat Feb 14 21:58:31 2009
@@ -18,6 +18,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "hashlib.h"
 
 
 /* Endianness testing and definitions */
@@ -480,14 +481,17 @@
 static PyObject *
 SHA256_update(SHAobject *self, PyObject *args)
 {
-    unsigned char *cp;
-    int len;
+    PyObject *obj;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
+    if (!PyArg_ParseTuple(args, "O:update", &obj))
         return NULL;
 
-    sha_update(self, cp, len);
+    GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
 
+    sha_update(self, buf.buf, buf.len);
+
+    PyBuffer_Release(&buf);
     Py_INCREF(Py_None);
     return Py_None;
 }
@@ -614,14 +618,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     SHAobject *new;
-    unsigned char *cp = NULL;
-    int len;
+    PyObject *data_obj = NULL;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
-                                     &cp, &len)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newSHA256object()) == NULL)
         return NULL;
 
@@ -631,8 +638,10 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (cp)
-        sha_update(new, cp, len);
+    if (data_obj) {
+        sha_update(new, buf.buf, buf.len);
+        PyBuffer_Release(&buf);
+    }
 
     return (PyObject *)new;
 }
@@ -645,14 +654,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     SHAobject *new;
-    unsigned char *cp = NULL;
-    int len;
+    PyObject *data_obj = NULL;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
-                                     &cp, &len)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newSHA224object()) == NULL)
         return NULL;
 
@@ -662,8 +674,10 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (cp)
-        sha_update(new, cp, len);
+    if (data_obj) {
+        sha_update(new, buf.buf, buf.len);
+        PyBuffer_Release(&buf);
+    }
 
     return (PyObject *)new;
 }

Modified: python/branches/io-c/Modules/sha512module.c
==============================================================================
--- python/branches/io-c/Modules/sha512module.c	(original)
+++ python/branches/io-c/Modules/sha512module.c	Sat Feb 14 21:58:31 2009
@@ -18,6 +18,7 @@
 
 #include "Python.h"
 #include "structmember.h"
+#include "hashlib.h"
 
 #ifdef PY_LONG_LONG /* If no PY_LONG_LONG, don't compile anything! */
 
@@ -546,14 +547,17 @@
 static PyObject *
 SHA512_update(SHAobject *self, PyObject *args)
 {
-    unsigned char *cp;
-    int len;
+    PyObject *obj;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
+    if (!PyArg_ParseTuple(args, "O:update", &obj))
         return NULL;
 
-    sha512_update(self, cp, len);
+    GET_BUFFER_VIEW_OR_ERROUT(obj, &buf);
 
+    sha512_update(self, buf.buf, buf.len);
+
+    PyBuffer_Release(&buf);
     Py_INCREF(Py_None);
     return Py_None;
 }
@@ -680,14 +684,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     SHAobject *new;
-    unsigned char *cp = NULL;
-    int len;
+    PyObject *data_obj = NULL;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
-                                     &cp, &len)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newSHA512object()) == NULL)
         return NULL;
 
@@ -697,8 +704,10 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (cp)
-        sha512_update(new, cp, len);
+    if (data_obj) {
+        sha512_update(new, buf.buf, buf.len);
+        PyBuffer_Release(&buf);
+    }
 
     return (PyObject *)new;
 }
@@ -711,14 +720,17 @@
 {
     static char *kwlist[] = {"string", NULL};
     SHAobject *new;
-    unsigned char *cp = NULL;
-    int len;
+    PyObject *data_obj = NULL;
+    Py_buffer buf;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
-                                     &cp, &len)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|O:new", kwlist,
+                                     &data_obj)) {
         return NULL;
     }
 
+    if (data_obj)
+        GET_BUFFER_VIEW_OR_ERROUT(data_obj, &buf);
+
     if ((new = newSHA384object()) == NULL)
         return NULL;
 
@@ -728,8 +740,10 @@
         Py_DECREF(new);
         return NULL;
     }
-    if (cp)
-        sha512_update(new, cp, len);
+    if (data_obj) {
+        sha512_update(new, buf.buf, buf.len);
+        PyBuffer_Release(&buf);
+    }
 
     return (PyObject *)new;
 }

Modified: python/branches/io-c/Modules/socketmodule.c
==============================================================================
--- python/branches/io-c/Modules/socketmodule.c	(original)
+++ python/branches/io-c/Modules/socketmodule.c	Sat Feb 14 21:58:31 2009
@@ -3567,8 +3567,11 @@
 #endif
 
 #if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK)
+#if (SIZEOF_INT != 4)
+#error "Not sure if in_addr_t exists and int is not 32-bits."
+#endif
 	/* Have to use inet_addr() instead */
-	unsigned long packed_addr;
+	unsigned int packed_addr;
 #endif
 	char *ip_addr;
 
@@ -5090,7 +5093,10 @@
 inet_pton(int af, const char *src, void *dst)
 {
 	if (af == AF_INET) {
-		long packed_addr;
+#if (SIZEOF_INT != 4)
+#error "Not sure if in_addr_t exists and int is not 32-bits."
+#endif
+		unsigned int packed_addr;
 		packed_addr = inet_addr(src);
 		if (packed_addr == INADDR_NONE)
 			return 0;

Modified: python/branches/io-c/Modules/testcapi_long.h
==============================================================================
--- python/branches/io-c/Modules/testcapi_long.h	(original)
+++ python/branches/io-c/Modules/testcapi_long.h	Sat Feb 14 21:58:31 2009
@@ -97,6 +97,10 @@
 		if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
 			return error(
 				"PyLong_AsUnsignedXXX(-1) didn't complain");
+		if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+			return error(
+				"PyLong_AsUnsignedXXX(-1) raised "
+				"something other than OverflowError");
 		PyErr_Clear();
 		UNBIND(x);
 
@@ -112,11 +116,15 @@
 			return error(
 				"unexpected NULL from PyNumber_Lshift");
 
-  		uout = F_PY_TO_U(x);
+		uout = F_PY_TO_U(x);
 		if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
 			return error(
 				"PyLong_AsUnsignedXXX(2**NBITS) didn't "
 				"complain");
+		if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+			return error(
+				"PyLong_AsUnsignedXXX(2**NBITS) raised "
+				"something other than OverflowError");
 		PyErr_Clear();
 
 		/* Signed complains about 2**(NBITS-1)?
@@ -132,6 +140,10 @@
 			return error(
 				"PyLong_AsXXX(2**(NBITS-1)) didn't "
 				"complain");
+		if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+			return error(
+				"PyLong_AsXXX(2**(NBITS-1)) raised "
+				"something other than OverflowError");
 		PyErr_Clear();
 
 		/* Signed complains about -2**(NBITS-1)-1?;
@@ -153,6 +165,10 @@
 			return error(
 				"PyLong_AsXXX(-2**(NBITS-1)-1) didn't "
 				"complain");
+		if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+			return error(
+				"PyLong_AsXXX(-2**(NBITS-1)-1) raised "
+				"something other than OverflowError");
 		PyErr_Clear();
 		UNBIND(y);
 

Modified: python/branches/io-c/Modules/tkappinit.c
==============================================================================
--- python/branches/io-c/Modules/tkappinit.c	(original)
+++ python/branches/io-c/Modules/tkappinit.c	Sat Feb 14 21:58:31 2009
@@ -16,11 +16,21 @@
 #include <tcl.h>
 #include <tk.h>
 
+#include "tkinter.h"
+
+#ifdef TKINTER_PROTECT_LOADTK
+/* See Tkapp_TkInit in _tkinter.c for the usage of tk_load_faile */
+static int tk_load_failed;
+#endif
+
 int
 Tcl_AppInit(Tcl_Interp *interp)
 {
 	Tk_Window main_window;
-	const char * _tkinter_skip_tk_init;
+	const char *_tkinter_skip_tk_init;
+#ifdef TKINTER_PROTECT_LOADTK
+	const char *_tkinter_tk_failed;
+#endif
 
 #ifdef TK_AQUA
 #ifndef MAX_PATH_LEN
@@ -74,12 +84,32 @@
 		/* Initialize modules that don't require Tk */
 #endif
 
-	_tkinter_skip_tk_init =	Tcl_GetVar(interp, "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
-	if (_tkinter_skip_tk_init != NULL && strcmp(_tkinter_skip_tk_init, "1")	== 0) {
+	_tkinter_skip_tk_init =	Tcl_GetVar(interp,
+			"_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
+	if (_tkinter_skip_tk_init != NULL &&
+			strcmp(_tkinter_skip_tk_init, "1") == 0) {
 		return TCL_OK;
 	}
-	if (Tk_Init(interp) == TCL_ERROR)
+
+#ifdef TKINTER_PROTECT_LOADTK
+	_tkinter_tk_failed = Tcl_GetVar(interp,
+			"_tkinter_tk_failed", TCL_GLOBAL_ONLY);
+
+	if (tk_load_failed || (
+				_tkinter_tk_failed != NULL &&
+				strcmp(_tkinter_tk_failed, "1") == 0)) {
+		Tcl_SetResult(interp, TKINTER_LOADTK_ERRMSG, TCL_STATIC);
 		return TCL_ERROR;
+	}
+#endif
+
+	if (Tk_Init(interp) == TCL_ERROR) {
+#ifdef TKINTER_PROTECT_LOADTK
+		tk_load_failed = 1;
+		Tcl_SetVar(interp, "_tkinter_tk_failed", "1", TCL_GLOBAL_ONLY);
+#endif
+		return TCL_ERROR;
+	}
 
 	main_window = Tk_MainWindow(interp);
 

Modified: python/branches/io-c/Objects/exceptions.c
==============================================================================
--- python/branches/io-c/Objects/exceptions.c	(original)
+++ python/branches/io-c/Objects/exceptions.c	Sat Feb 14 21:58:31 2009
@@ -1776,28 +1776,6 @@
     if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \
         Py_FatalError("Module dictionary insertion problem.");
 
-#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
-/* crt variable checking in VisualStudio .NET 2005 */
-#include <crtdbg.h>
-
-static int	prevCrtReportMode;
-static _invalid_parameter_handler	prevCrtHandler;
-
-/* Invalid parameter handler.  Sets a ValueError exception */
-static void
-InvalidParameterHandler(
-    const wchar_t * expression,
-    const wchar_t * function,
-    const wchar_t * file,
-    unsigned int line,
-    uintptr_t pReserved)
-{
-    /* Do nothing, allow execution to continue.  Usually this
-     * means that the CRT will set errno to EINVAL
-     */
-}
-#endif
-
 
 void
 _PyExc_Init(void)
@@ -1949,13 +1927,6 @@
     }
 
     Py_DECREF(bltinmod);
-
-#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
-    /* Set CRT argument error handler */
-    prevCrtHandler = _set_invalid_parameter_handler(InvalidParameterHandler);
-    /* turn off assertions in debug mode */
-    prevCrtReportMode = _CrtSetReportMode(_CRT_ASSERT, 0);
-#endif
 }
 
 void
@@ -1963,9 +1934,4 @@
 {
     Py_XDECREF(PyExc_MemoryErrorInst);
     PyExc_MemoryErrorInst = NULL;
-#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
-    /* reset CRT error handling */
-    _set_invalid_parameter_handler(prevCrtHandler);
-    _CrtSetReportMode(_CRT_ASSERT, prevCrtReportMode);
-#endif
 }

Modified: python/branches/io-c/Objects/longobject.c
==============================================================================
--- python/branches/io-c/Objects/longobject.c	(original)
+++ python/branches/io-c/Objects/longobject.c	Sat Feb 14 21:58:31 2009
@@ -786,7 +786,7 @@
 	if (Py_SIZE(v) < 0) {
 		ndigits = -(Py_SIZE(v));
 		if (!is_signed) {
-			PyErr_SetString(PyExc_TypeError,
+			PyErr_SetString(PyExc_OverflowError,
 				"can't convert negative int to unsigned");
 			return -1;
 		}

Modified: python/branches/io-c/Objects/object.c
==============================================================================
--- python/branches/io-c/Objects/object.c	(original)
+++ python/branches/io-c/Objects/object.c	Sat Feb 14 21:58:31 2009
@@ -699,23 +699,15 @@
 long
 _Py_HashPointer(void *p)
 {
-#if SIZEOF_LONG >= SIZEOF_VOID_P
-	return (long)p;
-#else
-	/* convert to a Python long and hash that */
-	PyObject* longobj;
 	long x;
-
-	if ((longobj = PyLong_FromVoidPtr(p)) == NULL) {
-		x = -1;
-		goto finally;
-	}
-	x = PyObject_Hash(longobj);
-
-finally:
-	Py_XDECREF(longobj);
+	size_t y = (size_t)p;
+	/* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
+	   excessive hash collisions for dicts and sets */
+	y = (y >> 4) | (y << (8 * SIZEOF_VOID_P - 4));
+	x = (long)y;
+	if (x == -1)
+		x = -2;
 	return x;
-#endif
 }
 
 long

Modified: python/branches/io-c/Objects/typeobject.c
==============================================================================
--- python/branches/io-c/Objects/typeobject.c	(original)
+++ python/branches/io-c/Objects/typeobject.c	Sat Feb 14 21:58:31 2009
@@ -4618,7 +4618,7 @@
 
 	if (res == NULL)
 		return -1;
-	len = PyLong_AsSsize_t(res);
+	len = PyNumber_AsSsize_t(res, PyExc_OverflowError);
 	Py_DECREF(res);
 	if (len < 0) {
 		if (!PyErr_Occurred())

Modified: python/branches/io-c/PC/VC6/_multiprocessing.dsp
==============================================================================
--- python/branches/io-c/PC/VC6/_multiprocessing.dsp	(original)
+++ python/branches/io-c/PC/VC6/_multiprocessing.dsp	Sat Feb 14 21:58:31 2009
@@ -1,115 +1,115 @@
-# Microsoft Developer Studio Project File - Name="_multiprocessing" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=_multiprocessing - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "_multiprocessing.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "_multiprocessing.mak" CFG="_multiprocessing - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "_multiprocessing - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "_multiprocessing - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "_multiprocessing"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "_multiprocessing - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "."
-# PROP Intermediate_Dir "x86-temp-release\_multiprocessing"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-F90=df.exe
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_multiprocessing.pyd"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "_multiprocessing - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir "x86-temp-debug\_multiprocessing"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-F90=df.exe
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1d0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_multiprocessing_d.pyd" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF 
-
-# Begin Target
-
-# Name "_multiprocessing - Win32 Release"
-# Name "_multiprocessing - Win32 Debug"
-# Begin Source File
-
-SOURCE=..\..\Modules\_multiprocessing\multiprocessing.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Modules\_multiprocessing\pipe_connection.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Modules\_multiprocessing\semaphore.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Modules\_multiprocessing\socket_connection.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Modules\_multiprocessing\win32_functions.c
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="_multiprocessing" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=_multiprocessing - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "_multiprocessing.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "_multiprocessing.mak" CFG="_multiprocessing - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "_multiprocessing - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "_multiprocessing - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "_multiprocessing"
+# PROP Scc_LocalPath ".."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "_multiprocessing - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "x86-temp-release\_multiprocessing"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+F90=df.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_multiprocessing.pyd"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "_multiprocessing - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "x86-temp-debug\_multiprocessing"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+F90=df.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1d0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_multiprocessing_d.pyd" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "_multiprocessing - Win32 Release"
+# Name "_multiprocessing - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\Modules\_multiprocessing\multiprocessing.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Modules\_multiprocessing\pipe_connection.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Modules\_multiprocessing\semaphore.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Modules\_multiprocessing\socket_connection.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Modules\_multiprocessing\win32_functions.c
+# End Source File
+# End Target
+# End Project

Modified: python/branches/io-c/PC/VC6/build_tkinter.py
==============================================================================
--- python/branches/io-c/PC/VC6/build_tkinter.py	(original)
+++ python/branches/io-c/PC/VC6/build_tkinter.py	Sat Feb 14 21:58:31 2009
@@ -1,81 +1,81 @@
-import os
-import sys
-import subprocess
-
-TCL_MAJOR = 8
-TCL_MINOR = 5
-TCL_PATCH = 2
-
-TIX_MAJOR = 8
-TIX_MINOR = 4
-TIX_PATCH = 3
-
-def abspath(name):
-    par = os.path.pardir
-    return os.path.abspath(os.path.join(__file__, par, par, par, par, name))
-
-TCL_DIR = abspath("tcl%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
-TK_DIR  = abspath("tk%d.%d.%d"  % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
-TIX_DIR = abspath("tix%d.%d.%d" % (TIX_MAJOR, TIX_MINOR, TIX_PATCH))
-OUT_DIR = abspath("tcltk")
-
-def have_args(*a):
-    return any(s in sys.argv[1:] for s in a)
-
-def enter(dir):
-    os.chdir(os.path.join(dir, "win"))
-
-def main():
-    debug = have_args("-d", "--debug")
-    clean = have_args("clean")
-    install = have_args("install")
-    tcl = have_args("tcl")
-    tk = have_args("tk")
-    tix = have_args("tix")
-    if not(tcl) and not(tk) and not(tix):
-        tcl = tk = tix = True
-
-    def nmake(makefile, *a):
-        args = ["nmake", "/nologo", "/f", makefile, "DEBUG=%d" % debug]
-        args.extend(a)
-        subprocess.check_call(args)
-
-    if tcl:
-        enter(TCL_DIR)
-        def nmake_tcl(*a):
-            nmake("makefile.vc", *a)
-        if clean:
-            nmake_tcl("clean")
-        elif install:
-            nmake_tcl("install", "INSTALLDIR=" + OUT_DIR)
-        else:
-            nmake_tcl()
-
-    if tk:
-        enter(TK_DIR)
-        def nmake_tk(*a):
-            nmake("makefile.vc", "TCLDIR=" + TCL_DIR, *a)
-        if clean:
-            nmake_tk("clean")
-        elif install:
-            nmake_tk("install", "INSTALLDIR=" + OUT_DIR)
-        else:
-            nmake_tk()
-
-    if tix:
-        enter(TIX_DIR)
-        def nmake_tix(*a):
-            nmake("python.mak",
-                  "TCL_MAJOR=%d" % TCL_MAJOR,
-                  "TCL_MINOR=%d" % TCL_MINOR,
-                  "TCL_PATCH=%d" % TCL_PATCH,
-                  "MACHINE=IX86", *a)
-        if clean:
-            nmake_tix("clean")
-        elif install:
-            nmake_tix("install", "INSTALL_DIR=" + OUT_DIR)
-        else:
-            nmake_tix()
-
-if __name__ == '__main__':
-    main()
+import os
+import sys
+import subprocess
+
+TCL_MAJOR = 8
+TCL_MINOR = 5
+TCL_PATCH = 2
+
+TIX_MAJOR = 8
+TIX_MINOR = 4
+TIX_PATCH = 3
+
+def abspath(name):
+    par = os.path.pardir
+    return os.path.abspath(os.path.join(__file__, par, par, par, par, name))
+
+TCL_DIR = abspath("tcl%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
+TK_DIR  = abspath("tk%d.%d.%d"  % (TCL_MAJOR, TCL_MINOR, TCL_PATCH))
+TIX_DIR = abspath("tix%d.%d.%d" % (TIX_MAJOR, TIX_MINOR, TIX_PATCH))
+OUT_DIR = abspath("tcltk")
+
+def have_args(*a):
+    return any(s in sys.argv[1:] for s in a)
+
+def enter(dir):
+    os.chdir(os.path.join(dir, "win"))
+
+def main():
+    debug = have_args("-d", "--debug")
+    clean = have_args("clean")
+    install = have_args("install")
+    tcl = have_args("tcl")
+    tk = have_args("tk")
+    tix = have_args("tix")
+    if not(tcl) and not(tk) and not(tix):
+        tcl = tk = tix = True
+
+    def nmake(makefile, *a):
+        args = ["nmake", "/nologo", "/f", makefile, "DEBUG=%d" % debug]
+        args.extend(a)
+        subprocess.check_call(args)
+
+    if tcl:
+        enter(TCL_DIR)
+        def nmake_tcl(*a):
+            nmake("makefile.vc", *a)
+        if clean:
+            nmake_tcl("clean")
+        elif install:
+            nmake_tcl("install", "INSTALLDIR=" + OUT_DIR)
+        else:
+            nmake_tcl()
+
+    if tk:
+        enter(TK_DIR)
+        def nmake_tk(*a):
+            nmake("makefile.vc", "TCLDIR=" + TCL_DIR, *a)
+        if clean:
+            nmake_tk("clean")
+        elif install:
+            nmake_tk("install", "INSTALLDIR=" + OUT_DIR)
+        else:
+            nmake_tk()
+
+    if tix:
+        enter(TIX_DIR)
+        def nmake_tix(*a):
+            nmake("python.mak",
+                  "TCL_MAJOR=%d" % TCL_MAJOR,
+                  "TCL_MINOR=%d" % TCL_MINOR,
+                  "TCL_PATCH=%d" % TCL_PATCH,
+                  "MACHINE=IX86", *a)
+        if clean:
+            nmake_tix("clean")
+        elif install:
+            nmake_tix("install", "INSTALL_DIR=" + OUT_DIR)
+        else:
+            nmake_tix()
+
+if __name__ == '__main__':
+    main()

Modified: python/branches/io-c/PC/VC6/tcl852.patch
==============================================================================
--- python/branches/io-c/PC/VC6/tcl852.patch	(original)
+++ python/branches/io-c/PC/VC6/tcl852.patch	Sat Feb 14 21:58:31 2009
@@ -1,22 +1,22 @@
---- tcl8.5.2\generic\tcl.h	Fri Jun 13 03:35:39 2008
-+++ tcl8.5.2\generic\tcl.h	Sun Jan  4 16:52:30 2009
-@@ -367,7 +367,7 @@
- typedef struct stati64 Tcl_StatBuf;
- #         define TCL_LL_MODIFIER	"L"
- #      else /* __BORLANDC__ */
--#         if _MSC_VER < 1400 && !defined(_M_IX86)
-+#         if _MSC_VER < 1400 /*&& !defined(_M_IX86)*/
- typedef struct _stati64	Tcl_StatBuf;
- #         else
- typedef struct _stat64	Tcl_StatBuf;
---- tcl8.5.2\generic\tcl.h	Fri Jun 13 03:35:39 2008
-+++ tcl8.5.2\generic\tcl.h	Sun Jan  4 16:52:30 2009
-@@ -367,7 +367,7 @@
- typedef struct stati64 Tcl_StatBuf;
- #         define TCL_LL_MODIFIER	"L"
- #      else /* __BORLANDC__ */
--#         if _MSC_VER < 1400 && !defined(_M_IX86)
-+#         if _MSC_VER < 1400 /*&& !defined(_M_IX86)*/
- typedef struct _stati64	Tcl_StatBuf;
- #         else
- typedef struct _stat64	Tcl_StatBuf;
+--- tcl8.5.2\generic\tcl.h	Fri Jun 13 03:35:39 2008
++++ tcl8.5.2\generic\tcl.h	Sun Jan  4 16:52:30 2009
+@@ -367,7 +367,7 @@
+ typedef struct stati64 Tcl_StatBuf;
+ #         define TCL_LL_MODIFIER	"L"
+ #      else /* __BORLANDC__ */
+-#         if _MSC_VER < 1400 && !defined(_M_IX86)
++#         if _MSC_VER < 1400 /*&& !defined(_M_IX86)*/
+ typedef struct _stati64	Tcl_StatBuf;
+ #         else
+ typedef struct _stat64	Tcl_StatBuf;
+--- tcl8.5.2\generic\tcl.h	Fri Jun 13 03:35:39 2008
++++ tcl8.5.2\generic\tcl.h	Sun Jan  4 16:52:30 2009
+@@ -367,7 +367,7 @@
+ typedef struct stati64 Tcl_StatBuf;
+ #         define TCL_LL_MODIFIER	"L"
+ #      else /* __BORLANDC__ */
+-#         if _MSC_VER < 1400 && !defined(_M_IX86)
++#         if _MSC_VER < 1400 /*&& !defined(_M_IX86)*/
+ typedef struct _stati64	Tcl_StatBuf;
+ #         else
+ typedef struct _stat64	Tcl_StatBuf;

Modified: python/branches/io-c/PCbuild/sqlite3.vcproj
==============================================================================
--- python/branches/io-c/PCbuild/sqlite3.vcproj	(original)
+++ python/branches/io-c/PCbuild/sqlite3.vcproj	Sat Feb 14 21:58:31 2009
@@ -22,7 +22,7 @@
 		<Configuration
 			Name="Debug|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd_d.vsprops"
+			InheritedPropertySheets=".\sqlite3.vsprops;.\debug.vsprops"
 			CharacterSet="0"
 			>
 			<Tool
@@ -42,8 +42,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -83,7 +82,7 @@
 		<Configuration
 			Name="Debug|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd_d.vsprops;.\x64.vsprops"
+			InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\debug.vsprops"
 			CharacterSet="0"
 			>
 			<Tool
@@ -104,8 +103,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -145,7 +143,7 @@
 		<Configuration
 			Name="Release|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops"
+			InheritedPropertySheets=".\sqlite3.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -166,8 +164,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -207,7 +204,7 @@
 		<Configuration
 			Name="Release|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops"
+			InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -229,8 +226,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -270,7 +266,7 @@
 		<Configuration
 			Name="PGInstrument|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\pginstrument.vsprops"
+			InheritedPropertySheets=".\sqlite3.vsprops;.\pginstrument.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -291,8 +287,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories="&quot;$(sqlite3Dir)&quot;"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -332,7 +327,7 @@
 		<Configuration
 			Name="PGInstrument|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pginstrument.vsprops"
+			InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pginstrument.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -354,8 +349,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -394,7 +388,7 @@
 		<Configuration
 			Name="PGUpdate|Win32"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\pgupdate.vsprops"
+			InheritedPropertySheets=".\sqlite3.vsprops;.\pgupdate.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -415,8 +409,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -456,7 +449,7 @@
 		<Configuration
 			Name="PGUpdate|x64"
 			ConfigurationType="2"
-			InheritedPropertySheets=".\pyd.vsprops;.\x64.vsprops;.\pgupdate.vsprops"
+			InheritedPropertySheets=".\x64.vsprops;.\sqlite3.vsprops;.\pgupdate.vsprops"
 			CharacterSet="0"
 			WholeProgramOptimization="1"
 			>
@@ -478,8 +471,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="$(sqlite3Dir)"
-				PreprocessorDefinitions="SQLITE_API=__declspec(dllexport)"
+				AdditionalIncludeDirectories=""
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"

Modified: python/branches/io-c/Python/pymath.c
==============================================================================
--- python/branches/io-c/Python/pymath.c	(original)
+++ python/branches/io-c/Python/pymath.c	Sat Feb 14 21:58:31 2009
@@ -1,5 +1,18 @@
 #include "Python.h"
 
+#ifdef X87_DOUBLE_ROUNDING
+/* On x86 platforms using an x87 FPU, this function is called from the
+   Py_FORCE_DOUBLE macro (defined in pymath.h) to force a floating-point
+   number out of an 80-bit x87 FPU register and into a 64-bit memory location,
+   thus rounding from extended precision to double precision. */
+double _Py_force_double(double x)
+{
+	volatile double y;
+	y = x;
+	return y;
+}
+#endif
+
 #ifndef HAVE_HYPOT
 double hypot(double x, double y)
 {

Modified: python/branches/io-c/Tools/msi/uuids.py
==============================================================================
--- python/branches/io-c/Tools/msi/uuids.py	(original)
+++ python/branches/io-c/Tools/msi/uuids.py	Sat Feb 14 21:58:31 2009
@@ -63,8 +63,8 @@
     '3.0.122': '{f707b8e9-a257-4045-818e-4923fc20fbb6}', # 3.0c2
     '3.0.123': '{5e7208f1-8643-4ea2-ab5e-4644887112e3}', # 3.0c3
     '3.0.150': '{e0e56e21-55de-4f77-a109-1baa72348743}', # 3.0.0
-    '3.1.1121':'{d35b1ea5-3d70-4872-bf7e-cd066a77a9c9}', # 3.0.1c1
-    '3.1.1150':'{de2f2d9c-53e2-40ee-8209-74da63cb060e}', # 3.0.1
-    '3.1.2121':'{cef79e7f-9809-49e2-afd2-e24148d7c855}', # 3.0.2c1
-    '3.1.2150':'{0cf3b95a-8382-4607-9779-c36407ff362c}', # 3.0.2
+    '3.0.1121':'{d35b1ea5-3d70-4872-bf7e-cd066a77a9c9}', # 3.0.1c1
+    '3.0.1150':'{de2f2d9c-53e2-40ee-8209-74da63cb060e}', # 3.0.1
+    '3.0.2121':'{cef79e7f-9809-49e2-afd2-e24148d7c855}', # 3.0.2c1
+    '3.0.2150':'{0cf3b95a-8382-4607-9779-c36407ff362c}', # 3.0.2
 }

Modified: python/branches/io-c/setup.py
==============================================================================
--- python/branches/io-c/setup.py	(original)
+++ python/branches/io-c/setup.py	Sat Feb 14 21:58:31 2009
@@ -433,7 +433,8 @@
         # _json speedups
         exts.append( Extension("_json", ["_json.c"]) )
         # Python C API test module
-        exts.append( Extension('_testcapi', ['_testcapimodule.c']) )
+        exts.append( Extension('_testcapi', ['_testcapimodule.c'],
+                               depends=['testcapi_long.h']) )
         # profiler (_lsprof is for cProfile.py)
         exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) )
         # static Unicode character database


More information about the Python-checkins mailing list