[Python-checkins] r76236 - in python/branches/release31-maint: Doc/distutils/apiref.rst Doc/distutils/examples.rst Doc/library/2to3.rst Doc/library/bdb.rst Doc/library/io.rst Doc/library/operator.rst Doc/library/pdb.rst Doc/library/profile.rst Doc/library/pty.rst Doc/library/turtle.rst Doc/library/weakref.rst Doc/library/zipfile.rst Doc/whatsnew/2.6.rst Lib/distutils/command/check.py Lib/inspect.py Lib/test/test_ast.py Lib/test/test_inspect.py Lib/test/test_module.py Lib/test/test_strptime.py Lib/test/test_tokenize.py Lib/tokenize.py Lib/xml/__init__.py Misc/Porting Modules/mathmodule.c Modules/operator.c Objects/descrobject.c Objects/listobject.c Objects/moduleobject.c Parser/tokenizer.c

benjamin.peterson python-checkins at python.org
Fri Nov 13 03:29:36 CET 2009


Author: benjamin.peterson
Date: Fri Nov 13 03:29:35 2009
New Revision: 76236
Log:
Merged revisions 76235 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
 r76235 | benjamin.peterson | 2009年11月12日 20:25:08 -0600 (2009年11月12日) | 170 lines
 
 Merged revisions 75149,75260-75263,75265-75267,75292,75300,75376,75405,75429-75433,75437,75445,75501,75551,75572,75589-75591,75657,75742,75868,75952-75957,76057,76105,76139,76143,76162,76223 via svnmerge from 
 svn+ssh://pythondev@svn.python.org/python/trunk
 
 ........
 r75149 | gregory.p.smith | 2009年09月29日 16:56:31 -0500 (2009年9月29日) | 3 lines
 
 Mention issue6972 in extractall docs about overwriting things outside of
 the supplied path.
 ........
 r75260 | andrew.kuchling | 2009年10月05日 16:24:20 -0500 (2009年10月05日) | 1 line
 
 Wording fix
 ........
 r75261 | andrew.kuchling | 2009年10月05日 16:24:35 -0500 (2009年10月05日) | 1 line
 
 Fix narkup
 ........
 r75262 | andrew.kuchling | 2009年10月05日 16:25:03 -0500 (2009年10月05日) | 1 line
 
 Document 'skip' parameter to constructor
 ........
 r75263 | andrew.kuchling | 2009年10月05日 16:25:35 -0500 (2009年10月05日) | 1 line
 
 Note side benefit of socket.create_connection()
 ........
 r75265 | andrew.kuchling | 2009年10月05日 17:31:11 -0500 (2009年10月05日) | 1 line
 
 Reword sentence
 ........
 r75266 | andrew.kuchling | 2009年10月05日 17:32:48 -0500 (2009年10月05日) | 1 line
 
 Use standard comma punctuation; reword some sentences in the docs
 ........
 r75267 | andrew.kuchling | 2009年10月05日 17:42:56 -0500 (2009年10月05日) | 1 line
 
 Backport r73983: Document the thousands separator.
 ........
 r75292 | benjamin.peterson | 2009年10月08日 22:11:36 -0500 (2009年10月08日) | 1 line
 
 death to old CVS keyword
 ........
 r75300 | benjamin.peterson | 2009年10月09日 16:48:14 -0500 (2009年10月09日) | 1 line
 
 fix some coding style
 ........
 r75376 | benjamin.peterson | 2009年10月11日 20:26:07 -0500 (2009年10月11日) | 1 line
 
 platform we don't care about
 ........
 r75405 | neil.schemenauer | 2009年10月14日 12:17:14 -0500 (2009年10月14日) | 4 lines
 
 Issue #1754094: Improve the stack depth calculation in the compiler.
 There should be no other effect than a small decrease in memory use.
 Patch by Christopher Tur Lesniewski-Laas.
 ........
 r75429 | benjamin.peterson | 2009年10月14日 20:47:28 -0500 (2009年10月14日) | 1 line
 
 pep8ify if blocks
 ........
 r75430 | benjamin.peterson | 2009年10月14日 20:49:37 -0500 (2009年10月14日) | 1 line
 
 use floor division and add a test that exercises the tabsize codepath
 ........
 r75431 | benjamin.peterson | 2009年10月14日 20:56:25 -0500 (2009年10月14日) | 1 line
 
 change test to what I intended
 ........
 r75432 | benjamin.peterson | 2009年10月14日 22:05:39 -0500 (2009年10月14日) | 1 line
 
 some cleanups
 ........
 r75433 | benjamin.peterson | 2009年10月14日 22:06:55 -0500 (2009年10月14日) | 1 line
 
 make inspect.isabstract() always return a boolean; add a test for it, too #7069
 ........
 r75437 | benjamin.peterson | 2009年10月15日 10:44:46 -0500 (2009年10月15日) | 1 line
 
 only clear a module's __dict__ if the module is the only one with a reference to it #7140
 ........
 r75445 | vinay.sajip | 2009年10月16日 09:06:44 -0500 (2009年10月16日) | 1 line
 
 Issue #7120: logging: Removed import of multiprocessing which is causing crash in GAE.
 ........
 r75501 | antoine.pitrou | 2009年10月18日 13:37:11 -0500 (2009年10月18日) | 3 lines
 
 Add a comment about unreachable code, and fix a typo
 ........
 r75551 | benjamin.peterson | 2009年10月19日 22:14:10 -0500 (2009年10月19日) | 1 line
 
 use property api
 ........
 r75572 | benjamin.peterson | 2009年10月20日 16:55:17 -0500 (2009年10月20日) | 1 line
 
 clarify buffer arg #7178
 ........
 r75589 | benjamin.peterson | 2009年10月21日 21:26:47 -0500 (2009年10月21日) | 1 line
 
 whitespace
 ........
 r75590 | benjamin.peterson | 2009年10月21日 21:36:47 -0500 (2009年10月21日) | 1 line
 
 rewrite to be nice to other implementations
 ........
 r75591 | benjamin.peterson | 2009年10月21日 21:50:38 -0500 (2009年10月21日) | 4 lines
 
 rewrite for style, clarify, and comments
 
 Also, use the hasattr() like scheme of allowing BaseException exceptions through.
 ........
 r75657 | antoine.pitrou | 2009年10月24日 07:41:27 -0500 (2009年10月24日) | 3 lines
 
 Fix compilation error in debug mode.
 ........
 r75742 | benjamin.peterson | 2009年10月26日 17:51:16 -0500 (2009年10月26日) | 1 line
 
 use 'is' instead of id()
 ........
 r75868 | benjamin.peterson | 2009年10月27日 15:59:18 -0500 (2009年10月27日) | 1 line
 
 test expect base classes
 ........
 r75952 | georg.brandl | 2009年10月29日 15:38:32 -0500 (2009年10月29日) | 1 line
 
 Use the correct function name in docstring.
 ........
 r75953 | georg.brandl | 2009年10月29日 15:39:50 -0500 (2009年10月29日) | 1 line
 
 Remove mention of the old -X command line switch.
 ........
 r75954 | georg.brandl | 2009年10月29日 15:53:00 -0500 (2009年10月29日) | 1 line
 
 Use constants instead of magic integers for test result. Do not re-run with --verbose3 for environment changing tests.
 ........
 r75955 | georg.brandl | 2009年10月29日 15:54:03 -0500 (2009年10月29日) | 1 line
 
 Use a single style for all the docstrings in the math module.
 ........
 r75956 | georg.brandl | 2009年10月29日 16:16:34 -0500 (2009年10月29日) | 1 line
 
 I do not think the "railroad" program mentioned is still available.
 ........
 r75957 | georg.brandl | 2009年10月29日 16:44:56 -0500 (2009年10月29日) | 1 line
 
 Fix constant name.
 ........
 r76057 | benjamin.peterson | 2009年11月02日 09:06:45 -0600 (2009年11月02日) | 1 line
 
 prevent a rather unlikely segfault
 ........
 r76105 | georg.brandl | 2009年11月04日 01:38:12 -0600 (2009年11月04日) | 1 line
 
 #7259: show correct equivalent for operator.i* operations in docstring; fix minor issues in operator docs.
 ........
 r76139 | benjamin.peterson | 2009年11月06日 19:04:38 -0600 (2009年11月06日) | 1 line
 
 spelling
 ........
 r76143 | georg.brandl | 2009年11月07日 02:26:07 -0600 (2009年11月07日) | 1 line
 
 #7271: fix typo.
 ........
 r76162 | benjamin.peterson | 2009年11月08日 22:10:53 -0600 (2009年11月08日) | 1 line
 
 discuss how to use -p
 ........
 r76223 | georg.brandl | 2009年11月12日 02:29:46 -0600 (2009年11月12日) | 1 line
 
 Give the profile module a module directive.
 ........
