[Python-3000-checkins] r60262 - in python/branches/py3k-ctypes-pep3118: Doc/bugs.rst Doc/c-api/gcsupport.rst Doc/c-api/index.rst Doc/c-api/module.rst Doc/c-api/typeobj.rst Doc/conf.py Doc/extending/building.rst Doc/howto/doanddont.rst Doc/howto/regex.rst Doc/library/bdb.rst Doc/library/configparser.rst Doc/library/constants.rst Doc/library/fileformats.rst Doc/library/functions.rst Doc/library/itertools.rst Doc/library/logging.rst Doc/library/mmap.rst Doc/library/plistlib.rst Doc/library/pprint.rst Doc/library/pydoc.rst Doc/library/shutil.rst Doc/library/sys.rst Doc/library/urllib.rst Doc/reference/lexical_analysis.rst Doc/tools/sphinxext/patchlevel.py Doc/tutorial/controlflow.rst Doc/tutorial/interpreter.rst Doc/tutorial/stdlib2.rst Doc/using/cmdline.rst Doc/whatsnew/3.0.rst Include/modsupport.h Include/pyport.h Include/structmember.h Lib/distutils/command/build.py Lib/formatter.py Lib/ftplib.py Lib/heapq.py Lib/idlelib/NEWS.txt Lib/idlelib/configHandler.py Lib/keyword.py Lib/logging/__init__.py Lib/logging/handlers.py Lib/plat-mac/plistlib.py Lib/plistlib.py Lib/pprint.py Lib/pstats.py Lib/pydoc.py Lib/rational.py Lib/re.py Lib/shutil.py Lib/site.py Lib/test/pydocfodder.py Lib/test/test_builtin.py Lib/test/test_descr.py Lib/test/test_grp.py Lib/test/test_iter.py Lib/test/test_itertools.py Lib/test/test_largefile.py Lib/test/test_mmap.py Lib/test/test_operator.py Lib/test/test_pep263.py Lib/test/test_profilehooks.py Lib/test/test_pstats.py Lib/test/test_pwd.py Lib/test/test_pyclbr.py Lib/test/test_rational.py Lib/test/test_shutil.py Lib/test/test_structmembers.py Lib/test/test_threading.py Lib/test/test_trace.py Lib/test/test_urllib.py Lib/test/test_urllibnet.py Lib/test/test_winreg.py Lib/threading.py Lib/urllib.py Lib/urllib2.py Lib/urlparse.py Makefile.pre.in Misc/NEWS Modules/_testcapimodule.c Modules/config.c.in Modules/itertoolsmodule.c Modules/mmapmodule.c Modules/socketmodule.c Parser/tokenizer.c Python/bltinmodule.c Python/ceval.c Python/dynload_win.c Python/hypot.c Python/pystate.c Python/structmember.c Python/sysmodule.c Tools/pynche/ColorDB.py configure configure.in pyconfig.h.in

thomas.heller python-3000-checkins at python.org
Thu Jan 24 22:12:28 CET 2008


Author: thomas.heller
Date: Thu Jan 24 22:12:24 2008
New Revision: 60262

Added:
   python/branches/py3k-ctypes-pep3118/Doc/library/plistlib.rst
      - copied unchanged from r60245, python/branches/py3k/Doc/library/plistlib.rst
   python/branches/py3k-ctypes-pep3118/Doc/tools/sphinxext/patchlevel.py
      - copied unchanged from r60245, python/branches/py3k/Doc/tools/sphinxext/patchlevel.py
   python/branches/py3k-ctypes-pep3118/Lib/plistlib.py
      - copied unchanged from r60245, python/branches/py3k/Lib/plistlib.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_pstats.py
      - copied unchanged from r60245, python/branches/py3k/Lib/test/test_pstats.py
Removed:
   python/branches/py3k-ctypes-pep3118/Lib/plat-mac/plistlib.py
Modified:
   python/branches/py3k-ctypes-pep3118/   (props changed)
   python/branches/py3k-ctypes-pep3118/Doc/bugs.rst
   python/branches/py3k-ctypes-pep3118/Doc/c-api/gcsupport.rst
   python/branches/py3k-ctypes-pep3118/Doc/c-api/index.rst
   python/branches/py3k-ctypes-pep3118/Doc/c-api/module.rst
   python/branches/py3k-ctypes-pep3118/Doc/c-api/typeobj.rst
   python/branches/py3k-ctypes-pep3118/Doc/conf.py
   python/branches/py3k-ctypes-pep3118/Doc/extending/building.rst
   python/branches/py3k-ctypes-pep3118/Doc/howto/doanddont.rst
   python/branches/py3k-ctypes-pep3118/Doc/howto/regex.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/bdb.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/configparser.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/constants.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/fileformats.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/functions.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/itertools.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/logging.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/mmap.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/pprint.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/pydoc.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/shutil.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/sys.rst
   python/branches/py3k-ctypes-pep3118/Doc/library/urllib.rst
   python/branches/py3k-ctypes-pep3118/Doc/reference/lexical_analysis.rst
   python/branches/py3k-ctypes-pep3118/Doc/tutorial/controlflow.rst
   python/branches/py3k-ctypes-pep3118/Doc/tutorial/interpreter.rst
   python/branches/py3k-ctypes-pep3118/Doc/tutorial/stdlib2.rst
   python/branches/py3k-ctypes-pep3118/Doc/using/cmdline.rst
   python/branches/py3k-ctypes-pep3118/Doc/whatsnew/3.0.rst
   python/branches/py3k-ctypes-pep3118/Include/modsupport.h
   python/branches/py3k-ctypes-pep3118/Include/pyport.h
   python/branches/py3k-ctypes-pep3118/Include/structmember.h
   python/branches/py3k-ctypes-pep3118/Lib/distutils/command/build.py
   python/branches/py3k-ctypes-pep3118/Lib/formatter.py
   python/branches/py3k-ctypes-pep3118/Lib/ftplib.py
   python/branches/py3k-ctypes-pep3118/Lib/heapq.py
   python/branches/py3k-ctypes-pep3118/Lib/idlelib/NEWS.txt
   python/branches/py3k-ctypes-pep3118/Lib/idlelib/configHandler.py
   python/branches/py3k-ctypes-pep3118/Lib/keyword.py
   python/branches/py3k-ctypes-pep3118/Lib/logging/__init__.py
   python/branches/py3k-ctypes-pep3118/Lib/logging/handlers.py
   python/branches/py3k-ctypes-pep3118/Lib/pprint.py
   python/branches/py3k-ctypes-pep3118/Lib/pstats.py
   python/branches/py3k-ctypes-pep3118/Lib/pydoc.py
   python/branches/py3k-ctypes-pep3118/Lib/rational.py
   python/branches/py3k-ctypes-pep3118/Lib/re.py
   python/branches/py3k-ctypes-pep3118/Lib/shutil.py
   python/branches/py3k-ctypes-pep3118/Lib/site.py
   python/branches/py3k-ctypes-pep3118/Lib/test/pydocfodder.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_builtin.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_descr.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_grp.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_iter.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_itertools.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_largefile.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_mmap.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_operator.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_pep263.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_profilehooks.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_pwd.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_pyclbr.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_rational.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_shutil.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_structmembers.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_threading.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_trace.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_urllib.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_urllibnet.py
   python/branches/py3k-ctypes-pep3118/Lib/test/test_winreg.py
   python/branches/py3k-ctypes-pep3118/Lib/threading.py
   python/branches/py3k-ctypes-pep3118/Lib/urllib.py
   python/branches/py3k-ctypes-pep3118/Lib/urllib2.py
   python/branches/py3k-ctypes-pep3118/Lib/urlparse.py
   python/branches/py3k-ctypes-pep3118/Makefile.pre.in
   python/branches/py3k-ctypes-pep3118/Misc/NEWS
   python/branches/py3k-ctypes-pep3118/Modules/_testcapimodule.c
   python/branches/py3k-ctypes-pep3118/Modules/config.c.in
   python/branches/py3k-ctypes-pep3118/Modules/itertoolsmodule.c
   python/branches/py3k-ctypes-pep3118/Modules/mmapmodule.c
   python/branches/py3k-ctypes-pep3118/Modules/socketmodule.c
   python/branches/py3k-ctypes-pep3118/Parser/tokenizer.c
   python/branches/py3k-ctypes-pep3118/Python/bltinmodule.c
   python/branches/py3k-ctypes-pep3118/Python/ceval.c
   python/branches/py3k-ctypes-pep3118/Python/dynload_win.c
   python/branches/py3k-ctypes-pep3118/Python/hypot.c
   python/branches/py3k-ctypes-pep3118/Python/pystate.c
   python/branches/py3k-ctypes-pep3118/Python/structmember.c
   python/branches/py3k-ctypes-pep3118/Python/sysmodule.c
   python/branches/py3k-ctypes-pep3118/Tools/pynche/ColorDB.py
   python/branches/py3k-ctypes-pep3118/configure
   python/branches/py3k-ctypes-pep3118/configure.in
   python/branches/py3k-ctypes-pep3118/pyconfig.h.in
Log:
Merged revisions 60129-60130,60132,60144,60150,60176,60206,60210,60220,60235-60236,60245 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r60129 | georg.brandl | 2008-01-20 11:59:44 +0100 (So, 20 Jan 2008) | 2 lines
  
  Fix markup.
................
  r60130 | georg.brandl | 2008-01-20 12:00:14 +0100 (So, 20 Jan 2008) | 2 lines
  
  Fix two oversights in C API split.
................
  r60132 | georg.brandl | 2008-01-20 12:22:21 +0100 (So, 20 Jan 2008) | 4 lines
  
  Fix now-wrong :keyword: markup. Remove the section about
  "exec without namespace" from the "don't" howto since exec()
  can't overwrite names in the calling namespace anymore.
................
  r60144 | christian.heimes | 2008-01-20 16:14:11 +0100 (So, 20 Jan 2008) | 54 lines
  
  Merged revisions 60124-60142 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60131 | georg.brandl | 2008-01-20 12:13:29 +0100 (Sun, 20 Jan 2008) | 3 lines
    
    #1351692: in pprint, always call format() for dict and list items to enable
    custom formatting of contents via subclassing PrettyPrinter.
  ........
    r60133 | georg.brandl | 2008-01-20 12:43:03 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #1178141: add addinfourl.code to get http status code from urllib.
  ........
    r60134 | georg.brandl | 2008-01-20 13:05:43 +0100 (Sun, 20 Jan 2008) | 4 lines
    
    #856047: respect the ``no_proxy`` env var when checking for proxies
    in urllib and using the other ``_proxy`` env vars.
    Original patch by Donovan Baarda.
  ........
    r60135 | georg.brandl | 2008-01-20 13:18:17 +0100 (Sun, 20 Jan 2008) | 4 lines
    
    #1664522: in urllib, don't read non-existing directories in ftp mode,
    returning a 0-byte file -- raise an IOError instead.
    Original patch from Phil Knirsch.
  ........
    r60136 | georg.brandl | 2008-01-20 13:57:47 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #799369: document possible sys.platform values.
  ........
    r60137 | georg.brandl | 2008-01-20 14:08:37 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #652749: document the constants added to the builtins by site.py.
  ........
    r60138 | georg.brandl | 2008-01-20 14:59:46 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #1648: add sys.gettrace() and sys.getprofile().
  ........
    r60139 | georg.brandl | 2008-01-20 15:17:42 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #1669: don't allow shutil.rmtree() to be called on a symlink.
  ........
    r60140 | georg.brandl | 2008-01-20 15:20:02 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    Fix test_pyclbr after urllib change.
  ........
    r60141 | christian.heimes | 2008-01-20 15:28:28 +0100 (Sun, 20 Jan 2008) | 1 line
    
    Fixed a wrong assumption in configure.in and Include/pyport.h. The is finite function is not called isfinite() but finite(). Sorry, my fault. :)
  ........
    r60142 | georg.brandl | 2008-01-20 15:31:27 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #1876: fix typos in test_operator.
  ........
................
  r60150 | christian.heimes | 2008-01-21 12:20:28 +0100 (Mo, 21 Jan 2008) | 41 lines
  
  Merged revisions 60143-60149 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60143 | georg.brandl | 2008-01-20 15:50:05 +0100 (Sun, 20 Jan 2008) | 3 lines
    
    Switch mmap from old Py_FindMethod to new PyObject_GenericGetAttr attribute access.
    Fixes #1087735.
  ........
    r60145 | georg.brandl | 2008-01-20 20:40:58 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    Add blurb about executable scripts on Windows. #760657.
  ........
    r60146 | georg.brandl | 2008-01-20 20:48:40 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    #1219903: fix tp_richcompare docs.
  ........
    r60147 | georg.brandl | 2008-01-20 22:10:08 +0100 (Sun, 20 Jan 2008) | 2 lines
    
    Fix markup.
  ........
    r60148 | gregory.p.smith | 2008-01-21 08:11:11 +0100 (Mon, 21 Jan 2008) | 14 lines
    
    Provide a sanity check during PyThreadState_DeleteCurrent() and
    PyThreadState_Delete() to avoid an infinite loop when the tstate list
    is messed up and has somehow becomes circular and does not contain the
    current thread.
    
    I don't know how this happens but it does, *very* rarely.  On more than
    one hardware platform.  I have not been able to reproduce it manually.
    
    Attaching to a process where its happening: it has always been in an
    infinite loop over a single element tstate list that is not the tstate
    we're looking to delete.  It has been in t_bootstrap()'s call to
    PyThreadState_DeleteCurrent() as a pthread is exiting.
  ........
    r60149 | georg.brandl | 2008-01-21 11:24:59 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #1269: fix a bug in pstats.add_callers() and add a unit test file for pstats.
  ........
................
  r60176 | georg.brandl | 2008-01-21 21:36:10 +0100 (Mo, 21 Jan 2008) | 91 lines
  
  Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
    
    A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
  ........
    r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
    
    #1087741: make mmap.mmap the type of mmap objects, not a
    factory function. Allow it to be subclassed.
  ........
    r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    mmap is an extension module.
  ........
    r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Fix example.
  ........
    r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #1555501: document plistlib and move it to the general library.
  ........
    r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Add a stub for bundlebuilder documentation.
  ........
    r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
  ........
    r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #997912: acknowledge nested scopes in tutorial.
  ........
    r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
    
    Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
  ........
    r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Adapt pydoc to new doc URLs.
  ........
    r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Fix old link.
  ........
    r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #1726198: replace while 1: fp.readline() with file iteration.
  ........
    r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Clarify $ behavior in re docstring. #1631394.
  ........
    r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
    
    Minor documentation change - hyperlink tidied up.
  ........
    r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #1530959: change distutils build dir for --with-pydebug python builds.
  ........
    r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
    
    Updated to include news on recent logging fixes and documentation changes.
  ........
    r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
    
    Issue #1882: when compiling code from a string, encoding cookies in the
    second line of code were not always recognized correctly.
  ........
    r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Add NEWS entry for #1882.
  ........
    r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Use original location of document, which has translations.
  ........
    r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Follow PEP 8 in module docstring.
  ........
    r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Adapt to latest doctools refactoring.
  ........
................
  r60206 | raymond.hettinger | 2008-01-23 00:25:35 +0100 (Mi, 23 Jan 2008) | 1 line
  
  Replace map(None, *iterables) with zip(*iterables).
................
  r60210 | christian.heimes | 2008-01-23 09:24:23 +0100 (Mi, 23 Jan 2008) | 90 lines
  
  Merged revisions 60176-60209 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60178 | georg.brandl | 2008-01-21 22:05:49 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    #1715: include sub-extension modules in pydoc text output.
  ........
    r60179 | georg.brandl | 2008-01-21 22:14:21 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Add a "const" to make gcc happy.
  ........
    r60180 | georg.brandl | 2008-01-21 22:19:07 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Add the correct build dir when building with pydebug.
  ........
    r60181 | georg.brandl | 2008-01-21 22:23:15 +0100 (Mon, 21 Jan 2008) | 3 lines
    
    Patch #1720595: add T_BOOL to the range of structmember types.
    Patch by Angelo Mottola, reviewed by MvL, tests by me.
  ........
    r60182 | georg.brandl | 2008-01-21 22:28:32 +0100 (Mon, 21 Jan 2008) | 2 lines
    
    Reformat some ugly code.
  ........
    r60187 | brett.cannon | 2008-01-22 00:50:16 +0100 (Tue, 22 Jan 2008) | 4 lines
    
    Make's MAKEFLAGS variable is set to a string containing the single-letter
    arguments to Make. This means there are no hyphens. Fix the '-s' check to
    silence distutils to now work.
  ........
    r60188 | gregory.p.smith | 2008-01-22 01:19:41 +0100 (Tue, 22 Jan 2008) | 3 lines
    
    accepts and closes issue #1221598: adds an optional callback to ftplib.FTP
    storbinary() and storlines() methods.
  ........
    r60189 | gregory.p.smith | 2008-01-22 02:12:02 +0100 (Tue, 22 Jan 2008) | 2 lines
    
    Replace spam.acquire() try: ... finally: spam.release() with "with spam:"
  ........
    r60190 | gregory.p.smith | 2008-01-22 02:20:42 +0100 (Tue, 22 Jan 2008) | 4 lines
    
    - Fix Issue #1703448: A joined thread could show up in the
      threading.enumerate() list after the join() for a brief period until
      it actually exited.
  ........
    r60193 | georg.brandl | 2008-01-22 08:53:31 +0100 (Tue, 22 Jan 2008) | 2 lines
    
    Fix \xhh specs, #1889.
  ........
    r60198 | christian.heimes | 2008-01-22 16:01:25 +0100 (Tue, 22 Jan 2008) | 1 line
    
    Fixed a missing (X) in define
  ........
    r60199 | christian.heimes | 2008-01-22 16:25:18 +0100 (Tue, 22 Jan 2008) | 2 lines
    
    Don't repeat yourself
    Added the macros PyModule_AddIntMacro and PyModule_AddStringMacro. They shorten PyModule_AddIntConstant(m, "AF_INET", AF_INET) to PyModule_AddIntMacro(m, AF_INET)
  ........
    r60201 | raymond.hettinger | 2008-01-22 20:51:41 +0100 (Tue, 22 Jan 2008) | 1 line
    
    Document when to use izip_longest().
  ........
    r60202 | georg.brandl | 2008-01-22 20:56:03 +0100 (Tue, 22 Jan 2008) | 2 lines
    
    Fix for #1087741 patch.
  ........
    r60203 | raymond.hettinger | 2008-01-22 21:18:53 +0100 (Tue, 22 Jan 2008) | 1 line
    
    Give zip() the same guarantee as izip() for left-to-right evaluation.
  ........
    r60204 | raymond.hettinger | 2008-01-22 23:09:26 +0100 (Tue, 22 Jan 2008) | 1 line
    
    Improve variable name in sample code
  ........
    r60205 | gregory.p.smith | 2008-01-23 00:15:34 +0100 (Wed, 23 Jan 2008) | 2 lines
    
    docstring and comment updates suggested by Giampaolo Rodola'
  ........
    r60207 | raymond.hettinger | 2008-01-23 01:04:40 +0100 (Wed, 23 Jan 2008) | 1 line
    
    Let pprint() support sets and frozensets (suggested by David Mertz).
  ........
    r60208 | guido.van.rossum | 2008-01-23 02:18:27 +0100 (Wed, 23 Jan 2008) | 4 lines
    
    I'm tired of these tests breaking at Google due to our large number of
    users and groups in LDAP/NIS.  So I'm limiting the extra-heavy part of
    the tests to passwd/group files with at most 1000 entries.
  ........
................
  r60220 | georg.brandl | 2008-01-23 18:10:38 +0100 (Mi, 23 Jan 2008) | 2 lines
  
  Fix #1913.
