[Python-checkins] r70074 - in python/branches/io-c: Doc/c-api/intro.rst Doc/c-api/veryhigh.rst Doc/distutils/setupscript.rst Doc/distutils/uploading.rst Doc/extending/newtypes.rst Doc/extending/windows.rst Doc/howto/webservers.rst Doc/library/2to3.rst Doc/library/abc.rst Doc/library/cgi.rst Doc/library/cgitb.rst Doc/library/collections.rst Doc/library/functions.rst Doc/library/stdtypes.rst Doc/library/urllib.request.rst Doc/library/xml.etree.elementtree.rst Doc/whatsnew/2.5.rst Lib/_abcoll.py Lib/distutils/README Lib/distutils/command/bdist_rpm.py Lib/distutils/command/build_ext.py Lib/distutils/command/install.py Lib/distutils/command/upload.py Lib/distutils/tests/test_bdist_rpm.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_config.py Lib/distutils/tests/test_install.py Lib/distutils/tests/test_sdist.py Lib/socketserver.py Lib/test/test_mmap.py Lib/test/test_opcodes.py Misc/NEWS Modules/_ssl.c Modules/cmathmodule.c Modules/mmapmodule.c Modules/python.c Objects/longobject.c Python/ceval.c README Tools/scripts/README Tools/scripts/analyze_dxp.py

benjamin.peterson python-checkins at python.org
Sat Feb 28 20:21:02 CET 2009


Author: benjamin.peterson
Date: Sat Feb 28 20:20:42 2009
New Revision: 70074

Log:
Merged revisions 69975,69977,69982,69986,69989-69990,69995-69996,70001,70005,70009,70015,70019,70024,70027-70029,70037,70051,70053,70057,70063,70072 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r69975 | mark.dickinson | 2009-02-25 14:33:49 -0600 (Wed, 25 Feb 2009) | 10 lines
  
  Merged revisions 69974 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69974 | mark.dickinson | 2009-02-25 20:29:50 +0000 (Wed, 25 Feb 2009) | 3 lines
    
    Replace long with twodigits, to avoid depending
    on sizeof(digit) < sizeof(long)
  ........
................
  r69977 | tarek.ziade | 2009-02-25 16:31:38 -0600 (Wed, 25 Feb 2009) | 9 lines
  
  Merged revisions 69976 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69976 | tarek.ziade | 2009-02-25 23:29:27 +0100 (Wed, 25 Feb 2009) | 1 line
    
    Fixed #5316 : test failure in test_site
  ........
................
  r69982 | raymond.hettinger | 2009-02-25 16:51:40 -0600 (Wed, 25 Feb 2009) | 1 line
  
  Sync-up 3.1 docs with 2.7 for collections.Counter().
................
  r69986 | raymond.hettinger | 2009-02-25 18:27:18 -0600 (Wed, 25 Feb 2009) | 1 line
  
  Fix typo.
................
  r69989 | benjamin.peterson | 2009-02-25 20:44:26 -0600 (Wed, 25 Feb 2009) | 36 lines
  
  Blocked revisions 69937,69946,69952-69953,69955,69959,69981,69983 via svnmerge
  
  ........
    r69937 | raymond.hettinger | 2009-02-24 06:23:23 -0600 (Tue, 24 Feb 2009) | 3 lines
    
    Backport 69934:  Register xrange() as a Sequence.
  ........
    r69946 | brett.cannon | 2009-02-24 16:01:02 -0600 (Tue, 24 Feb 2009) | 2 lines
    
    Expand upon test_site.test_s_option to try to debug its failure.
  ........
    r69952 | raymond.hettinger | 2009-02-24 18:37:57 -0600 (Tue, 24 Feb 2009) | 1 line
    
    Sync-up py3.1 doc updates for super().
  ........
    r69953 | raymond.hettinger | 2009-02-24 18:39:47 -0600 (Tue, 24 Feb 2009) | 1 line
    
    Restore Py2.x version of sample call to super().
  ........
    r69955 | raymond.hettinger | 2009-02-24 18:52:37 -0600 (Tue, 24 Feb 2009) | 1 line
    
    More markup and spelling fixes.
  ........
    r69959 | raymond.hettinger | 2009-02-24 19:06:52 -0600 (Tue, 24 Feb 2009) | 1 line
    
    Remove reference to zero argument form of super() in 2.x docs.
  ........
    r69981 | raymond.hettinger | 2009-02-25 16:48:24 -0600 (Wed, 25 Feb 2009) | 1 line
    
    Clarify Counter() docs.
  ........
    r69983 | raymond.hettinger | 2009-02-25 18:05:24 -0600 (Wed, 25 Feb 2009) | 1 line
    
    Fix typo.
  ........
................
  r69990 | benjamin.peterson | 2009-02-25 21:38:59 -0600 (Wed, 25 Feb 2009) | 45 lines
  
  Merged revisions 69803-69805,69840,69901,69905,69907,69924,69927,69987 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69803 | georg.brandl | 2009-02-20 01:48:21 -0600 (Fri, 20 Feb 2009) | 1 line
    
    #5327: fix a broken link by joining it.
  ........
    r69804 | georg.brandl | 2009-02-20 02:22:21 -0600 (Fri, 20 Feb 2009) | 1 line
    
    At least separate imports from other statements.
  ........
    r69805 | georg.brandl | 2009-02-20 02:45:47 -0600 (Fri, 20 Feb 2009) | 2 lines
    
    Fix punctuation.
  ........
    r69840 | georg.brandl | 2009-02-21 13:09:40 -0600 (Sat, 21 Feb 2009) | 1 line
    
    #5338, #5339: two types in the API manual.
  ........
    r69901 | georg.brandl | 2009-02-23 05:24:46 -0600 (Mon, 23 Feb 2009) | 2 lines
    
    #5349: C++ pure virtuals can also have an implementation.
  ........
    r69905 | georg.brandl | 2009-02-23 09:51:27 -0600 (Mon, 23 Feb 2009) | 2 lines
    
    #5352: str.count() counts non-overlapping instances.
  ........
    r69907 | georg.brandl | 2009-02-23 12:33:48 -0600 (Mon, 23 Feb 2009) | 1 line
    
    Fix grammar.
  ........
    r69924 | benjamin.peterson | 2009-02-23 20:45:35 -0600 (Mon, 23 Feb 2009) | 1 line
    
    update README on running tests
  ........
    r69927 | neil.schemenauer | 2009-02-23 22:23:25 -0600 (Mon, 23 Feb 2009) | 1 line
    
    Fix call to os.waitpid, it does not take keyword args.
  ........
    r69987 | benjamin.peterson | 2009-02-25 18:30:11 -0600 (Wed, 25 Feb 2009) | 1 line
    
    fix str.format()'s first arg #5371
  ........
................
  r69995 | benjamin.peterson | 2009-02-26 12:39:03 -0600 (Thu, 26 Feb 2009) | 8 lines
  
  Blocked revisions 69994 via svnmerge
  
  ........
    r69994 | georg.brandl | 2009-02-26 11:36:26 -0600 (Thu, 26 Feb 2009) | 1 line
    
    Document that setting sys.py3kwarning wont do anything.
  ........
................
  r69996 | benjamin.peterson | 2009-02-26 12:55:48 -0600 (Thu, 26 Feb 2009) | 14 lines
  
  Merged revisions 69811,69947 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r69811 | collin.winter | 2009-02-20 13:30:41 -0600 (Fri, 20 Feb 2009) | 2 lines
    
    Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
  ........
    r69947 | jeffrey.yasskin | 2009-02-24 16:48:34 -0600 (Tue, 24 Feb 2009) | 3 lines
    
    Tools/scripts/analyze_dxp.py, a module with some helper functions to
    analyze the output of sys.getdxp().
  ........
................
  r70001 | benjamin.peterson | 2009-02-26 13:17:12 -0600 (Thu, 26 Feb 2009) | 8 lines
  
  Blocked revisions 70000 via svnmerge
  
  ........
    r70000 | benjamin.peterson | 2009-02-26 13:07:18 -0600 (Thu, 26 Feb 2009) | 1 line
    
    remove deprecated symtable.Symbol methods
  ........
................
  r70005 | tarek.ziade | 2009-02-26 17:47:00 -0600 (Thu, 26 Feb 2009) | 9 lines
  
  Merged revisions 70003 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70003 | tarek.ziade | 2009-02-27 00:44:00 +0100 (Fri, 27 Feb 2009) | 1 line
    
    removed unused import
  ........
................
  r70009 | tarek.ziade | 2009-02-26 20:22:25 -0600 (Thu, 26 Feb 2009) | 9 lines
  
  Merged revisions 70007 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70007 | tarek.ziade | 2009-02-27 03:14:35 +0100 (Fri, 27 Feb 2009) | 1 line
    
    more info on long_description
  ........
................
  r70015 | raymond.hettinger | 2009-02-27 01:47:32 -0600 (Fri, 27 Feb 2009) | 1 line
  
  Give mapping views a usable repr.
................
  r70019 | tarek.ziade | 2009-02-27 06:58:56 -0600 (Fri, 27 Feb 2009) | 9 lines
  
  Merged revisions 70017 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70017 | tarek.ziade | 2009-02-27 13:53:34 +0100 (Fri, 27 Feb 2009) | 1 line
    
    Issue #5052: make Distutils compatible with 2.3 again.
  ........
................
  r70024 | georg.brandl | 2009-02-27 10:46:46 -0600 (Fri, 27 Feb 2009) | 1 line
  
  #5357: fix incomprehensible paragraph in urlopen() doc.
................
  r70027 | georg.brandl | 2009-02-27 11:03:38 -0600 (Fri, 27 Feb 2009) | 1 line
  
  #5360: remove RO which has been kicked from 3k.
................
  r70028 | georg.brandl | 2009-02-27 11:11:23 -0600 (Fri, 27 Feb 2009) | 1 line
  
  #5360: replace PyObject_HEAD_INIT by PyVarObject_HEAD_INIT.
................
  r70029 | georg.brandl | 2009-02-27 11:52:38 -0600 (Fri, 27 Feb 2009) | 1 line
  
  another instance of #804543: use strdup() when saving the result of setlocale() because it could be overwritten by subsequent setlocale()s.