................
Modified:
 python/branches/release31-maint/ (props changed)
 python/branches/release31-maint/Doc/distutils/apiref.rst
 python/branches/release31-maint/Doc/distutils/examples.rst
 python/branches/release31-maint/Doc/library/2to3.rst
 python/branches/release31-maint/Doc/library/bdb.rst
 python/branches/release31-maint/Doc/library/io.rst
 python/branches/release31-maint/Doc/library/operator.rst
 python/branches/release31-maint/Doc/library/pdb.rst
 python/branches/release31-maint/Doc/library/profile.rst
 python/branches/release31-maint/Doc/library/pty.rst
 python/branches/release31-maint/Doc/library/turtle.rst
 python/branches/release31-maint/Doc/library/weakref.rst
 python/branches/release31-maint/Doc/library/zipfile.rst
 python/branches/release31-maint/Doc/whatsnew/2.6.rst
 python/branches/release31-maint/Lib/distutils/command/check.py
 python/branches/release31-maint/Lib/inspect.py
 python/branches/release31-maint/Lib/test/test_ast.py
 python/branches/release31-maint/Lib/test/test_inspect.py
 python/branches/release31-maint/Lib/test/test_module.py
 python/branches/release31-maint/Lib/test/test_strptime.py
 python/branches/release31-maint/Lib/test/test_tokenize.py
 python/branches/release31-maint/Lib/tokenize.py
 python/branches/release31-maint/Lib/xml/__init__.py
 python/branches/release31-maint/Misc/Porting
 python/branches/release31-maint/Modules/mathmodule.c
 python/branches/release31-maint/Modules/operator.c
 python/branches/release31-maint/Objects/descrobject.c
 python/branches/release31-maint/Objects/listobject.c
 python/branches/release31-maint/Objects/moduleobject.c
 python/branches/release31-maint/Parser/tokenizer.c
Modified: python/branches/release31-maint/Doc/distutils/apiref.rst
==============================================================================
--- python/branches/release31-maint/Doc/distutils/apiref.rst	(original)
+++ python/branches/release31-maint/Doc/distutils/apiref.rst	Fri Nov 13 03:29:35 2009
@@ -1952,7 +1952,7 @@
 
 
 The ``check`` command performs some tests on the meta-data of a package.
-It makes sure for example that all required meta-data are provided through
+For example, it verifies that all required meta-data are provided as
 the arguments passed to the :func:`setup` function.
 
 .. % todo
Modified: python/branches/release31-maint/Doc/distutils/examples.rst
==============================================================================
--- python/branches/release31-maint/Doc/distutils/examples.rst	(original)
+++ python/branches/release31-maint/Doc/distutils/examples.rst	Fri Nov 13 03:29:35 2009
@@ -236,10 +236,10 @@
 Checking a package
 ==================
 
-The ``check`` command allows you to verify if your package meta-data are
-meeting the minimum requirements to build a distribution.
+The ``check`` command allows you to verify if your package meta-data
+meet the minimum requirements to build a distribution.
 
-To run it, just call it over your :file:`setup.py` script. If something is
+To run it, just call it using your :file:`setup.py` script. If something is
 missing, ``check`` will display a warning.
 
 Let's take an example with a simple script::
@@ -252,7 +252,7 @@
 
 $ python setup.py check
 running check
- warning: check: missing required meta-data: version ,url
+ warning: check: missing required meta-data: version, url
 warning: check: missing meta-data: either (author and author_email) or
 (maintainer and maintainer_email) must be supplied
 
Modified: python/branches/release31-maint/Doc/library/2to3.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/2to3.rst	(original)
+++ python/branches/release31-maint/Doc/library/2to3.rst	Fri Nov 13 03:29:35 2009
@@ -86,6 +86,14 @@
 The :option:`-v` option enables output of more information on the translation
 process.
 
+Since some print statements can be parsed as function calls or statements, 2to3
+cannot always read files containing the print function. When 2to3 detects the
+presence of the ``from __future__ import print_function`` compiler directive, it
+modifies its internal grammar to interpert :func:`print` as a function. This
+change can also be enabled manually with the :option:`-p` flag. Use
+:option:`-p` to run fixers on code that already has had its print statements
+converted.
+
 
 .. _2to3-fixers:
 
Modified: python/branches/release31-maint/Doc/library/bdb.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/bdb.rst	(original)
+++ python/branches/release31-maint/Doc/library/bdb.rst	Fri Nov 13 03:29:35 2009
@@ -62,14 +62,22 @@
 * The breakpoint hit count.
 
 