................
  r60235 | christian.heimes | 2008-01-24 10:42:52 +0100 (Do, 24 Jan 2008) | 66 lines
  
  Merged revisions 60210-60233 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60213 | christian.heimes | 2008-01-23 15:00:25 +0100 (Wed, 23 Jan 2008) | 1 line
    
    Use Py_TYPE() instead of ->ob_type
  ........
    r60214 | armin.rigo | 2008-01-23 15:07:13 +0100 (Wed, 23 Jan 2008) | 3 lines
    
    patch 1754489 by vlahan:
    improve portability of address length calculation for AF_UNIX sockets
  ........
    r60216 | christian.heimes | 2008-01-23 15:20:50 +0100 (Wed, 23 Jan 2008) | 1 line
    
    Fixed bug #1915: Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support.
  ........
    r60221 | christian.heimes | 2008-01-23 18:15:06 +0100 (Wed, 23 Jan 2008) | 2 lines
    
    Applied #1069410
    The "can't load dll" message box on Windows is suppressed while an extension is loaded by calling SetErrorMode in dynload_win.c. The error is still reported properly.
  ........
    r60224 | guido.van.rossum | 2008-01-23 21:19:01 +0100 (Wed, 23 Jan 2008) | 2 lines
    
    Fix two crashers.
  ........
    r60225 | kurt.kaiser | 2008-01-23 23:19:23 +0100 (Wed, 23 Jan 2008) | 3 lines
    
    Could not open files in .idlerc directory if latter was hidden on Windows.
    Issue 1743, Issue 1862.
  ........
    r60226 | guido.van.rossum | 2008-01-23 23:43:27 +0100 (Wed, 23 Jan 2008) | 2 lines
    
    Fix misleading comment reported in issue #1917.
  ........
    r60227 | kurt.kaiser | 2008-01-23 23:55:26 +0100 (Wed, 23 Jan 2008) | 2 lines
    
    There was an error on exit if no sys.exitfunc was defined. Issue 1647.
  ........
    r60228 | guido.van.rossum | 2008-01-24 00:23:43 +0100 (Thu, 24 Jan 2008) | 2 lines
    
    Turn three recently fixed crashers into regular tests.
  ........
    r60229 | raymond.hettinger | 2008-01-24 01:54:21 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Add first-cut at an approximation function (still needs rounding tweaks).  Add continued fraction conversions.
  ........
    r60230 | raymond.hettinger | 2008-01-24 03:00:25 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Minor clean-up and more tests.
  ........
    r60231 | raymond.hettinger | 2008-01-24 03:05:06 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Cleanup
  ........
    r60232 | neal.norwitz | 2008-01-24 05:14:50 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Fix the tests by restoring __import__.  I think the test is still valid.
  ........
    r60233 | neal.norwitz | 2008-01-24 08:40:51 +0100 (Thu, 24 Jan 2008) | 4 lines
    
    Fix the test_urllib2net failures that were caused by r58067.
    I'm not sure this is the correct fix, but at least the test passes
    now and should be closer to correct.
  ........
................
  r60236 | thomas.heller | 2008-01-24 11:31:31 +0100 (Do, 24 Jan 2008) | 1 line
  
  Fix a bug in the test.
................
  r60245 | christian.heimes | 2008-01-24 17:21:45 +0100 (Do, 24 Jan 2008) | 31 lines
  
  Merged revisions 60234-60244 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r60234 | gregory.p.smith | 2008-01-24 10:38:26 +0100 (Thu, 24 Jan 2008) | 4 lines
    
    Fix issue1789: The tutorial contained a misuse of the struct module.
    
    (also remove an unneeded import struct from test_largefile)
  ........
    r60237 | vinay.sajip | 2008-01-24 13:37:08 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Added optional delay argument to FileHandler and subclasses.
  ........
    r60238 | vinay.sajip | 2008-01-24 13:37:33 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Added optional delay argument to FileHandler and subclasses.
  ........
    r60239 | vinay.sajip | 2008-01-24 13:38:30 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Added documentation for optional delay argument to FileHandler and subclasses.
  ........
    r60240 | vinay.sajip | 2008-01-24 13:43:33 +0100 (Thu, 24 Jan 2008) | 1 line
    
    Updated for optional delay argument to FileHandler and subclasses.
  ........
    r60243 | guido.van.rossum | 2008-01-24 16:53:22 +0100 (Thu, 24 Jan 2008) | 2 lines
    
    Fi debug turd -- a call accidentally left out.
  ........
................


Modified: python/branches/py3k-ctypes-pep3118/Doc/bugs.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/bugs.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/bugs.rst	Thu Jan 24 22:12:24 2008
@@ -49,7 +49,7 @@
 
 .. seealso::
 
-   `How to Report Bugs Effectively <http://www-mice.cs.ucl.ac.uk/multimedia/software/documentation/ReportingBugs.html>`_
+   `How to Report Bugs Effectively <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>`_
       Article which goes into some detail about how to create a useful bug report.
       This describes what kind of information is useful and why it is useful.
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/c-api/gcsupport.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/c-api/gcsupport.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/c-api/gcsupport.rst	Thu Jan 24 22:12:24 2008
@@ -18,6 +18,7 @@
 
 
 .. data:: Py_TPFLAGS_HAVE_GC
+   :noindex:
 
    Objects with a type with this flag set must conform with the rules documented
    here.  For convenience these objects will be referred to as container objects.

Modified: python/branches/py3k-ctypes-pep3118/Doc/c-api/index.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/c-api/index.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/c-api/index.rst	Thu Jan 24 22:12:24 2008
@@ -24,4 +24,4 @@
    concrete.rst
    init.rst
    memory.rst
-   newtypes.rst
+   objimpl.rst

Modified: python/branches/py3k-ctypes-pep3118/Doc/c-api/module.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/c-api/module.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/c-api/module.rst	Thu Jan 24 22:12:24 2008
@@ -18,12 +18,12 @@
    is exposed to Python programs as ``types.ModuleType``.
 
 
-.. cfunction:: int PyModule_Check(PyObject *p)
+.. cmacro:: int PyModule_Check(PyObject *p)
 
    Return true if *p* is a module object, or a subtype of a module object.
 
 
-.. cfunction:: int PyModule_CheckExact(PyObject *p)
+.. cmacro:: int PyModule_CheckExact(PyObject *p)
 
    Return true if *p* is a module object, but not a subtype of
    :cdata:`PyModule_Type`.
@@ -92,3 +92,17 @@
    Add a string constant to *module* as *name*.  This convenience function can be
    used from the module's initialization function.  The string *value* must be
    null-terminated.  Return ``-1`` on error, ``0`` on success.
+
+
+.. cmacro:: int PyModule_AddIntMacro(PyObject *module, macro)
+
+   Add an int constant to *module*. The name and the value are taken from 
+   *macro*. For example ``PyModule_AddConstant(module, AF_INET)`` adds the int
+   constant *AF_INET* with the value of *AF_INET* to *module*.
+   Return ``-1`` on error, ``0`` on success.
+
+
+.. cmacro:: int PyModule_AddStringMacro(PyObject *module, macro)
+
+   Add a string constant to *module*.
+

Modified: python/branches/py3k-ctypes-pep3118/Doc/c-api/typeobj.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/c-api/typeobj.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/c-api/typeobj.rst	Thu Jan 24 22:12:24 2008
@@ -649,13 +649,19 @@
 
 .. cmember:: richcmpfunc PyTypeObject.tp_richcompare
 
-   An optional pointer to the rich comparison function.
+   An optional pointer to the rich comparison function, whose signature is
+   ``PyObject *tp_richcompare(PyObject *a, PyObject *b, int op)``.
 
-   The signature is the same as for :cfunc:`PyObject_RichCompare`. The function
-   should return the result of the comparison (usually ``Py_True`` or
-   ``Py_False``).  If the comparison is undefined, it must return
-   ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and set
-   an exception condition.
+   The function should return the result of the comparison (usually ``Py_True``
+   or ``Py_False``).  If the comparison is undefined, it must return
+   ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and
+   set an exception condition.
+
+   .. note::
+
+      If you want to implement a type for which only a limited set of
+      comparisons makes sense (e.g. ``==`` and ``!=``, but not ``<`` and
+      friends), directly raise :exc:`TypeError` in the rich comparison function.
 
    This field is inherited by subtypes together with :attr:`tp_compare` and
    :attr:`tp_hash`: a subtype inherits all three of :attr:`tp_compare`,
@@ -681,10 +687,10 @@
    | :const:`Py_GE` | ``>=``     |
    +----------------+------------+
 
+
 The next field only exists if the :const:`Py_TPFLAGS_HAVE_WEAKREFS` flag bit is
 set.
 
-
 .. cmember:: long PyTypeObject.tp_weaklistoffset
 
    If the instances of this type are weakly referenceable, this field is greater

Modified: python/branches/py3k-ctypes-pep3118/Doc/conf.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/conf.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/conf.py	Thu Jan 24 22:12:24 2008
@@ -7,23 +7,27 @@
 # The contents of this file are pickled, so don't put values in the namespace
 # that aren't pickleable (module imports are okay, they're removed automatically).
 
+import sys, os, time
+sys.path.append('tools/sphinxext')
+
 # General configuration
 # ---------------------
 
 # General substitutions.
 project = 'Python'
-copyright = '1990-2007, Python Software Foundation'
+copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
 
 # The default replacements for |version| and |release|.
-# If '<auto>', Sphinx looks for the Include/patchlevel.h file in the current Python
-# source tree and replaces the values accordingly.
 #
 # The short X.Y version.
 # version = '2.6'
-version = '<auto>'
 # The full version, including alpha/beta/rc tags.
 # release = '2.6a0'
-release = '<auto>'
+
+# We look for the Include/patchlevel.h file in the current Python source tree
+# and replace the values accordingly.
+import patchlevel
+version, release = patchlevel.get_version_info()
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
@@ -119,7 +123,6 @@
      'What\'s New in Python', 'A. M. Kuchling', 'howto'),
 ]
 # Collect all HOWTOs individually
-import os
 latex_documents.extend(('howto/' + fn, 'howto-' + fn[:-4] + '.tex',
                         'HOWTO', _stdauthor, 'howto')
                        for fn in os.listdir('howto')

Modified: python/branches/py3k-ctypes-pep3118/Doc/extending/building.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/extending/building.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/extending/building.rst	Thu Jan 24 22:12:24 2008
@@ -80,7 +80,7 @@
           description = 'This is a demo package',
           author = 'Martin v. Loewis',
           author_email = 'martin at v.loewis.de',
-          url = 'http://www.python.org/doc/current/ext/building.html',
+          url = 'http://docs.python.org/extending/building',
           long_description = '''
    This is really just a demo package.
    ''',

Modified: python/branches/py3k-ctypes-pep3118/Doc/howto/doanddont.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/howto/doanddont.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/howto/doanddont.rst	Thu Jan 24 22:12:24 2008
@@ -75,39 +75,6 @@
 * When the module advertises itself as ``from import *`` safe.
 
 
-Unadorned :keyword:`exec` and friends
--------------------------------------
-
-The word "unadorned" refers to the use without an explicit dictionary, in which
-case those constructs evaluate code in the *current* environment. This is
-dangerous for the same reasons ``from import *`` is dangerous --- it might step
-over variables you are counting on and mess up things for the rest of your code.
-Simply do not do that.
-
-Bad examples::
-
-   >>> for name in sys.argv[1:]:
-   >>>     exec "%s=1" % name
-   >>> def func(s, **kw):
-   >>>     for var, val in kw.items():
-   >>>         exec "s.%s=val" % var  # invalid!
-   >>> exec(open("handler.py").read())
-   >>> handle()
-
-Good examples::
-
-   >>> d = {}
-   >>> for name in sys.argv[1:]:
-   >>>     d[name] = 1
-   >>> def func(s, **kw):
-   >>>     for var, val in kw.items():
-   >>>         setattr(s, var, val)
-   >>> d={}
-   >>> exec(open("handle.py").read(), d, d)
-   >>> handle = d['handle']
-   >>> handle()
-
-
 from module import name1, name2
 -------------------------------
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/howto/regex.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/howto/regex.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/howto/regex.rst	Thu Jan 24 22:12:24 2008
@@ -335,9 +335,8 @@
 
 Once you have an object representing a compiled regular expression, what do you
 do with it?  :class:`RegexObject` instances have several methods and attributes.
-Only the most significant ones will be covered here; consult `the Library
-Reference <http://www.python.org/doc/lib/module-re.html>`_ for a complete
-listing.
+Only the most significant ones will be covered here; consult the :mod:`re` docs
+for a complete listing.
 
 +------------------+-----------------------------------------------+
 | Method/Attribute | Purpose                                       |

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/bdb.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/bdb.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/bdb.rst	Thu Jan 24 22:12:24 2008
@@ -294,7 +294,7 @@
 
 .. method:: Bdb.run(cmd, [globals, [locals]])
 
-   Debug a statement executed via the :keyword:`exec` statement.  *globals*
+   Debug a statement executed via the :func:`exec` function.  *globals*
    defaults to :attr:`__main__.__dict__`, *locals* defaults to *globals*.
 
 .. method:: Bdb.runeval(expr, [globals, [locals]])

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/configparser.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/configparser.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/configparser.rst	Thu Jan 24 22:12:24 2008
@@ -420,3 +420,5 @@
            # Create non-existent section
            config.add_section(section2)
            opt_move(config, section1, section2, option)
+       else:
+           config.remove_option(section1, option)

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/constants.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/constants.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/constants.rst	Thu Jan 24 22:12:24 2008
@@ -1,4 +1,3 @@
-
 Built-in Constants
 ==================
 
@@ -52,3 +51,28 @@
    This constant is true if Python was not started with an :option:`-O` option.
    Assignments to :const:`__debug__` are illegal and raise a :exc:`SyntaxError`.
    See also the :keyword:`assert` statement.
+
+
+Constants added by the :mod:`site` module
+-----------------------------------------
+
+The :mod:`site` module (which is imported automatically during startup, except
+if the :option:`-S` command-line option is given) adds several constants to the
+built-in namespace.  They are useful for the interactive interpreter shell and
+should not be used in programs.
+
+.. data:: quit([code=None])
+          exit([code=None])
+
+   Objects that when printed, print a message like "Use quit() or Ctrl-D
+   (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the
+   specified exit code, and when .
+
+.. data:: copyright
+          license
+          credits
+
+   Objects that when printed, print a message like "Type license() to see the
+   full license text", and when called, display the corresponding text in a
+   pager-like fashion (one screen at a time).
+

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/fileformats.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/fileformats.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/fileformats.rst	Thu Jan 24 22:12:24 2008
@@ -16,3 +16,4 @@
    robotparser.rst
    netrc.rst
    xdrlib.rst
+   plistlib.rst

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/functions.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/functions.rst	Thu Jan 24 22:12:24 2008
@@ -526,6 +526,8 @@
    topic, and a help page is printed on the console.  If the argument is any other
    kind of object, a help page on the object is generated.
 
+   This function is added to the built-in namespace by the :mod:`site` module.
+
 
 .. function:: hex(x)
 
@@ -646,17 +648,7 @@
    Return an iterator that applies *function* to every item of *iterable*,
    yielding the results.  If additional *iterable* arguments are passed,
    *function* must take that many arguments and is applied to the items from all
-   iterables in parallel.  If one iterable is shorter than another it is assumed
-   to be extended with ``None`` items.  If *function* is ``None``, the identity
-   function is assumed; if there are multiple arguments, :func:`map` returns a
-   list consisting of tuples containing the corresponding items from all
-   iterables (a kind of transpose operation).  The *iterable* arguments may be a
-   sequence or any iterable object; the result is always a list.
-
-   Note that for only one *iterable* argument, ``map(function, iterable)`` is
-   equivalent to the generator expression ``(function(item) for item in
-   iterable)`` if *function* is not ``None``.
-
+   iterables in parallel.
 
 .. function:: max(iterable[, args...], *[, key])
 
@@ -1148,6 +1140,10 @@
    sequence argument, it returns an iterator of 1-tuples.  With no arguments, it
    returns an empty iterator.
 
+   The left-to-right evaluation order of the iterables is guaranteed. This
+   makes possible an idiom for clustering a data series into n-length groups
+   using ``zip(*[iter(s)]*n)``.
+
 
 .. rubric:: Footnotes
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/itertools.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/itertools.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/itertools.rst	Thu Jan 24 22:12:24 2008
@@ -204,17 +204,12 @@
 .. function:: imap(function, *iterables)
 
    Make an iterator that computes the function using arguments from each of the
-   iterables.  If *function* is set to ``None``, then :func:`imap` returns the
-   arguments as a tuple.  Like :func:`map` but stops when the shortest iterable is
-   exhausted instead of filling in ``None`` for shorter iterables.  The reason for
-   the difference is that infinite iterator arguments are typically an error for
-   :func:`map` (because the output is fully evaluated) but represent a common and
-   useful way of supplying arguments to :func:`imap`. Equivalent to::
+   iterables.  Equivalent to::
 
       def imap(function, *iterables):
-          iterables = map(iter, iterables)
+          iterables = [iter(it) for it in iterables)
           while True:
-              args = [next(i) for i in iterables]
+              args = [next(it) for it in iterables]
               if function is None:
                   yield tuple(args)
               else:
@@ -260,12 +255,11 @@
 
    When no iterables are specified, return a zero length iterator.
 
-   Note, the left-to-right evaluation order of the iterables is guaranteed. This
-   makes possible an idiom for clustering a data series into n-length groups using
-   ``izip(*[iter(s)]*n)``.  For data that doesn't fit n-length groups exactly, the
-   last tuple can be pre-padded with fill values using ``izip(*[chain(s,
-   [None]*(n-1))]*n)``.
+   The left-to-right evaluation order of the iterables is guaranteed. This
+   makes possible an idiom for clustering a data series into n-length groups
+   using ``izip(*[iter(s)]*n)``.
 
+<<<<<<< .working
    Note, when :func:`izip` is used with unequal length inputs, subsequent
    iteration over the longer iterables cannot reliably be continued after
    :func:`izip` terminates.  Potentially, up to one entry will be missing from
@@ -276,6 +270,11 @@
    the iterator for retrieval with ``next(it)``).  In general, :func:`izip`
    should only be used with unequal length inputs when you don't care about
    trailing, unmatched values from the longer iterables.
+=======
+   :func:`izip` should only be used with unequal length inputs when you don't
+   care about trailing, unmatched values from the longer iterables.  If those
+   values are important, use :func:`izip_longest` instead.
+>>>>>>> .merge-right.r60208
 
 
 .. function:: izip_longest(*iterables[, fillvalue])

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/logging.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/logging.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/logging.rst	Thu Jan 24 22:12:24 2008
@@ -1180,13 +1180,13 @@
 "dict-like" object for use in the constructor::
 
    import logging
-   
+
    class ConnInfo:
        """
        An example class which shows how an arbitrary class can be used as
        the 'extra' context information repository passed to a LoggerAdapter.
        """
-   
+
        def __getitem__(self, name):
            """
            To allow this instance to look like a dict.
@@ -1199,7 +1199,7 @@
            else:
                result = self.__dict__.get(name, "?")
            return result
-   
+
        def __iter__(self):
            """
            To allow iteration over keys, which will be merged into
@@ -1208,7 +1208,7 @@
            keys = ["ip", "user"]
            keys.extend(self.__dict__.keys())
            return keys.__iter__()
-   
+
    if __name__ == "__main__":
        from random import choice
        levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
@@ -1517,12 +1517,13 @@
 :class:`StreamHandler`.
 
 
-.. class:: FileHandler(filename[, mode[, encoding]])
+.. class:: FileHandler(filename[, mode[, encoding[, delay]]])
 
    Returns a new instance of the :class:`FileHandler` class. The specified file is
    opened and used as the stream for logging. If *mode* is not specified,
    :const:`'a'` is used.  If *encoding* is not *None*, it is used to open the file
-   with that encoding.  By default, the file grows indefinitely.
+   with that encoding.  If *delay* is true, then file opening is deferred until the
+   first call to :meth:`emit`. By default, the file grows indefinitely.
 
 
 .. method:: FileHandler.close()
@@ -1556,12 +1557,13 @@
 this value.
 
 
-.. class:: WatchedFileHandler(filename[,mode[, encoding]])
+.. class:: WatchedFileHandler(filename[,mode[, encoding[, delay]]])
 
    Returns a new instance of the :class:`WatchedFileHandler` class. The specified
    file is opened and used as the stream for logging. If *mode* is not specified,
    :const:`'a'` is used.  If *encoding* is not *None*, it is used to open the file
-   with that encoding.  By default, the file grows indefinitely.
+   with that encoding.  If *delay* is true, then file opening is deferred until the
+   first call to :meth:`emit`.  By default, the file grows indefinitely.
 
 
 .. method:: WatchedFileHandler.emit(record)
@@ -1578,11 +1580,13 @@
 module, supports rotation of disk log files.
 
 
-.. class:: RotatingFileHandler(filename[, mode[, maxBytes[, backupCount]]])
+.. class:: RotatingFileHandler(filename[, mode[, maxBytes[, backupCount[, encoding[, delay]]]]])
 
    Returns a new instance of the :class:`RotatingFileHandler` class. The specified
    file is opened and used as the stream for logging. If *mode* is not specified,
-   ``'a'`` is used. By default, the file grows indefinitely.
+   ``'a'`` is used.  If *encoding* is not *None*, it is used to open the file
+   with that encoding.  If *delay* is true, then file opening is deferred until the
+   first call to :meth:`emit`.  By default, the file grows indefinitely.
 
    You can use the *maxBytes* and *backupCount* values to allow the file to
    :dfn:`rollover` at a predetermined size. When the size is about to be exceeded,
@@ -1616,7 +1620,7 @@
 timed intervals.
 
 
-.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount]]])
+.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay]]]]])
 
    Returns a new instance of the :class:`TimedRotatingFileHandler` class. The
    specified file is opened and used as the stream for logging. On rotating it also