................
  r70037 | benjamin.peterson | 2009-02-27 16:29:33 -0600 (Fri, 27 Feb 2009) | 15 lines
  
  Blocked revisions 70011,70016 via svnmerge
  
  ........
    r70011 | brett.cannon | 2009-02-26 21:38:28 -0600 (Thu, 26 Feb 2009) | 5 lines
    
    Fix a bug where code was trying to index an int. Left over from the situation
    from using str.rpartition to str.rindex.
    
    Closes Issue5213.
  ........
    r70016 | raymond.hettinger | 2009-02-27 02:09:47 -0600 (Fri, 27 Feb 2009) | 1 line
    
    Give mapping views a usable repr.
  ........
................
  r70051 | tarek.ziade | 2009-02-28 04:16:43 -0600 (Sat, 28 Feb 2009) | 9 lines
  
  Merged revisions 70049 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70049 | tarek.ziade | 2009-02-28 11:08:02 +0100 (Sat, 28 Feb 2009) | 1 line
    
    Issues #1533164 and #5378: Added quiet and force-optimize options to Distutils bdist_rpm command
  ........
................
  r70053 | hirokazu.yamamoto | 2009-02-28 04:56:50 -0600 (Sat, 28 Feb 2009) | 10 lines
  
  Merged revisions 70052 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70052 | hirokazu.yamamoto | 2009-02-28 19:31:54 +0900 | 2 lines
    
    Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer
    overrun.
  ........
................
  r70057 | hirokazu.yamamoto | 2009-02-28 06:21:53 -0600 (Sat, 28 Feb 2009) | 10 lines
  
  Merged revisions 70056 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70056 | hirokazu.yamamoto | 2009-02-28 21:13:07 +0900 | 2 lines
    
    Issue #1733986: Fixed mmap crash in accessing elements of second map object
    with same tagname but larger size than first map. (Windows)
  ........
................
  r70063 | mark.dickinson | 2009-02-28 09:53:24 -0600 (Sat, 28 Feb 2009) | 9 lines
  
  Merged revisions 70062 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r70062 | mark.dickinson | 2009-02-28 15:50:40 +0000 (Sat, 28 Feb 2009) | 2 lines
    
    Issue #5393: typo in cmath.cos and cmath.cosh docstring
  ........
................
  r70072 | benjamin.peterson | 2009-02-28 13:06:54 -0600 (Sat, 28 Feb 2009) | 1 line
  
  #4967 fix buggy read()
................


Added:
   python/branches/io-c/Lib/distutils/tests/test_bdist_rpm.py
      - copied unchanged from r70072, /python/branches/py3k/Lib/distutils/tests/test_bdist_rpm.py
   python/branches/io-c/Tools/scripts/analyze_dxp.py
      - copied unchanged from r70072, /python/branches/py3k/Tools/scripts/analyze_dxp.py
Modified:
   python/branches/io-c/   (props changed)
   python/branches/io-c/Doc/c-api/intro.rst
   python/branches/io-c/Doc/c-api/veryhigh.rst
   python/branches/io-c/Doc/distutils/setupscript.rst
   python/branches/io-c/Doc/distutils/uploading.rst
   python/branches/io-c/Doc/extending/newtypes.rst
   python/branches/io-c/Doc/extending/windows.rst
   python/branches/io-c/Doc/howto/webservers.rst
   python/branches/io-c/Doc/library/2to3.rst
   python/branches/io-c/Doc/library/abc.rst
   python/branches/io-c/Doc/library/cgi.rst
   python/branches/io-c/Doc/library/cgitb.rst
   python/branches/io-c/Doc/library/collections.rst
   python/branches/io-c/Doc/library/functions.rst
   python/branches/io-c/Doc/library/stdtypes.rst
   python/branches/io-c/Doc/library/urllib.request.rst
   python/branches/io-c/Doc/library/xml.etree.elementtree.rst
   python/branches/io-c/Doc/whatsnew/2.5.rst
   python/branches/io-c/Lib/_abcoll.py
   python/branches/io-c/Lib/distutils/README
   python/branches/io-c/Lib/distutils/command/bdist_rpm.py
   python/branches/io-c/Lib/distutils/command/build_ext.py
   python/branches/io-c/Lib/distutils/command/install.py
   python/branches/io-c/Lib/distutils/command/upload.py
   python/branches/io-c/Lib/distutils/tests/test_build_ext.py
   python/branches/io-c/Lib/distutils/tests/test_config.py
   python/branches/io-c/Lib/distutils/tests/test_install.py
   python/branches/io-c/Lib/distutils/tests/test_sdist.py
   python/branches/io-c/Lib/socketserver.py
   python/branches/io-c/Lib/test/test_mmap.py
   python/branches/io-c/Lib/test/test_opcodes.py
   python/branches/io-c/Misc/NEWS
   python/branches/io-c/Modules/_ssl.c
   python/branches/io-c/Modules/cmathmodule.c
   python/branches/io-c/Modules/mmapmodule.c
   python/branches/io-c/Modules/python.c
   python/branches/io-c/Objects/longobject.c
   python/branches/io-c/Python/ceval.c
   python/branches/io-c/README
   python/branches/io-c/Tools/scripts/README

Modified: python/branches/io-c/Doc/c-api/intro.rst
==============================================================================
--- python/branches/io-c/Doc/c-api/intro.rst	(original)
+++ python/branches/io-c/Doc/c-api/intro.rst	Sat Feb 28 20:20:42 2009
@@ -187,7 +187,7 @@
 the caller is said to *borrow* the reference. Nothing needs to be done for a
 borrowed reference.
 
-Conversely, when a calling function passes it a reference to an  object, there
+Conversely, when a calling function passes in a reference to an  object, there
 are two possibilities: the function *steals* a  reference to the object, or it
 does not.  *Stealing a reference* means that when you pass a reference to a
 function, that function assumes that it now owns that reference, and you are not

Modified: python/branches/io-c/Doc/c-api/veryhigh.rst
==============================================================================
--- python/branches/io-c/Doc/c-api/veryhigh.rst	(original)
+++ python/branches/io-c/Doc/c-api/veryhigh.rst	Sat Feb 28 20:20:42 2009
@@ -16,7 +16,7 @@
 :const:`Py_file_input`, and :const:`Py_single_input`.  These are described
 following the functions which accept them as parameters.
 
-Note also that several of these functions take :ctype:`FILE\*` parameters.  On
+Note also that several of these functions take :ctype:`FILE\*` parameters.  One
 particular issue which needs to be handled carefully is that the :ctype:`FILE`
 structure for different C libraries can be different and incompatible.  Under
 Windows (at least), it is possible for dynamically linked extensions to actually

Modified: python/branches/io-c/Doc/distutils/setupscript.rst
==============================================================================
--- python/branches/io-c/Doc/distutils/setupscript.rst	(original)
+++ python/branches/io-c/Doc/distutils/setupscript.rst	Sat Feb 28 20:20:42 2009
@@ -19,18 +19,18 @@
 distributions.  The Distutils' own setup script, shown here, is used to install
 the package into Python 1.5.2.) ::
 
-   #!/usr/bin/env python
+    #!/usr/bin/env python
 
-   from distutils.core import setup
+    from distutils.core import setup
 
-   setup(name='Distutils',
-         version='1.0',
-         description='Python Distribution Utilities',
-         author='Greg Ward',
-         author_email='gward at python.net',
-         url='http://www.python.org/sigs/distutils-sig/',
-         packages=['distutils', 'distutils.command'],
-        )
+    setup(name='Distutils',
+          version='1.0',
+          description='Python Distribution Utilities',
+          author='Greg Ward',
+          author_email='gward at python.net',
+          url='http://www.python.org/sigs/distutils-sig/',
+          packages=['distutils', 'distutils.command'],
+         )
 
 There are only two differences between this and the trivial one-file
 distribution presented in section :ref:`distutils-simple-example`: more metadata, and the
@@ -53,8 +53,8 @@
 :func:`os.listdir` to specify files, you should be careful to write portable
 code instead of hardcoding path separators::
 
-   glob.glob(os.path.join('mydir', 'subdir', '*.html'))
-   os.listdir(os.path.join('mydir', 'subdir'))
+    glob.glob(os.path.join('mydir', 'subdir', '*.html'))
+    os.listdir(os.path.join('mydir', 'subdir'))
 
 
 .. _listing-packages:
@@ -81,7 +81,7 @@
 package at all) are in :file:`lib`, modules in the :mod:`foo` package are in
 :file:`lib/foo`, and so forth.  Then you would put ::
 
-   package_dir = {'': 'lib'}
+    package_dir = {'': 'lib'}
 
 in your setup script.  The keys to this dictionary are package names, and an
 empty package name stands for the root package.  The values are directory names
@@ -92,7 +92,7 @@
 :file:`lib`, the :mod:`foo.bar` package in :file:`lib/bar`, etc.  This would be
 written in the setup script as ::
 
-   package_dir = {'foo': 'lib'}
+    package_dir = {'foo': 'lib'}
 
 A ``package: dir`` entry in the :option:`package_dir` dictionary implicitly
 applies to all packages below *package*, so the :mod:`foo.bar` case is
@@ -114,7 +114,7 @@
 "root package" (i.e., no package at all).  This simplest case was shown in
 section :ref:`distutils-simple-example`; here is a slightly more involved example::
 
-   py_modules = ['mod1', 'pkg.mod2']
+    py_modules = ['mod1', 'pkg.mod2']
 
 This describes two modules, one of them in the "root" package, the other in the
 :mod:`pkg` package.  Again, the default package/directory layout implies that
@@ -144,17 +144,17 @@
 implemented by :file:`foo.c`.  If no additional instructions to the
 compiler/linker are needed, describing this extension is quite simple::
 
-   Extension('foo', ['foo.c'])
+    Extension('foo', ['foo.c'])
 
 The :class:`Extension` class can be imported from :mod:`distutils.core` along
 with :func:`setup`.  Thus, the setup script for a module distribution that
 contains only this one extension and nothing else might be::
 
-   from distutils.core import setup, Extension
-   setup(name='foo',
-         version='1.0',
-         ext_modules=[Extension('foo', ['foo.c'])],
-         )
+    from distutils.core import setup, Extension
+    setup(name='foo',
+          version='1.0',
+          ext_modules=[Extension('foo', ['foo.c'])],
+          )
 
 The :class:`Extension` class (actually, the underlying extension-building
 machinery implemented by the :command:`build_ext` command) supports a great deal