-.. class:: Bdb()
+.. class:: Bdb(skip=None)
 
- The :class:`Bdb` acts as a generic Python debugger base class.
+ The :class:`Bdb` class acts as a generic Python debugger base class.
 
 This class takes care of the details of the trace facility; a derived class
 should implement user interaction. The standard debugger class
 (:class:`pdb.Pdb`) is an example.
 
+ The *skip* argument, if given, must be an iterable of glob-style
+ module name patterns. The debugger will not step into frames that
+ originate in a module that matches one of these patterns. Whether a
+ frame is considered to originate in a certain module is determined
+ by the ``__name__`` in the frame globals.
+
+ .. versionadded:: 2.7
+ The *skip* argument.
 
 The following methods of :class:`Bdb` normally don't need to be overridden.
 
Modified: python/branches/release31-maint/Doc/library/io.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/io.rst	(original)
+++ python/branches/release31-maint/Doc/library/io.rst	Fri Nov 13 03:29:35 2009
@@ -98,8 +98,8 @@
 
 *buffering* is an optional integer used to set the buffering policy. By
 default full buffering is on. Pass 0 to switch buffering off (only allowed
- in binary mode), 1 to set line buffering, and an integer > 1 for full
- buffering.
+ in binary mode), 1 to set line buffering, and an integer > 1 to indicate the
+ size of the buffer.
 
 *encoding* is the name of the encoding used to decode or encode the file.
 This should only be used in text mode. The default encoding is platform
Modified: python/branches/release31-maint/Doc/library/operator.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/operator.rst	(original)
+++ python/branches/release31-maint/Doc/library/operator.rst	Fri Nov 13 03:29:35 2009
@@ -104,6 +104,14 @@
 Return ``a // b``.
 
 
+.. function:: index(a)
+ __index__(a)
+
+ Return *a* converted to an integer. Equivalent to ``a.__index__()``.
+
+ .. versionadded:: 2.5
+
+
 .. function:: inv(obj)
 invert(obj)
 __inv__(obj)
@@ -133,7 +141,7 @@
 .. function:: neg(obj)
 __neg__(obj)
 
- Return *obj* negated.
+ Return *obj* negated (``-obj``).
 
 
 .. function:: or_(a, b)
@@ -145,7 +153,7 @@
 .. function:: pos(obj)
 __pos__(obj)
 
- Return *obj* positive.
+ Return *obj* positive (``+obj``).
 
 
 .. function:: pow(a, b)
@@ -179,13 +187,7 @@
 Return the bitwise exclusive or of *a* and *b*.
 
 
-.. function:: index(a)
- __index__(a)
-
- Return *a* converted to an integer. Equivalent to ``a.__index__()``.
-
-
-Operations which work with sequences include:
+Operations which work with sequences (some of them with mappings too) include:
 
 .. function:: concat(a, b)
 __concat__(a, b)
@@ -394,67 +396,77 @@
 This table shows how abstract operations correspond to operator symbols in the
 Python syntax and the functions in the :mod:`operator` module.
 