@@ -2053,7 +2057,13 @@
    record is computed using *msg* % *args*. If the formatting string contains
    ``'(asctime)'``, :meth:`formatTime` is called to format the event time. If there
    is exception information, it is formatted using :meth:`formatException` and
-   appended to the message.
+   appended to the message. Note that the formatted exception information is cached
+   in attribute *exc_text*. This is useful because the exception information can
+   be pickled and sent across the wire, but you should be careful if you have more
+   than one :class:`Formatter` subclass which customizes the formatting of exception
+   information. In this case, you will have to clear the cached value after a
+   formatter has done its formatting, so that the next formatter to handle the event
+   doesn't use the cached value but recalculates it afresh.
 
 
 .. method:: Formatter.formatTime(record[, datefmt])
@@ -2133,7 +2143,10 @@
 .. versionadded:: 2.6
 
 :class:`LoggerAdapter` instances are used to conveniently pass contextual
-information into logging calls. For a usage example , see context-info_.
+information into logging calls. For a usage example , see the section on
+`adding contextual information to your logging output`__.
+
+__ context-info_
 
 .. class:: LoggerAdapter(logger, extra)
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/mmap.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/mmap.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/mmap.rst	Thu Jan 24 22:12:24 2008
@@ -15,7 +15,7 @@
 and write data starting at the current file position, and :meth:`seek` through
 the file to different positions.
 
-A memory-mapped file is created by the :func:`mmap` function, which is different
+A memory-mapped file is created by the :class:`mmap` constructor, which is different
 on Unix and on Windows.  In either case you must provide a file descriptor for a
 file opened for update. If you wish to map an existing Python file object, use
 its :meth:`fileno` method to obtain the correct value for the *fileno*
@@ -23,7 +23,7 @@
 which returns a file descriptor directly (the file still needs to be closed when
 done).
 
-For both the Unix and Windows versions of the function, *access* may be
+For both the Unix and Windows versions of the constructor, *access* may be
 specified as an optional keyword parameter. *access* accepts one of three
 values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` to
 specify readonly, write-through or copy-on-write memory respectively. *access*
@@ -37,11 +37,10 @@
 
 To map anonymous memory, -1 should be passed as the fileno along with the length.
 
-
-.. function:: mmap(fileno, length[, tagname[, access[, offset]]])
+.. class:: mmap(fileno, length[, tagname[, access[, offset]]])
 
    **(Windows version)** Maps *length* bytes from the file specified by the file
-   handle *fileno*, and returns a mmap object.  If *length* is larger than the
+   handle *fileno*, and creates a mmap object.  If *length* is larger than the
    current size of the file, the file is extended to contain *length* bytes.  If
    *length* is ``0``, the maximum length of the map is the current size of the
    file, except that if the file is empty Windows raises an exception (you cannot
@@ -59,12 +58,12 @@
    *offset* must be a multiple of the ALLOCATIONGRANULARITY.
 
 
-.. function:: mmap(fileno, length[, flags[, prot[, access[, offset]]]])
+.. class:: mmap(fileno, length[, flags[, prot[, access[, offset]]]])
    :noindex:
 
    **(Unix version)** Maps *length* bytes from the file specified by the file
    descriptor *fileno*, and returns a mmap object.  If *length* is ``0``, the
-   maximum length of the map will be the current size of the file when :func:`mmap`
+   maximum length of the map will be the current size of the file when :class:`mmap`
    is called.
 
    *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a
@@ -85,7 +84,7 @@
    be relative to the offset from the beginning of the file. *offset* defaults to 0.
    *offset* must be a multiple of the PAGESIZE or ALLOCATIONGRANULARITY.
    
-   This example shows a simple way of using :func:`mmap`::
+   This example shows a simple way of using :class:`mmap`::
 
       import mmap
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/pprint.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/pprint.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/pprint.rst	Thu Jan 24 22:12:24 2008
@@ -22,6 +22,9 @@
 
 Dictionaries are sorted by key before the display is computed.
 
+.. versionchanged:: 2.6
+   Added support for :class:`set` and :class:`frozenset`.
+
 The :mod:`pprint` module defines one class:
 
 .. First the implementation class:

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/pydoc.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/pydoc.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/pydoc.rst	Thu Jan 24 22:12:24 2008
@@ -57,7 +57,7 @@
 Python interpreter and typed ``import spam``.
 
 Module docs for core modules are assumed to reside in
-http://www.python.org/doc/current/lib/.  This can be overridden by setting the
+http://docs.python.org/library/.  This can be overridden by setting the
 :envvar:`PYTHONDOCS` environment variable to a different URL or to a local
 directory containing the Library Reference Manual pages.
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/shutil.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/shutil.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/shutil.rst	Thu Jan 24 22:12:24 2008
@@ -93,18 +93,24 @@
 
    .. index:: single: directory; deleting
 
-   Delete an entire directory tree (*path* must point to a directory). If
-   *ignore_errors* is true, errors resulting from failed removals will be ignored;
-   if false or omitted, such errors are handled by calling a handler specified by
-   *onerror* or, if that is omitted, they raise an exception.
-
-   If *onerror* is provided, it must be a callable that accepts three parameters:
-   *function*, *path*, and *excinfo*. The first parameter, *function*, is the
-   function which raised the exception; it will be :func:`os.listdir`,
-   :func:`os.remove` or :func:`os.rmdir`.  The second parameter, *path*, will be
-   the path name passed to *function*.  The third parameter, *excinfo*, will be the
-   exception information return by :func:`sys.exc_info`.  Exceptions raised by
-   *onerror* will not be caught.
+   Delete an entire directory tree; *path* must point to a directory (but not a
+   symbolic link to a directory).  If *ignore_errors* is true, errors resulting
+   from failed removals will be ignored; if false or omitted, such errors are
+   handled by calling a handler specified by *onerror* or, if that is omitted,
+   they raise an exception.
+
+   If *onerror* is provided, it must be a callable that accepts three
+   parameters: *function*, *path*, and *excinfo*. The first parameter,
+   *function*, is the function which raised the exception; it will be
+   :func:`os.path.islink`, :func:`os.listdir`, :func:`os.remove` or
+   :func:`os.rmdir`.  The second parameter, *path*, will be the path name passed
+   to *function*.  The third parameter, *excinfo*, will be the exception
+   information return by :func:`sys.exc_info`.  Exceptions raised by *onerror*
+   will not be caught.
+
+   .. versionchanged:: 2.6
+      Explicitly check for *path* being a symbolic link and raise :exc:`OSError`
+      in that case.
 
 
 .. function:: move(src, dst)

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/sys.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/sys.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/sys.rst	Thu Jan 24 22:12:24 2008
@@ -326,6 +326,35 @@
    This function should be used for internal and specialized purposes only.
 
 
+.. function:: getprofile()
+
+   .. index::
+      single: profile function
+      single: profiler
+
+   Get the profiler function as set by :func:`setprofile`.
+
+   .. versionadded:: 2.6
+
+
+.. function:: gettrace()
+
+   .. index::
+      single: trace function
+      single: debugger
+
+   Get the trace function as set by :func:`settrace`.
+
+   .. note::
+
+      The :func:`gettrace` function is intended only for implementing debuggers,
+      profilers, coverage tools and the like. Its behavior is part of the
+      implementation platform, rather than part of the language definition,
+      and thus may not be available in all Python implementations.
+
+   .. versionadded:: 2.6
+
+
 .. function:: getwindowsversion()
 
    Return a tuple containing five components, describing the Windows version
@@ -444,9 +473,26 @@
 
 .. data:: platform
 
-   This string contains a platform identifier, e.g. ``'sunos5'`` or ``'linux1'``.
-   This can be used to append platform-specific components to ``path``, for
-   instance.
+   This string contains a platform identifier that can be used to append
+   platform-specific components to :data:`sys.path`, for instance.
+
+   For Unix systems, this is the lowercased OS name as returned by ``uname -s``
+   with the first part of the version as returned by ``uname -r`` appended,
+   e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*.
+   For other systems, the values are:
+
+   ================ ===========================
+   System           :data:`platform` value
+   ================ ===========================
+   Windows          ``'win32'``
+   Windows/Cygwin   ``'cygwin'``
+   MacOS X          ``'darwin'``
+   MacOS 9          ``'mac'``
+   OS/2             ``'os2'``
+   OS/2 EMX         ``'os2emx'``
+   RiscOS           ``'riscos'``
+   AtheOS           ``'atheos'``
+   ================ ===========================
 
 
 .. data:: prefix

Modified: python/branches/py3k-ctypes-pep3118/Doc/library/urllib.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/library/urllib.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/library/urllib.rst	Thu Jan 24 22:12:24 2008
@@ -27,16 +27,17 @@
    a server somewhere on the network.  If the connection cannot be made the
    :exc:`IOError` exception is raised.  If all went well, a file-like object is
    returned.  This supports the following methods: :meth:`read`, :meth:`readline`,
-   :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info` and
+   :meth:`readlines`, :meth:`fileno`, :meth:`close`, :meth:`info`, :meth:`getcode` and
    :meth:`geturl`.  It also has proper support for the :term:`iterator` protocol. One
    caveat: the :meth:`read` method, if the size argument is omitted or negative,
    may not read until the end of the data stream; there is no good way to determine
    that the entire stream from a socket has been read in the general case.
 
-   Except for the :meth:`info` and :meth:`geturl` methods, these methods have the
-   same interface as for file objects --- see section :ref:`bltin-file-objects` in
-   this manual.  (It is not a built-in file object, however, so it can't be used at
-   those few places where a true built-in file object is required.)
+   Except for the :meth:`info`, :meth:`getcode` and :meth:`geturl` methods,
+   these methods have the same interface as for file objects --- see section
+   :ref:`bltin-file-objects` in this manual.  (It is not a built-in file object,
+   however, so it can't be used at those few places where a true built-in file
+   object is required.)
 
    .. index:: module: mimetools
 
@@ -58,6 +59,9 @@
    the client was redirected to.  The :meth:`geturl` method can be used to get at
    this redirected URL.
 
+   The :meth:`getcode` method returns the HTTP status code that was sent with the
+   response, or ``None`` if the URL is no HTTP URL.
+
    If the *url* uses the :file:`http:` scheme identifier, the optional *data*
    argument may be given to specify a ``POST`` request (normally the request type
    is ``GET``).  The *data* argument must be in standard
@@ -75,6 +79,11 @@
       % python
       ...
 
+   The :envvar:`no_proxy` environment variable can be used to specify hosts which
+   shouldn't be reached via proxy; if set, it should be a comma-separated list
+   of hostname suffixes, optionally with ``:port`` appended, for example
+   ``cern.ch,ncsa.uiuc.edu,some.host:8080``.
+
    In a Windows environment, if no proxy environment variables are set, proxy
    settings are obtained from the registry's Internet Settings section.
 

Modified: python/branches/py3k-ctypes-pep3118/Doc/reference/lexical_analysis.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/reference/lexical_analysis.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/reference/lexical_analysis.rst	Thu Jan 24 22:12:24 2008
@@ -502,7 +502,7 @@
 
 (4)
    Individual code units which form parts of a surrogate pair can be encoded using
-   this escape sequence.
+   this escape sequence. Unlike in Standard C, exactly two hex digits are required.
 
 (5)
    Any Unicode character can be encoded this way, but characters outside the Basic

Modified: python/branches/py3k-ctypes-pep3118/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/tutorial/controlflow.rst	Thu Jan 24 22:12:24 2008
@@ -235,10 +235,11 @@
 The *execution* of a function introduces a new symbol table used for the local
 variables of the function.  More precisely, all variable assignments in a
 function store the value in the local symbol table; whereas variable references
-first look in the local symbol table, then in the global symbol table, and then
-in the table of built-in names. Thus,  global variables cannot be directly
-assigned a value within a function (unless named in a :keyword:`global`
-statement), although they may be referenced.
+first look in the local symbol table, then in the local symbol tables of
+enclosing functions, then in the global symbol table, and finally in the table
+of built-in names. Thus, global variables cannot be directly assigned a value
+within a function (unless named in a :keyword:`global` statement), although they
+may be referenced.
 
 The actual parameters (arguments) to a function call are introduced in the local
 symbol table of the called function when it is called; thus, arguments are
@@ -263,7 +264,7 @@
 technically speaking, procedures do return a value, albeit a rather boring one.
 This value is called ``None`` (it's a built-in name).  Writing the value
 ``None`` is normally suppressed by the interpreter if it would be the only value
-written.  You can see it if you really want to using :keyword:`print`::
+written.  You can see it if you really want to using :func:`print`::
 
    >>> fib(0)
    >>> print(fib(0))

Modified: python/branches/py3k-ctypes-pep3118/Doc/tutorial/interpreter.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/tutorial/interpreter.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/tutorial/interpreter.rst	Thu Jan 24 22:12:24 2008
@@ -169,6 +169,12 @@
 
    $ chmod +x myscript.py
 
+On Windows systems, there is no notion of an "executable mode".  The Python
+installer automatically associates ``.py`` files with ``python.exe`` so that
+a double-click on a Python file will run it as a script.  The extension can
+also be ``.pyw``, in that case, the console window that normally appears is
+suppressed.
+
 
 Source Code Encoding
 --------------------

Modified: python/branches/py3k-ctypes-pep3118/Doc/tutorial/stdlib2.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/tutorial/stdlib2.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/tutorial/stdlib2.rst	Thu Jan 24 22:12:24 2008
@@ -134,8 +134,10 @@
 
 The :mod:`struct` module provides :func:`pack` and :func:`unpack` functions for
 working with variable length binary record formats.  The following example shows
-how to loop through header information in a ZIP file (with pack codes ``"H"``
-and ``"L"`` representing two and four byte unsigned numbers respectively)::
+how to loop through header information in a ZIP file without using the
+:mod:`zipfile` module.  Pack codes ``"H"`` and ``"I"`` represent two and four
+byte unsigned numbers respectively.  The ``"<"`` indicates that they are
+standard size and in little-endian byte order::
 
    import struct
 
@@ -143,7 +145,7 @@
    start = 0
    for i in range(3):                      # show the first 3 file headers
        start += 14
-       fields = struct.unpack('LLLHH', data[start:start+16])
+       fields = struct.unpack('<IIIHH', data[start:start+16])
        crc32, comp_size, uncomp_size, filenamesize, extra_size = fields
 
        start += 16

Modified: python/branches/py3k-ctypes-pep3118/Doc/using/cmdline.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/using/cmdline.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/using/cmdline.rst	Thu Jan 24 22:12:24 2008
@@ -297,14 +297,14 @@
 .. envvar:: PYTHONHOME
    
    Change the location of the standard Python libraries.  By default, the
-   libraries are searched in :file:`{prefix}/lib/python<version>` and
-   :file:`{exec_prefix}/lib/python<version>`, where :file:`{prefix}` and
+   libraries are searched in :file:`{prefix}/lib/python{version}` and
+   :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and
    :file:`{exec_prefix}` are installation-dependent directories, both defaulting
    to :file:`/usr/local`.
    
    When :envvar:`PYTHONHOME` is set to a single directory, its value replaces
    both :file:`{prefix}` and :file:`{exec_prefix}`.  To specify different values
-   for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}``.
+   for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`.
 
 
 .. envvar:: PYTHONPATH
@@ -314,7 +314,7 @@
    colons.  Non-existent directories are silently ignored.
    
    The default search path is installation dependent, but generally begins with
-   :file:`{prefix}/lib/python<version>`` (see :envvar:`PYTHONHOME` above).  It
+   :file:`{prefix}/lib/python{version}`` (see :envvar:`PYTHONHOME` above).  It
    is *always* appended to :envvar:`PYTHONPATH`.
    
    If a script argument is given, the directory containing the script is

Modified: python/branches/py3k-ctypes-pep3118/Doc/whatsnew/3.0.rst
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Doc/whatsnew/3.0.rst	(original)
+++ python/branches/py3k-ctypes-pep3118/Doc/whatsnew/3.0.rst	Thu Jan 24 22:12:24 2008
@@ -389,7 +389,8 @@
 
 * Everything is all in the details!
 
-* Developers can include intobject.h after Python.h for some PyInt_ aliases.
+* Developers can include :file:`intobject.h` after :file:`Python.h` for
+  some ``PyInt_`` aliases.
 
 .. ======================================================================
 

Modified: python/branches/py3k-ctypes-pep3118/Include/modsupport.h
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Include/modsupport.h	(original)
+++ python/branches/py3k-ctypes-pep3118/Include/modsupport.h	Thu Jan 24 22:12:24 2008
@@ -40,7 +40,8 @@
 PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
 PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
 PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
-
+#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
+#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
 
 #define PYTHON_API_VERSION 1013
 #define PYTHON_API_STRING "1013"

Modified: python/branches/py3k-ctypes-pep3118/Include/pyport.h
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Include/pyport.h	(original)
+++ python/branches/py3k-ctypes-pep3118/Include/pyport.h	Thu Jan 24 22:12:24 2008
@@ -388,8 +388,8 @@
  * macro for this particular test is useful
  */
 #ifndef Py_IS_FINITE
-#ifdef HAVE_ISFINITE
-#define Py_IS_FINITE(X) isfinite
+#ifdef HAVE_FINITE
+#define Py_IS_FINITE(X) finite(X)
 #else
 #define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
 #endif

Modified: python/branches/py3k-ctypes-pep3118/Include/structmember.h
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Include/structmember.h	(original)
+++ python/branches/py3k-ctypes-pep3118/Include/structmember.h	Thu Jan 24 22:12:24 2008
@@ -54,6 +54,9 @@
 /* Added by Jack: strings contained in the structure */
 #define T_STRING_INPLACE	13
 
+/* Added by Lillo: bools contained in the structure (assumed char) */
+#define T_BOOL		14
+
 #define T_OBJECT_EX	16	/* Like T_OBJECT, but raises AttributeError
 				   when the value is NULL, instead of
 				   converting to None. */

Modified: python/branches/py3k-ctypes-pep3118/Lib/distutils/command/build.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/distutils/command/build.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/distutils/command/build.py	Thu Jan 24 22:12:24 2008
@@ -66,6 +66,12 @@
     def finalize_options(self):
         plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3])
 
+        # Make it so Python 2.x and Python 2.x with --with-pydebug don't
+        # share the same build directories. Doing so confuses the build
+        # process for C modules
+        if hasattr(sys, 'gettotalrefcount'):
+            plat_specifier += '-pydebug'
+
         # 'build_purelib' and 'build_platlib' just default to 'lib' and
         # 'lib.<plat>' under the base build directory.  We only use one of
         # them for a given distribution, though --

Modified: python/branches/py3k-ctypes-pep3118/Lib/formatter.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/formatter.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/formatter.py	Thu Jan 24 22:12:24 2008
@@ -433,10 +433,7 @@
         fp = open(sys.argv[1])
     else:
         fp = sys.stdin
-    while 1:
-        line = fp.readline()
-        if not line:
-            break
+    for line in fp:
         if line == '\n':
             f.end_paragraph(1)
         else:

Modified: python/branches/py3k-ctypes-pep3118/Lib/ftplib.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/ftplib.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/ftplib.py	Thu Jan 24 22:12:24 2008
@@ -32,6 +32,7 @@
 # Changes and improvements suggested by Steve Majewski.
 # Modified by Jack to work on the mac.
 # Modified by Siebren to support docstrings and PASV.
+# Modified by Phil Schwartz to add storbinary and storlines callbacks.
 #
 
 import os
@@ -313,7 +314,7 @@
         expected size may be None if it could not be determined.
 
         Optional `rest' argument can be a string that is sent as the
-        argument to a RESTART command.  This is essentially a server
+        argument to a REST command.  This is essentially a server
         marker used to tell the server to skip over any data up to the
         given marker.
         """
@@ -376,14 +377,18 @@
         return resp
 
     def retrbinary(self, cmd, callback, blocksize=8192, rest=None):
-        """Retrieve data in binary mode.
+        """Retrieve data in binary mode.  A new port is created for you.
 
-        `cmd' is a RETR command.  `callback' is a callback function is
-        called for each block.  No more than `blocksize' number of
-        bytes will be read from the socket.  Optional `rest' is passed
-        to transfercmd().
+        Args:
+          cmd: A RETR command.
+          callback: A single parameter callable to be called on each
+                    block of data read.
+          blocksize: The maximum number of bytes to read from the
+                     socket at one time.  [default: 8192]
+          rest: Passed to transfercmd().  [default: None]
 
-        A new port is created for you.  Return the response code.
+        Returns:
+          The response code.
         """
         self.voidcmd('TYPE I')
         conn = self.transfercmd(cmd, rest)
@@ -396,11 +401,17 @@
         return self.voidresp()
 
     def retrlines(self, cmd, callback = None):
-        '''Retrieve data in line mode.
-        The argument is a RETR or LIST command.
-        The callback function (2nd argument) is called for each line,
-        with trailing CRLF stripped.  This creates a new port for you.
-        print_line() is the default callback.'''
+        """Retrieve data in line mode.  A new port is created for you.
+
+        Args:
+          cmd: A RETR, LIST, NLST, or MLSD command.
+          callback: An optional single parameter callable that is called
+                    for each line with the trailing CRLF stripped.
+                    [default: print_line()]
+
+        Returns:
+          The response code.
+        """
         if callback is None: callback = print_line
         resp = self.sendcmd('TYPE A')
         conn = self.transfercmd(cmd)
@@ -419,19 +430,42 @@
         conn.close()
         return self.voidresp()
 
-    def storbinary(self, cmd, fp, blocksize=8192):
-        '''Store a file in binary mode.'''
+    def storbinary(self, cmd, fp, blocksize=8192, callback=None):
+        """Store a file in binary mode.  A new port is created for you.
+
+        Args:
+          cmd: A STOR command.
+          fp: A file-like object with a read(num_bytes) method.
+          blocksize: The maximum data size to read from fp and send over
+                     the connection at once.  [default: 8192]
+          callback: An optional single parameter callable that is called on
+                    on each block of data after it is sent.  [default: None]
+
+        Returns:
+          The response code.
+        """
         self.voidcmd('TYPE I')
         conn = self.transfercmd(cmd)
         while 1:
             buf = fp.read(blocksize)
             if not buf: break
             conn.sendall(buf)
+            if callback: callback(buf)
         conn.close()
         return self.voidresp()
 
-    def storlines(self, cmd, fp):
-        '''Store a file in line mode.'''
+    def storlines(self, cmd, fp, callback=None):
+        """Store a file in line mode.  A new port is created for you.
+
+        Args:
+          cmd: A STOR command.
+          fp: A file-like object with a readline() method.
+          callback: An optional single parameter callable that is called on
+                    on each line after it is sent.  [default: None]
+
+        Returns:
+          The response code.
+        """
         self.voidcmd('TYPE A')
         conn = self.transfercmd(cmd)
         while 1:
@@ -441,6 +475,7 @@
                 if buf[-1] in CRLF: buf = buf[:-1]
                 buf = buf + CRLF
             conn.sendall(buf)
+            if callback: callback(buf)
         conn.close()
         return self.voidresp()
 
@@ -505,7 +540,7 @@
 
     def size(self, filename):
         '''Retrieve the size of a file.'''
-        # Note that the RFC doesn't say anything about 'SIZE'
+        # The SIZE command is defined in RFC-3659
         resp = self.sendcmd('SIZE ' + filename)
         if resp[:3] == '213':
             s = resp[3:].strip()

Modified: python/branches/py3k-ctypes-pep3118/Lib/heapq.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/heapq.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/heapq.py	Thu Jan 24 22:12:24 2008
@@ -351,7 +351,8 @@
     Equivalent to:  sorted(iterable, key=key)[:n]
     """
     in1, in2 = tee(iterable)
-    it = izip(map(key, in1), count(), in2)                  # decorate
+    keys = in1 if key is None else map(key, in1)
+    it = izip(keys, count(), in2)                           # decorate
     result = _nsmallest(n, it)
     return list(map(itemgetter(2), result))                 # undecorate
 
@@ -362,7 +363,8 @@
     Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]
     """
     in1, in2 = tee(iterable)
-    it = izip(map(key, in1), map(neg, count()), in2)        # decorate
+    keys = in1 if key is None else map(key, in1)
+    it = izip(keys, map(neg, count()), in2)                 # decorate
     result = _nlargest(n, it)
     return list(map(itemgetter(2), result))                 # undecorate
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/idlelib/NEWS.txt
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/idlelib/NEWS.txt	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/idlelib/NEWS.txt	Thu Jan 24 22:12:24 2008
@@ -45,6 +45,11 @@
 
 *Release date: XX-XXX-200X*  UNRELEASED, but merged into 3.0
 
+- There was an error on exit if no sys.exitfunc was defined. Issue 1647.
+
+- Could not open files in .idlerc directory if latter was hidden on Windows.
+  Issue 1743, Issue 1862.
+
 - Configure Dialog: improved layout for keybinding.  Patch 1457 Tal Einat.
 
 - tabpage.py updated: tabbedPages.py now supports multiple dynamic rows

Modified: python/branches/py3k-ctypes-pep3118/Lib/idlelib/configHandler.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/idlelib/configHandler.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/idlelib/configHandler.py	Thu Jan 24 22:12:24 2008
@@ -139,7 +139,12 @@
 
         """
         if not self.IsEmpty():
-            cfgFile=open(self.file,'w')
+            fname = self.file
+            try:
+                cfgFile = open(fname, 'w')
+            except IOError:
+                fname.unlink()
+                cfgFile = open(fname, 'w')
             self.write(cfgFile)
         else:
             self.RemoveFile()

Modified: python/branches/py3k-ctypes-pep3118/Lib/keyword.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/keyword.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/keyword.py	Thu Jan 24 22:12:24 2008
@@ -64,9 +64,7 @@
     fp = open(iptfile)
     strprog = re.compile('"([^"]+)"')
     lines = []
-    while 1:
-        line = fp.readline()
-        if not line: break
+    for line in fp:
         if '{1, "' in line:
             match = strprog.search(line)
             if match:

Modified: python/branches/py3k-ctypes-pep3118/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/logging/__init__.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/logging/__init__.py	Thu Jan 24 22:12:24 2008
@@ -38,8 +38,8 @@
 
 __author__  = "Vinay Sajip <vinay_sajip at red-dove.com>"
 __status__  = "production"
-__version__ = "0.5.0.4"
-__date__    = "18 January 2008"
+__version__ = "0.5.0.5"
+__date__    = "24 January 2008"
 
 #---------------------------------------------------------------------------
 #   Miscellaneous module data
@@ -760,7 +760,7 @@
     """
     A handler class which writes formatted logging records to disk files.
     """
-    def __init__(self, filename, mode='a', encoding=None):
+    def __init__(self, filename, mode='a', encoding=None, delay=0):
         """
         Open the specified file and use it as the stream for logging.
         """
@@ -771,8 +771,11 @@
         self.baseFilename = os.path.abspath(filename)
         self.mode = mode
         self.encoding = encoding
-        stream = self._open()
-        StreamHandler.__init__(self, stream)
+        if delay:
+            self.stream = None
+        else:
+            stream = self._open()
+            StreamHandler.__init__(self, stream)
 
     def close(self):
         """
@@ -795,6 +798,18 @@
             stream = codecs.open(self.baseFilename, self.mode, self.encoding)
         return stream
 
+    def emit(self, record):
+        """
+        Emit a record.
+
+        If the stream was not opened because 'delay' was specified in the
+        constructor, open it before calling the superclass's emit.
+        """
+        if self.stream is None:
+            stream = self._open()
+            StreamHandler.__init__(self, stream)
+        StreamHandler.emit(self, record)
+
 #---------------------------------------------------------------------------
 #   Manager classes and functions
 #---------------------------------------------------------------------------

Modified: python/branches/py3k-ctypes-pep3118/Lib/logging/handlers.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/logging/handlers.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/logging/handlers.py	Thu Jan 24 22:12:24 2008
@@ -51,13 +51,13 @@
     Not meant to be instantiated directly.  Instead, use RotatingFileHandler
     or TimedRotatingFileHandler.
     """
-    def __init__(self, filename, mode, encoding=None):
+    def __init__(self, filename, mode, encoding=None, delay=0):
         """
         Use the specified filename for streamed logging
         """
         if codecs is None:
             encoding = None
-        logging.FileHandler.__init__(self, filename, mode, encoding)
+        logging.FileHandler.__init__(self, filename, mode, encoding, delay)
         self.mode = mode
         self.encoding = encoding
 
@@ -82,7 +82,7 @@
     Handler for logging to a set of files, which switches from one file
     to the next when the current file reaches a certain size.
     """
-    def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None):
+    def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0):
         """
         Open the specified file and use it as the stream for logging.
 
@@ -105,7 +105,7 @@
         """
         if maxBytes > 0:
             mode = 'a' # doesn't make sense otherwise!
-        BaseRotatingHandler.__init__(self, filename, mode, encoding)
+        BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
         self.maxBytes = maxBytes
         self.backupCount = backupCount
 
@@ -154,8 +154,8 @@
     If backupCount is > 0, when rollover is done, no more than backupCount
     files are kept - the oldest ones are deleted.
     """
-    def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None):
-        BaseRotatingHandler.__init__(self, filename, 'a', encoding)
+    def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0):
+        BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
         self.when = when.upper()
         self.backupCount = backupCount
         # Calculate the real rollover interval, which is just the number of
@@ -226,13 +226,16 @@
             #         Days to rollover is 6 - 5 + 3, or 4.  In this case, it's the
             #         number of days left in the current week (1) plus the number
             #         of days in the next week until the rollover day (3).
+            # The calculations described in 2) and 3) above need to have a day added.
+            # This is because the above time calculation takes us to midnight on this
+            # day, i.e. the start of the next day.
             if when.startswith('W'):
                 day = t[6] # 0 is Monday
                 if day != self.dayOfWeek:
                     if day < self.dayOfWeek:
-                        daysToWait = self.dayOfWeek - day - 1
+                        daysToWait = self.dayOfWeek - day
                     else:
-                        daysToWait = 6 - day + self.dayOfWeek
+                        daysToWait = 6 - day + self.dayOfWeek + 1
                     self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
 
         #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
@@ -297,10 +300,13 @@
     This handler is based on a suggestion and patch by Chad J.
     Schroeder.
     """
-    def __init__(self, filename, mode='a', encoding=None):
-        logging.FileHandler.__init__(self, filename, mode, encoding)
-        stat = os.stat(self.baseFilename)
-        self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
+    def __init__(self, filename, mode='a', encoding=None, delay=0):
+        logging.FileHandler.__init__(self, filename, mode, encoding, delay)
+        if not os.path.exists(self.baseFilename):
+            self.dev, self.ino = -1, -1
+        else:
+            stat = os.stat(self.baseFilename)
+            self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
 
     def emit(self, record):
         """
@@ -316,7 +322,7 @@
         else:
             stat = os.stat(self.baseFilename)
             changed = (stat[ST_DEV] != self.dev) or (stat[ST_INO] != self.ino)
-        if changed:
+        if changed and self.stream is not None:
             self.stream.flush()
             self.stream.close()
             self.stream = self._open()

Deleted: /python/branches/py3k-ctypes-pep3118/Lib/plat-mac/plistlib.py
==============================================================================
--- /python/branches/py3k-ctypes-pep3118/Lib/plat-mac/plistlib.py	Thu Jan 24 22:12:24 2008
+++ (empty file)
@@ -1,469 +0,0 @@
-"""plistlib.py -- a tool to generate and parse MacOSX .plist files.
-
-The PropertList (.plist) file format is a simple XML pickle supporting
-basic object types, like dictionaries, lists, numbers and strings.
-Usually the top level object is a dictionary.
-
-To write out a plist file, use the writePlist(rootObject, pathOrFile)
-function. 'rootObject' is the top level object, 'pathOrFile' is a
-filename or a (writable) file object.
-
-To parse a plist from a file, use the readPlist(pathOrFile) function,
-with a file name or a (readable) file object as the only argument. It
-returns the top level object (again, usually a dictionary).
-
-To work with plist data in bytes objects, you can use readPlistFromBytes()
-and writePlistToBytes().
-
-Values can be strings, integers, floats, booleans, tuples, lists,
-dictionaries, Data or datetime.datetime objects. String values (including
-dictionary keys) may be unicode strings -- they will be written out as
-UTF-8.
-
-The <data> plist type is supported through the Data class. This is a
-thin wrapper around a Python bytes object.
-
-Generate Plist example:
-
-    pl = dict(
-        aString="Doodah",
-        aList=["A", "B", 12, 32.1, [1, 2, 3]],
-        aFloat = 0.1,
-        anInt = 728,
-        aDict=dict(
-            anotherString="<hello & hi there!>",
-            aUnicodeValue=u'M\xe4ssig, Ma\xdf',
-            aTrueValue=True,
-            aFalseValue=False,
-        ),
-        someData = Data(b"<binary gunk>"),
-        someMoreData = Data(b"<lots of binary gunk>" * 10),
-        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
-    )
-    # unicode keys are possible, but a little awkward to use:
-    pl[u'\xc5benraa'] = "That was a unicode key."
-    writePlist(pl, fileName)
-
-Parse Plist example:
-
-    pl = readPlist(pathOrFile)
-    print pl["aKey"]
-"""
-
-
-__all__ = [
-    "readPlist", "writePlist", "readPlistFromBytes", "writePlistToBytes",
-    "readPlistFromResource", "writePlistToResource",
-    "Plist", "Data", "Dict"
-]
-# Note: the Plist and Dict classes have been deprecated.
-
-import binascii
-import datetime
-from io import BytesIO
-import re
-
-
-def readPlist(pathOrFile):
-    """Read a .plist file. 'pathOrFile' may either be a file name or a
-    (readable) file object. Return the unpacked root object (which
-    usually is a dictionary).
-    """
-    didOpen = False
-    if isinstance(pathOrFile, str):
-        pathOrFile = open(pathOrFile, 'rb')
-        didOpen = True
-    p = PlistParser()
-    rootObject = p.parse(pathOrFile)
-    if didOpen:
-        pathOrFile.close()
-    return rootObject
-
-
-def writePlist(rootObject, pathOrFile):
-    """Write 'rootObject' to a .plist file. 'pathOrFile' may either be a
-    file name or a (writable) file object.
-    """
-    didOpen = False
-    if isinstance(pathOrFile, str):
-        pathOrFile = open(pathOrFile, 'wb')
-        didOpen = True
-    writer = PlistWriter(pathOrFile)
-    writer.writeln("<plist version=\"1.0\">")
-    writer.writeValue(rootObject)
-    writer.writeln("</plist>")
-    if didOpen:
-        pathOrFile.close()
-
-
-def readPlistFromBytes(data):
-    """Read a plist data from a bytes object. Return the root object.
-    """
-    return readPlist(BytesIO(data))
-
-
-def writePlistToBytes(rootObject):
-    """Return 'rootObject' as a plist-formatted bytes object.
-    """
-    f = BytesIO()
-    writePlist(rootObject, f)
-    return f.getvalue()
-
-
-def readPlistFromResource(path, restype='plst', resid=0):
-    """Read plst resource from the resource fork of path.
-    """
-    from Carbon.File import FSRef, FSGetResourceForkName
-    from Carbon.Files import fsRdPerm
-    from Carbon import Res
-    fsRef = FSRef(path)
-    resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdPerm)
-    Res.UseResFile(resNum)
-    plistData = Res.Get1Resource(restype, resid).data
-    Res.CloseResFile(resNum)
-    return readPlistFromString(plistData)
-
-
-def writePlistToResource(rootObject, path, restype='plst', resid=0):
-    """Write 'rootObject' as a plst resource to the resource fork of path.
-    """
-    from Carbon.File import FSRef, FSGetResourceForkName
-    from Carbon.Files import fsRdWrPerm
-    from Carbon import Res
-    plistData = writePlistToString(rootObject)
-    fsRef = FSRef(path)
-    resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm)
-    Res.UseResFile(resNum)
-    try:
-        Res.Get1Resource(restype, resid).RemoveResource()
-    except Res.Error:
-        pass
-    res = Res.Resource(plistData)
-    res.AddResource(restype, resid, '')
-    res.WriteResource()
-    Res.CloseResFile(resNum)
-
-
-class DumbXMLWriter:
-    def __init__(self, file, indentLevel=0, indent="\t"):
-        self.file = file
-        self.stack = []
-        self.indentLevel = indentLevel
-        self.indent = indent
-
-    def beginElement(self, element):
-        self.stack.append(element)
-        self.writeln("<%s>" % element)
-        self.indentLevel += 1
-
-    def endElement(self, element):
-        assert self.indentLevel > 0
-        assert self.stack.pop() == element
-        self.indentLevel -= 1
-        self.writeln("</%s>" % element)
-
-    def simpleElement(self, element, value=None):
-        if value is not None:
-            value = _escape(value)
-            self.writeln("<%s>%s</%s>" % (element, value, element))
-        else:
-            self.writeln("<%s/>" % element)
-
-    def writeln(self, line):
-        if line:
-            # plist has fixed encoding of utf-8
-            if isinstance(line, str):
-                line = line.encode('utf-8')
-            self.file.write(self.indentLevel * self.indent)
-            self.file.write(line)
-        self.file.write(b'\n')
-
-
-# Contents should conform to a subset of ISO 8601
-# (in particular, YYYY '-' MM '-' DD 'T' HH ':' MM ':' SS 'Z'.  Smaller units may be omitted with
-#  a loss of precision)
-_dateParser = re.compile(r"(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?Z")
-
-def _dateFromString(s):
-    order = ('year', 'month', 'day', 'hour', 'minute', 'second')
-    gd = _dateParser.match(s).groupdict()
-    lst = []
-    for key in order:
-        val = gd[key]
-        if val is None:
-            break
-        lst.append(int(val))
-    return datetime.datetime(*lst)
-
-def _dateToString(d):
-    return '%04d-%02d-%02dT%02d:%02d:%02dZ' % (
-        d.year, d.month, d.day,
-        d.hour, d.minute, d.second
-    )
-
-
-# Regex to find any control chars, except for \t \n and \r
-_controlCharPat = re.compile(
-    r"[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f"
-    r"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]")
-
-def _escape(text):
-    m = _controlCharPat.search(text)
-    if m is not None:
-        raise ValueError("strings can't contains control characters; "
-                         "use plistlib.Data instead")
-    text = text.replace("\r\n", "\n")       # convert DOS line endings
-    text = text.replace("\r", "\n")         # convert Mac line endings
-    text = text.replace("&", "&amp;")       # escape '&'
-    text = text.replace("<", "&lt;")        # escape '<'
-    text = text.replace(">", "&gt;")        # escape '>'
-    return text
-
-
-PLISTHEADER = b"""\
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-"""
-
-class PlistWriter(DumbXMLWriter):
-
-    def __init__(self, file, indentLevel=0, indent=b"\t", writeHeader=1):
-        if writeHeader:
-            file.write(PLISTHEADER)
-        DumbXMLWriter.__init__(self, file, indentLevel, indent)
-
-    def writeValue(self, value):
-        if isinstance(value, str):
-            self.simpleElement("string", value)
-        elif isinstance(value, bool):
-            # must switch for bool before int, as bool is a
-            # subclass of int...
-            if value:
-                self.simpleElement("true")
-            else:
-                self.simpleElement("false")
-        elif isinstance(value, int):
-            self.simpleElement("integer", "%d" % value)
-        elif isinstance(value, float):
-            self.simpleElement("real", repr(value))
-        elif isinstance(value, dict):
-            self.writeDict(value)
-        elif isinstance(value, Data):
-            self.writeData(value)
-        elif isinstance(value, datetime.datetime):
-            self.simpleElement("date", _dateToString(value))
-        elif isinstance(value, (tuple, list)):
-            self.writeArray(value)
-        else:
-            raise TypeError("unsuported type: %s" % type(value))
-
-    def writeData(self, data):
-        self.beginElement("data")
-        self.indentLevel -= 1
-        maxlinelength = 76 - len(self.indent.replace(b"\t", b" " * 8) *
-                                 self.indentLevel)
-        for line in data.asBase64(maxlinelength).split(b"\n"):
-            if line:
-                self.writeln(line)
-        self.indentLevel += 1
-        self.endElement("data")
-
-    def writeDict(self, d):
-        self.beginElement("dict")
-        items = sorted(d.items())
-        for key, value in items:
-            if not isinstance(key, str):
-                raise TypeError("keys must be strings")
-            self.simpleElement("key", key)
-            self.writeValue(value)
-        self.endElement("dict")
-
-    def writeArray(self, array):
-        self.beginElement("array")
-        for value in array:
-            self.writeValue(value)
-        self.endElement("array")
-
-
-class _InternalDict(dict):
-
-    # This class is needed while Dict is scheduled for deprecation:
-    # we only need to warn when a *user* instantiates Dict or when
-    # the "attribute notation for dict keys" is used.
-
-    def __getattr__(self, attr):
-        try:
-            value = self[attr]
-        except KeyError:
-            raise AttributeError(attr)
-        from warnings import warn
-        warn("Attribute access from plist dicts is deprecated, use d[key] "
-             "notation instead", PendingDeprecationWarning)
-        return value
-
-    def __setattr__(self, attr, value):
-        from warnings import warn
-        warn("Attribute access from plist dicts is deprecated, use d[key] "
-             "notation instead", PendingDeprecationWarning)
-        self[attr] = value
-
-    def __delattr__(self, attr):
-        try:
-            del self[attr]
-        except KeyError:
-            raise AttributeError(attr)
-        from warnings import warn
-        warn("Attribute access from plist dicts is deprecated, use d[key] "
-             "notation instead", PendingDeprecationWarning)
-
-class Dict(_InternalDict):
-
-    def __init__(self, **kwargs):
-        from warnings import warn
-        warn("The plistlib.Dict class is deprecated, use builtin dict instead",
-             PendingDeprecationWarning)
-        super().__init__(**kwargs)
-
-
-class Plist(_InternalDict):
-
-    """This class has been deprecated. Use readPlist() and writePlist()
-    functions instead, together with regular dict objects.
-    """
-
-    def __init__(self, **kwargs):
-        from warnings import warn
-        warn("The Plist class is deprecated, use the readPlist() and "
-             "writePlist() functions instead", PendingDeprecationWarning)
-        super().__init__(**kwargs)
-
-    def fromFile(cls, pathOrFile):
-        """Deprecated. Use the readPlist() function instead."""
-        rootObject = readPlist(pathOrFile)
-        plist = cls()
-        plist.update(rootObject)
-        return plist
-    fromFile = classmethod(fromFile)
-
-    def write(self, pathOrFile):
-        """Deprecated. Use the writePlist() function instead."""
-        writePlist(self, pathOrFile)
-
-
-def _encodeBase64(s, maxlinelength=76):
-    # copied from base64.encodestring(), with added maxlinelength argument
-    maxbinsize = (maxlinelength//4)*3
-    pieces = []
-    for i in range(0, len(s), maxbinsize):
-        chunk = s[i : i + maxbinsize]
-        pieces.append(binascii.b2a_base64(chunk))
-    return b''.join(pieces)
-
-class Data:
-
-    """Wrapper for binary data."""
-
-    def __init__(self, data):
-        if not isinstance(data, bytes):
-            raise TypeError("data must be as bytes")
-        self.data = data
-
-    @classmethod
-    def fromBase64(cls, data):
-        # base64.decodestring just calls binascii.a2b_base64;
-        # it seems overkill to use both base64 and binascii.
-        return cls(binascii.a2b_base64(data))
-
-    def asBase64(self, maxlinelength=76):
-        return _encodeBase64(self.data, maxlinelength)
-
-    def __eq__(self, other):
-        if isinstance(other, self.__class__):
-            return self.data == other.data
-        elif isinstance(other, str):
-            return self.data == other
-        else:
-            return id(self) == id(other)
-
-    def __repr__(self):
-        return "%s(%s)" % (self.__class__.__name__, repr(self.data))
-
-
-class PlistParser:
-
-    def __init__(self):
-        self.stack = []
-        self.currentKey = None
-        self.root = None
-
-    def parse(self, fileobj):
-        from xml.parsers.expat import ParserCreate
-        parser = ParserCreate()
-        parser.StartElementHandler = self.handleBeginElement
-        parser.EndElementHandler = self.handleEndElement
-        parser.CharacterDataHandler = self.handleData
-        parser.ParseFile(fileobj)
-        return self.root
-
-    def handleBeginElement(self, element, attrs):
-        self.data = []
-        handler = getattr(self, "begin_" + element, None)
-        if handler is not None:
-            handler(attrs)
-
-    def handleEndElement(self, element):
-        handler = getattr(self, "end_" + element, None)
-        if handler is not None:
-            handler()
-
-    def handleData(self, data):
-        self.data.append(data)
-
-    def addObject(self, value):
-        if self.currentKey is not None:
-            self.stack[-1][self.currentKey] = value
-            self.currentKey = None
-        elif not self.stack:
-            # this is the root object
-            self.root = value
-        else:
-            self.stack[-1].append(value)
-
-    def getData(self):
-        data = ''.join(self.data)
-        self.data = []
-        return data
-
-    # element handlers
-
-    def begin_dict(self, attrs):
-        d = _InternalDict()
-        self.addObject(d)
-        self.stack.append(d)
-    def end_dict(self):
-        self.stack.pop()
-
-    def end_key(self):
-        self.currentKey = self.getData()
-
-    def begin_array(self, attrs):
-        a = []
-        self.addObject(a)
-        self.stack.append(a)
-    def end_array(self):
-        self.stack.pop()
-
-    def end_true(self):
-        self.addObject(True)
-    def end_false(self):
-        self.addObject(False)
-    def end_integer(self):
-        self.addObject(int(self.getData()))
-    def end_real(self):
-        self.addObject(float(self.getData()))
-    def end_string(self):
-        self.addObject(self.getData())
-    def end_data(self):
-        self.addObject(Data.fromBase64(self.getData().encode("utf-8")))
-    def end_date(self):
-        self.addObject(_dateFromString(self.getData()))

Modified: python/branches/py3k-ctypes-pep3118/Lib/pprint.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/pprint.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/pprint.py	Thu Jan 24 22:12:24 2008
@@ -159,11 +159,24 @@
                 write('}')
                 return
 
-            if (issubclass(typ, list) and r is list.__repr__) or \
-               (issubclass(typ, tuple) and r is tuple.__repr__):
+            if ((issubclass(typ, list) and r is list.__repr__) or
+                (issubclass(typ, tuple) and r is tuple.__repr__) or
+                (issubclass(typ, set) and r is set.__repr__) or
+                (issubclass(typ, frozenset) and r is frozenset.__repr__)
+               ):
                 if issubclass(typ, list):
                     write('[')
                     endchar = ']'
+                elif issubclass(typ, set):
+                    write('{')
+                    endchar = '}'
+                    object = sorted(object)
+                    indent += 4
+                elif issubclass(typ, frozenset):
+                    write('frozenset([')
+                    endchar = '])'
+                    object = sorted(object)
+                    indent += 9
                 else:
                     write('(')
                     endchar = ')'

Modified: python/branches/py3k-ctypes-pep3118/Lib/pstats.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/pstats.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/pstats.py	Thu Jan 24 22:12:24 2008
@@ -511,7 +511,8 @@
         new_callers[func] = caller
     for func, caller in source.items():
         if func in new_callers:
-            new_callers[func] = caller + new_callers[func]
+            new_callers[func] = tuple([i[0] + i[1] for i in
+                                       zip(caller, new_callers[func])])
         else:
             new_callers[func] = caller
     return new_callers

Modified: python/branches/py3k-ctypes-pep3118/Lib/pydoc.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/pydoc.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/pydoc.py	Thu Jan 24 22:12:24 2008
@@ -27,7 +27,7 @@
 
 Module docs for core modules are assumed to be in
 
-    http://www.python.org/doc/current/lib/
+    http://docs.python.org/library/
 
 This can be overridden by setting the PYTHONDOCS environment variable
 to a different URL or to a local directory containing the Library
@@ -341,7 +341,7 @@
             file = '(built-in)'
 
         docloc = os.environ.get("PYTHONDOCS",
-                                "http://www.python.org/doc/current/lib")
+                                "http://docs.python.org/library")
         basedir = os.path.join(sys.exec_prefix, "lib",
                                "python"+sys.version[0:3])
         if (isinstance(object, type(os)) and
@@ -350,11 +350,10 @@
                                  'thread', 'zipimport') or
              (file.startswith(basedir) and
               not file.startswith(os.path.join(basedir, 'site-packages'))))):
-            htmlfile = "module-%s.html" % object.__name__
             if docloc.startswith("http://"):
-                docloc = "%s/%s" % (docloc.rstrip("/"), htmlfile)
+                docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__)
             else:
-                docloc = os.path.join(docloc, htmlfile)
+                docloc = os.path.join(docloc, object.__name__ + ".html")
         else:
             docloc = None
         return docloc
@@ -537,7 +536,7 @@
                 url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif pep:
-                url = 'http://www.python.org/peps/pep-%04d.html' % int(pep)
+                url = 'http://www.python.org/peps/pep-%04d' % int(pep)
                 results.append('<a href="%s">%s</a>' % (url, escape(all)))
             elif text[end:end+1] == '(':
                 results.append(self.namelink(name, methods, funcs, classes))
@@ -1056,9 +1055,11 @@
             if visiblename(key, all):
                 data.append((key, value))
 
+        modpkgs = []
+        modpkgs_names = set()
         if hasattr(object, '__path__'):
-            modpkgs = []
             for importer, modname, ispkg in pkgutil.iter_modules(object.__path__):
+                modpkgs_names.add(modname)
                 if ispkg:
                     modpkgs.append(modname + ' (package)')
                 else:
@@ -1068,6 +1069,16 @@
             result = result + self.section(
                 'PACKAGE CONTENTS', '\n'.join(modpkgs))
 
+        # Detect submodules as sometimes created by C extensions
+        submodules = []
+        for key, value in inspect.getmembers(object, inspect.ismodule):
+            if value.__name__.startswith(name + '.') and key not in modpkgs_names:
+                submodules.append(key)
+        if submodules:
+            submodules.sort()
+            result = result + self.section(
+                'SUBMODULES', join(submodules, '\n'))
+
         if classes:
             classlist = [value for key, value in classes]
             contents = [self.formattree(
@@ -1729,7 +1740,7 @@
 Welcome to Python %s!  This is the online help utility.
 
 If this is your first time using Python, you should definitely check out
-the tutorial on the Internet at http://www.python.org/doc/tut/.
+the tutorial on the Internet at http://docs.python.org/tutorial/.
 
 Enter the name of any module, keyword, or topic to get help on writing
 Python programs and using Python modules.  To quit this help utility and

Modified: python/branches/py3k-ctypes-pep3118/Lib/rational.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/rational.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/rational.py	Thu Jan 24 22:12:24 2008
@@ -171,6 +171,42 @@
         else:
             return cls(digits, 10 ** -exp)
 
+    @classmethod
+    def from_continued_fraction(cls, seq):
+        'Build a Rational from a continued fraction expessed as a sequence'
+        n, d = 1, 0
+        for e in reversed(seq):
+            n, d = d, n
+            n += e * d
+        return cls(n, d) if seq else cls(0)
+
+    def as_continued_fraction(self):
+        'Return continued fraction expressed as a list'
+        n = self.numerator
+        d = self.denominator
+        cf = []
+        while d:
+            e = int(n // d)
+            cf.append(e)
+            n -= e * d
+            n, d = d, n
+        return cf
+
+    @classmethod
+    def approximate_from_float(cls, f, max_denominator):
+        'Best rational approximation to f with a denominator <= max_denominator'
+        # XXX First cut at algorithm
+        # Still needs rounding rules as specified at
+        #       http://en.wikipedia.org/wiki/Continued_fraction
+        cf = cls.from_float(f).as_continued_fraction()
+        result = Rational(0)
+        for i in range(1, len(cf)):
+            new = cls.from_continued_fraction(cf[:i])
+            if new.denominator > max_denominator:
+                break
+            result = new
+        return result
+
     @property
     def numerator(a):
         return a._numerator

Modified: python/branches/py3k-ctypes-pep3118/Lib/re.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/re.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/re.py	Thu Jan 24 22:12:24 2008
@@ -29,7 +29,8 @@
 The special characters are:
     "."      Matches any character except a newline.
     "^"      Matches the start of the string.
-    "$"      Matches the end of the string.
+    "$"      Matches the end of the string or just before the newline at
+             the end of the string.
     "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
              Greedy means that it will match as many repetitions as possible.
     "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
@@ -83,8 +84,10 @@
 Some of the functions in this module takes flags as optional parameters:
     I  IGNORECASE  Perform case-insensitive matching.
     L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
-    M  MULTILINE   "^" matches the beginning of lines as well as the string.
-                   "$" matches the end of lines as well as the string.
+    M  MULTILINE   "^" matches the beginning of lines (after a newline)
+                   as well as the string.
+                   "$" matches the end of lines (before a newline) as well
+                   as the end of the string.
     S  DOTALL      "." matches any character at all, including the newline.
     X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
     U  UNICODE     Make \w, \W, \b, \B, dependent on the Unicode locale.

Modified: python/branches/py3k-ctypes-pep3118/Lib/shutil.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/shutil.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/shutil.py	Thu Jan 24 22:12:24 2008
@@ -156,6 +156,14 @@
     elif onerror is None:
         def onerror(*args):
             raise
+    try:
+        if os.path.islink(path):
+            # symlinks to directories are forbidden, see bug #1669
+            raise OSError("Cannot call rmtree on a symbolic link")
+    except OSError:
+        onerror(os.path.islink, path, sys.exc_info())
+        # can't continue even if onerror hook returns
+        return
     names = []
     try:
         names = os.listdir(path)

Modified: python/branches/py3k-ctypes-pep3118/Lib/site.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/site.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/site.py	Thu Jan 24 22:12:24 2008
@@ -96,6 +96,8 @@
     (especially for Guido :-)"""
     from distutils.util import get_platform
     s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
+    if hasattr(sys, 'gettotalrefcount'):
+        s += '-pydebug'
     s = os.path.join(os.path.dirname(sys.path[-1]), s)
     sys.path.append(s)
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/pydocfodder.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/pydocfodder.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/pydocfodder.py	Thu Jan 24 22:12:24 2008
@@ -1,5 +1,7 @@
 """Something just to look at via pydoc."""
 
+import types
+
 class A_classic:
     "A classic class."
     def A_method(self):
@@ -208,3 +210,7 @@
             del inst.desc[self.attr]
 
     x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x')
+
+
+submodule = types.ModuleType(__name__ + '.submodule',
+    """A submodule, which should appear in its parent's summary""")

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_builtin.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_builtin.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_builtin.py	Thu Jan 24 22:12:24 2008
@@ -1100,18 +1100,6 @@
 
     def test_map(self):
         self.assertEqual(
-            list(map(None, 'hello')),
-            [('h',), ('e',), ('l',), ('l',), ('o',)]
-        )
-        self.assertEqual(
-            list(map(None, 'abcd', 'efg')),
-            [('a', 'e'), ('b', 'f'), ('c', 'g')]
-        )
-        self.assertEqual(
-            list(map(None, range(3))),
-            [(0,), (1,), (2,)]
-        )
-        self.assertEqual(
             list(map(lambda x: x*x, range(1,4))),
             [1, 4, 9]
         )
@@ -1146,17 +1134,9 @@
             [1+4+1, 3+9+1, 7+2+0]
         )
         self.assertEqual(
-            list(map(None, Squares(10))),
-            [(0,), (1,), (4,), (9,), (16,), (25,), (36,), (49,), (64,), (81,)]
-        )
-        self.assertEqual(
             list(map(int, Squares(10))),
             [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
         )
-        self.assertEqual(
-            list(map(None, Squares(3), Squares(2))),
-            [(0,0), (1,1)]
-        )
         def Max(a, b):
             if a is None:
                 return b
@@ -1169,7 +1149,6 @@
         )
         self.assertRaises(TypeError, map)
         self.assertRaises(TypeError, map, lambda x: x, 42)
-        self.assertEqual(list(map(None, [42])), [(42,)])
         class BadSeq:
             def __iter__(self):
                 raise ValueError

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_descr.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_descr.py	Thu Jan 24 22:12:24 2008
@@ -1,7 +1,7 @@
 # Test enhancements related to descriptors and new-style classes
 
-from test.test_support import verify, vereq, verbose, TestFailed, TESTFN
-from test.test_support import get_original_stdout
+# XXX Please, please, please, someone convert this to unittest style!
+from test.test_support import verify, vereq, verbose, TestFailed, TESTFN, get_original_stdout
 from copy import deepcopy
 import types
 
@@ -4173,6 +4173,8 @@
     # ceval.c's assign_slice used to check for
     # tp->tp_as_sequence->sq_slice instead of
     # tp->tp_as_sequence->sq_ass_slice
+    if verbose:
+        print("Testing assign_slice...")
 
     class C(object):
         def __setitem__(self, idx, value):
@@ -4182,6 +4184,70 @@
     c[1:2] = 3
     vereq(c.value, 3)
 
+def test_weakref_in_del_segfault():
+    # This used to segfault until r60057
+    if verbose:
+        print("Testing weakref in del segfault...")
+
+    import weakref
+    global ref
+
+    class Target():
+        def __del__(self):
+            global ref
+            ref = weakref.ref(self)
+
+    w = Target()
+    del w
+    del ref
+
+def test_borrowed_ref_3_segfault():
+    # This used to segfault until r60224
+    if verbose:
+        print("Testing borrowed ref 3 segfault...")
+
+    class KeyFunc(object):
+        def __call__(self, n):
+            del d['key']
+            return 1
+
+    d = {'key': KeyFunc()}
+    try:
+        min(range(10), **d)
+    except:
+        pass
+
+def test_borrowed_ref_4_segfault():
+    # This used to segfault until r60224
+    if verbose:
+        print("Testing borrowed ref 4 segfault...")
+
+    import types
+    import builtins
+
+    class X(object):
+        def __getattr__(self, name):
+            # this is called with name == '__bases__' by PyObject_IsInstance()
+            # during the unbound method call -- it frees the unbound method
+            # itself before it invokes its im_func.
+            del builtins.__import__
+            return ()
+
+    pseudoclass = X()
+
+    class Y(object):
+        def __call__(self, *args):
+            # 'self' was freed already
+            return (self, args)
+
+    # make an unbound method
+    orig_import = __import__
+    try:
+        builtins.__import__ = types.MethodType(Y(), (pseudoclass, str))
+        import spam
+    finally:
+        builtins.__import__ = orig_import
+
 def test_main():
     weakref_segfault() # Must be first, somehow
     wrapper_segfault() # NB This one is slow
@@ -4279,6 +4345,9 @@
     methodwrapper()
     notimplemented()
     test_assign_slice()
+    test_weakref_in_del_segfault()
+    test_borrowed_ref_3_segfault()
+    test_borrowed_ref_4_segfault()
 
     if verbose: print("All OK")
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_grp.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_grp.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_grp.py	Thu Jan 24 22:12:24 2008
@@ -25,6 +25,9 @@
         for e in entries:
             self.check_value(e)
 
+        if len(entries) > 1000:  # Huge group file (NIS?) -- skip the rest
+            return
+
         for e in entries:
             e2 = grp.getgrgid(e.gr_gid)
             self.check_value(e2)

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_iter.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_iter.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_iter.py	Thu Jan 24 22:12:24 2008
@@ -382,13 +382,10 @@
 
     # Test map()'s use of iterators.
     def test_builtin_map(self):
-        self.assertEqual(list(map(None, SequenceClass(5))),
-                         [(0,), (1,), (2,), (3,), (4,)])
         self.assertEqual(list(map(lambda x: x+1, SequenceClass(5))),
                          list(range(1, 6)))
 
         d = {"one": 1, "two": 2, "three": 3}
-        self.assertEqual(list(map(None, d)), [(k,) for k in d])
         self.assertEqual(list(map(lambda k, d=d: (k, d[k]), d)),
                          list(d.items()))
         dkeys = list(d.keys())
@@ -396,11 +393,6 @@
                      i,
                      i < len(d) and dkeys[i] or None)
                     for i in range(3)]
-        self.assertEqual(list(map(None,
-                                  d,
-                                  SequenceClass(5),
-                                  iter(d.keys()))),
-                         expected)
 
         f = open(TESTFN, "w")
         try:

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_itertools.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_itertools.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_itertools.py	Thu Jan 24 22:12:24 2008
@@ -236,7 +236,7 @@
         self.assertEqual(list(izip_longest('abcdef')), list(zip('abcdef')))
 
         self.assertEqual(list(izip_longest('abc', 'defg', **{})),
-                         list(map(None, list('abc')+[None], 'defg'))) # empty keyword dict
+                         list(izip(list('abc')+[None], 'defg'))) # empty keyword dict
         self.assertRaises(TypeError, izip_longest, 3)
         self.assertRaises(TypeError, izip_longest, range(3), 3)
 
@@ -281,14 +281,17 @@
     def test_imap(self):
         self.assertEqual(list(imap(operator.pow, range(3), range(1,7))),
                          [0**1, 1**2, 2**3])
-        self.assertEqual(list(imap(None, 'abc', range(5))),
+        def tupleize(*args):
+            return args
+        self.assertEqual(list(imap(tupleize, 'abc', range(5))),
                          [('a',0),('b',1),('c',2)])
-        self.assertEqual(list(imap(None, 'abc', count())),
+        self.assertEqual(list(imap(tupleize, 'abc', count())),
                          [('a',0),('b',1),('c',2)])
-        self.assertEqual(take(2,imap(None, 'abc', count())),
+        self.assertEqual(take(2,imap(tupleize, 'abc', count())),
                          [('a',0),('b',1)])
         self.assertEqual(list(imap(operator.pow, [])), [])
         self.assertRaises(TypeError, imap)
+        self.assertRaises(TypeError, list, imap(None, range(3), range(3)))
         self.assertRaises(TypeError, imap, operator.neg)
         self.assertRaises(TypeError, next, imap(10, range(5)))
         self.assertRaises(ValueError, next, imap(errfunc, [4], [5]))

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_largefile.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_largefile.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_largefile.py	Thu Jan 24 22:12:24 2008
@@ -6,7 +6,7 @@
 #----------------------------------------------------------------------
 
 from test import test_support
-import os, struct, stat, sys
+import os, stat, sys
 
 try:
     import signal

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_mmap.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_mmap.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_mmap.py	Thu Jan 24 22:12:24 2008
@@ -419,6 +419,13 @@
             except OSError:
                 pass
 
+    def test_subclass(self):
+        class anon_mmap(mmap.mmap):
+            def __new__(klass, *args, **kwargs):
+                return mmap.mmap.__new__(klass, -1, *args, **kwargs)
+        anon_mmap(PAGESIZE)
+
+
 def test_main():
     run_unittest(MmapTests)
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_operator.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_operator.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_operator.py	Thu Jan 24 22:12:24 2008
@@ -364,9 +364,9 @@
         self.assertRaises(TypeError, operator.attrgetter('x', (), 'y'), record)
 
         class C(object):
-            def __getattr(self, name):
+            def __getattr__(self, name):
                 raise SyntaxError
-        self.failUnlessRaises(AttributeError, operator.attrgetter('foo'), C())
+        self.failUnlessRaises(SyntaxError, operator.attrgetter('foo'), C())
 
     def test_itemgetter(self):
         a = 'ABCDE'
@@ -376,9 +376,9 @@
         self.assertRaises(IndexError, f, a)
 
         class C(object):
-            def __getitem(self, name):
+            def __getitem__(self, name):
                 raise SyntaxError
-        self.failUnlessRaises(TypeError, operator.itemgetter(42), C())
+        self.failUnlessRaises(SyntaxError, operator.itemgetter(42), C())
 
         f = operator.itemgetter('name')
         self.assertRaises(TypeError, f, a)

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_pep263.py
==============================================================================
Binary files. No diff available.

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_profilehooks.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_profilehooks.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_profilehooks.py	Thu Jan 24 22:12:24 2008
@@ -4,6 +4,22 @@
 
 from test import test_support
 
+class TestGetProfile(unittest.TestCase):
+    def setUp(self):
+        sys.setprofile(None)
+
+    def tearDown(self):
+        sys.setprofile(None)
+
+    def test_empty(self):
+        assert sys.getprofile() == None
+
+    def test_setget(self):
+        def fn(*args):
+            pass
+
+        sys.setprofile(fn)
+        assert sys.getprofile() == fn
 
 class HookWatcher:
     def __init__(self):
@@ -359,6 +375,7 @@
 
 def test_main():
     test_support.run_unittest(
+        TestGetProfile,
         ProfileHookTestCase,
         ProfileSimulatorTestCase
     )

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_pwd.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_pwd.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_pwd.py	Thu Jan 24 22:12:24 2008
@@ -35,6 +35,9 @@
             entriesbyname.setdefault(e.pw_name, []).append(e)
             entriesbyuid.setdefault(e.pw_uid, []).append(e)
 
+        if len(entries) > 1000:  # Huge passwd file (NIS?) -- skip the rest
+            return
+
         # check whether the entry returned by getpwuid()
         # for each uid is among those from getpwall() for this uid
         for e in entries:

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_pyclbr.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_pyclbr.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_pyclbr.py	Thu Jan 24 22:12:24 2008
@@ -158,6 +158,7 @@
         cm('cgi', ignore=('log',))      # set with = in module
         cm('mhlib')
         cm('urllib', ignore=('getproxies_registry',
+                             'proxy_bypass_registry',
                              'open_https',
                              '_https_connection',
                              'getproxies_internetconfig',)) # not on all platforms

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_rational.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_rational.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_rational.py	Thu Jan 24 22:12:24 2008
@@ -135,6 +135,29 @@
             TypeError, "Cannot convert sNaN to Rational.",
             R.from_decimal, Decimal("snan"))
 
+    def testFromContinuedFraction(self):
+        self.assertRaises(TypeError, R.from_continued_fraction, None)
+        phi = R.from_continued_fraction([1]*100)
+        self.assertEquals(round(phi - (1 + 5 ** 0.5) / 2, 10), 0.0)
+
+        minusphi = R.from_continued_fraction([-1]*100)
+        self.assertEquals(round(minusphi + (1 + 5 ** 0.5) / 2, 10), 0.0)
+
+        self.assertEquals(R.from_continued_fraction([0]), R(0))
+        self.assertEquals(R.from_continued_fraction([]), R(0))
+
+    def testAsContinuedFraction(self):
+        self.assertEqual(R.from_float(math.pi).as_continued_fraction()[:15],
+                         [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3, 3])
+        self.assertEqual(R.from_float(-math.pi).as_continued_fraction()[:16],
+                         [-4, 1, 6, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3, 3])
+        self.assertEqual(R(0).as_continued_fraction(), [0])
+
+    def testApproximateFromFloat(self):
+        self.assertEqual(R.approximate_from_float(math.pi, 10000), R(355, 113))
+        self.assertEqual(R.approximate_from_float(-math.pi, 10000), R(-355, 113))
+        self.assertEqual(R.approximate_from_float(0.0, 10000), R(0))
+
     def testConversions(self):
         self.assertTypedEquals(-1, trunc(R(-11, 10)))
         self.assertTypedEquals(-2, math.floor(R(-11, 10)))

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_shutil.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_shutil.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_shutil.py	Thu Jan 24 22:12:24 2008
@@ -149,6 +149,20 @@
                 except OSError:
                     pass
 
+        def test_rmtree_on_symlink(self):
+            # bug 1669.
+            os.mkdir(TESTFN)
+            try:
+                src = os.path.join(TESTFN, 'cheese')
+                dst = os.path.join(TESTFN, 'shop')
+                os.mkdir(src)
+                os.symlink(src, dst)
+                self.assertRaises(OSError, shutil.rmtree, dst)
+            finally:
+                shutil.rmtree(TESTFN, ignore_errors=True)
+
+
+
 def test_main():
     test_support.run_unittest(TestShutil)
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_structmembers.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_structmembers.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_structmembers.py	Thu Jan 24 22:12:24 2008
@@ -8,52 +8,59 @@
 import warnings, unittest, sys
 from test import test_support
 
-ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010)
+ts=test_structmembersType(False, 1, 2, 3, 4, 5, 6, 7, 8,
+                          9.99999, 10.1010101010)
 
 class ReadWriteTests(unittest.TestCase):
     def test_types(self):
-        ts.T_BYTE=CHAR_MAX
+        ts.T_BOOL = True
+        self.assertEquals(ts.T_BOOL, True)
+        ts.T_BOOL = False
+        self.assertEquals(ts.T_BOOL, False)
+        self.assertRaises(TypeError, setattr, ts, 'T_BOOL', 1)
+
+        ts.T_BYTE = CHAR_MAX
         self.assertEquals(ts.T_BYTE, CHAR_MAX)
-        ts.T_BYTE=CHAR_MIN
+        ts.T_BYTE = CHAR_MIN
         self.assertEquals(ts.T_BYTE, CHAR_MIN)
-        ts.T_UBYTE=UCHAR_MAX
+        ts.T_UBYTE = UCHAR_MAX
         self.assertEquals(ts.T_UBYTE, UCHAR_MAX)
 
-        ts.T_SHORT=SHRT_MAX
+        ts.T_SHORT = SHRT_MAX
         self.assertEquals(ts.T_SHORT, SHRT_MAX)
-        ts.T_SHORT=SHRT_MIN
+        ts.T_SHORT = SHRT_MIN
         self.assertEquals(ts.T_SHORT, SHRT_MIN)
-        ts.T_USHORT=USHRT_MAX
+        ts.T_USHORT = USHRT_MAX
         self.assertEquals(ts.T_USHORT, USHRT_MAX)
 
-        ts.T_INT=INT_MAX
+        ts.T_INT = INT_MAX
         self.assertEquals(ts.T_INT, INT_MAX)
-        ts.T_INT=INT_MIN
+        ts.T_INT = INT_MIN
         self.assertEquals(ts.T_INT, INT_MIN)
-        ts.T_UINT=UINT_MAX
+        ts.T_UINT = UINT_MAX
         self.assertEquals(ts.T_UINT, UINT_MAX)
 
-        ts.T_LONG=LONG_MAX
+        ts.T_LONG = LONG_MAX
         self.assertEquals(ts.T_LONG, LONG_MAX)
-        ts.T_LONG=LONG_MIN
+        ts.T_LONG = LONG_MIN
         self.assertEquals(ts.T_LONG, LONG_MIN)
-        ts.T_ULONG=ULONG_MAX
+        ts.T_ULONG = ULONG_MAX
         self.assertEquals(ts.T_ULONG, ULONG_MAX)
 
         ## T_LONGLONG and T_ULONGLONG may not be present on some platforms
         if hasattr(ts, 'T_LONGLONG'):
-            ts.T_LONGLONG=LLONG_MAX
+            ts.T_LONGLONG = LLONG_MAX
             self.assertEquals(ts.T_LONGLONG, LLONG_MAX)
-            ts.T_LONGLONG=LLONG_MIN
+            ts.T_LONGLONG = LLONG_MIN
             self.assertEquals(ts.T_LONGLONG, LLONG_MIN)
 
-            ts.T_ULONGLONG=ULLONG_MAX
+            ts.T_ULONGLONG = ULLONG_MAX
             self.assertEquals(ts.T_ULONGLONG, ULLONG_MAX)
 
             ## make sure these will accept a plain int as well as a long
-            ts.T_LONGLONG=3
+            ts.T_LONGLONG = 3
             self.assertEquals(ts.T_LONGLONG, 3)
-            ts.T_ULONGLONG=4
+            ts.T_ULONGLONG = 4
             self.assertEquals(ts.T_ULONGLONG, 4)
 
 
@@ -63,32 +70,32 @@
 
     def test_byte_max(self):
         with test_support.catch_warning() as w:
-            ts.T_BYTE=CHAR_MAX+1
+            ts.T_BYTE = CHAR_MAX+1
             self.has_warned(w)
 
     def test_byte_min(self):
         with test_support.catch_warning() as w:
-            ts.T_BYTE=CHAR_MIN-1
+            ts.T_BYTE = CHAR_MIN-1
             self.has_warned(w)
 
     def test_ubyte_max(self):
         with test_support.catch_warning() as w:
-            ts.T_UBYTE=UCHAR_MAX+1
+            ts.T_UBYTE = UCHAR_MAX+1
             self.has_warned(w)
 
     def test_short_max(self):
         with test_support.catch_warning() as w:
-            ts.T_SHORT=SHRT_MAX+1
+            ts.T_SHORT = SHRT_MAX+1
             self.has_warned(w)
 
     def test_short_min(self):
         with test_support.catch_warning() as w:
-            ts.T_SHORT=SHRT_MIN-1
+            ts.T_SHORT = SHRT_MIN-1
             self.has_warned(w)
 
     def test_ushort_max(self):
         with test_support.catch_warning() as w:
-            ts.T_USHORT=USHRT_MAX+1
+            ts.T_USHORT = USHRT_MAX+1
             self.has_warned(w)
 
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_threading.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_threading.py	Thu Jan 24 22:12:24 2008
@@ -236,6 +236,24 @@
             """])
         self.assertEqual(rc, 42)
 
+    def test_enumerate_after_join(self):
+        # Try hard to trigger #1703448: a thread is still returned in
+        # threading.enumerate() after it has been join()ed.
+        enum = threading.enumerate
+        old_interval = sys.getcheckinterval()
+        sys.setcheckinterval(1)
+        try:
+            for i in range(1, 1000):
+                t = threading.Thread(target=lambda: None)
+                t.start()
+                t.join()
+                l = enum()
+                self.assertFalse(t in l,
+                    "#1703448 triggered after %d trials: %s" % (i, l))
+        finally:
+            sys.setcheckinterval(old_interval)
+
+
 class ThreadingExceptionTests(unittest.TestCase):
     # A RuntimeError should be raised if Thread.start() is called
     # multiple times.

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_trace.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_trace.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_trace.py	Thu Jan 24 22:12:24 2008
@@ -268,6 +268,20 @@
         self.compare_events(func.__code__.co_firstlineno,
                             tracer.events, func.events)
 
+    def set_and_retrieve_none(self):
+        sys.settrace(None)
+        assert sys.gettrace() is None
+
+    def set_and_retrieve_func(self):
+        def fn(*args):
+            pass
+
+        sys.settrace(fn)
+        try:
+            assert sys.gettrace() is fn
+        finally:
+            sys.settrace(None)
+
     def test_01_basic(self):
         self.run_test(basic)
     def test_02_arigo(self):

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_urllib.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_urllib.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_urllib.py	Thu Jan 24 22:12:24 2008
@@ -47,7 +47,7 @@
     def test_interface(self):
         # Make sure object returned by urlopen() has the specified methods
         for attr in ("read", "readline", "readlines", "fileno",
-                     "close", "info", "geturl", "__iter__"):
+                     "close", "info", "geturl", "getcode", "__iter__"):
             self.assert_(hasattr(self.returned_obj, attr),
                          "object returned by urlopen() lacks %s attribute" %
                          attr)
@@ -87,6 +87,9 @@
     def test_geturl(self):
         self.assertEqual(self.returned_obj.geturl(), self.pathname)
 
+    def test_getcode(self):
+        self.assertEqual(self.returned_obj.getcode(), None)
+
     def test_iter(self):
         # Test iterator
         # Don't need to count number of iterations since test would fail the
@@ -123,6 +126,8 @@
             fp = urllib.urlopen("http://python.org/")
             self.assertEqual(fp.readline(), b"Hello!")
             self.assertEqual(fp.readline(), b"")
+            self.assertEqual(fp.geturl(), 'http://python.org/')
+            self.assertEqual(fp.getcode(), 200)
         finally:
             self.unfakehttp()
 

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_urllibnet.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_urllibnet.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_urllibnet.py	Thu Jan 24 22:12:24 2008
@@ -83,6 +83,16 @@
             open_url.close()
         self.assertEqual(gotten_url, URL)
 
+    def test_getcode(self):
+        # test getcode() with the fancy opener to get 404 error codes
+        URL = "http://www.python.org/XXXinvalidXXX"
+        open_url = urllib.FancyURLopener().open(URL)
+        try:
+            code = open_url.getcode()
+        finally:
+            open_url.close()
+        self.assertEqual(code, 404)
+
     def test_fileno(self):
         if (sys.platform in ('win32',) or
                 not hasattr(os, 'fdopen')):

Modified: python/branches/py3k-ctypes-pep3118/Lib/test/test_winreg.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/test/test_winreg.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/test/test_winreg.py	Thu Jan 24 22:12:24 2008
@@ -73,7 +73,7 @@
 
         key = OpenKey(root_key, test_key_name)
         # Read the sub-keys
-        with OpenKey(key, "sub_key") as sub_key:
+        with OpenKey(key, subkeystr) as sub_key:
             # Check I can enumerate over the values.
             index = 0
             while 1:

Modified: python/branches/py3k-ctypes-pep3118/Lib/threading.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/threading.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/threading.py	Thu Jan 24 22:12:24 2008
@@ -346,27 +346,18 @@
         return self._flag
 
     def set(self):
-        self._cond.acquire()
-        try:
+        with self._cond:
             self._flag = True
             self._cond.notifyAll()
-        finally:
-            self._cond.release()
 
     def clear(self):
-        self._cond.acquire()
-        try:
+        with self._cond:
             self._flag = False
-        finally:
-            self._cond.release()
 
     def wait(self, timeout=None):
-        self._cond.acquire()
-        try:
+        with self._cond:
             if not self._flag:
                 self._cond.wait(timeout)
-        finally:
-            self._cond.release()
 
 # Helper to generate new thread names
 _counter = 0
@@ -523,17 +514,19 @@
                 if __debug__:
                     self._note("%s.__bootstrap(): normal return", self)
         finally:
-            self._stop()
-            try:
-                self._delete()
-            except:
-                pass
+            with _active_limbo_lock:
+                self._stop()
+                try:
+                    # We don't call self.__delete() because it also
+                    # grabs _active_limbo_lock.
+                    del _active[_get_ident()]
+                except:
+                    pass
 
     def _stop(self):
-        self._block.acquire()
-        self._stopped = True
-        self._block.notifyAll()
-        self._block.release()
+        with self._block:
+            self._stopped = True
+            self._block.notifyAll()
 
     def _delete(self):
         "Remove current thread from the dict of currently running threads."
@@ -559,15 +552,12 @@
         # since it isn't if dummy_threading is *not* being used then don't
         # hide the exception.
 
-        _active_limbo_lock.acquire()
-        try:
+        with _active_limbo_lock:
             try:
                 del _active[_get_ident()]
             except KeyError:
                 if 'dummy_threading' not in _sys.modules:
                     raise
-        finally:
-            _active_limbo_lock.release()
 
     def join(self, timeout=None):
         if not self._initialized:
@@ -580,8 +570,7 @@
         if __debug__:
             if not self._stopped:
                 self._note("%s.join(): waiting until thread stops", self)
-        self._block.acquire()
-        try:
+        with self._block:
             if timeout is None:
                 while not self._stopped:
                     self._block.wait()
@@ -599,8 +588,6 @@
                 else:
                     if __debug__:
                         self._note("%s.join(): thread stopped", self)
-        finally:
-            self._block.release()
 
     def getName(self):
         assert self._initialized, "Thread.__init__() not called"

Modified: python/branches/py3k-ctypes-pep3118/Lib/urllib.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/urllib.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/urllib.py	Thu Jan 24 22:12:24 2008
@@ -557,7 +557,7 @@
 
     def http_error_default(self, url, fp, errcode, errmsg, headers):
         """Default error handling -- don't raise an exception."""
-        return addinfourl(fp, headers, "http:" + url)
+        return addinfourl(fp, headers, "http:" + url, errcode)
 
     def http_error_302(self, url, fp, errcode, errmsg, headers, data=None):
         """Error 302 -- relocated (temporarily)."""
@@ -815,9 +815,19 @@
         if not conn:
             # Set transfer mode to ASCII!
             self.ftp.voidcmd('TYPE A')
-            # Try a directory listing
-            if file: cmd = 'LIST ' + file
-            else: cmd = 'LIST'
+            # Try a directory listing. Verify that directory exists.
+            if file:
+                pwd = self.ftp.pwd()
+                try:
+                    try:
+                        self.ftp.cwd(file)
+                    except ftplib.error_perm as reason:
+                        raise IOError('ftp error', reason) from reason
+                finally:
+                    self.ftp.cwd(pwd)
+                cmd = 'LIST ' + file
+            else:
+                cmd = 'LIST'
             conn = self.ftp.ntransfercmd(cmd)
         self.busy = 1
         # Pass back both a suitably decorated object and a retrieval length
@@ -898,14 +908,18 @@
 class addinfourl(addbase):
     """class to add info() and geturl() methods to an open file."""
 
-    def __init__(self, fp, headers, url):
+    def __init__(self, fp, headers, url, code=None):
         addbase.__init__(self, fp)
         self.headers = headers
         self.url = url
+        self.code = code
 
     def info(self):
         return self.headers
 
+    def getcode(self):
+        return self.code
+
     def geturl(self):
         return self.url
 
@@ -1228,10 +1242,33 @@
     proxies = {}
     for name, value in os.environ.items():
         name = name.lower()
+        if name == 'no_proxy':
+            # handled in proxy_bypass_environment
+            continue
         if value and name[-6:] == '_proxy':
             proxies[name[:-6]] = value
     return proxies
 
+def proxy_bypass_environment(host):
+    """Test if proxies should not be used for a particular host.
+
+    Checks the environment for a variable named no_proxy, which should
+    be a list of DNS suffixes separated by commas, or '*' for all hosts.
+    """
+    no_proxy = os.environ.get('no_proxy', '') or os.environ.get('NO_PROXY', '')
+    # '*' is special case for always bypass
+    if no_proxy == '*':
+        return 1
+    # strip port off host
+    hostonly, port = splitport(host)
+    # check if the host ends with any of the DNS suffixes
+    for name in no_proxy.split(','):
+        if name and (hostonly.endswith(name) or host.endswith(name)):
+            return 1
+    # otherwise, don't bypass
+    return 0
+
+
 if sys.platform == 'darwin':
     def getproxies_internetconfig():
         """Return a dictionary of scheme -> proxy server URL mappings.
@@ -1259,12 +1296,15 @@
                 pass
             else:
                 proxies['http'] = 'http://%s' % value
-        # FTP: XXXX To be done.
-        # Gopher: XXXX To be done.
+        # FTP: XXX To be done.
+        # Gopher: XXX To be done.
         return proxies
 
-    def proxy_bypass(x):
-        return 0
+    def proxy_bypass(host):
+        if getproxies_environment():
+            return proxy_bypass_environment(host)
+        else:
+            return 0
 
     def getproxies():
         return getproxies_environment() or getproxies_internetconfig()
@@ -1324,7 +1364,7 @@
         """
         return getproxies_environment() or getproxies_registry()
 
-    def proxy_bypass(host):
+    def proxy_bypass_registry(host):
         try:
             import _winreg
             import re
@@ -1383,12 +1423,22 @@
                     return 1
         return 0
 
+    def proxy_bypass(host):
+        """Return a dictionary of scheme -> proxy server URL mappings.
+
+        Returns settings gathered from the environment, if specified,
+        or the registry.
+
+        """
+        if getproxies_environment():
+            return proxy_bypass_environment(host)
+        else:
+            return proxy_bypass_registry(host)
+
 else:
     # By default use environment variables
     getproxies = getproxies_environment
-
-    def proxy_bypass(host):
-        return 0
+    proxy_bypass = proxy_bypass_environment
 
 # Test and time quote() and unquote()
 def test1():

Modified: python/branches/py3k-ctypes-pep3118/Lib/urllib2.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/urllib2.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/urllib2.py	Thu Jan 24 22:12:24 2008
@@ -1286,7 +1286,7 @@
             headers = mimetools.Message(sf)
             return addinfourl(fp, headers, req.get_full_url())
         except ftplib.all_errors as msg:
-            raise URLError('ftp error %s' % msg).with_traceback(sys.exc_info()[2])
+            raise URLError('ftp error: %s' % msg).with_traceback(sys.exc_info()[2])
 
     def connect_ftp(self, user, passwd, host, port, dirs, timeout):
         fw = ftpwrapper(user, passwd, host, port, dirs, timeout)

Modified: python/branches/py3k-ctypes-pep3118/Lib/urlparse.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Lib/urlparse.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Lib/urlparse.py	Thu Jan 24 22:12:24 2008
@@ -305,9 +305,7 @@
     else:
         from io import StringIO
         fp = StringIO(test_input)
-    while 1:
-        line = fp.readline()
-        if not line: break
+    for line in fp:
         words = line.split()
         if not words:
             continue

Modified: python/branches/py3k-ctypes-pep3118/Makefile.pre.in
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Makefile.pre.in	(original)
+++ python/branches/py3k-ctypes-pep3118/Makefile.pre.in	Thu Jan 24 22:12:24 2008
@@ -223,6 +223,10 @@
 		Parser/printgrammar.o \
 		Parser/pgenmain.o
 
+PARSER_HEADERS= \
+		Parser/parser.h \
+		Parser/tokenizer.h
+
 PGENOBJS=	$(PGENMAIN) $(POBJS) $(PGOBJS)
 
 ##########################################################################
@@ -356,7 +360,7 @@
 # Build the shared modules
 sharedmods: $(BUILDPYTHON)
 	@case $$MAKEFLAGS in \
-	*-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
 	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
 	esac
 
@@ -542,13 +546,16 @@
 # Header files
 
 PYTHON_HEADERS= \
-		Include/Python.h \
 		Include/Python-ast.h \
-		Include/asdl.h \
+		Include/Python.h \
 		Include/abstract.h \
+		Include/asdl.h \
+		Include/ast.h \
+		Include/bitset.h \
 		Include/boolobject.h \
 		Include/bytes_methods.h \
 		Include/bytesobject.h \
+		Include/cellobject.h \
 		Include/ceval.h \
 		Include/classobject.h \
 		Include/cobject.h \
@@ -559,48 +566,62 @@
 		Include/descrobject.h \
 		Include/dictobject.h \
 		Include/enumobject.h \
-		Include/genobject.h \
+		Include/errcode.h \
+		Include/eval.h \
 		Include/fileobject.h \
 		Include/floatobject.h \
 		Include/formatter_unicode.h \
+		Include/frameobject.h \
 		Include/funcobject.h \
+		Include/genobject.h \
 		Include/import.h \
 		Include/intrcheck.h \
 		Include/iterobject.h \
 		Include/listobject.h \
 		Include/longintrepr.h \
 		Include/longobject.h \
+		Include/marshal.h \
 		Include/memoryobject.h \
+		Include/metagrammar.h \
 		Include/methodobject.h \
 		Include/modsupport.h \
 		Include/moduleobject.h \
+		Include/node.h \
 		Include/object.h \
 		Include/objimpl.h \
+		Include/opcode.h \
+		Include/osdefs.h \
 		Include/parsetok.h \
 		Include/patchlevel.h \
+		Include/pgen.h \
+		Include/pgenheaders.h \
 		Include/pyarena.h \
 		Include/pydebug.h \
 		Include/pyerrors.h \
 		Include/pyfpe.h \
+		Include/pygetopt.h \
 		Include/pymem.h \
 		Include/pyport.h \
 		Include/pystate.h \
-		Include/pystrtod.h \
 		Include/pystrcmp.h \
+		Include/pystrtod.h \
 		Include/pythonrun.h \
+		Include/pythread.h \
 		Include/rangeobject.h \
-                Include/setobject.h \
+		Include/setobject.h \
 		Include/sliceobject.h \
 		Include/stringobject.h \
-		Include/structseq.h \
 		Include/structmember.h \
+		Include/structseq.h \
 		Include/symtable.h \
 		Include/sysmodule.h \
 		Include/traceback.h \
 		Include/tupleobject.h \
+		Include/ucnhash.h \
 		Include/unicodeobject.h \
 		Include/weakrefobject.h \
-		pyconfig.h
+		pyconfig.h \
+		$(PARSER_HEADERS)
 
 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
 

Modified: python/branches/py3k-ctypes-pep3118/Misc/NEWS
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Misc/NEWS	(original)
+++ python/branches/py3k-ctypes-pep3118/Misc/NEWS	Thu Jan 24 22:12:24 2008
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- map() and itertools.imap() no longer accept None for the first argument.
+  Use zip() instead.
+
 - Issue #1769: Now int("- 1") is not allowed any more.
 
 - Object/longobject.c: long(float('nan')) raises an OverflowError instead

Modified: python/branches/py3k-ctypes-pep3118/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Modules/_testcapimodule.c	Thu Jan 24 22:12:24 2008
@@ -930,6 +930,7 @@
 #define AddSym(d, n, f, v) {PyObject *o = f(v); PyDict_SetItemString(d, n, o); Py_DECREF(o);}
 
 typedef struct {
+	char bool_member;
 	char byte_member;
 	unsigned char ubyte_member;
 	short short_member;
@@ -952,6 +953,7 @@
 } test_structmembers;
 
 static struct PyMemberDef test_members[] = {
+	{"T_BOOL", T_BOOL, offsetof(test_structmembers, structmembers.bool_member), 0, NULL},
 	{"T_BYTE", T_BYTE, offsetof(test_structmembers, structmembers.byte_member), 0, NULL},
 	{"T_UBYTE", T_UBYTE, offsetof(test_structmembers, structmembers.ubyte_member), 0, NULL},
 	{"T_SHORT", T_SHORT, offsetof(test_structmembers, structmembers.short_member), 0, NULL},
@@ -970,39 +972,53 @@
 };
 
 
-static PyObject *test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs){
-	static char *keywords[]={"T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT", "T_INT", "T_UINT",
-		"T_LONG", "T_ULONG", "T_FLOAT", "T_DOUBLE",
-		#ifdef HAVE_LONG_LONG	
+static PyObject *
+test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+	static char *keywords[] = {
+		"T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT",
+		"T_INT", "T_UINT", "T_LONG", "T_ULONG",
+		"T_FLOAT", "T_DOUBLE",
+#ifdef HAVE_LONG_LONG	
 		"T_LONGLONG", "T_ULONGLONG",
-		#endif
+#endif
 		NULL};
-	static char *fmt="|bBhHiIlkfd"
-		#ifdef HAVE_LONG_LONG
+	static char *fmt = "|bbBhHiIlkfd"
+#ifdef HAVE_LONG_LONG
 		"LK"
-		#endif
+#endif
 		;
-	test_structmembers *ob=PyObject_New(test_structmembers, type);
-	if (ob==NULL)
+	test_structmembers *ob;
+	ob = PyObject_New(test_structmembers, type);
+	if (ob == NULL)
 		return NULL;
 	memset(&ob->structmembers, 0, sizeof(all_structmembers));
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs, fmt, keywords,
-		&ob->structmembers.byte_member, &ob->structmembers.ubyte_member,
-		&ob->structmembers.short_member, &ob->structmembers.ushort_member,
-		&ob->structmembers.int_member, &ob->structmembers.uint_member, 
-		&ob->structmembers.long_member, &ob->structmembers.ulong_member,
-		&ob->structmembers.float_member, &ob->structmembers.double_member
-		#ifdef HAVE_LONG_LONG
-		,&ob->structmembers.longlong_member, &ob->structmembers.ulonglong_member
-		#endif
-		)){
+					 &ob->structmembers.bool_member,
+					 &ob->structmembers.byte_member,
+					 &ob->structmembers.ubyte_member,
+					 &ob->structmembers.short_member,
+					 &ob->structmembers.ushort_member,
+					 &ob->structmembers.int_member,
+					 &ob->structmembers.uint_member, 
+					 &ob->structmembers.long_member,
+					 &ob->structmembers.ulong_member,
+					 &ob->structmembers.float_member,
+					 &ob->structmembers.double_member
+#ifdef HAVE_LONG_LONG
+					 , &ob->structmembers.longlong_member,
+					 &ob->structmembers.ulonglong_member
+#endif
+		)) {
 		Py_DECREF(ob);
 		return NULL;
-		}
+	}
 	return (PyObject *)ob;
 }
 
-static void test_structmembers_free(PyObject *ob){
+static void
+test_structmembers_free(PyObject *ob)
+{
 	PyObject_FREE(ob);
 }
 
@@ -1023,8 +1039,8 @@
 	0,				/* tp_hash */
 	0,				/* tp_call */
 	0,				/* tp_str */
-	PyObject_GenericGetAttr,
-	PyObject_GenericSetAttr,
+	PyObject_GenericGetAttr,	/* tp_getattro */
+	PyObject_GenericSetAttr,	/* tp_setattro */
 	0,				/* tp_as_buffer */
 	0,				/* tp_flags */
 	"Type containing all structmember types",
@@ -1035,7 +1051,7 @@
 	0,				/* tp_iter */
 	0,				/* tp_iternext */
 	0,				/* tp_methods */
-	test_members,	/* tp_members */
+	test_members,			/* tp_members */
 	0,
 	0,
 	0,
@@ -1044,7 +1060,7 @@
 	0,
 	0,
 	0,
-	test_structmembers_new,			/* tp_new */
+	test_structmembers_new,	       	/* tp_new */
 };
 
 

Modified: python/branches/py3k-ctypes-pep3118/Modules/config.c.in
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Modules/config.c.in	(original)
+++ python/branches/py3k-ctypes-pep3118/Modules/config.c.in	Thu Jan 24 22:12:24 2008
@@ -43,7 +43,7 @@
 	/* This lives in Python/Python-ast.c */
 	{"_ast", init_ast},
 
-	/* This lives in Python/_types.c */
+	/* This lives in Modules/_typesmodule.c */
 	{"_types", init_types},
 
 	/* These entries are here for sys.builtin_module_names */

Modified: python/branches/py3k-ctypes-pep3118/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Modules/itertoolsmodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Modules/itertoolsmodule.c	Thu Jan 24 22:12:24 2008
@@ -1490,31 +1490,6 @@
 	return 0;
 }
 
-/*	
-imap() is an iterator version of __builtins__.map() except that it does
-not have the None fill-in feature.  That was intentionally left out for
-the following reasons:
-
-  1) Itertools are designed to be easily combined and chained together.
-     Having all tools stop with the shortest input is a unifying principle
-     that makes it easier to combine finite iterators (supplying data) with
-     infinite iterators like count() and repeat() (for supplying sequential
-     or constant arguments to a function).
-
-  2) In typical use cases for combining itertools, having one finite data 
-     supplier run out before another is likely to be an error condition which
-     should not pass silently by automatically supplying None.
-
-  3) The use cases for automatic None fill-in are rare -- not many functions
-     do something useful when a parameter suddenly switches type and becomes
-     None.  
-
-  4) If a need does arise, it can be met by __builtins__.map() or by 
-     writing:  chain(iterable, repeat(None)).
-
-  5) Similar toolsets in Haskell and SML do not have automatic None fill-in.
-*/
-
 static PyObject *
 imap_next(imapobject *lz)
 {
@@ -1536,8 +1511,6 @@
 		}
 		PyTuple_SET_ITEM(argtuple, i, val);
 	}
-	if (lz->func == Py_None) 
-		return argtuple;
 	result = PyObject_Call(lz->func, argtuple, NULL);
 	Py_DECREF(argtuple);
 	return result;
@@ -1547,10 +1520,7 @@
 "imap(func, *iterables) --> imap object\n\
 \n\
 Make an iterator that computes the function using arguments from\n\
-each of the iterables.	Like map() except that it returns\n\
-an iterator instead of a list and that it stops when the shortest\n\
-iterable is exhausted instead of filling in None for shorter\n\
-iterables.");
+each of the iterables.	Stops when the shortest iterable is exhausted.");
 
 static PyTypeObject imap_type = {
 	PyVarObject_HEAD_INIT(NULL, 0)

Modified: python/branches/py3k-ctypes-pep3118/Modules/mmapmodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Modules/mmapmodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Modules/mmapmodule.c	Thu Jan 24 22:12:24 2008
@@ -130,7 +130,7 @@
 	}
 #endif /* UNIX */
 
-	PyObject_Del(m_obj);
+	Py_TYPE(m_obj)->tp_free((PyObject*)m_obj);
 }
 
 static PyObject *
@@ -666,12 +666,6 @@
         self->exports--;
 }
 
-static PyObject *
-mmap_object_getattr(mmap_object *self, char *name)
-{
-	return Py_FindMethod(mmap_object_methods, (PyObject *)self, name);
-}
-
 static Py_ssize_t
 mmap_length(mmap_object *self)
 {
@@ -901,15 +895,42 @@
         (releasebufferproc)mmap_buffer_releasebuf,
 };
 
+static PyObject *
+new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict);
+
+PyDoc_STRVAR(mmap_doc,
+"Windows: mmap(fileno, length[, tagname[, access[, offset]]])\n\
+\n\
+Maps length bytes from the file specified by the file handle fileno,\n\
+and returns a mmap object.  If length is larger than the current size\n\
+of the file, the file is extended to contain length bytes.  If length\n\
+is 0, the maximum length of the map is the current size of the file,\n\
+except that if the file is empty Windows raises an exception (you cannot\n\
+create an empty mapping on Windows).\n\
+\n\
+Unix: mmap(fileno, length[, flags[, prot[, access[, offset]]]])\n\
+\n\
+Maps length bytes from the file specified by the file descriptor fileno,\n\
+and returns a mmap object.  If length is 0, the maximum length of the map\n\
+will be the current size of the file when mmap is called.\n\
+flags specifies the nature of the mapping. MAP_PRIVATE creates a\n\
+private copy-on-write mapping, so changes to the contents of the mmap\n\
+object will be private to this process, and MAP_SHARED`creates a mapping\n\
+that's shared with all other processes mapping the same areas of the file.\n\
+The default value is MAP_SHARED.\n\
+\n\
+To map anonymous memory, pass -1 as the fileno (both versions).");
+
+
 static PyTypeObject mmap_object_type = {
-	PyVarObject_HEAD_INIT(0, 0) /* patched in module init */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"mmap.mmap",				/* tp_name */
 	sizeof(mmap_object),			/* tp_size */
 	0,					/* tp_itemsize */
 	/* methods */
 	(destructor) mmap_object_dealloc,	/* tp_dealloc */
 	0,					/* tp_print */
-	(getattrfunc) mmap_object_getattr,	/* tp_getattr */
+	0,					/* tp_getattr */
 	0,					/* tp_setattr */
 	0,					/* tp_compare */
 	0,					/* tp_repr */
@@ -919,11 +940,29 @@
 	0,					/*tp_hash*/
 	0,					/*tp_call*/
 	0,					/*tp_str*/
-	0,					/*tp_getattro*/
+	PyObject_GenericGetAttr,		/*tp_getattro*/
 	0,					/*tp_setattro*/
 	&mmap_as_buffer,			/*tp_as_buffer*/
-	Py_TPFLAGS_DEFAULT,			/*tp_flags*/
-	0,					/*tp_doc*/
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,		/*tp_flags*/
+	mmap_doc,				/*tp_doc*/
+	0,					/* tp_traverse */
+	0,					/* tp_clear */
+	0,					/* tp_richcompare */
+	0,					/* tp_weaklistoffset */
+	0,		                        /* tp_iter */
+	0,		                        /* tp_iternext */
+	mmap_object_methods,			/* tp_methods */
+	0,					/* tp_members */
+	0,					/* tp_getset */
+	0,					/* tp_base */
+	0,					/* tp_dict */
+	0,					/* tp_descr_get */
+	0,					/* tp_descr_set */
+	0,					/* tp_dictoffset */
+	0,                                      /* tp_init */
+	PyType_GenericAlloc,			/* tp_alloc */
+	new_mmap_object,			/* tp_new */
+	PyObject_Del,                           /* tp_free */
 };
 
 
@@ -955,7 +994,7 @@
 
 #ifdef UNIX
 static PyObject *
-new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
+new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
 {
 #ifdef HAVE_FSTAT
 	struct stat st;
@@ -1023,7 +1062,7 @@
 		}
 	}
 #endif
-	m_obj = PyObject_New(mmap_object, &mmap_object_type);
+	m_obj = (mmap_object *)type->tp_alloc(type, 0);
 	if (m_obj == NULL) {return NULL;}
 	m_obj->data = NULL;
 	m_obj->size = (size_t) map_size;
@@ -1078,7 +1117,7 @@
 
 #ifdef MS_WINDOWS
 static PyObject *
-new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
+new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
 {
 	mmap_object *m_obj;
 	PyObject *map_size_obj = NULL, *offset_obj = NULL;
@@ -1147,7 +1186,7 @@
 		lseek(fileno, 0, SEEK_SET);
 	}
 
-	m_obj = PyObject_New(mmap_object, &mmap_object_type);
+	m_obj = (mmap_object *)type->tp_alloc(type, 0);
 	if (m_obj == NULL)
 		return NULL;
 	/* Set every field to an invalid marker, so we can safely
@@ -1262,13 +1301,6 @@
 }
 #endif /* MS_WINDOWS */
 
-/* List of functions exported by this module */
-static struct PyMethodDef mmap_functions[] = {
-	{"mmap",	(PyCFunction) new_mmap_object,
-	 METH_VARARGS|METH_KEYWORDS},
-	{NULL,		NULL}	     /* Sentinel */
-};
-
 static void
 setint(PyObject *d, const char *name, long value)
 {
@@ -1279,14 +1311,14 @@
 }
 
 PyMODINIT_FUNC
-	initmmap(void)
+initmmap(void)
 {
 	PyObject *dict, *module;
 
-	/* Patch the object type */
-	Py_TYPE(&mmap_object_type) = &PyType_Type;
+	if (PyType_Ready(&mmap_object_type) < 0)
+		return;
 
-	module = Py_InitModule("mmap", mmap_functions);
+	module = Py_InitModule("mmap", NULL);
 	if (module == NULL)
 		return;
 	dict = PyModule_GetDict(module);
@@ -1294,6 +1326,7 @@
 		return;
 	mmap_module_error = PyExc_EnvironmentError;
 	PyDict_SetItemString(dict, "error", mmap_module_error);
+	PyDict_SetItemString(dict, "mmap", (PyObject*) &mmap_object_type);
 #ifdef PROT_EXEC
 	setint(dict, "PROT_EXEC", PROT_EXEC);
 #endif

Modified: python/branches/py3k-ctypes-pep3118/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Modules/socketmodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Modules/socketmodule.c	Thu Jan 24 22:12:24 2008
@@ -966,7 +966,7 @@
 		struct sockaddr_un *a = (struct sockaddr_un *) addr;
 #ifdef linux
 		if (a->sun_path[0] == 0) {  /* Linux abstract namespace */
-			addrlen -= (sizeof(*a) - sizeof(a->sun_path));
+			addrlen -= offsetof(struct sockaddr_un, sun_path);
 			return PyString_FromStringAndSize(a->sun_path, addrlen);
 		}
 		else
@@ -1171,7 +1171,7 @@
 #if defined(PYOS_OS2)
 		*len_ret = sizeof(*addr);
 #else
-		*len_ret = len + sizeof(*addr) - sizeof(addr->sun_path);
+		*len_ret = len + offsetof(struct sockaddr_un, sun_path);
 #endif
 		return 1;
 	}

Modified: python/branches/py3k-ctypes-pep3118/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Parser/tokenizer.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Parser/tokenizer.c	Thu Jan 24 22:12:24 2008
@@ -640,6 +640,7 @@
 {
 	PyObject* utf8 = NULL;
 	const char *s;
+	const char *newl[2] = {NULL, NULL};
 	int lineno = 0;
 	tok->enc = NULL;
 	tok->str = str;
@@ -656,13 +657,23 @@
 	for (s = str;; s++) {
 		if (*s == '\0') break;
 		else if (*s == '\n') {
+			newl[lineno] = s;
 			lineno++;
 			if (lineno == 2) break;
 		}
 	}
 	tok->enc = NULL;
-	if (!check_coding_spec(str, s - str, tok, buf_setreadl))
-		return error_ret(tok);
+	/* need to check line 1 and 2 separately since check_coding_spec
+	   assumes a single line as input */
+	if (newl[0]) {
+		if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl))
+			return error_ret(tok);
+		if (tok->enc == NULL && newl[1]) {
+			if (!check_coding_spec(newl[0]+1, newl[1] - newl[0],
+					       tok, buf_setreadl))
+				return error_ret(tok);
+		}
+	}
 	if (tok->enc != NULL) {
 		assert(utf8 == NULL);
 		utf8 = translate_into_utf8(str, tok->enc);

Modified: python/branches/py3k-ctypes-pep3118/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/bltinmodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/bltinmodule.c	Thu Jan 24 22:12:24 2008
@@ -815,7 +815,6 @@
 items of the argument iterables(s).  If more than one iterable is given,\n\
 the function is called with an argument list consisting of the\n\
 corresponding item of each iterable, until an iterable is exhausted.\n\
-If the function is None, 'lambda *a: a' is assumed.\n\
 (This is identical to itertools.imap().)");
 
 
@@ -1009,11 +1008,14 @@
 				"%s() got an unexpected keyword argument", name);
 			return NULL;
 		}
+		Py_INCREF(keyfunc);
 	}
 
 	it = PyObject_GetIter(v);
-	if (it == NULL)
+	if (it == NULL) {
+		Py_XDECREF(keyfunc);
 		return NULL;
+	}
 
 	maxitem = NULL; /* the result */
 	maxval = NULL;  /* the value associated with the result */
@@ -1062,6 +1064,7 @@
 	else
 		Py_DECREF(maxval);
 	Py_DECREF(it);
+	Py_XDECREF(keyfunc);
 	return maxitem;
 
 Fail_it_item_and_val:
@@ -1072,6 +1075,7 @@
 	Py_XDECREF(maxval);
 	Py_XDECREF(maxitem);
 	Py_DECREF(it);
+	Py_XDECREF(keyfunc);
 	return NULL;
 }
 

Modified: python/branches/py3k-ctypes-pep3118/Python/ceval.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/ceval.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/ceval.c	Thu Jan 24 22:12:24 2008
@@ -1833,6 +1833,7 @@
 						"__import__ not found");
 				break;
 			}
+			Py_INCREF(x);
 			v = POP();
 			u = TOP();
 			if (PyLong_AsLong(u) != -1 || PyErr_Occurred())
@@ -1854,11 +1855,14 @@
 			Py_DECREF(u);
 			if (w == NULL) {
 				u = POP();
+				Py_DECREF(x);
 				x = NULL;
 				break;
 			}
 			READ_TIMESTAMP(intr0);
-			x = PyEval_CallObject(x, w);
+			v = x;
+			x = PyEval_CallObject(v, w);
+			Py_DECREF(v);
 			READ_TIMESTAMP(intr1);
 			Py_DECREF(w);
 			SET_TOP(x);

Modified: python/branches/py3k-ctypes-pep3118/Python/dynload_win.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/dynload_win.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/dynload_win.c	Thu Jan 24 22:12:24 2008
@@ -171,11 +171,16 @@
 		HINSTANCE hDLL = NULL;
 		char pathbuf[260];
 		LPTSTR dummy;
+		unsigned int old_mode;
 		/* We use LoadLibraryEx so Windows looks for dependent DLLs 
 		    in directory of pathname first.  However, Windows95
 		    can sometimes not work correctly unless the absolute
 		    path is used.  If GetFullPathName() fails, the LoadLibrary
 		    will certainly fail too, so use its error code */
+
+		/* Don't display a message box when Python can't load a DLL */
+		old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
+
 		if (GetFullPathName(pathname,
 				    sizeof(pathbuf),
 				    pathbuf,
@@ -183,6 +188,10 @@
 			/* XXX This call doesn't exist in Windows CE */
 			hDLL = LoadLibraryEx(pathname, NULL,
 					     LOAD_WITH_ALTERED_SEARCH_PATH);
+
+		/* restore old error mode settings */
+		SetErrorMode(old_mode);
+
 		if (hDLL==NULL){
 			PyObject *message;
 			unsigned int errorCode;

Modified: python/branches/py3k-ctypes-pep3118/Python/hypot.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/hypot.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/hypot.c	Thu Jan 24 22:12:24 2008
@@ -2,6 +2,7 @@
 
 #include "Python.h"
 
+#ifndef HAVE_HYPOT
 double hypot(double x, double y)
 {
 	double yx;
@@ -20,3 +21,5 @@
 		return x*sqrt(1.+yx*yx);
 	}
 }
+#endif /* HAVE_HYPOT */
+

Modified: python/branches/py3k-ctypes-pep3118/Python/pystate.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/pystate.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/pystate.c	Thu Jan 24 22:12:24 2008
@@ -242,6 +242,7 @@
 {
 	PyInterpreterState *interp;
 	PyThreadState **p;
+	PyThreadState *prev_p = NULL;
 	if (tstate == NULL)
 		Py_FatalError("PyThreadState_Delete: NULL tstate");
 	interp = tstate->interp;
@@ -254,6 +255,15 @@
 				"PyThreadState_Delete: invalid tstate");
 		if (*p == tstate)
 			break;
+		if (*p == prev_p)
+			Py_FatalError(
+				"PyThreadState_Delete: small circular list(!)"
+                                " and tstate not found.");
+		prev_p = *p;
+		if ((*p)->next == interp->tstate_head)
+			Py_FatalError(
+				"PyThreadState_Delete: circular list(!) and"
+                                " tstate not found.");
 	}
 	*p = tstate->next;
 	HEAD_UNLOCK();

Modified: python/branches/py3k-ctypes-pep3118/Python/structmember.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/structmember.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/structmember.c	Thu Jan 24 22:12:24 2008
@@ -12,6 +12,9 @@
 
 	addr += l->offset;
 	switch (l->type) {
+	case T_BOOL:
+		v = PyBool_FromLong(*(char*)addr);
+		break;
 	case T_BYTE:
 		v = PyLong_FromLong(*(char*)addr);
 		break;
@@ -113,6 +116,18 @@
 	}
 	addr += l->offset;
 	switch (l->type) {
+	case T_BOOL:{
+		if (!PyBool_Check(v)) {
+			PyErr_SetString(PyExc_TypeError,
+					"attribute value type must be bool");
+			return -1;
+		}
+		if (v == Py_True)
+			*(char*)addr = (char) 1;
+		else
+			*(char*)addr = (char) 0;
+		break;
+		}
 	case T_BYTE:{
 		long long_val = PyLong_AsLong(v);
 		if ((long_val == -1) && PyErr_Occurred())

Modified: python/branches/py3k-ctypes-pep3118/Python/sysmodule.c
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Python/sysmodule.c	(original)
+++ python/branches/py3k-ctypes-pep3118/Python/sysmodule.c	Thu Jan 24 22:12:24 2008
@@ -374,6 +374,25 @@
 );
 
 static PyObject *
+sys_gettrace(PyObject *self, PyObject *args)
+{
+	PyThreadState *tstate = PyThreadState_GET();
+	PyObject *temp = tstate->c_traceobj;
+
+	if (temp == NULL)
+		temp = Py_None;
+	Py_INCREF(temp);
+	return temp;
+}
+
+PyDoc_STRVAR(gettrace_doc,
+"gettrace()\n\
+\n\
+Return the global debug tracing function set with sys.settrace.\n\
+See the debugger chapter in the library manual."
+);
+
+static PyObject *
 sys_setprofile(PyObject *self, PyObject *args)
 {
 	if (trace_init() == -1)
@@ -394,6 +413,25 @@
 );
 
 static PyObject *
+sys_getprofile(PyObject *self, PyObject *args)
+{
+	PyThreadState *tstate = PyThreadState_GET();
+	PyObject *temp = tstate->c_profileobj;
+
+	if (temp == NULL)
+		temp = Py_None;
+	Py_INCREF(temp);
+	return temp;
+}
+
+PyDoc_STRVAR(getprofile_doc,
+"getprofile()\n\
+\n\
+Return the profiling function set with sys.setprofile.\n\
+See the profiler chapter in the library manual."
+);
+
+static PyObject *
 sys_setcheckinterval(PyObject *self, PyObject *args)
 {
 	if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_Py_CheckInterval))
@@ -763,12 +801,14 @@
 	 setdlopenflags_doc},
 #endif
 	{"setprofile",	sys_setprofile, METH_O, setprofile_doc},
+	{"getprofile",	sys_getprofile, METH_NOARGS, getprofile_doc},
 	{"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS,
 	 setrecursionlimit_doc},
 #ifdef WITH_TSC
 	{"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc},
 #endif
 	{"settrace",	sys_settrace, METH_O, settrace_doc},
+	{"gettrace",	sys_gettrace, METH_NOARGS, gettrace_doc},
 	{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
 	{NULL,		NULL}		/* sentinel */
 };
@@ -903,8 +943,10 @@
 exc_info() -- return thread-safe information about the current exception\n\
 exit() -- exit the interpreter by raising SystemExit\n\
 getdlopenflags() -- returns flags to be used for dlopen() calls\n\
+getprofile() -- get the global profiling function\n\
 getrefcount() -- return the reference count for an object (plus one :-)\n\
 getrecursionlimit() -- return the max recursion depth for the interpreter\n\
+gettrace() -- get the global debug tracing function\n\
 setcheckinterval() -- control how often the interpreter checks for events\n\
 setdlopenflags() -- set the flags to be used for dlopen() calls\n\
 setprofile() -- set the global profiling function\n\

Modified: python/branches/py3k-ctypes-pep3118/Tools/pynche/ColorDB.py
==============================================================================
--- python/branches/py3k-ctypes-pep3118/Tools/pynche/ColorDB.py	(original)
+++ python/branches/py3k-ctypes-pep3118/Tools/pynche/ColorDB.py	Thu Jan 24 22:12:24 2008
@@ -50,10 +50,7 @@
         self.__byname = {}
         # all unique names (non-aliases).  built-on demand
         self.__allnames = None
-        while 1:
-            line = fp.readline()
-            if not line:
-                break
+        for line in fp:
             # get this compiled regular expression from derived class
             mo = self._re.match(line)
             if not mo:

Modified: python/branches/py3k-ctypes-pep3118/configure
==============================================================================
--- python/branches/py3k-ctypes-pep3118/configure	(original)
+++ python/branches/py3k-ctypes-pep3118/configure	Thu Jan 24 22:12:24 2008
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 59826 .
+# From configure.in Revision: 59829 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.0.
 #
@@ -20584,7 +20584,6 @@
 # ************************************
 # * Check for mathematical functions *
 # ************************************
-# check for hypot() in math library
 LIBS_SAVE=$LIBS
 LIBS="$LIBS $LIBM"
 
@@ -20694,7 +20693,12 @@
 
 
 
-for ac_func in copysign isfinite isnan isinf
+
+
+
+
+
+for ac_func in acosh asinh atanh copysign expm1 finite isinf isnan log1p
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5

Modified: python/branches/py3k-ctypes-pep3118/configure.in
==============================================================================
--- python/branches/py3k-ctypes-pep3118/configure.in	(original)
+++ python/branches/py3k-ctypes-pep3118/configure.in	Thu Jan 24 22:12:24 2008
@@ -2948,12 +2948,11 @@
 # ************************************
 # * Check for mathematical functions *
 # ************************************
-# check for hypot() in math library
 LIBS_SAVE=$LIBS
 LIBS="$LIBS $LIBM"
 AC_REPLACE_FUNCS(hypot)
 
-AC_CHECK_FUNCS(copysign isfinite isnan isinf)
+AC_CHECK_FUNCS(acosh asinh atanh copysign expm1 finite isinf isnan log1p)
 
 LIBS=$LIBS_SAVE
 

Modified: python/branches/py3k-ctypes-pep3118/pyconfig.h.in
==============================================================================
--- python/branches/py3k-ctypes-pep3118/pyconfig.h.in	(original)
+++ python/branches/py3k-ctypes-pep3118/pyconfig.h.in	Thu Jan 24 22:12:24 2008
@@ -25,6 +25,9 @@
    the case on Motorola V4 (R40V4.2) */
 #undef GETTIMEOFDAY_NO_TZ
 
+/* Define to 1 if you have the `acosh' function. */
+#undef HAVE_ACOSH
+
 /* struct addrinfo (netdb.h) */
 #undef HAVE_ADDRINFO
 
@@ -34,9 +37,15 @@
 /* Define this if your time.h defines altzone. */
 #undef HAVE_ALTZONE
 
+/* Define to 1 if you have the `asinh' function. */
+#undef HAVE_ASINH
+
 /* Define to 1 if you have the <asm/types.h> header file. */
 #undef HAVE_ASM_TYPES_H
 
+/* Define to 1 if you have the `atanh' function. */
+#undef HAVE_ATANH
+
 /* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */
 #undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE
 
@@ -141,6 +150,9 @@
 /* Define to 1 if you have the `execv' function. */
 #undef HAVE_EXECV
 
+/* Define to 1 if you have the `expm1' function. */
+#undef HAVE_EXPM1
+
 /* Define if you have the 'fchdir' function. */
 #undef HAVE_FCHDIR
 
@@ -156,6 +168,9 @@
 /* Define if you have the 'fdatasync' function. */
 #undef HAVE_FDATASYNC
 
+/* Define to 1 if you have the `finite' function. */
+#undef HAVE_FINITE
+
 /* Define if you have the 'flock' function. */
 #undef HAVE_FLOCK
 
@@ -288,9 +303,6 @@
 /* Define to 1 if you have the <io.h> header file. */
 #undef HAVE_IO_H
 
-/* Define to 1 if you have the `isfinite' function. */
-#undef HAVE_ISFINITE
-
 /* Define to 1 if you have the `isinf' function. */
 #undef HAVE_ISINF
 
@@ -354,6 +366,9 @@
 /* Define to 1 if you have the <linux/tipc.h> header file. */
 #undef HAVE_LINUX_TIPC_H
 
+/* Define to 1 if you have the `log1p' function. */
+#undef HAVE_LOG1P
+
 /* Define this if you have the type long double. */
 #undef HAVE_LONG_DOUBLE
 


More information about the Python-3000-checkins mailing list