@@ -168,11 +168,11 @@
 The first argument to the :class:`Extension` constructor is always the name of
 the extension, including any package names.  For example, ::
 
-   Extension('foo', ['src/foo1.c', 'src/foo2.c'])
+    Extension('foo', ['src/foo1.c', 'src/foo2.c'])
 
 describes an extension that lives in the root package, while ::
 
-   Extension('pkg.foo', ['src/foo1.c', 'src/foo2.c'])
+    Extension('pkg.foo', ['src/foo1.c', 'src/foo2.c'])
 
 describes the same extension in the :mod:`pkg` package.  The source files and
 resulting object code are identical in both cases; the only difference is where
@@ -183,11 +183,11 @@
 same base package), use the :option:`ext_package` keyword argument to
 :func:`setup`.  For example, ::
 
-   setup(...,
-         ext_package='pkg',
-         ext_modules=[Extension('foo', ['foo.c']),
-                      Extension('subpkg.bar', ['bar.c'])],
-        )
+    setup(...,
+          ext_package='pkg',
+          ext_modules=[Extension('foo', ['foo.c']),
+                       Extension('subpkg.bar', ['bar.c'])],
+         )
 
 will compile :file:`foo.c` to the extension :mod:`pkg.foo`, and :file:`bar.c` to
 :mod:`pkg.subpkg.bar`.
@@ -212,15 +212,15 @@
 This warning notwithstanding, options to SWIG can be currently passed like
 this::
 
-   setup(...,
-         ext_modules=[Extension('_foo', ['foo.i'],
-                                swig_opts=['-modern', '-I../include'])],
-         py_modules=['foo'],
-        )
+    setup(...,
+          ext_modules=[Extension('_foo', ['foo.i'],
+                                 swig_opts=['-modern', '-I../include'])],
+          py_modules=['foo'],
+         )
 
 Or on the commandline like this::
 
-   > python setup.py build_ext --swig-opts="-modern -I../include"
+    > python setup.py build_ext --swig-opts="-modern -I../include"
 
 On some platforms, you can include non-source files that are processed by the
 compiler and included in your extension.  Currently, this just means Windows
@@ -239,18 +239,18 @@
 For example, if your extension requires header files in the :file:`include`
 directory under your distribution root, use the ``include_dirs`` option::
 
-   Extension('foo', ['foo.c'], include_dirs=['include'])
+    Extension('foo', ['foo.c'], include_dirs=['include'])
 
 You can specify absolute directories there; if you know that your extension will
 only be built on Unix systems with X11R6 installed to :file:`/usr`, you can get
 away with ::
 
-   Extension('foo', ['foo.c'], include_dirs=['/usr/include/X11'])
+    Extension('foo', ['foo.c'], include_dirs=['/usr/include/X11'])
 
 You should avoid this sort of non-portable usage if you plan to distribute your
 code: it's probably better to write C code like  ::
 
-   #include <X11/Xlib.h>
+    #include <X11/Xlib.h>
 
 If you need to include header files from some other Python extension, you can
 take advantage of the fact that header files are installed in a consistent way
@@ -262,17 +262,17 @@
 included in the search path when building Python extensions, the best approach
 is to write C code like  ::
 
-   #include <Numerical/arrayobject.h>
+    #include <Numerical/arrayobject.h>
 
 If you must put the :file:`Numerical` include directory right into your header
 search path, though, you can find that directory using the Distutils
 :mod:`distutils.sysconfig` module::
 
-   from distutils.sysconfig import get_python_inc
-   incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
-   setup(...,
-         Extension(..., include_dirs=[incdir]),
-         )
+    from distutils.sysconfig import get_python_inc
+    incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
+    setup(...,
+          Extension(..., include_dirs=[incdir]),
+          )
 
 Even though this is quite portable---it will work on any Python installation,
 regardless of platform---it's probably easier to just write your C code in the
@@ -288,17 +288,17 @@
 
 For example::
 
-   Extension(...,
-             define_macros=[('NDEBUG', '1'),
-                            ('HAVE_STRFTIME', None)],
-             undef_macros=['HAVE_FOO', 'HAVE_BAR'])
+    Extension(...,
+              define_macros=[('NDEBUG', '1'),
+                             ('HAVE_STRFTIME', None)],
+              undef_macros=['HAVE_FOO', 'HAVE_BAR'])
 
 is the equivalent of having this at the top of every C source file::
 
-   #define NDEBUG 1
-   #define HAVE_STRFTIME
-   #undef HAVE_FOO
-   #undef HAVE_BAR
+    #define NDEBUG 1
+    #define HAVE_STRFTIME
+    #undef HAVE_FOO
+    #undef HAVE_BAR
 
 
 Library options
@@ -313,15 +313,15 @@
 For example, if you need to link against libraries known to be in the standard
 library search path on target systems ::
 
-   Extension(...,
-             libraries=['_gdbm', 'readline'])
+    Extension(...,
+              libraries=['gdbm', 'readline'])
 
 If you need to link with libraries in a non-standard location, you'll have to
 include the location in ``library_dirs``::
 
-   Extension(...,
-             library_dirs=['/usr/X11R6/lib'],
-             libraries=['X11', 'Xt'])
+    Extension(...,
+              library_dirs=['/usr/X11R6/lib'],
+              libraries=['X11', 'Xt'])
 
 (Again, this sort of non-portable construct should be avoided if you intend to
 distribute your code.)
@@ -379,8 +379,8 @@
 parentheses.  Each qualifier may consist of a comparison operator and a version
 number.  The accepted comparison operators are::
 
-   <    >    ==
-   <=   >=   !=
+    <    >    ==
+    <=   >=   !=
 
 These can be combined by using multiple qualifiers separated by commas (and
 optional whitespace).  In this case, all of the qualifiers must be matched; a
@@ -446,13 +446,13 @@
 The :option:`scripts` option simply is a list of files to be handled in this
 way.  From the PyXML setup script::
 
-   setup(...,
-         scripts=['scripts/xmlproc_parse', 'scripts/xmlproc_val']
-         )
+    setup(...,
+          scripts=['scripts/xmlproc_parse', 'scripts/xmlproc_val']
+          )
 
 .. versionchanged:: 2.7
-  All the scripts will also be added to the ``MANIFEST``
-  file if no template is provided. See :ref:`manifest`.
+    All the scripts will also be added to the ``MANIFEST``
+    file if no template is provided. See :ref:`manifest`.
 
 .. _distutils-installing-package-data:
 
@@ -478,28 +478,28 @@
 For example, if a package should contain a subdirectory with several data files,
 the files can be arranged like this in the source tree::
 
-   setup.py
-   src/
-       mypkg/
-           __init__.py
-           module.py
-           data/
-               tables.dat
-               spoons.dat
-               forks.dat
+    setup.py
+    src/
+        mypkg/
+            __init__.py
+            module.py
+            data/
+                tables.dat
+                spoons.dat
+                forks.dat
 
 The corresponding call to :func:`setup` might be::
 
-   setup(...,
-         packages=['mypkg'],
-         package_dir={'mypkg': 'src/mypkg'},
-         package_data={'mypkg': ['data/*.dat']},
-         )
+    setup(...,
+          packages=['mypkg'],
+          package_dir={'mypkg': 'src/mypkg'},
+          package_data={'mypkg': ['data/*.dat']},
+          )
 
 
 .. versionchanged:: 2.7
-  All the files that match ``package_data`` will be added to the ``MANIFEST``
-  file if no template is provided. See :ref:`manifest`.
+    All the files that match ``package_data`` will be added to the ``MANIFEST``
+    file if no template is provided. See :ref:`manifest`.
 
 
 .. _distutils-additional-files:
@@ -514,11 +514,11 @@
 :option:`data_files` specifies a sequence of (*directory*, *files*) pairs in the
 following way::
 
-   setup(...,
-         data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
-                     ('config', ['cfg/data.cfg']),
-                     ('/etc/init.d', ['init-script'])]
-        )
+    setup(...,
+          data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
+                      ('config', ['cfg/data.cfg']),
+                      ('/etc/init.d', ['init-script'])]
+         )
 
 Note that you can specify the directory names where the data files will be
 installed, but you cannot rename the data files themselves.
@@ -539,8 +539,8 @@
 directory.
 
 .. versionchanged:: 2.7
-  All the files that match ``data_files`` will be added to the ``MANIFEST``
-  file if no template is provided. See :ref:`manifest`.
+    All the files that match ``data_files`` will be added to the ``MANIFEST``
+    file if no template is provided. See :ref:`manifest`.
 
 
 
@@ -575,7 +575,7 @@
 |                      | description of the        |                 |        |
 |                      | package                   |                 |        |
 +----------------------+---------------------------+-----------------+--------+
-| ``long_description`` | longer description of the | long string     |        |
+| ``long_description`` | longer description of the | long string     | \(5)   |
 |                      | package                   |                 |        |
 +----------------------+---------------------------+-----------------+--------+
 | ``download_url``     | location where the        | URL             | \(4)   |
@@ -589,28 +589,32 @@
 Notes:
 
 (1)
-   These fields are required.
+    These fields are required.
 
 (2)
-   It is recommended that versions take the form *major.minor[.patch[.sub]]*.
+    It is recommended that versions take the form *major.minor[.patch[.sub]]*.
 
 (3)
-   Either the author or the maintainer must be identified.
+    Either the author or the maintainer must be identified.
 
 (4)
-   These fields should not be used if your package is to be compatible with Python
-   versions prior to 2.2.3 or 2.3.  The list is available from the `PyPI website
-   <http://pypi.python.org/pypi>`_.
+    These fields should not be used if your package is to be compatible with Python
+    versions prior to 2.2.3 or 2.3.  The list is available from the `PyPI website
+    <http://pypi.python.org/pypi>`_.
+
+(5)
+    The ``long_description`` field is used by PyPI when you are registering a
+    package, to build its home page.
 
 'short string'
-   A single line of text, not more than 200 characters.
+    A single line of text, not more than 200 characters.
 
 'long string'
-   Multiple lines of plain text in reStructuredText format (see
-   http://docutils.sf.net/).
+    Multiple lines of plain text in reStructuredText format (see
+    http://docutils.sf.net/).
 
 'list of strings'
-   See below.
+    See below.
 
 Encoding the version information is an art in itself. Python packages generally
 adhere to the version format *major.minor[.patch][sub]*. The major number is 0
@@ -624,44 +628,44 @@
 (for final pre-release release testing). Some examples:
 
 0.1.0
-   the first, experimental release of a package
+    the first, experimental release of a package
 
 1.0.1a2
-   the second alpha release of the first patch version of 1.0
+    the second alpha release of the first patch version of 1.0
 
 :option:`classifiers` are specified in a python list::
 
-   setup(...,
-         classifiers=[
-             'Development Status :: 4 - Beta',
-             'Environment :: Console',
-             'Environment :: Web Environment',
-             'Intended Audience :: End Users/Desktop',
-             'Intended Audience :: Developers',
-             'Intended Audience :: System Administrators',
-             'License :: OSI Approved :: Python Software Foundation License',
-             'Operating System :: MacOS :: MacOS X',
-             'Operating System :: Microsoft :: Windows',
-             'Operating System :: POSIX',
-             'Programming Language :: Python',
-             'Topic :: Communications :: Email',
-             'Topic :: Office/Business',
-             'Topic :: Software Development :: Bug Tracking',
-             ],
-         )
+    setup(...,
+          classifiers=[
+              'Development Status :: 4 - Beta',
+              'Environment :: Console',
+              'Environment :: Web Environment',
+              'Intended Audience :: End Users/Desktop',
+              'Intended Audience :: Developers',
+              'Intended Audience :: System Administrators',
+              'License :: OSI Approved :: Python Software Foundation License',
+              'Operating System :: MacOS :: MacOS X',
+              'Operating System :: Microsoft :: Windows',
+              'Operating System :: POSIX',
+              'Programming Language :: Python',
+              'Topic :: Communications :: Email',
+              'Topic :: Office/Business',
+              'Topic :: Software Development :: Bug Tracking',
+              ],
+          )
 
 If you wish to include classifiers in your :file:`setup.py` file and also wish
 to remain backwards-compatible with Python releases prior to 2.2.3, then you can
 include the following code fragment in your :file:`setup.py` before the
 :func:`setup` call. ::
 
-   # patch distutils if it can't cope with the "classifiers" or
-   # "download_url" keywords
-   from sys import version
-   if version < '2.2.3':
-       from distutils.dist import DistributionMetadata
-       DistributionMetadata.classifiers = None
-       DistributionMetadata.download_url = None
+    # patch distutils if it can't cope with the "classifiers" or
+    # "download_url" keywords
+    from sys import version
+    if version < '2.2.3':
+        from distutils.dist import DistributionMetadata
+        DistributionMetadata.classifiers = None
+        DistributionMetadata.download_url = None
 
 
 Debugging the setup script
@@ -683,5 +687,3 @@
 to anything except an empty string, and distutils will now print detailed
 information what it is doing, and prints the full traceback in case an exception
 occurs.
-
-

Modified: python/branches/io-c/Doc/distutils/uploading.rst
==============================================================================
--- python/branches/io-c/Doc/distutils/uploading.rst	(original)
+++ python/branches/io-c/Doc/distutils/uploading.rst	Sat Feb 28 20:20:42 2009
@@ -41,3 +41,32 @@
 *section* the name of the section in :file:`$HOME/.pypirc`, and
 :option:`--show-response` (which displays the full response text from the PyPI
 server for help in debugging upload problems).
+
+PyPI package display
+====================
+
+The ``long_description`` field plays a special role at PyPI. It is used by
+the server to display a home page for the registered package.
+
+If you use the `reStructuredText <http://docutils.sourceforge.net/rst.html>`_
+syntax for this field, PyPI will parse it and display an HTML output for
+the package home page.
+
+The ``long_description`` field can be attached to a text file located
+in the package::
+
+    from distutils.core import setup
+
+    setup(name='Distutils',
+          long_description=open('README.txt'))
+
+In that case, `README.txt` is a regular reStructuredText text file located
+in the root of the package besides `setup.py`.
+
+To prevent registering broken reStructuredText content, you can use the
+:program:`rst2html` program that is provided by the `docutils` package
+and check the ``long_description`` from the command line::
+
+    $ python setup.py --long-description | rst2html.py > output.html
+
+`docutils` will display a warning if there's something wrong with your syntax.

Modified: python/branches/io-c/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/io-c/Doc/extending/newtypes.rst	(original)
+++ python/branches/io-c/Doc/extending/newtypes.rst	Sat Feb 28 20:20:42 2009
@@ -72,7 +72,7 @@
 Moving on, we come to the crunch --- the type object. ::
 
    static PyTypeObject noddy_NoddyType = {
-       PyObject_HEAD_INIT(NULL)
+       PyVarObject_HEAD_INIT(NULL, 0)
        "noddy.Noddy",             /* tp_name */
        sizeof(noddy_NoddyObject), /* tp_basicsize */
        0,                         /* tp_itemsize */
@@ -103,11 +103,11 @@
 This is so important that we're going to pick the top of it apart still
 further::
 
-   PyObject_HEAD_INIT(NULL)
+   PyVarObject_HEAD_INIT(NULL, 0)
 
 This line is a bit of a wart; what we'd like to write is::
 
-   PyObject_HEAD_INIT(&PyType_Type)
+   PyVarObject_HEAD_INIT(&PyType_Type, 0)
 
 as the type of a type object is "type", but this isn't strictly conforming C and
 some compilers complain.  Fortunately, this member will be filled in for us by
@@ -1154,8 +1154,6 @@
 +===========================+==============================================+
 | :const:`READONLY`         | Never writable.                              |
 +---------------------------+----------------------------------------------+
-| :const:`RO`               | Shorthand for :const:`READONLY`.             |
-+---------------------------+----------------------------------------------+
 | :const:`READ_RESTRICTED`  | Not readable in restricted mode.             |
 +---------------------------+----------------------------------------------+
 | :const:`WRITE_RESTRICTED` | Not writable in restricted mode.             |
@@ -1165,7 +1163,6 @@
 
 .. index::
    single: READONLY
-   single: RO
    single: READ_RESTRICTED
    single: WRITE_RESTRICTED
    single: RESTRICTED
@@ -1430,7 +1427,7 @@
 The statically-declared type object for instances is defined this way::
 
    PyTypeObject PyInstance_Type = {
-       PyObject_HEAD_INIT(&PyType_Type)
+       PyVarObject_HEAD_INIT(&PyType_Type, 0)
        0,
        "module.instance",
 

Modified: python/branches/io-c/Doc/extending/windows.rst
==============================================================================
--- python/branches/io-c/Doc/extending/windows.rst	(original)
+++ python/branches/io-c/Doc/extending/windows.rst	Sat Feb 28 20:20:42 2009
@@ -169,11 +169,11 @@
 
 If your module creates a new type, you may have trouble with this line::
 
-   PyObject_HEAD_INIT(&PyType_Type)
+   PyVarObject_HEAD_INIT(&PyType_Type, 0)
 
 Change it to::
 
-   PyObject_HEAD_INIT(NULL)
+   PyVarObject_HEAD_INIT(NULL, 0)
 
 and add the following to the module initialization function::
 

Modified: python/branches/io-c/Doc/howto/webservers.rst
==============================================================================
--- python/branches/io-c/Doc/howto/webservers.rst	(original)
+++ python/branches/io-c/Doc/howto/webservers.rst	Sat Feb 28 20:20:42 2009
@@ -99,7 +99,8 @@
     # -*- coding: UTF-8 -*-
 
     # enable debugging
-    import cgitb; cgitb.enable()
+    import cgitb
+    cgitb.enable()
 
     print("Content-Type: text/plain;charset=utf-8")
     print()

Modified: python/branches/io-c/Doc/library/2to3.rst
==============================================================================
--- python/branches/io-c/Doc/library/2to3.rst	(original)
+++ python/branches/io-c/Doc/library/2to3.rst	Sat Feb 28 20:20:42 2009
@@ -38,9 +38,9 @@
    $ 2to3 example.py
 
 A diff against the original source file is printed.  2to3 can also write the
-needed modifications right back to the source file.  (Of course, a backup of the
-original is also be made unless :option:`-n` is also given.)  Writing the
-changes back is enabled with the :option:`-w` flag::
+needed modifications right back to the source file.  (A backup of the original
+file is made unless :option:`-n` is also given.)  Writing the changes back is
+enabled with the :option:`-w` flag::
 
    $ 2to3 -w example.py
 

Modified: python/branches/io-c/Doc/library/abc.rst
==============================================================================
--- python/branches/io-c/Doc/library/abc.rst	(original)
+++ python/branches/io-c/Doc/library/abc.rst	Sat Feb 28 20:20:42 2009
@@ -150,7 +150,7 @@
 
    .. note::
 
-      Unlike C++'s pure virtual functions, or Java abstract methods, these abstract
+      Unlike Java abstract methods, these abstract
       methods may have an implementation. This implementation can be
       called via the :func:`super` mechanism from the class that
       overrides it.  This could be useful as an end-point for a

Modified: python/branches/io-c/Doc/library/cgi.rst
==============================================================================
--- python/branches/io-c/Doc/library/cgi.rst	(original)
+++ python/branches/io-c/Doc/library/cgi.rst	Sat Feb 28 20:20:42 2009
@@ -65,16 +65,18 @@
 
 Begin by writing ``import cgi``.
 
-When you write a new script, consider adding the line::
+When you write a new script, consider adding these lines::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 This activates a special exception handler that will display detailed reports in
 the Web browser if any errors occur.  If you'd rather not show the guts of your
 program to users of your script, you can have the reports saved to files
-instead, with a line like this::
+instead, with code like this::
 
-   import cgitb; cgitb.enable(display=0, logdir="/tmp")
+   import cgitb
+   cgitb.enable(display=0, logdir="/tmp")
 
 It's very helpful to use this feature during script development. The reports
 produced by :mod:`cgitb` provide information that can save you a lot of time in
@@ -445,9 +447,10 @@
 
 Fortunately, once you have managed to get your script to execute *some* code,
 you can easily send tracebacks to the Web browser using the :mod:`cgitb` module.
-If you haven't done so already, just add the line::
+If you haven't done so already, just add the lines::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 to the top of your script.  Then try running it again; when a problem occurs,
 you should see a detailed report that will likely make apparent the cause of the

Modified: python/branches/io-c/Doc/library/cgitb.rst
==============================================================================
--- python/branches/io-c/Doc/library/cgitb.rst	(original)
+++ python/branches/io-c/Doc/library/cgitb.rst	Sat Feb 28 20:20:42 2009
@@ -24,9 +24,10 @@
 functions, to help you debug the problem.  Optionally, you can save this
 information to a file instead of sending it to the browser.
 
-To enable this feature, simply add one line to the top of your CGI script::
+To enable this feature, simply add this to the top of your CGI script::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 The options to the :func:`enable` function control whether the report is
 displayed in the browser and whether the report is logged to a file for later

Modified: python/branches/io-c/Doc/library/collections.rst
==============================================================================
--- python/branches/io-c/Doc/library/collections.rst	(original)
+++ python/branches/io-c/Doc/library/collections.rst	Sat Feb 28 20:20:42 2009
@@ -236,13 +236,12 @@
     c.most_common()[:-n:-1]         # n least common elements
     c += Counter()                  # remove zero and negative counts
 
-Several multiset mathematical operations are provided for combining
-:class:`Counter` objects.  Multisets are like regular sets but are allowed to
-contain repeated elements (with counts of one or more).  Addition and
-subtraction combine counters by adding or subtracting the counts of
-corresponding elements.  Intersection and union return the minimum and maximum
-of corresponding counts.  Each operation can accept inputs with signed counts,
-but the output excludes results with counts less than one.
+Several mathematical operations are provided for combining :class:`Counter`
+objects to produce multisets (counters that have counts greater than zero).
+Addition and subtraction combine counters by adding or subtracting the counts
+of corresponding elements.  Intersection and union return the minimum and
+maximum of corresponding counts.  Each operation can accept inputs with signed
+counts, but the output will exclude results with counts of zero or less.
 
     >>> c = Counter(a=3, b=1)
     >>> d = Counter(a=1, b=2)

Modified: python/branches/io-c/Doc/library/functions.rst
==============================================================================
--- python/branches/io-c/Doc/library/functions.rst	(original)
+++ python/branches/io-c/Doc/library/functions.rst	Sat Feb 28 20:20:42 2009
@@ -1067,7 +1067,7 @@
    The second use case is to support cooperative multiple inheritance in a
    dynamic execution environment.  This use case is unique to Python and is
    not found in statically compiled languages or languages that only support
-   single inheritance.  This makes in possible to implement "diamond diagrams"
+   single inheritance.  This makes it possible to implement "diamond diagrams"
    where multiple base classes implement the same method.  Good design dictates
    that this method have the same calling signature in every case (because the
    order of calls is determined at runtime, because that order adapts

Modified: python/branches/io-c/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/io-c/Doc/library/stdtypes.rst	(original)
+++ python/branches/io-c/Doc/library/stdtypes.rst	Sat Feb 28 20:20:42 2009
@@ -793,9 +793,9 @@
 
 .. method:: str.count(sub[, start[, end]])
 
-   Return the number of occurrences of substring *sub* in the range [*start*,
-   *end*].  Optional arguments *start* and *end* are interpreted as in slice
-   notation.
+   Return the number of non-overlapping occurrences of substring *sub* in the
+   range [*start*, *end*].  Optional arguments *start* and *end* are
+   interpreted as in slice notation.
 
 
 .. method:: str.encode([encoding[, errors]])
@@ -835,7 +835,7 @@
    found.
 
 
-.. method:: str.format(format_string, *args, **kwargs)
+.. method:: str.format(*args, **kwargs)
 
    Perform a string formatting operation.  The *format_string* argument can
    contain literal text or replacement fields delimited by braces ``{}``.  Each

Modified: python/branches/io-c/Doc/library/urllib.request.rst
==============================================================================
--- python/branches/io-c/Doc/library/urllib.request.rst	(original)
+++ python/branches/io-c/Doc/library/urllib.request.rst	Sat Feb 28 20:20:42 2009
@@ -37,20 +37,20 @@
    * :meth:`geturl` --- return the URL of the resource retrieved, commonly used to
      determine if a redirect was followed
 
-   * :meth:`info` --- return the meta-information of the page, such as headers, in
-     the form of an ``http.client.HTTPMessage`` instance
-     (see `Quick Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)
+   * :meth:`info` --- return the meta-information of the page, such as headers,
+     in the form of an ``http.client.HTTPMessage`` instance (see `Quick
+     Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)
 
    Raises :exc:`URLError` on errors.
 
-   Note that ``None`` may be returned if no handler handles the request (though the
-   default installed global :class:`OpenerDirector` uses :class:`UnknownHandler` to
-   ensure this never happens).
-   The urlopen function from the previous version, Python 2.6 and earlier,  of
-   the module  urllib has been discontinued as urlopen can return the
-   file-object as the previous. The proxy handling, which in earlier was passed
-   as a dict parameter to urlopen can be availed by the use of
-   :class:`ProxyHandler` objects.
+   Note that ``None`` may be returned if no handler handles the request (though
+   the default installed global :class:`OpenerDirector` uses
+   :class:`UnknownHandler` to ensure this never happens).
+
+   The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been
+   discontinued; :func:`urlopen` corresponds to the old ``urllib2.urlopen``.
+   Proxy handling, which was done by passing a dictionary parameter to
+   ``urllib.urlopen``, can be obtained by using :class:`ProxyHandler` objects.
 
 
 .. function:: install_opener(opener)

Modified: python/branches/io-c/Doc/library/xml.etree.elementtree.rst
==============================================================================
--- python/branches/io-c/Doc/library/xml.etree.elementtree.rst	(original)
+++ python/branches/io-c/Doc/library/xml.etree.elementtree.rst	Sat Feb 28 20:20:42 2009
@@ -529,5 +529,5 @@
 .. [#] The encoding string included in XML output should conform to the
    appropriate standards. For example, "UTF-8" is valid, but "UTF8" is
    not. See http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
-   and http://www.iana.org/assignments/character-sets .
+   and http://www.iana.org/assignments/character-sets.
 

Modified: python/branches/io-c/Doc/whatsnew/2.5.rst
==============================================================================
--- python/branches/io-c/Doc/whatsnew/2.5.rst	(original)
+++ python/branches/io-c/Doc/whatsnew/2.5.rst	Sat Feb 28 20:20:42 2009
@@ -1761,8 +1761,8 @@
 included.
 
 The rest of this section will provide a brief overview of using ElementTree.
-Full documentation for ElementTree is available at http://effbot.org/zone
-/element-index.htm.
+Full documentation for ElementTree is available at
+http://effbot.org/zone/element-index.htm.
 
 ElementTree represents an XML document as a tree of element nodes. The text
 content of the document is stored as the :attr:`.text` and :attr:`.tail`

Modified: python/branches/io-c/Lib/_abcoll.py
==============================================================================
--- python/branches/io-c/Lib/_abcoll.py	(original)
+++ python/branches/io-c/Lib/_abcoll.py	Sat Feb 28 20:20:42 2009
@@ -392,6 +392,9 @@
     def __len__(self):
         return len(self._mapping)
 
+    def __repr__(self):
+        return '{0.__class__.__name__}({0._mapping!r})'.format(self)
+
 
 class KeysView(MappingView, Set):
 

Modified: python/branches/io-c/Lib/distutils/README
==============================================================================
--- python/branches/io-c/Lib/distutils/README	(original)
+++ python/branches/io-c/Lib/distutils/README	Sat Feb 28 20:20:42 2009
@@ -8,4 +8,6 @@
 
     http://www.python.org/sigs/distutils-sig/
 
+WARNING : Distutils must remain compatible with 2.3
+
 $Id$

Modified: python/branches/io-c/Lib/distutils/command/bdist_rpm.py
==============================================================================
--- python/branches/io-c/Lib/distutils/command/bdist_rpm.py	(original)
+++ python/branches/io-c/Lib/distutils/command/bdist_rpm.py	Sat Feb 28 20:20:42 2009
@@ -122,10 +122,21 @@
         # Allow a packager to explicitly force an architecture
         ('force-arch=', None,
          "Force an architecture onto the RPM build process"),
-       ]
+
+        ('quiet', 'q',
+         "Run the INSTALL phase of RPM building in quiet mode"),
+
+        # Forces the -O1 option when calling the install command,
+        # so the rpm contains all files needed for proper operation under
+        # SELinux. Some systems checks for this on build-time and will
+        # fail without this.
+        ('force-optimize', None,
+         "Forces the -O1 option when calling the install command"),
+
+        ]
 
     boolean_options = ['keep-temp', 'use-rpm-opt-flags', 'rpm3-mode',
-                       'no-autoreq']
+                       'no-autoreq', 'quiet', 'force-optimize']
 
     negative_opt = {'no-keep-temp': 'keep-temp',
                     'no-rpm-opt-flags': 'use-rpm-opt-flags',
@@ -175,6 +186,8 @@
         self.no_autoreq = 0
 
         self.force_arch = None
+        self.quiet = 0
+        self.force_optimize = 1
 
     def finalize_options(self):
         self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
@@ -311,6 +324,7 @@
         if os.path.exists('/usr/bin/rpmbuild') or \
            os.path.exists('/bin/rpmbuild'):
             rpm_cmd = ['rpmbuild']
+
         if self.source_only: # what kind of RPMs?
             rpm_cmd.append('-bs')
         elif self.binary_only:
@@ -322,6 +336,10 @@
                              '_topdir %s' % os.path.abspath(self.rpm_base)])
         if not self.keep_temp:
             rpm_cmd.append('--clean')
+
+        if self.quiet:
+            rpm_cmd.append('--quiet')
+
         rpm_cmd.append(spec_path)
         # Determine the binary rpm names that should be built out of this spec
         # file
@@ -474,13 +492,19 @@
         # that we open and interpolate into the spec file, but the defaults
         # are just text that we drop in as-is.  Hmmm.
 
+        # forcing -O1 if force-optimize
+        if self.force_optimize:
+            optimize = ' -O1'
+        else:
+            optimize = ''
+
+        install_cmd = ('%s install%s --root=$RPM_BUILD_ROOT '
+                       '--record=INSTALLED_FILES') % (def_setup_call, optimize)
+
         script_options = [
             ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),
             ('build', 'build_script', def_build),
-            ('install', 'install_script',
-             ("%s install "
-              "--root=$RPM_BUILD_ROOT "
-              "--record=INSTALLED_FILES") % def_setup_call),
+            ('install', 'install_script', install_cmd),
             ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"),
             ('verifyscript', 'verify_script', None),
             ('pre', 'pre_install', None),

Modified: python/branches/io-c/Lib/distutils/command/build_ext.py
==============================================================================
--- python/branches/io-c/Lib/distutils/command/build_ext.py	(original)
+++ python/branches/io-c/Lib/distutils/command/build_ext.py	Sat Feb 28 20:20:42 2009
@@ -7,7 +7,6 @@
 __revision__ = "$Id$"
 
 import sys, os, re
-from site import USER_BASE, USER_SITE
 from distutils.core import Command
 from distutils.errors import *
 from distutils.sysconfig import customize_compiler, get_python_version
@@ -16,6 +15,14 @@
 from distutils.util import get_platform
 from distutils import log
 
+# this keeps compatibility from 2.3 to 2.5
+if sys.version < "2.6":
+    USER_BASE = None
+    HAS_USER_SITE = False
+else:
+    from site import USER_BASE
+    HAS_USER_SITE = True
+
 if os.name == 'nt':
     from distutils.msvccompiler import get_build_version
     MSVC_VERSION = int(get_build_version())
@@ -91,11 +98,14 @@
          "list of SWIG command line options"),
         ('swig=', None,
          "path to the SWIG executable"),
-        ('user', None,
-         "add user include, library and rpath"),
         ]
 
-    boolean_options = ['inplace', 'debug', 'force', 'swig-cpp', 'user']
+    boolean_options = ['inplace', 'debug', 'force', 'swig-cpp']
+
+    if HAS_USER_SITE:
+        user_options.append(('user', None,
+                             "add user include, library and rpath"))
+        boolean_options.append('user')
 
     help_options = [
         ('help-compiler', None,

Modified: python/branches/io-c/Lib/distutils/command/install.py
==============================================================================
--- python/branches/io-c/Lib/distutils/command/install.py	(original)
+++ python/branches/io-c/Lib/distutils/command/install.py	Sat Feb 28 20:20:42 2009
@@ -15,9 +15,16 @@
 from distutils.util import convert_path, subst_vars, change_root
 from distutils.util import get_platform
 from distutils.errors import DistutilsOptionError
-from site import USER_BASE
-from site import USER_SITE
 
+# this keeps compatibility from 2.3 to 2.5
+if sys.version < "2.6":
+    USER_BASE = None
+    USER_SITE = None
+    HAS_USER_SITE = False
+else:
+    from site import USER_BASE
+    from site import USER_SITE
+    HAS_USER_SITE = True
 
 if sys.version < "2.2":
     WINDOWS_SCHEME = {
@@ -51,21 +58,7 @@
         'scripts': '$base/bin',
         'data'   : '$base',
         },
-    'unix_user': {
-        'purelib': '$usersite',
-        'platlib': '$usersite',
-        'headers': '$userbase/include/python$py_version_short/$dist_name',
-        'scripts': '$userbase/bin',
-        'data'   : '$userbase',
-        },
     'nt': WINDOWS_SCHEME,
-    'nt_user': {
-        'purelib': '$usersite',
-        'platlib': '$usersite',
-        'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
-        'scripts': '$userbase/Scripts',
-        'data'   : '$userbase',
-        },
     'mac': {
         'purelib': '$base/Lib/site-packages',
         'platlib': '$base/Lib/site-packages',
@@ -73,13 +66,7 @@
         'scripts': '$base/Scripts',
         'data'   : '$base',
         },
-    'mac_user': {
-        'purelib': '$usersite',
-        'platlib': '$usersite',
-        'headers': '$userbase/$py_version_short/include/$dist_name',
-        'scripts': '$userbase/bin',
-        'data'   : '$userbase',
-        },
+
     'os2': {
         'purelib': '$base/Lib/site-packages',
         'platlib': '$base/Lib/site-packages',
@@ -87,14 +74,41 @@
         'scripts': '$base/Scripts',
         'data'   : '$base',
         },
-    'os2_home': {
+    }
+
+# user site schemes
+if HAS_USER_SITE:
+    INSTALL_SCHEMES['nt_user'] = {
+        'purelib': '$usersite',
+        'platlib': '$usersite',
+        'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
+        'scripts': '$userbase/Scripts',
+        'data'   : '$userbase',
+        }
+
+    INSTALL_SCHEMES['unix_user'] = {
         'purelib': '$usersite',
         'platlib': '$usersite',
         'headers': '$userbase/include/python$py_version_short/$dist_name',
         'scripts': '$userbase/bin',
         'data'   : '$userbase',
-        },
-    }
+        }
+
+    INSTALL_SCHEMES['mac_user'] = {
+        'purelib': '$usersite',
+        'platlib': '$usersite',
+        'headers': '$userbase/$py_version_short/include/$dist_name',
+        'scripts': '$userbase/bin',
+        'data'   : '$userbase',
+        }
+
+    INSTALL_SCHEMES['os2_home'] = {
+        'purelib': '$usersite',
+        'platlib': '$usersite',
+        'headers': '$userbase/include/python$py_version_short/$dist_name',
+        'scripts': '$userbase/bin',
+        'data'   : '$userbase',
+        }
 
 # The keys to an installation scheme; if any new types of files are to be
 # installed, be sure to add an entry to every installation scheme above,
@@ -114,8 +128,6 @@
          "(Unix only) prefix for platform-specific files"),
         ('home=', None,
          "(Unix only) home directory to install under"),
-        ('user', None,
-         "install in user site-package '%s'" % USER_SITE),
 
         # Or, just set the base director(y|ies)
         ('install-base=', None,
@@ -167,7 +179,13 @@
          "filename in which to record list of installed files"),
         ]
 
-    boolean_options = ['compile', 'force', 'skip-build', 'user']
+    boolean_options = ['compile', 'force', 'skip-build']
+
+    if HAS_USER_SITE:
+        user_options.append(('user', None,
+                             "install in user site-package '%s'" % USER_SITE))
+        boolean_options.append('user')
+
     negative_opt = {'no-compile' : 'compile'}
 
 
@@ -319,9 +337,12 @@
                             'prefix': prefix,
                             'sys_exec_prefix': exec_prefix,
                             'exec_prefix': exec_prefix,
-                            'userbase': self.install_userbase,
-                            'usersite': self.install_usersite,
                            }
+
+        if HAS_USER_SITE:
+            self.config_vars['userbase'] = self.install_userbase
+            self.config_vars['usersite'] = self.install_usersite
+
         self.expand_basedirs()
 
         self.dump_dirs("post-expand_basedirs()")

Modified: python/branches/io-c/Lib/distutils/command/upload.py
==============================================================================
--- python/branches/io-c/Lib/distutils/command/upload.py	(original)
+++ python/branches/io-c/Lib/distutils/command/upload.py	Sat Feb 28 20:20:42 2009
@@ -6,7 +6,7 @@
 from distutils.core import PyPIRCCommand
 from distutils.spawn import spawn
 from distutils import log
-from hashlib import md5
+import sys
 import os, io
 import socket
 import platform
@@ -15,6 +15,12 @@
 import base64
 import urllib.parse
 
+# this keeps compatibility for 2.3 and 2.4
+if sys.version < "2.5":
+    from md5 import md5
+else:
+    from hashlib import md5
+
 class upload(PyPIRCCommand):
 
     description = "upload binary package to PyPI"

Modified: python/branches/io-c/Lib/distutils/tests/test_build_ext.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_build_ext.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_build_ext.py	Sat Feb 28 20:20:42 2009
@@ -24,11 +24,17 @@
     def setUp(self):
         # Create a simple test environment
         # Note that we're making changes to sys.path
-        TempdirManager.setUp(self)
+        super(BuildExtTestCase, self).setUp()
         self.tmp_dir = self.mkdtemp()
         self.sys_path = sys.path[:]
         sys.path.append(self.tmp_dir)
         shutil.copy(_get_source_filename(), self.tmp_dir)
+        if sys.version > "2.6":
+            import site
+            self.old_user_base = site.USER_BASE
+            site.USER_BASE = self.mkdtemp()
+            from distutils.command import build_ext
+            build_ext.USER_BASE = site.USER_BASE
 
     def test_build_ext(self):
         global ALREADY_TESTED
@@ -76,7 +82,12 @@
         # Get everything back to normal
         support.unload('xx')
         sys.path = self.sys_path
-        TempdirManager.tearDown(self)
+        if sys.version > "2.6":
+            import site
+            site.USER_BASE = self.old_user_base
+            from distutils.command import build_ext
+            build_ext.USER_BASE = self.old_user_base
+        super(BuildExtTestCase, self).tearDown()
 
     def test_solaris_enable_shared(self):
         dist = Distribution({'name': 'xx'})
@@ -99,6 +110,37 @@
         # make sur we get some lobrary dirs under solaris
         self.assert_(len(cmd.library_dirs) > 0)
 
+    def test_user_site(self):
+        # site.USER_SITE was introduced in 2.6
+        if sys.version < '2.6':
+            return
+
+        import site
+        dist = Distribution({'name': 'xx'})
+        cmd = build_ext(dist)
+
+        # making sure the suer option is there
+        options = [name for name, short, lable in
+                   cmd.user_options]
+        self.assert_('user' in options)
+
+        # setting a value
+        cmd.user = 1
+
+        # setting user based lib and include
+        lib = os.path.join(site.USER_BASE, 'lib')
+        incl = os.path.join(site.USER_BASE, 'include')
+        os.mkdir(lib)
+        os.mkdir(incl)
+
+        # let's run finalize
+        cmd.ensure_finalized()
+
+        # see if include_dirs and library_dirs
+        # were set
+        self.assert_(lib in cmd.library_dirs)
+        self.assert_(incl in cmd.include_dirs)
+
 def test_suite():
     src = _get_source_filename()
     if not os.path.exists(src):

Modified: python/branches/io-c/Lib/distutils/tests/test_config.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_config.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_config.py	Sat Feb 28 20:20:42 2009
@@ -50,7 +50,7 @@
 
     def setUp(self):
         """Patches the environment."""
-        support.TempdirManager.setUp(self)
+        super(PyPIRCCommandTestCase, self).setUp()
 
         if 'HOME' in os.environ:
             self._old_home = os.environ['HOME']
@@ -78,7 +78,7 @@
         else:
             os.environ['HOME'] = self._old_home
         set_threshold(self.old_threshold)
-        support.TempdirManager.tearDown(self)
+        super(PyPIRCCommandTestCase, self).tearDown()
 
     def test_server_registration(self):
         # This test makes sure PyPIRCCommand knows how to:

Modified: python/branches/io-c/Lib/distutils/tests/test_install.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_install.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_install.py	Sat Feb 28 20:20:42 2009
@@ -1,9 +1,14 @@
 """Tests for distutils.command.install."""
 
 import os
+import os.path
+import sys
 import unittest
+import site
 
 from distutils.command.install import install
+from distutils.command import install as install_module
+from distutils.command.install import INSTALL_SCHEMES
 from distutils.core import Distribution
 
 from distutils.tests import support
@@ -47,6 +52,65 @@
         check_path(cmd.install_scripts, os.path.join(destination, "bin"))
         check_path(cmd.install_data, destination)
 
+    def test_user_site(self):
+        # site.USER_SITE was introduced in 2.6
+        if sys.version < '2.6':
+            return
+
+        # preparing the environement for the test
+        self.old_user_base = site.USER_BASE
+        self.old_user_site = site.USER_SITE
+        self.tmpdir = self.mkdtemp()
+        self.user_base = os.path.join(self.tmpdir, 'B')
+        self.user_site = os.path.join(self.tmpdir, 'S')
+        site.USER_BASE = self.user_base
+        site.USER_SITE = self.user_site
+        install_module.USER_BASE = self.user_base
+        install_module.USER_SITE = self.user_site
+
+        def _expanduser(path):
+            return self.tmpdir
+        self.old_expand = os.path.expanduser
+        os.path.expanduser = _expanduser
+
+        try:
+            # this is the actual test
+            self._test_user_site()
+        finally:
+            site.USER_BASE = self.old_user_base
+            site.USER_SITE = self.old_user_site
+            install_module.USER_BASE = self.old_user_base
+            install_module.USER_SITE = self.old_user_site
+            os.path.expanduser = self.old_expand
+
+    def _test_user_site(self):
+        for key in ('nt_user', 'unix_user', 'os2_home'):
+            self.assert_(key in INSTALL_SCHEMES)
+
+        dist = Distribution({'name': 'xx'})
+        cmd = install(dist)
+
+        # making sure the user option is there
+        options = [name for name, short, lable in
+                   cmd.user_options]
+        self.assert_('user' in options)
+
+        # setting a value
+        cmd.user = 1
+
+        # user base and site shouldn't be created yet
+        self.assert_(not os.path.exists(self.user_base))
+        self.assert_(not os.path.exists(self.user_site))
+
+        # let's run finalize
+        cmd.ensure_finalized()
+
+        # now they should
+        self.assert_(os.path.exists(self.user_base))
+        self.assert_(os.path.exists(self.user_site))
+
+        self.assert_('userbase' in cmd.config_vars)
+        self.assert_('usersite' in cmd.config_vars)
 
 def test_suite():
     return unittest.makeSuite(InstallTestCase)

Modified: python/branches/io-c/Lib/distutils/tests/test_sdist.py
==============================================================================
--- python/branches/io-c/Lib/distutils/tests/test_sdist.py	(original)
+++ python/branches/io-c/Lib/distutils/tests/test_sdist.py	Sat Feb 28 20:20:42 2009
@@ -37,10 +37,9 @@
 class sdistTestCase(support.LoggingSilencer, PyPIRCCommandTestCase):
 
     def setUp(self):
-        support.LoggingSilencer.setUp(self)
         # PyPIRCCommandTestCase creates a temp dir already
         # and put it in self.tmp_dir
-        PyPIRCCommandTestCase.setUp(self)
+        super(sdistTestCase, self).setUp()
         # setting up an environment
         self.old_path = os.getcwd()
         os.mkdir(join(self.tmp_dir, 'somecode'))
@@ -54,8 +53,7 @@
     def tearDown(self):
         # back to normal
         os.chdir(self.old_path)
-        PyPIRCCommandTestCase.tearDown(self)
-        support.LoggingSilencer.tearDown(self)
+        super(sdistTestCase, self).tearDown()
 
     def get_cmd(self, metadata=None):
         """Returns a cmd"""

Modified: python/branches/io-c/Lib/socketserver.py
==============================================================================
--- python/branches/io-c/Lib/socketserver.py	(original)
+++ python/branches/io-c/Lib/socketserver.py	Sat Feb 28 20:20:42 2009
@@ -487,7 +487,7 @@
             # libraries that expect to be able to wait for their own
             # children.
             try:
-                pid, status = os.waitpid(0, options=0)
+                pid, status = os.waitpid(0, 0)
             except os.error:
                 pid = None
             if pid not in self.active_children: continue

Modified: python/branches/io-c/Lib/test/test_mmap.py
==============================================================================
--- python/branches/io-c/Lib/test/test_mmap.py	(original)
+++ python/branches/io-c/Lib/test/test_mmap.py	Sat Feb 28 20:20:42 2009
@@ -466,6 +466,72 @@
         self.assert_(issubclass(mmap.error, EnvironmentError))
         self.assert_("mmap.error" in str(mmap.error))
 
+    def test_io_methods(self):
+        data = b"0123456789"
+        open(TESTFN, "wb").write(b"x"*len(data))
+        f = open(TESTFN, "r+b")
+        m = mmap.mmap(f.fileno(), len(data))
+        f.close()
+        # Test write_byte()
+        for i in range(len(data)):
+            self.assertEquals(m.tell(), i)
+            m.write_byte(data[i:i+1])
+            self.assertEquals(m.tell(), i+1)
+        self.assertRaises(ValueError, m.write_byte, b"x")
+        self.assertEquals(m[:], data)
+        # Test read_byte()
+        m.seek(0)
+        for i in range(len(data)):
+            self.assertEquals(m.tell(), i)
+            # XXX: Disable this test for now because it's not clear
+            # which type of object m.read_byte returns. Currently, it
+            # returns 1-length str (unicode).
+            if 0:
+                self.assertEquals(m.read_byte(), data[i:i+1])
+            else:
+                m.read_byte()
+            self.assertEquals(m.tell(), i+1)
+        self.assertRaises(ValueError, m.read_byte)
+        # Test read()
+        m.seek(3)
+        self.assertEquals(m.read(3), b"345")
+        self.assertEquals(m.tell(), 6)
+        # Test write()
+        m.seek(3)
+        m.write(b"bar")
+        self.assertEquals(m.tell(), 6)
+        self.assertEquals(m[:], b"012bar6789")
+        m.seek(8)
+        self.assertRaises(ValueError, m.write, b"bar")
+
+    if os.name == 'nt':
+        def test_tagname(self):
+            data1 = b"0123456789"
+            data2 = b"abcdefghij"
+            assert len(data1) == len(data2)
+            # Test same tag
+            m1 = mmap.mmap(-1, len(data1), tagname="foo")
+            m1[:] = data1
+            m2 = mmap.mmap(-1, len(data2), tagname="foo")
+            m2[:] = data2
+            self.assertEquals(m1[:], data2)
+            self.assertEquals(m2[:], data2)
+            # Test differnt tag
+            m1 = mmap.mmap(-1, len(data1), tagname="foo")
+            m1[:] = data1
+            m2 = mmap.mmap(-1, len(data2), tagname="boo")
+            m2[:] = data2
+            self.assertEquals(m1[:], data1)
+            self.assertEquals(m2[:], data2)
+
+        def test_tagname_crash(self):
+            # Should not crash (Issue 1733986)
+            m = mmap.mmap(-1, 1000, tagname="foo")
+            try:
+                mmap.mmap(-1, 5000, tagname="foo")[:] # same tagname, but larger size
+            except:
+                pass
+
 
 def test_main():
     run_unittest(MmapTests)

Modified: python/branches/io-c/Lib/test/test_opcodes.py
==============================================================================
--- python/branches/io-c/Lib/test/test_opcodes.py	(original)
+++ python/branches/io-c/Lib/test/test_opcodes.py	Sat Feb 28 20:20:42 2009
@@ -98,6 +98,12 @@
         g = eval('lambda a=1: None')
         self.assertNotEquals(f, g)
 
+    def test_modulo_of_string_subclasses(self):
+        class MyString(str):
+            def __mod__(self, value):
+                return 42
+        self.assertEqual(MyString() % 3, 42)
+
 
 def test_main():
     run_unittest(OpcodeTest)

Modified: python/branches/io-c/Misc/NEWS
==============================================================================
--- python/branches/io-c/Misc/NEWS	(original)
+++ python/branches/io-c/Misc/NEWS	Sat Feb 28 20:20:42 2009
@@ -173,6 +173,22 @@
 Library
 -------
 
+- Issue #1733986: Fixed mmap crash in accessing elements of second map object
+  with same tagname but larger size than first map. (Windows)
+
+- Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer
+  overrun.
+
+- Issue #1533164: Installed but not listed *.pyo was breaking Distutils
+  bdist_rpm command.
+
+- Issue #5378: added --quiet option to Distutils bdist_rpm command.
+
+- Issue #5052: make Distutils compatible with 2.3 again.
+
+- Issue #5316: Fixed buildbot failures introduced by multiple inheritance
+  in Distutils tests.
+
 - Issue #5287: Add exception handling around findCaller() call to help out
   IronPython.
 

Modified: python/branches/io-c/Modules/_ssl.c
==============================================================================
--- python/branches/io-c/Modules/_ssl.c	(original)
+++ python/branches/io-c/Modules/_ssl.c	Sat Feb 28 20:20:42 2009
@@ -1244,9 +1244,12 @@
 
 static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
 {
-	PyObject *buf = NULL;
+	PyObject *dest = NULL;
+	Py_buffer buf;
 	int buf_passed = 0;
 	int count = -1;
+	char *mem;
+	/* XXX this should use Py_ssize_t */
 	int len = 1024;
 	int sockstate;
 	int err;
@@ -1260,19 +1263,22 @@
                 return NULL;
         }
 
-	if (!PyArg_ParseTuple(args, "|Oi:read", &buf, &count))
+	if (!PyArg_ParseTuple(args, "|Oi:read", &dest, &count))
 		return NULL;
-        if ((buf == NULL) || (buf == Py_None)) {
-		if (!(buf = PyByteArray_FromStringAndSize((char *) 0, len)))
+        if ((dest == NULL) || (dest == Py_None)) {
+		if (!(dest = PyByteArray_FromStringAndSize((char *) 0, len)))
 			return NULL;
-        } else if (PyLong_Check(buf)) {
-		len = PyLong_AS_LONG(buf);
-		if (!(buf = PyByteArray_FromStringAndSize((char *) 0, len)))
+		mem = PyByteArray_AS_STRING(dest);
+        } else if (PyLong_Check(dest)) {
+		len = PyLong_AS_LONG(dest);
+		if (!(dest = PyByteArray_FromStringAndSize((char *) 0, len)))
 			return NULL;
+		mem = PyByteArray_AS_STRING(dest);
 	} else {
-		if (!PyByteArray_Check(buf))
+		if (PyObject_GetBuffer(dest, &buf, PyBUF_CONTIG) < 0)
 			return NULL;
-		len = PyByteArray_Size(buf);
+		mem = buf.buf;
+		len = buf.len;
 		if ((count > 0) && (count <= len))
 			len = count;
 		buf_passed = 1;
@@ -1293,18 +1299,11 @@
 		if (sockstate == SOCKET_HAS_TIMED_OUT) {
 			PyErr_SetString(PySSLErrorObject,
 					"The read operation timed out");
-			if (!buf_passed) {
-				Py_DECREF(buf);
-			}
-			return NULL;
+			goto error;
 		} else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) {
 			PyErr_SetString(PySSLErrorObject,
 				"Underlying socket too large for select().");
-			if (!buf_passed) {
-				Py_DECREF(buf);
-			}
-			Py_DECREF(buf);
-			return NULL;
+			goto error;
 		} else if (sockstate == SOCKET_HAS_BEEN_CLOSED) {
 			count = 0;
 			goto done;
@@ -1313,15 +1312,11 @@
 	do {
 		err = 0;
 		PySSL_BEGIN_ALLOW_THREADS
-		count = SSL_read(self->ssl, PyByteArray_AsString(buf), len);
+		count = SSL_read(self->ssl, mem, len);
 		err = SSL_get_error(self->ssl, count);
 		PySSL_END_ALLOW_THREADS
-		if(PyErr_CheckSignals()) {
-			if (!buf_passed) {
-				Py_DECREF(buf);
-			}
-			return NULL;
-		}
+		if (PyErr_CheckSignals())
+			goto error;
 		if (err == SSL_ERROR_WANT_READ) {
 			sockstate =
 			  check_socket_and_wait_for_timeout(sock, 0);
@@ -1340,29 +1335,31 @@
 		if (sockstate == SOCKET_HAS_TIMED_OUT) {
 			PyErr_SetString(PySSLErrorObject,
 					"The read operation timed out");
-			if (!buf_passed) {
-				Py_DECREF(buf);
-			}
-			return NULL;
+			goto error;
 		} else if (sockstate == SOCKET_IS_NONBLOCKING) {
 			break;
 		}
 	} while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE);
 	if (count <= 0) {
-		if (!buf_passed) {
-			Py_DECREF(buf);
-		}
-		return PySSL_SetError(self, count, __FILE__, __LINE__);
+		PySSL_SetError(self, count, __FILE__, __LINE__);
+		goto error;
 	}
   done:
 	if (!buf_passed) {
-		PyObject *res = PyBytes_FromStringAndSize(
-			PyByteArray_AS_STRING(buf), count);
-		Py_DECREF(buf);
+		PyObject *res = PyBytes_FromStringAndSize(mem, count);
+		Py_DECREF(dest);
 		return res;
 	} else {
+		PyBuffer_Release(&buf);
 		return PyLong_FromLong(count);
 	}
+  error:
+	if (!buf_passed) {
+		Py_DECREF(dest);
+	} else {
+		PyBuffer_Release(&buf);
+	}
+	return NULL;
 }
 
 PyDoc_STRVAR(PySSL_SSLread_doc,

Modified: python/branches/io-c/Modules/cmathmodule.c
==============================================================================
--- python/branches/io-c/Modules/cmathmodule.c	(original)
+++ python/branches/io-c/Modules/cmathmodule.c	Sat Feb 28 20:20:42 2009
@@ -368,7 +368,7 @@
 
 PyDoc_STRVAR(c_cos_doc,
 "cos(x)\n"
-"n"
+"\n"
 "Return the cosine of x.");
 
 
@@ -427,7 +427,7 @@
 
 PyDoc_STRVAR(c_cosh_doc,
 "cosh(x)\n"
-"n"
+"\n"
 "Return the hyperbolic cosine of x.");
 
 

Modified: python/branches/io-c/Modules/mmapmodule.c
==============================================================================
--- python/branches/io-c/Modules/mmapmodule.c	(original)
+++ python/branches/io-c/Modules/mmapmodule.c	Sat Feb 28 20:20:42 2009
@@ -376,10 +376,17 @@
 
 	if (!is_writable(self))
 		return NULL;
-	*(self->data+self->pos) = value;
-	self->pos += 1;
-	Py_INCREF(Py_None);
-	return Py_None;
+
+	if (self->pos < self->size) {
+		*(self->data+self->pos) = value;
+		self->pos += 1;
+		Py_INCREF(Py_None);
+		return Py_None;
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError, "write byte out of range");
+		return NULL;
+	}
 }
 
 static PyObject *
@@ -1290,7 +1297,7 @@
 						     dwDesiredAccess,
 						     off_hi,
 						     off_lo,
-						     0);
+						     m_obj->size);
 		if (m_obj->data != NULL)
 			return (PyObject *)m_obj;
 		else

Modified: python/branches/io-c/Modules/python.c
==============================================================================
--- python/branches/io-c/Modules/python.c	(original)
+++ python/branches/io-c/Modules/python.c	Sat Feb 28 20:20:42 2009
@@ -37,7 +37,7 @@
 		fprintf(stderr, "out of memory\n");
 		return 1;
 	}
-	oldloc = setlocale(LC_ALL, NULL);
+	oldloc = strdup(setlocale(LC_ALL, NULL));
 	setlocale(LC_ALL, "");
 	for (i = 0; i < argc; i++) {
 #ifdef HAVE_BROKEN_MBSTOWCS
@@ -67,6 +67,7 @@
 		}
 	}
 	setlocale(LC_ALL, oldloc);
+	free(oldloc);
 	res = Py_Main(argc, argv_copy);
 	for (i = 0; i < argc; i++) {
 		PyMem_Free(argv_copy2[i]);

Modified: python/branches/io-c/Objects/longobject.c
==============================================================================
--- python/branches/io-c/Objects/longobject.c	(original)
+++ python/branches/io-c/Objects/longobject.c	Sat Feb 28 20:20:42 2009
@@ -1557,7 +1557,7 @@
 		digit powbase = base;  /* powbase == base ** power */
 		int power = 1;
 		for (;;) {
-			unsigned long newpow = powbase * (unsigned long)base;
+			twodigits newpow = powbase * (twodigits)base;
 			if (newpow >> PyLong_SHIFT)  /* doesn't fit in a digit */
 				break;
 			powbase = (digit)newpow;

Modified: python/branches/io-c/Python/ceval.c
==============================================================================
--- python/branches/io-c/Python/ceval.c	(original)
+++ python/branches/io-c/Python/ceval.c	Sat Feb 28 20:20:42 2009
@@ -1446,7 +1446,10 @@
 		TARGET(BINARY_MODULO)
 			w = POP();
 			v = TOP();
-			x = PyNumber_Remainder(v, w);
+			if (PyUnicode_CheckExact(v))
+				x = PyUnicode_Format(v, w);
+			else
+				x = PyNumber_Remainder(v, w);
 			Py_DECREF(v);
 			Py_DECREF(w);
 			SET_TOP(x);

Modified: python/branches/io-c/README
==============================================================================
--- python/branches/io-c/README	(original)
+++ python/branches/io-c/README	Sat Feb 28 20:20:42 2009
@@ -88,6 +88,33 @@
 used, and backported versions of certain key Python 3.x features.
 
 
+Testing
+-------
+
+To test the interpreter, type "make test" in the top-level directory.
+This runs the test set twice (once with no compiled files, once with
+the compiled files left by the previous test run).  The test set
+produces some output.  You can generally ignore the messages about
+skipped tests due to optional features which can't be imported.
+If a message is printed about a failed test or a traceback or core
+dump is produced, something is wrong.  On some Linux systems (those
+that are not yet using glibc 6), test_strftime fails due to a
+non-standard implementation of strftime() in the C library. Please
+ignore this, or upgrade to glibc version 6.
+
+By default, tests are prevented from overusing resources like disk space and
+memory.  To enable these tests, run "make testall".
+
+IMPORTANT: If the tests fail and you decide to mail a bug report,
+*don't* include the output of "make test".  It is useless.  Run the
+failing test manually, as follows:
+
+        ./python Lib/test/regrtest.py -v test_whatever
+
+(substituting the top of the source tree for '.' if you built in a
+different directory).  This runs the test in verbose mode.
+
+
 Installing multiple versions
 ----------------------------
 

Modified: python/branches/io-c/Tools/scripts/README
==============================================================================
--- python/branches/io-c/Tools/scripts/README	(original)
+++ python/branches/io-c/Tools/scripts/README	Sat Feb 28 20:20:42 2009
@@ -4,6 +4,7 @@
 
 See also the Demo/scripts directory!
 
+analyze_dxp.py		Analyzes the result of sys.getdxp()
 byext.py		Print lines/words/chars stats of files by extension
 byteyears.py		Print product of a file's size and age
 checkappend.py		Search for multi-argument .append() calls


More information about the Python-checkins mailing list