-+-----------------------+-------------------------+---------------------------------+
-| Operation | Syntax | Function |
-+=======================+=========================+=================================+
-| Addition | ``a + b`` | ``add(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Concatenation | ``seq1 + seq2`` | ``concat(seq1, seq2)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Containment Test | ``obj in seq`` | ``contains(seq, obj)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Division | ``a / b`` | ``truediv(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Division | ``a // b`` | ``floordiv(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Bitwise And | ``a & b`` | ``and_(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Bitwise Exclusive Or | ``a ^ b`` | ``xor(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Bitwise Inversion | ``~ a`` | ``invert(a)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Bitwise Or | ``a | b`` | ``or_(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Exponentiation | ``a ** b`` | ``pow(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Identity | ``a is b`` | ``is_(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Identity | ``a is not b`` | ``is_not(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Indexed Assignment | ``obj[k] = v`` | ``setitem(obj, k, v)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Indexed Deletion | ``del obj[k]`` | ``delitem(obj, k)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Indexing | ``obj[k]`` | ``getitem(obj, k)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Left Shift | ``a << b`` | ``lshift(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Modulo | ``a % b`` | ``mod(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Multiplication | ``a * b`` | ``mul(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Negation (Arithmetic) | ``- a`` | ``neg(a)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Negation (Logical) | ``not a`` | ``not_(a)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Right Shift | ``a >> b`` | ``rshift(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| String Formatting | ``s % obj`` | ``mod(s, obj)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Subtraction | ``a - b`` | ``sub(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Truth Test | ``obj`` | ``truth(obj)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Ordering | ``a < b`` | ``lt(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Ordering | ``a <= b`` | ``le(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Equality | ``a == b`` | ``eq(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Difference | ``a != b`` | ``ne(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Ordering | ``a >= b`` | ``ge(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
-| Ordering | ``a > b`` | ``gt(a, b)`` |
-+-----------------------+-------------------------+---------------------------------+
++-----------------------+-------------------------+---------------------------------------+
+| Operation | Syntax | Function |
++=======================+=========================+=======================================+
+| Addition | ``a + b`` | ``add(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Concatenation | ``seq1 + seq2`` | ``concat(seq1, seq2)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Containment Test | ``obj in seq`` | ``contains(seq, obj)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Division | ``a / b`` | ``div(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Division | ``a // b`` | ``floordiv(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Bitwise And | ``a & b`` | ``and_(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Bitwise Exclusive Or | ``a ^ b`` | ``xor(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Bitwise Inversion | ``~ a`` | ``invert(a)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Bitwise Or | ``a | b`` | ``or_(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Exponentiation | ``a ** b`` | ``pow(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Identity | ``a is b`` | ``is_(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Identity | ``a is not b`` | ``is_not(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Indexed Assignment | ``obj[k] = v`` | ``setitem(obj, k, v)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Indexed Deletion | ``del obj[k]`` | ``delitem(obj, k)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Indexing | ``obj[k]`` | ``getitem(obj, k)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Left Shift | ``a << b`` | ``lshift(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Modulo | ``a % b`` | ``mod(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Multiplication | ``a * b`` | ``mul(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Negation (Arithmetic) | ``- a`` | ``neg(a)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Negation (Logical) | ``not a`` | ``not_(a)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Positive | ``+ a`` | ``pos(a)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Right Shift | ``a >> b`` | ``rshift(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Sequence Repetition | ``seq * i`` | ``repeat(seq, i)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Slice Assignment | ``seq[i:j] = values`` | ``setitem(seq, slice(i, j), values)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Slice Deletion | ``del seq[i:j]`` | ``delitem(seq, slice(i, j))`` |
++-----------------------+-------------------------+---------------------------------------+
+| Slicing | ``seq[i:j]`` | ``getitem(seq, slice(i, j))`` |
++-----------------------+-------------------------+---------------------------------------+
+| String Formatting | ``s % obj`` | ``mod(s, obj)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Subtraction | ``a - b`` | ``sub(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Truth Test | ``obj`` | ``truth(obj)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Ordering | ``a < b`` | ``lt(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Ordering | ``a <= b`` | ``le(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Equality | ``a == b`` | ``eq(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Difference | ``a != b`` | ``ne(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Ordering | ``a >= b`` | ``ge(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Ordering | ``a > b`` | ``gt(a, b)`` |
++-----------------------+-------------------------+---------------------------------------+
 
Modified: python/branches/release31-maint/Doc/library/pdb.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/pdb.rst	(original)
+++ python/branches/release31-maint/Doc/library/pdb.rst	Fri Nov 13 03:29:35 2009
@@ -55,7 +55,7 @@
 import pdb; pdb.set_trace()
 
 at the location you want to break into the debugger. You can then step through
-the code following this statement, and continue running without debugger using
+the code following this statement, and continue running without the debugger using
 the ``c`` command.
 
 The typical usage to inspect a crashed program is::
Modified: python/branches/release31-maint/Doc/library/profile.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/profile.rst	(original)
+++ python/branches/release31-maint/Doc/library/profile.rst	Fri Nov 13 03:29:35 2009
@@ -7,6 +7,8 @@
 
 .. sectionauthor:: James Roskind
 
+.. module:: profile
+ :synopsis: Python source profiler.
 
 .. index:: single: InfoSeek Corporation
 
Modified: python/branches/release31-maint/Doc/library/pty.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/pty.rst	(original)
+++ python/branches/release31-maint/Doc/library/pty.rst	Fri Nov 13 03:29:35 2009
@@ -3,8 +3,8 @@
 ========================================
 
 .. module:: pty
- :platform: IRIX, Linux
- :synopsis: Pseudo-Terminal Handling for SGI and Linux.
+ :platform: Linux
+ :synopsis: Pseudo-Terminal Handling for Linux.
 .. moduleauthor:: Steen Lumholt
 .. sectionauthor:: Moshe Zadka <moshez at zadka.site.co.il>
 
@@ -14,8 +14,8 @@
 controlling terminal programmatically.
 
 Because pseudo-terminal handling is highly platform dependent, there is code to
-do it only for SGI and Linux. (The Linux code is supposed to work on other
-platforms, but hasn't been tested yet.)
+do it only for Linux. (The Linux code is supposed to work on other platforms,
+but hasn't been tested yet.)
 
 The :mod:`pty` module defines the following functions:
 
@@ -32,8 +32,8 @@
 .. function:: openpty()
 
 Open a new pseudo-terminal pair, using :func:`os.openpty` if possible, or
- emulation code for SGI and generic Unix systems. Return a pair of file
- descriptors ``(master, slave)``, for the master and the slave end, respectively.
+ emulation code for generic Unix systems. Return a pair of file descriptors
+ ``(master, slave)``, for the master and the slave end, respectively.
 
 
 .. function:: spawn(argv[, master_read[, stdin_read]])
Modified: python/branches/release31-maint/Doc/library/turtle.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/turtle.rst	(original)
+++ python/branches/release31-maint/Doc/library/turtle.rst	Fri Nov 13 03:29:35 2009
@@ -2023,7 +2023,7 @@
 Subclass of TurtleScreen, with :ref:`four methods added <screenspecific>`.
 
 
-.. class:: ScrolledCavas(master)
+.. class:: ScrolledCanvas(master)
 
 :param master: some Tkinter widget to contain the ScrolledCanvas, i.e.
 a Tkinter-canvas with scrollbars added
Modified: python/branches/release31-maint/Doc/library/weakref.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/weakref.rst	(original)
+++ python/branches/release31-maint/Doc/library/weakref.rst	Fri Nov 13 03:29:35 2009
@@ -69,10 +69,9 @@
 
 obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable
 
-.. impl-detail::
-
- Other built-in types such as :class:`tuple` and :class:`long` do not support
- weak references even when subclassed.
+Other built-in types such as :class:`tuple` and :class:`long` do not support
+weak references even when subclassed (This is an implementation detail and may
+be different across various Python implementations.).
 
 Extension types can easily be made to support weak references; see
 :ref:`weakref-support`.
Modified: python/branches/release31-maint/Doc/library/zipfile.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/zipfile.rst	(original)
+++ python/branches/release31-maint/Doc/library/zipfile.rst	Fri Nov 13 03:29:35 2009
@@ -197,6 +197,13 @@
 be a subset of the list returned by :meth:`namelist`. *pwd* is the password
 used for encrypted files.
 
+ .. warning::
+
+ Never extract archives from untrusted sources without prior inspection.
+ It is possible that files are created outside of *path*, e.g. members
+ that have absolute filenames starting with ``"/"`` or filenames with two
+ dots ``".."``.
+
 
 .. method:: ZipFile.printdir()
 
Modified: python/branches/release31-maint/Doc/whatsnew/2.6.rst
==============================================================================
--- python/branches/release31-maint/Doc/whatsnew/2.6.rst	(original)
+++ python/branches/release31-maint/Doc/whatsnew/2.6.rst	Fri Nov 13 03:29:35 2009
@@ -2416,9 +2416,13 @@
 environments. TIPC addresses are 4- or 5-tuples.
 (Contributed by Alberto Bertogli; :issue:`1646`.)
 
- A new function, :func:`create_connection`, takes an address
- and connects to it using an optional timeout value, returning
- the connected socket object.
+ A new function, :func:`create_connection`, takes an address and
+ connects to it using an optional timeout value, returning the
+ connected socket object. This function also looks up the address's
+ type and connects to it using IPv4 or IPv6 as appropriate. Changing
+ your code to use :func:`create_connection` instead of
+ ``socket(socket.AF_INET, ...)`` may be all that's required to make
+ your code work with IPv6.
 
 * The base classes in the :mod:`SocketServer` module now support
 calling a :meth:`handle_timeout` method after a span of inactivity
Modified: python/branches/release31-maint/Lib/distutils/command/check.py
==============================================================================
--- python/branches/release31-maint/Lib/distutils/command/check.py	(original)
+++ python/branches/release31-maint/Lib/distutils/command/check.py	Fri Nov 13 03:29:35 2009
@@ -92,7 +92,7 @@
 missing.append(attr)
 
 if missing:
- self.warn("missing required meta-data: %s" % ' ,'.join(missing))
+ self.warn("missing required meta-data: %s" % ', '.join(missing))
 if metadata.author:
 if not metadata.author_email:
 self.warn("missing meta-data: if 'author' supplied, " +
Modified: python/branches/release31-maint/Lib/inspect.py
==============================================================================
--- python/branches/release31-maint/Lib/inspect.py	(original)
+++ python/branches/release31-maint/Lib/inspect.py	Fri Nov 13 03:29:35 2009
@@ -238,7 +238,7 @@
 
 def isabstract(object):
 """Return true if the object is an abstract base class (ABC)."""
- return isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT
+ return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT)
 
 def getmembers(object, predicate=None):
 """Return all members of an object as (name, value) pairs sorted by name.
Modified: python/branches/release31-maint/Lib/test/test_ast.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_ast.py	(original)
+++ python/branches/release31-maint/Lib/test/test_ast.py	Fri Nov 13 03:29:35 2009
@@ -140,6 +140,14 @@
 self.assertEquals(to_tuple(ast_tree), o)
 self._assertTrueorder(ast_tree, (0, 0))
 
+ def test_base_classes(self):
+ self.assertTrue(issubclass(ast.For, ast.stmt))
+ self.assertTrue(issubclass(ast.Name, ast.expr))
+ self.assertTrue(issubclass(ast.stmt, ast.AST))
+ self.assertTrue(issubclass(ast.expr, ast.AST))
+ self.assertTrue(issubclass(ast.comprehension, ast.AST))
+ self.assertTrue(issubclass(ast.Gt, ast.AST))
+
 def test_nodeclasses(self):
 x = ast.BinOp(1, 2, 3, lineno=0)
 self.assertEquals(x.left, 1)
Modified: python/branches/release31-maint/Lib/test/test_inspect.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_inspect.py	(original)
+++ python/branches/release31-maint/Lib/test/test_inspect.py	Fri Nov 13 03:29:35 2009
@@ -120,6 +120,28 @@
 self.assertTrue('a' in members)
 self.assertTrue('b' not in members)
 
+ def test_isabstract(self):
+ from abc import ABCMeta, abstractmethod
+
+ class AbstractClassExample(metaclass=ABCMeta):
+
+ @abstractmethod
+ def foo(self):
+ pass
+
+ class ClassExample(AbstractClassExample):
+ def foo(self):
+ pass
+
+ a = ClassExample()
+
+ # Test general behaviour.
+ self.assertTrue(inspect.isabstract(AbstractClassExample))
+ self.assertFalse(inspect.isabstract(ClassExample))
+ self.assertFalse(inspect.isabstract(a))
+ self.assertFalse(inspect.isabstract(int))
+ self.assertFalse(inspect.isabstract(5))
+
 
 class TestInterpreterStack(IsTestBase):
 def __init__(self, *args, **kwargs):
Modified: python/branches/release31-maint/Lib/test/test_module.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_module.py	(original)
+++ python/branches/release31-maint/Lib/test/test_module.py	Fri Nov 13 03:29:35 2009
@@ -55,6 +55,14 @@
 {"__name__": "foo", "__doc__": "foodoc", "bar": 42})
 self.assertTrue(foo.__dict__ is d)
 
+ def test_dont_clear_dict(self):
+ # See issue 7140.
+ def f():
+ foo = ModuleType("foo")
+ foo.bar = 4
+ return foo
+ self.assertEqual(f().__dict__["bar"], 4)
+
 def test_main():
 run_unittest(ModuleTests)
 
Modified: python/branches/release31-maint/Lib/test/test_strptime.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_strptime.py	(original)
+++ python/branches/release31-maint/Lib/test/test_strptime.py	Fri Nov 13 03:29:35 2009
@@ -493,9 +493,9 @@
 _strptime._strptime_time("10", "%d")
 _strptime._strptime_time("2005", "%Y")
 _strptime._TimeRE_cache.locale_time.lang = "Ni"
- original_time_re = id(_strptime._TimeRE_cache)
+ original_time_re = _strptime._TimeRE_cache
 _strptime._strptime_time("10", "%d")
- self.assertNotEqual(original_time_re, id(_strptime._TimeRE_cache))
+ self.assertIsNot(original_time_re, _strptime._TimeRE_cache)
 self.assertEqual(len(_strptime._regex_cache), 1)
 
 def test_regex_cleanup(self):
@@ -514,11 +514,10 @@
 def test_new_localetime(self):
 # A new LocaleTime instance should be created when a new TimeRE object
 # is created.
- locale_time_id = id(_strptime._TimeRE_cache.locale_time)
+ locale_time_id = _strptime._TimeRE_cache.locale_time
 _strptime._TimeRE_cache.locale_time.lang = "Ni"
 _strptime._strptime_time("10", "%d")
- self.assertNotEqual(locale_time_id,
- id(_strptime._TimeRE_cache.locale_time))
+ self.assertIsNot(locale_time_id, _strptime._TimeRE_cache.locale_time)
 
 def test_TimeRE_recreation(self):
 # The TimeRE instance should be recreated upon changing the locale.
@@ -530,15 +529,15 @@
 try:
 _strptime._strptime_time('10', '%d')
 # Get id of current cache object.
- first_time_re_id = id(_strptime._TimeRE_cache)
+ first_time_re = _strptime._TimeRE_cache
 try:
 # Change the locale and force a recreation of the cache.
 locale.setlocale(locale.LC_TIME, ('de_DE', 'UTF8'))
 _strptime._strptime_time('10', '%d')
 # Get the new cache object's id.
- second_time_re_id = id(_strptime._TimeRE_cache)
+ second_time_re = _strptime._TimeRE_cache
 # They should not be equal.
- self.assertNotEqual(first_time_re_id, second_time_re_id)
+ self.assertIsNot(first_time_re, second_time_re)
 # Possible test locale is not supported while initial locale is.
 # If this is the case just suppress the exception and fall-through
 # to the reseting to the original locale.
Modified: python/branches/release31-maint/Lib/test/test_tokenize.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_tokenize.py	(original)
+++ python/branches/release31-maint/Lib/test/test_tokenize.py	Fri Nov 13 03:29:35 2009
@@ -531,6 +531,24 @@
 ... break
 ... else: True
 True
+
+Evil tabs
+ >>> dump_tokens("def f():\\n\\tif x\\n \\tpass")
+ ENCODING 'utf-8' (0, 0) (0, 0)
+ NAME 'def' (1, 0) (1, 3)
+ NAME 'f' (1, 4) (1, 5)
+ OP '(' (1, 5) (1, 6)
+ OP ')' (1, 6) (1, 7)
+ OP ':' (1, 7) (1, 8)
+ NEWLINE '\\n' (1, 8) (1, 9)
+ INDENT '\\t' (2, 0) (2, 1)
+ NAME 'if' (2, 1) (2, 3)
+ NAME 'x' (2, 4) (2, 5)
+ NEWLINE '\\n' (2, 5) (2, 6)
+ INDENT ' \\t' (3, 0) (3, 9)
+ NAME 'pass' (3, 9) (3, 13)
+ DEDENT '' (4, 0) (4, 0)
+ DEDENT '' (4, 0) (4, 0)
 """
 
 from test import support
Modified: python/branches/release31-maint/Lib/tokenize.py
==============================================================================
--- python/branches/release31-maint/Lib/tokenize.py	(original)
+++ python/branches/release31-maint/Lib/tokenize.py	Fri Nov 13 03:29:35 2009
@@ -23,15 +23,15 @@
 __credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
 'Skip Montanaro, Raymond Hettinger, Trent Nelson, '
 'Michael Foord')
-
 import re, string, sys
 from token import *
 from codecs import lookup, BOM_UTF8
 cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
 
 import token
-__all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize",
- "detect_encoding", "NL", "untokenize", "ENCODING", "TokenInfo"]
+__all__ = [x for x in dir(token) if not x.startswith("_")]
+__all__.extend(["COMMENT", "tokenize", "detect_encoding", "NL", "untokenize",
+ "ENCODING", "TokenInfo"])
 del token
 
 COMMENT = N_TOKENS
@@ -407,7 +407,7 @@
 
 if encoding is not None:
 line = line.decode(encoding)
- lnum = lnum + 1
+ lnum += 1
 pos, max = 0, len(line)
 
 if contstr: # continued string
@@ -435,12 +435,17 @@
 if not line: break
 column = 0
 while pos < max: # measure leading whitespace
- if line[pos] == ' ': column = column + 1
- elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize
- elif line[pos] == '\f': column = 0
- else: break
- pos = pos + 1
- if pos == max: break
+ if line[pos] == ' ':
+ column += 1
+ elif line[pos] == '\t':
+ column = (column//tabsize + 1)*tabsize
+ elif line[pos] == '\f':
+ column = 0
+ else:
+ break
+ pos += 1
+ if pos == max:
+ break
 
 if line[pos] in '#\r\n': # skip comments or blank lines
 if line[pos] == '#':
@@ -516,13 +521,15 @@
 elif initial == '\\': # continued stmt
 continued = 1
 else:
- if initial in '([{': parenlev = parenlev + 1
- elif initial in ')]}': parenlev = parenlev - 1
+ if initial in '([{':
+ parenlev += 1
+ elif initial in ')]}':
+ parenlev -= 1
 yield TokenInfo(OP, token, spos, epos, line)
 else:
 yield TokenInfo(ERRORTOKEN, line[pos],
 (lnum, pos), (lnum, pos+1), line)
- pos = pos + 1
+ pos += 1
 
 for indent in indents[1:]: # pop remaining indent levels
 yield TokenInfo(DEDENT, '', (lnum, 0), (lnum, 0), '')
Modified: python/branches/release31-maint/Lib/xml/__init__.py
==============================================================================
--- python/branches/release31-maint/Lib/xml/__init__.py	(original)
+++ python/branches/release31-maint/Lib/xml/__init__.py	Fri Nov 13 03:29:35 2009
@@ -19,12 +19,6 @@
 
 __all__ = ["dom", "parsers", "sax", "etree"]
 
-# When being checked-out without options, this has the form
-# "<dollar>Revision: x.y </dollar>"
-# When exported using -kv, it is "x.y".
-__version__ = "$Revision$".split()[-2:][0]
-
-
 _MINIMUM_XMLPLUS_VERSION = (0, 8, 4)
 
 
Modified: python/branches/release31-maint/Misc/Porting
==============================================================================
--- python/branches/release31-maint/Misc/Porting	(original)
+++ python/branches/release31-maint/Misc/Porting	Fri Nov 13 03:29:35 2009
@@ -31,8 +31,7 @@
 it out of the config.c file.
 
 Bang on it until you get a >>> prompt. (You may have to disable the
-importing of "site.py" and "exceptions.py" by passing -X and -S
-options.
+importing of "site.py" by passing the -S options.)
 
 Then bang on it until it executes very simple Python statements.
 
Modified: python/branches/release31-maint/Modules/mathmodule.c
==============================================================================
--- python/branches/release31-maint/Modules/mathmodule.c	(original)
+++ python/branches/release31-maint/Modules/mathmodule.c	Fri Nov 13 03:29:35 2009
@@ -374,7 +374,7 @@
 	 "This is the smallest integral value >= x.");
 
 FUNC2(copysign, copysign,
- "copysign(x,y)\n\nReturn x with the sign of y.")
+ "copysign(x, y)\n\nReturn x with the sign of y.")
 FUNC1(cos, cos, 0,
 "cos(x)\n\nReturn the cosine of x (measured in radians).")
 FUNC1(cosh, cosh, 1,
@@ -406,8 +406,8 @@
 	 "This is the largest integral value <= x.");
 
 FUNC1(log1p, log1p, 1,
- "log1p(x)\n\nReturn the natural logarithm of 1+x (base e).\n\
- The result is computed in a way which is accurate for x near zero.")
+ "log1p(x)\n\nReturn the natural logarithm of 1+x (base e).\n"
+ "The result is computed in a way which is accurate for x near zero.")
 FUNC1(sin, sin, 0,
 "sin(x)\n\nReturn the sine of x (measured in radians).")
 FUNC1(sinh, sinh, 1,
@@ -636,7 +636,7 @@
 #undef NUM_PARTIALS
 
 PyDoc_STRVAR(math_fsum_doc,
-"sum(iterable)\n\n\
+"fsum(iterable)\n\n\
 Return an accurate floating point sum of values in the iterable.\n\
 Assumes IEEE-754 floating point arithmetic.");
 
@@ -812,7 +812,8 @@
 }
 
 PyDoc_STRVAR(math_ldexp_doc,
-"ldexp(x, i) -> x * (2**i)");
+"ldexp(x, i)\n\n\
+Return x * (2**i).");
 
 static PyObject *
 math_modf(PyObject *self, PyObject *arg)
@@ -903,7 +904,8 @@
 }
 
 PyDoc_STRVAR(math_log_doc,
-"log(x[, base]) -> the logarithm of x to the given base.\n\
+"log(x[, base])\n\n\
+Return the logarithm of x to the given base.\n\
 If the base not specified, returns the natural logarithm (base e) of x.");
 
 static PyObject *
@@ -913,7 +915,7 @@
 }
 
 PyDoc_STRVAR(math_log10_doc,
-"log10(x) -> the base 10 logarithm of x.");
+"log10(x)\n\nReturn the base 10 logarithm of x.");
 
 static PyObject *
 math_fmod(PyObject *self, PyObject *args)
@@ -946,7 +948,7 @@
 }
 
 PyDoc_STRVAR(math_fmod_doc,
-"fmod(x,y)\n\nReturn fmod(x, y), according to platform C."
+"fmod(x, y)\n\nReturn fmod(x, y), according to platform C."
 " x % y may differ.");
 
 static PyObject *
@@ -988,7 +990,7 @@
 }
 
 PyDoc_STRVAR(math_hypot_doc,
-"hypot(x,y)\n\nReturn the Euclidean distance, sqrt(x*x + y*y).");
+"hypot(x, y)\n\nReturn the Euclidean distance, sqrt(x*x + y*y).");
 
 /* pow can't use math_2, but needs its own wrapper: the problem is
 that an infinite result can arise either as a result of overflow
@@ -1075,7 +1077,7 @@
 }
 
 PyDoc_STRVAR(math_pow_doc,
-"pow(x,y)\n\nReturn x**y (x to the power of y).");
+"pow(x, y)\n\nReturn x**y (x to the power of y).");
 
 static const double degToRad = Py_MATH_PI / 180.0;
 static const double radToDeg = 180.0 / Py_MATH_PI;
@@ -1090,7 +1092,8 @@
 }
 
 PyDoc_STRVAR(math_degrees_doc,
-"degrees(x) -> converts angle x from radians to degrees");
+"degrees(x)\n\n\
+Convert angle x from radians to degrees.");
 
 static PyObject *
 math_radians(PyObject *self, PyObject *arg)
@@ -1102,7 +1105,8 @@
 }
 
 PyDoc_STRVAR(math_radians_doc,
-"radians(x) -> converts angle x from degrees to radians");
+"radians(x)\n\n\
+Convert angle x from degrees to radians.");
 
 static PyObject *
 math_isnan(PyObject *self, PyObject *arg)
@@ -1114,8 +1118,8 @@
 }
 
 PyDoc_STRVAR(math_isnan_doc,
-"isnan(x) -> bool\n\
-Checks if float x is not a number (NaN)");
+"isnan(x) -> bool\n\n\
+Check if float x is not a number (NaN).");
 
 static PyObject *
 math_isinf(PyObject *self, PyObject *arg)
@@ -1127,8 +1131,8 @@
 }
 
 PyDoc_STRVAR(math_isinf_doc,
-"isinf(x) -> bool\n\
-Checks if float x is infinite (positive or negative)");
+"isinf(x) -> bool\n\n\
+Check if float x is infinite (positive or negative).");
 
 static PyMethodDef math_methods[] = {
 	{"acos",	math_acos,	METH_O,		math_acos_doc},
Modified: python/branches/release31-maint/Modules/operator.c
==============================================================================
--- python/branches/release31-maint/Modules/operator.c	(original)
+++ python/branches/release31-maint/Modules/operator.c	Fri Nov 13 03:29:35 2009
@@ -7,7 +7,7 @@
 This module exports a set of functions implemented in C corresponding\n\
 to the intrinsic operators of Python. For example, operator.add(x, y)\n\
 is equivalent to the expression x+y. The function names are those\n\
-used for special class methods; variants without leading and trailing\n\
+used for special methods; variants without leading and trailing\n\
 '__' are also provided for convenience.");
 
 #define spam1(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a1) { \
@@ -197,21 +197,21 @@
 spam2(and_,__and__, "and_(a, b) -- Same as a & b.")
 spam2(xor,__xor__, "xor(a, b) -- Same as a ^ b.")
 spam2(or_,__or__, "or_(a, b) -- Same as a | b.")
-spam2(iadd,__iadd__, "iadd(a, b) -- Same as a += b.")
-spam2(isub,__isub__, "isub(a, b) -- Same as a -= b.")
-spam2(imul,__imul__, "imul(a, b) -- Same as a *= b.")
-spam2(ifloordiv,__ifloordiv__, "ifloordiv(a, b) -- Same as a //= b.")
-spam2(itruediv,__itruediv__, "itruediv(a, b) -- Same as a /= b.")
-spam2(imod,__imod__, "imod(a, b) -- Same as a %= b.")
-spam2(ilshift,__ilshift__, "ilshift(a, b) -- Same as a <<= b.")
-spam2(irshift,__irshift__, "irshift(a, b) -- Same as a >>= b.")
-spam2(iand,__iand__, "iand(a, b) -- Same as a &= b.")
-spam2(ixor,__ixor__, "ixor(a, b) -- Same as a ^= b.")
-spam2(ior,__ior__, "ior(a, b) -- Same as a |= b.")
+spam2(iadd,__iadd__, "a = iadd(a, b) -- Same as a += b.")
+spam2(isub,__isub__, "a = isub(a, b) -- Same as a -= b.")
+spam2(imul,__imul__, "a = imul(a, b) -- Same as a *= b.")
+spam2(ifloordiv,__ifloordiv__, "a = ifloordiv(a, b) -- Same as a //= b.")
+spam2(itruediv,__itruediv__, "a = itruediv(a, b) -- Same as a /= b")
+spam2(imod,__imod__, "a = imod(a, b) -- Same as a %= b.")
+spam2(ilshift,__ilshift__, "a = ilshift(a, b) -- Same as a <<= b.")
+spam2(irshift,__irshift__, "a = irshift(a, b) -- Same as a >>= b.")
+spam2(iand,__iand__, "a = iand(a, b) -- Same as a &= b.")
+spam2(ixor,__ixor__, "a = ixor(a, b) -- Same as a ^= b.")
+spam2(ior,__ior__, "a = ior(a, b) -- Same as a |= b.")
 spam2(concat,__concat__,
 "concat(a, b) -- Same as a + b, for a and b sequences.")
 spam2(iconcat,__iconcat__,
- "iconcat(a, b) -- Same as a += b, for a and b sequences.")
+ "a = iconcat(a, b) -- Same as a += b, for a and b sequences.")
 spam2(getitem,__getitem__,
 "getitem(a, b) -- Same as a[b].")
 spam2(setitem,__setitem__,
@@ -219,7 +219,7 @@
 spam2(delitem,__delitem__,
 "delitem(a, b) -- Same as del a[b].")
 spam2(pow,__pow__, "pow(a, b) -- Same as a ** b.")
-spam2(ipow,__ipow__, "ipow(a, b) -- Same as a **= b.")
+spam2(ipow,__ipow__, "a = ipow(a, b) -- Same as a **= b.")
 spam2(lt,__lt__, "lt(a, b) -- Same as a<b.")
 spam2(le,__le__, "le(a, b) -- Same as a<=b.")
 spam2(eq,__eq__, "eq(a, b) -- Same as a==b.")
Modified: python/branches/release31-maint/Objects/descrobject.c
==============================================================================
--- python/branches/release31-maint/Objects/descrobject.c	(original)
+++ python/branches/release31-maint/Objects/descrobject.c	Fri Nov 13 03:29:35 2009
@@ -1293,26 +1293,29 @@
 	/* if no docstring given and the getter has one, use that one */
 	if ((doc == NULL || doc == Py_None) && get != NULL) {
 		PyObject *get_doc = PyObject_GetAttrString(get, "__doc__");
-		if (get_doc != NULL) {
-			/* get_doc already INCREF'd by GetAttr */
-			if (Py_TYPE(self)==&PyProperty_Type) {
+		if (get_doc) {
+			if (Py_TYPE(self) == &PyProperty_Type) {
 				Py_XDECREF(prop->prop_doc);
 				prop->prop_doc = get_doc;
-			} else {
-				/* Put __doc__ in dict of the subclass instance instead,
-				otherwise it gets shadowed by class's __doc__. */
-				if (PyObject_SetAttrString(self, "__doc__", get_doc) != 0)
-				{
-					/* DECREF for props handled by _dealloc */
-					Py_DECREF(get_doc);
+			}
+			else {
+				/* If this is a property subclass, put __doc__
+				in dict of the subclass instance instead,
+				otherwise it gets shadowed by __doc__ in the
+				class's dict. */
+				int err = PyObject_SetAttrString(self, "__doc__", get_doc);
+				Py_DECREF(get_doc);
+				if (err < 0)
 					return -1;
-	 }
- Py_DECREF(get_doc);
 			}
 			prop->getter_doc = 1;
-		} else {
+		}
+		else if (PyErr_ExceptionMatches(PyExc_Exception)) {
 			PyErr_Clear();
 		}
+		else {
+			return -1;
+		}
 	}
 
 	return 0;
Modified: python/branches/release31-maint/Objects/listobject.c
==============================================================================
--- python/branches/release31-maint/Objects/listobject.c	(original)
+++ python/branches/release31-maint/Objects/listobject.c	Fri Nov 13 03:29:35 2009
@@ -183,9 +183,12 @@
 		return NULL;
 	}
 	if (i < 0 || i >= Py_SIZE(op)) {
-		if (indexerr == NULL)
+		if (indexerr == NULL) {
 			indexerr = PyUnicode_FromString(
 				"list index out of range");
+			if (indexerr == NULL)
+				return NULL;
+		}
 		PyErr_SetObject(PyExc_IndexError, indexerr);
 		return NULL;
 	}
@@ -406,9 +409,12 @@
 list_item(PyListObject *a, Py_ssize_t i)
 {
 	if (i < 0 || i >= Py_SIZE(a)) {
-		if (indexerr == NULL)
+		if (indexerr == NULL) {
 			indexerr = PyUnicode_FromString(
 				"list index out of range");
+			if (indexerr == NULL)
+				return NULL;
+		}
 		PyErr_SetObject(PyExc_IndexError, indexerr);
 		return NULL;
 	}
Modified: python/branches/release31-maint/Objects/moduleobject.c
==============================================================================
--- python/branches/release31-maint/Objects/moduleobject.c	(original)
+++ python/branches/release31-maint/Objects/moduleobject.c	Fri Nov 13 03:29:35 2009
@@ -312,7 +312,10 @@
 	if (m->md_def && m->md_def->m_free)
 		m->md_def->m_free(m);
 	if (m->md_dict != NULL) {
-		_PyModule_Clear((PyObject *)m);
+		/* If we are the only ones holding a reference, we can clear
+		 the dictionary. */
+		if (Py_REFCNT(m->md_dict) == 1)
+			_PyModule_Clear((PyObject *)m);
 		Py_DECREF(m->md_dict);
 	}
 	if (m->md_state != NULL)
Modified: python/branches/release31-maint/Parser/tokenizer.c
==============================================================================
--- python/branches/release31-maint/Parser/tokenizer.c	(original)
+++ python/branches/release31-maint/Parser/tokenizer.c	Fri Nov 13 03:29:35 2009
@@ -195,20 +195,26 @@
 	int i;
 	for (i = 0; i < 12; i++) {
 		int c = s[i];
-		if (c == '0円') break;
-		else if (c == '_') buf[i] = '-';
-		else buf[i] = tolower(c);
+		if (c == '0円')
+			break;
+		else if (c == '_')
+			buf[i] = '-';
+		else
+			buf[i] = tolower(c);
 	}
 	buf[i] = '0円';
 	if (strcmp(buf, "utf-8") == 0 ||
-	 strncmp(buf, "utf-8-", 6) == 0) return "utf-8";
+	 strncmp(buf, "utf-8-", 6) == 0)
+		return "utf-8";
 	else if (strcmp(buf, "latin-1") == 0 ||
 		 strcmp(buf, "iso-8859-1") == 0 ||
 		 strcmp(buf, "iso-latin-1") == 0 ||
 		 strncmp(buf, "latin-1-", 8) == 0 ||
 		 strncmp(buf, "iso-8859-1-", 11) == 0 ||
-		 strncmp(buf, "iso-latin-1-", 12) == 0) return "iso-8859-1";
-	else return s;
+		 strncmp(buf, "iso-latin-1-", 12) == 0)
+		return "iso-8859-1";
+	else
+		return s;
 }
 
 /* Return the coding spec in S, or NULL if none is found. */
@@ -334,12 +340,18 @@
 	/* Disable support for UTF-16 BOMs until a decision
 	 is made whether this needs to be supported. */
 	} else if (ch == 0xFE) {
-		ch = get_char(tok); if (ch != 0xFF) goto NON_BOM;
-		if (!set_readline(tok, "utf-16-be")) return 0;
+		ch = get_char(tok);
+		if (ch != 0xFF)
+			goto NON_BOM;
+		if (!set_readline(tok, "utf-16-be"))
+			return 0;
 		tok->decoding_state = STATE_NORMAL;
 	} else if (ch == 0xFF) {
-		ch = get_char(tok); if (ch != 0xFE) goto NON_BOM;
-		if (!set_readline(tok, "utf-16-le")) return 0;
+		ch = get_char(tok);
+		if (ch != 0xFE)
+			goto NON_BOM;
+		if (!set_readline(tok, "utf-16-le"))
+			return 0;
 		tok->decoding_state = STATE_NORMAL;
 #endif
 	} else {
@@ -980,7 +992,7 @@
 {
 	if (c != EOF) {
 		if (--tok->cur < tok->buf)
-			Py_FatalError("tok_backup: begin of buffer");
+			Py_FatalError("tok_backup: beginning of buffer");
 		if (*tok->cur != c)
 			*tok->cur = c;
 	}


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /