merge 2.7.4 release branch
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 73f6fe6..fd4fe23 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -252,6 +252,8 @@
.. % because not all compilers support the %z width modifier -- we fake it
.. % when necessary via interpolating PY_FORMAT_SIZE_T.
+ .. tabularcolumns:: |l|l|L|
+
+-------------------+---------------------+--------------------------------+
| Format Characters | Type | Comment |
+===================+=====================+================================+
diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst
index b37e02c..f34a8ea 100644
--- a/Doc/distutils/apiref.rst
+++ b/Doc/distutils/apiref.rst
@@ -26,6 +26,8 @@
The setup function takes a large number of arguments. These are laid out in the
following table.
+ .. tabularcolumns:: |l|L|L|
+
+--------------------+--------------------------------+-------------------------------------------------------------+
| argument name | value | type |
+====================+================================+=============================================================+
@@ -125,6 +127,8 @@
*stop_after* tells :func:`setup` when to stop processing; possible values:
+ .. tabularcolumns:: |l|L|
+
+---------------+---------------------------------------------+
| value | description |
+===============+=============================================+
@@ -165,6 +169,8 @@
The Extension class describes a single C or C++extension module in a setup
script. It accepts the following keyword arguments in its constructor
+ .. tabularcolumns:: |l|L|l|
+
+------------------------+--------------------------------+---------------------------+
| argument name | value | type |
+========================+================================+===========================+
@@ -1556,6 +1562,8 @@
The options are all boolean, and affect the values returned by :meth:`readline`
+ .. tabularcolumns:: |l|L|l|
+
+------------------+--------------------------------+---------+
| option name | description | default |
+==================+================================+=========+
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index b79d716..4f3cabf 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -2,7 +2,9 @@
Extending/Embedding FAQ
=======================
-.. contents::
+.. only:: html
+
+ .. contents::
.. highlight:: c
diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst
index df43196..8cd139c 100644
--- a/Doc/faq/general.rst
+++ b/Doc/faq/general.rst
@@ -4,7 +4,10 @@
General Python FAQ
==================
-.. contents::
+.. only:: html
+
+ .. contents::
+
General Information
===================
diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst
index 50a30b0..bb54420 100644
--- a/Doc/faq/gui.rst
+++ b/Doc/faq/gui.rst
@@ -4,7 +4,9 @@
Graphic User Interface FAQ
==========================
-.. contents::
+.. only:: html
+
+ .. contents::
What platform-independent GUI toolkits exist for Python?
========================================================
diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst
index 7b340b2..295ff3b 100644
--- a/Doc/faq/library.rst
+++ b/Doc/faq/library.rst
@@ -4,7 +4,9 @@
Library and Extension FAQ
=========================
-.. contents::
+.. only:: html
+
+ .. contents::
General Library Questions
=========================
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index f7ea25a..2352db8 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -4,7 +4,9 @@
Programming FAQ
===============
-.. contents::
+.. only:: html
+
+ .. contents::
General Questions
=================
diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst
index 0abe2e9..7cc6033 100644
--- a/Doc/faq/windows.rst
+++ b/Doc/faq/windows.rst
@@ -6,7 +6,9 @@
Python on Windows FAQ
=====================
-.. contents::
+.. only:: html
+
+ .. contents::
How do I run a Python program under Windows?
--------------------------------------------
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index 0682031..422bf62 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -773,7 +773,7 @@
u'ASCII section\ufeffUnicode section'
- The Unicode code point ``u'\feff```, when encoded using UTF-8, will be
+ The Unicode code point ``u'\ufeff'``, when encoded using UTF-8, will be
encoded as a UTF-8 BOM -- the byte-string ``'\xef\xbb\xbf'``.
#. Replace the ASCII section with whatever placeholders you like, but make sure
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst
index 8a55b6a..f6e7153 100644
--- a/Doc/howto/logging.rst
+++ b/Doc/howto/logging.rst
@@ -63,6 +63,8 @@
they are used to track. The standard levels and their applicability are
described below (in increasing order of severity):
+.. tabularcolumns:: |l|L|
+
+--------------+---------------------------------------------+
| Level | When it's used |
+==============+=============================================+
diff --git a/Doc/install/index.rst b/Doc/install/index.rst
index d3e8bab..8b51b97 100644
--- a/Doc/install/index.rst
+++ b/Doc/install/index.rst
@@ -235,6 +235,8 @@
Unix-based), it also depends on whether the module distribution being installed
is pure Python or contains extensions ("non-pure"):
+.. tabularcolumns:: |l|l|l|l|
+
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
| Platform | Standard installation location | Default value | Notes |
+=================+=====================================================+==================================================+=======+
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index 62bb504..ce850f6 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -320,6 +320,8 @@
providing the *errors* string argument. The following string values are defined
and implemented by all standard Python codecs:
+.. tabularcolumns:: |l|L|
+
+-------------------------+-----------------------------------------------+
| Value | Meaning |
+=========================+===============================================+
@@ -887,6 +889,8 @@
* an IBM PC code page, which is ASCII compatible
+.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+
+-----------------+--------------------------------+--------------------------------+
| Codec | Aliases | Languages |
+=================+================================+================================+
@@ -1103,6 +1107,8 @@
byte string. The result of the "decoding" direction is listed as operand type in
the table.
+.. tabularcolumns:: |l|p{0.3\linewidth}|l|p{0.3\linewidth}|
+
+--------------------+---------------------------+----------------+---------------------------+
| Codec | Aliases | Operand type | Purpose |
+====================+===========================+================+===========================+
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index a3c6bb0..6e1a9c3 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -125,7 +125,8 @@
default=None, sort_keys=False, **kw)
Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting
- :term:`file-like object`).
+ :term:`file-like object`) using this :ref:`conversion table
+ <py-to-json-table>`.
If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not
of a basic type (:class:`str`, :class:`unicode`, :class:`int`, :class:`long`,
@@ -188,9 +189,10 @@
indent=None, separators=None, encoding="utf-8", \
default=None, sort_keys=False, **kw)
- Serialize *obj* to a JSON formatted :class:`str`. If *ensure_ascii* is
- ``False``, the result may contain non-ASCII characters and the return value
- may be a :class:`unicode` instance.
+ Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion
+ table <py-to-json-table>`. If *ensure_ascii* is ``False``, the result may
+ contain non-ASCII characters and the return value may be a :class:`unicode`
+ instance.
The arguments have the same meaning as in :func:`dump`.
@@ -206,7 +208,8 @@
.. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]])
Deserialize *fp* (a ``.read()``-supporting :term:`file-like object`
- containing a JSON document) to a Python object.
+ containing a JSON document) to a Python object using this :ref:`conversion
+ table <json-to-py-table>`.
If the contents of *fp* are encoded with an ASCII based encoding other than
UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified.
@@ -257,7 +260,8 @@
.. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]])
Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON
- document) to a Python object.
+ document) to a Python object using this :ref:`conversion table
+ <json-to-py-table>`.
If *s* is a :class:`str` instance and is encoded with an ASCII based encoding
other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
@@ -276,6 +280,8 @@
Performs the following translations in decoding by default:
+ .. _json-to-py-table:
+
+---------------+-------------------+
| JSON | Python |
+===============+===================+
@@ -364,6 +370,8 @@
Supports the following objects and types by default:
+ .. _py-to-json-table:
+
+-------------------+---------------+
| Python | JSON |
+===================+===============+
diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst
index d446d72..5590514 100644
--- a/Doc/library/locale.rst
+++ b/Doc/library/locale.rst
@@ -59,6 +59,8 @@
Returns the database of the local conventions as a dictionary. This dictionary
has the following strings as keys:
+ .. tabularcolumns:: |l|l|L|
+
+----------------------+-------------------------------------+--------------------------------+
| Category | Key | Meaning |
+======================+=====================================+================================+
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 524a7e8..a2d9033 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -893,6 +893,8 @@
The following keyword arguments are supported.
+ .. tabularcolumns:: |l|L|
+
+--------------+---------------------------------------------+
| Format | Description |
+==============+=============================================+
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 7e8fb26..d6ac364 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -72,7 +72,7 @@
tuple, and the fields depend on the address type. The general tuple form is
``(addr_type, v1, v2, v3 [, scope])``, where:
- - *addr_type* is one of :const;`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`,
+ - *addr_type* is one of :const:`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`,
or :const:`TIPC_ADDR_ID`.
- *scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`,
and :const:`TIPC_NODE_SCOPE`.
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index b7ed587..d29fbec 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -145,6 +145,8 @@
.. versionadded:: 2.7
+ ..
+
.. warning::
Invoking the system shell with ``shell=True`` can be a security hazard
@@ -225,7 +227,7 @@
When *stdout* or *stderr* are pipes and *universal_newlines* is
``True`` then all line endings will be converted to ``'\n'`` as described
- for the :term:`universal newlines` `'U'`` mode argument to :func:`open`.
+ for the :term:`universal newlines` ``'U'`` mode argument to :func:`open`.
If *shell* is ``True``, the specified command will be executed through
the shell. This can be useful if you are using Python primarily for the
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 989e7f4..6f8b8bb 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -302,6 +302,8 @@
5.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of
floating types', for details.
+ .. tabularcolumns:: |l|l|L|
+
+---------------------+----------------+--------------------------------------------------+
| attribute | float.h macro | explanation |
+=====================+================+==================================================+
@@ -599,6 +601,8 @@
A struct sequence that holds information about Python's
internal representation of integers. The attributes are read only.
+ .. tabularcolumns:: |l|L|
+
+-------------------------+----------------------------------------------+
| Attribute | Explanation |
+=========================+==============================================+
@@ -774,7 +778,7 @@
independent Python files are installed; by default, this is the string
``'/usr/local'``. This can be set at build time with the ``--prefix``
argument to the :program:`configure` script. The main collection of Python
- library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}``
+ library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}`
while the platform independent header files (all except :file:`pyconfig.h`) are
stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
number of Python, for example ``2.7``.
diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst
index e05305a..c9bdfea 100644
--- a/Doc/library/turtle.rst
+++ b/Doc/library/turtle.rst
@@ -2173,9 +2173,11 @@
The demoscripts are:
+.. tabularcolumns:: |l|L|L|
+
+----------------+------------------------------+-----------------------+
| Name | Description | Features |
-+----------------+------------------------------+-----------------------+
++================+==============================+=======================+
| bytedesign | complex classical | :func:`tracer`, delay,|
| | turtlegraphics pattern | :func:`update` |
+----------------+------------------------------+-----------------------+
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index c3170c0..abdef98 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -638,7 +638,7 @@
def skipUnlessHasattr(obj, attr):
if hasattr(obj, attr):
return lambda func: func
- return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr))
+ return unittest.skip("{!r} doesn't have {!r}".format(obj, attr))
The following decorators implement test skipping and expected failures:
@@ -660,6 +660,13 @@
Mark the test as an expected failure. If the test fails when run, the test
is not counted as a failure.
+.. exception:: SkipTest(reason)
+
+ This exception is raised to skip a test.
+
+ Usually you can use :meth:`TestCase.skipTest` or one of the skipping
+ decorators instead of raising this directly.
+
Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them.
Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run.
@@ -1956,7 +1963,7 @@
If an exception is raised during a ``setUpClass`` then the tests in the class
are not run and the ``tearDownClass`` is not run. Skipped classes will not
have ``setUpClass`` or ``tearDownClass`` run. If the exception is a
-``SkipTest`` exception then the class will be reported as having been skipped
+:exc:`SkipTest` exception then the class will be reported as having been skipped
instead of as an error.
@@ -1973,7 +1980,7 @@
If an exception is raised in a ``setUpModule`` then none of the tests in the
module will be run and the ``tearDownModule`` will not be run. If the exception is a
-``SkipTest`` exception then the module will be reported as having been skipped
+:exc:`SkipTest` exception then the module will be reported as having been skipped
instead of as an error.
diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst
index 0545dbe..27658d6 100644
--- a/Doc/library/warnings.rst
+++ b/Doc/library/warnings.rst
@@ -57,6 +57,8 @@
This categorization is useful to be able to filter out groups of warnings. The
following warnings category classes are currently defined:
+.. tabularcolumns:: |l|p{0.6\linewidth}|
+
+----------------------------------+-----------------------------------------------+
| Class | Description |
+==================================+===============================================+
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
index 5954735..e6ea004 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -312,6 +312,8 @@
Supported XPath syntax
^^^^^^^^^^^^^^^^^^^^^^
+.. tabularcolumns:: |l|L|
+
+-----------------------+------------------------------------------------------+
| Syntax | Meaning |
+=======================+======================================================+
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index d76dc92..79114c1 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -481,6 +481,8 @@
Special attributes:
+ .. tabularcolumns:: |l|L|l|
+
+-----------------------+-------------------------------+-----------+
| Attribute | Meaning | |
+=======================+===============================+===========+
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 812fb70..a11ee6e 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1370,7 +1370,7 @@
| :keyword:`not` ``x`` | Boolean NOT |
+-----------------------------------------------+-------------------------------------+
| :keyword:`in`, :keyword:`not in`, | Comparisons, including membership |
-| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, |
+| :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests |
| ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` | |
+-----------------------------------------------+-------------------------------------+
| ``|`` | Bitwise OR |
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index 843ce17..d8cfd5c 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -737,7 +737,7 @@
stored in :data:`sys.path_importer_cache` to signify that an implicit,
file-based finder that handles modules stored as individual files should be
used for that path. If the path does not exist then a finder which always
-returns `None`` is placed in the cache for the path.
+returns ``None`` is placed in the cache for the path.
.. index::
single: loader
diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv
index 3785e96..62ea376 100644
--- a/Doc/tools/sphinxext/susp-ignored.csv
+++ b/Doc/tools/sphinxext/susp-ignored.csv
@@ -1,9 +1,6 @@
c-api/arg,,:ref,"PyArg_ParseTuple(args, ""O|O:ref"", &object, &callback)"
c-api/list,,:high,list[low:high]
-c-api/list,,:high,list[low:high] = itemlist
c-api/sequence,,:i2,o[i1:i2]
-c-api/sequence,,:i2,o[i1:i2] = v
-c-api/sequence,,:i2,del o[i1:i2]
c-api/unicode,,:end,str[start:end]
distutils/setupscript,,::,
extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))"
@@ -11,7 +8,6 @@
extending/extending,,:myfunction,"PyArg_ParseTuple(args, ""D:myfunction"", &c);"
extending/newtypes,,:call,"if (!PyArg_ParseTuple(args, ""sss:call"", &arg1, &arg2, &arg3)) {"
extending/windows,,:initspam,/export:initspam
-howto/cporting,,:add,"if (!PyArg_ParseTuple(args, ""ii:add_ints"", &one, &two))"
howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))"
howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))"
howto/curses,,:black,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
@@ -22,11 +18,32 @@
howto/curses,,:red,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
howto/curses,,:white,"7:white."
howto/curses,,:yellow,"They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and"
+howto/logging,,:root,WARNING:root:Watch out!
+howto/logging,,:Watch,WARNING:root:Watch out!
+howto/logging,,:root,DEBUG:root:This message should go to the log file
+howto/logging,,:root,INFO:root:So should this
+howto/logging,,:So,INFO:root:So should this
+howto/logging,,:root,"WARNING:root:And this, too"
+howto/logging,,:And,"WARNING:root:And this, too"
+howto/logging,,:root,INFO:root:Started
+howto/logging,,:Started,INFO:root:Started
+howto/logging,,:root,INFO:root:Doing something
+howto/logging,,:Doing,INFO:root:Doing something
+howto/logging,,:root,INFO:root:Finished
+howto/logging,,:Finished,INFO:root:Finished
+howto/logging,,:root,WARNING:root:Look before you leap!
+howto/logging,,:Look,WARNING:root:Look before you leap!
+howto/logging,,:This,DEBUG:This message should appear on the console
+howto/logging,,:So,INFO:So should this
+howto/logging,,:And,"WARNING:And this, too"
+howto/logging,,:logger,severity:logger name:message
+howto/logging,,:message,severity:logger name:message
+howto/logging,,:This,DEBUG:root:This message should go to the log file
howto/regex,,::,
howto/regex,,:foo,(?:foo)
howto/urllib2,,:example,"for example ""joe@password:example.com"""
-howto/webservers,,.. image:,.. image:: http.png
library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],"
+library/cookie,,`,!#$%&'*+-.^_`|~
library/datetime,,:MM,
library/datetime,,:SS,
library/decimal,,:optional,"trailneg:optional trailing minus indicator"
@@ -40,22 +57,18 @@
library/doctest,,`,``factorial`` from the ``example`` module:
library/doctest,,`,The ``example`` module
library/doctest,,`,Using ``factorial``
+library/exceptions,,:err,err.object[err.start:err.end]
library/functions,,:step,a[start:stop:step]
library/functions,,:stop,"a[start:stop, i]"
library/functions,,:stop,a[start:stop:step]
library/hotshot,,:lineno,"ncalls tottime percall cumtime percall filename:lineno(function)"
library/httplib,,:port,host:port
-library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
-library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS +HHMM"""
+library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS"
+library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS"
library/itertools,,:stop,elements from seq[start:stop:step]
library/itertools,,:step,elements from seq[start:stop:step]
library/linecache,,:sys,"sys:x:3:3:sys:/dev:/bin/sh"
-library/logging,,:And,
-library/logging,,:package1,
-library/logging,,:package2,
-library/logging,,:root,
-library/logging,,:This,
-library/logging,,:port,host:port
+library/logging.handlers,,:port,host:port
library/mmap,,:i2,obj[i1:i2]
library/multiprocessing,,:queue,">>> QueueManager.register('get_queue', callable=lambda:queue)"
library/multiprocessing,,`,">>> l._callmethod('__getitem__', (20,)) # equiv to `l[20]`"
@@ -65,31 +78,25 @@
library/multiprocessing,,`,# A test file for the `multiprocessing` package
library/multiprocessing,,`,# A test of `multiprocessing.Pool` class
library/multiprocessing,,`,# Add more tasks using `put()`
-library/multiprocessing,,`,# create server for a `HostManager` object
-library/multiprocessing,,`,# Depends on `multiprocessing` package -- tested with `processing-0.60`
library/multiprocessing,,`,# in the original order then consider using `Pool.map()` or
library/multiprocessing,,`,# Not sure if we should synchronize access to `socket.accept()` method by
library/multiprocessing,,`,# object. (We import `multiprocessing.reduction` to enable this pickling.)
library/multiprocessing,,`,# register the Foo class; make `f()` and `g()` accessible via proxy
library/multiprocessing,,`,# register the Foo class; make `g()` and `_h()` accessible via proxy
library/multiprocessing,,`,# register the generator function baz; use `GeneratorProxy` to make proxies
-library/multiprocessing,,`,`Cluster` is a subclass of `SyncManager` so it allows creation of
-library/multiprocessing,,`,`hostname` gives the name of the host. If hostname is not
-library/multiprocessing,,`,`slots` is used to specify the number of slots for processes on
library/optparse,,:len,"del parser.rargs[:len(value)]"
library/os.path,,:foo,c:foo
-library/parser,,`,"""Make a function that raises an argument to the exponent `exp`."""
+library/pdb,,:lineno,filename:lineno
library/posix,,`,"CFLAGS=""`getconf LFS_CFLAGS`"" OPT=""-g -O2 $CFLAGS"""
library/profile,,:lineno,ncalls tottime percall cumtime percall filename:lineno(function)
library/profile,,:lineno,filename:lineno(function)
library/pyexpat,,:elem1,<py:elem1 />
library/pyexpat,,:py,"xmlns:py = ""http://www.python.org/ns/"">"
-library/repr,,`,"return `obj`"
library/smtplib,,:port,"as well as a regular host:port server."
library/socket,,::,'5aef:2b::8'
library/sqlite3,,:memory,
-library/sqlite3,,:age,"select name_last, age from people where name_last=:who and age=:age"
-library/sqlite3,,:who,"select name_last, age from people where name_last=:who and age=:age"
+library/sqlite3,,:who,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
+library/sqlite3,,:age,"cur.execute(""select * from people where name_last=:who and age=:age"", {""who"": who, ""age"": age})"
library/ssl,,:My,"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc."
library/ssl,,:My,"Organizational Unit Name (eg, section) []:My Group"
library/ssl,,:myserver,"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com"
@@ -98,8 +105,6 @@
library/ssl,,:Some,"Locality Name (eg, city) []:Some City"
library/ssl,,:US,Country Name (2 letter code) [AU]:US
library/stdtypes,,:len,s[len(s):len(s)]
-library/stdtypes,,:len,s[len(s):len(s)]
-library/string,,:end,s[start:end]
library/string,,:end,s[start:end]
library/subprocess,,`,"output=`mycmd myarg`"
library/subprocess,,`,"output=`dmesg | grep hda`"
@@ -121,11 +126,8 @@
reference/datamodel,,:step,a[i:j:step]
reference/datamodel,,:max,
reference/expressions,,:index,x[index:index]
-reference/expressions,,:datum,{key:datum...}
reference/expressions,,`,`expressions...`
-reference/grammar,,:output,#diagram:output
-reference/grammar,,:rules,#diagram:rules
-reference/grammar,,:token,#diagram:token
+reference/expressions,,`,"""`"""
reference/grammar,,`,'`' testlist1 '`'
reference/lexical_analysis,,:fileencoding,# vim:fileencoding=<encoding-name>
reference/lexical_analysis,,`,", : . ` = ;"
@@ -148,8 +150,6 @@
using/cmdline,,:message,action:message:category:module:line
using/cmdline,,:module,action:message:category:module:line
using/cmdline,,:errorhandler,:errorhandler
-using/windows,162,`,`` this fixes syntax highlighting errors in some editors due to the \\\\ hackery
-using/windows,170,`,``
whatsnew/2.0,418,:len,
whatsnew/2.3,,::,
whatsnew/2.3,,:config,
@@ -163,30 +163,18 @@
whatsnew/2.5,,:memory,:memory:
whatsnew/2.5,,:step,[start:stop:step]
whatsnew/2.5,,:stop,[start:stop:step]
-distutils/examples,267,`,This is the description of the ``foobar`` package.
faq/programming,,:reduce,"print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,"
faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,"
faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr("
faq/programming,,::,for x in sequence[::-1]:
-faq/windows,229,:EOF,@setlocal enableextensions & python -x %~f0 %* & goto :EOF
-faq/windows,393,:REG,.py :REG_SZ: c:\<path to python>\python.exe -u %s %s
library/bisect,,:hi,all(val >= x for val in a[i:hi])
library/bisect,,:hi,all(val > x for val in a[i:hi])
-library/http.client,52,:port,host:port
-library/nntplib,,:bytes,:bytes
-library/nntplib,,:lines,:lines
-library/nntplib,,:lines,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']"
-library/nntplib,,:bytes,"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']"
-library/pickle,567,:memory,"conn = sqlite3.connect("":memory:"")"
-library/profile,293,:lineno,"(sort by filename:lineno),"
library/socket,,::,"(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]"
library/stdtypes,,:end,s[start:end]
-library/stdtypes,,:end,s[start:end]
license,,`,* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
license,,`,* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
license,,`,"``Software''), to deal in the Software without restriction, including"
license,,`,"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,"
-reference/lexical_analysis,704,`,$ ? `
whatsnew/2.7,735,:Sunday,'2009:4:Sunday'
whatsnew/2.7,862,::,"export PYTHONWARNINGS=all,error:::Cookie:0"
whatsnew/2.7,862,:Cookie,"export PYTHONWARNINGS=all,error:::Cookie:0"
diff --git a/Doc/tools/sphinxext/suspicious.py b/Doc/tools/sphinxext/suspicious.py
index f15e931b..e397560 100644
--- a/Doc/tools/sphinxext/suspicious.py
+++ b/Doc/tools/sphinxext/suspicious.py
@@ -66,6 +66,10 @@
# None -> don't care
self.issue = issue # the markup fragment that triggered this rule
self.line = line # text of the container element (single line only)
+ self.used = False
+
+ def __repr__(self):
+ return '{0.docname},,{0.issue},{0.line}'.format(self)
@@ -105,6 +109,12 @@
doctree.walk(visitor)
def finish(self):
+ unused_rules = [rule for rule in self.rules if not rule.used]
+ if unused_rules:
+ self.warn('Found %s/%s unused rules:' %
+ (len(unused_rules), len(self.rules)))
+ for rule in unused_rules:
+ self.info(repr(rule))
return
def check_issue(self, line, lineno, issue):
@@ -129,6 +139,7 @@
if (rule.lineno is not None) and \
abs(rule.lineno - lineno) > 5: continue
# if it came this far, the rule matched
+ rule.used = True
return True
return False
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index e7376e4..0438afd 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -74,6 +74,7 @@
@abstractmethod
def next(self):
+ 'Return the next item from the iterator. When exhausted, raise StopIteration'
raise StopIteration
def __iter__(self):
@@ -194,6 +195,7 @@
return self._from_iterable(value for value in other if value in self)
def isdisjoint(self, other):
+ 'Return True if two sets have a null intersection.'
for value in other:
if value in self:
return False
@@ -259,6 +261,16 @@
class MutableSet(Set):
+ """A mutable set is a finite, iterable container.
+
+ This class provides concrete generic implementations of all
+ methods except for __contains__, __iter__, __len__,
+ add(), and discard().
+
+ To override the comparisons (presumably for speed, as the
+ semantics are fixed), all you have to do is redefine __le__ and
+ then the other operations will automatically follow suit.
+ """
@abstractmethod
def add(self, value):
@@ -333,11 +345,20 @@
class Mapping(Sized, Iterable, Container):
+ """A Mapping is a generic container for associating key/value
+ pairs.
+
+ This class provides concrete generic implementations of all
+ methods except for __getitem__, __iter__, and __len__.
+
+ """
+
@abstractmethod
def __getitem__(self, key):
raise KeyError
def get(self, key, default=None):
+ 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.'
try:
return self[key]
except KeyError:
@@ -352,23 +373,29 @@
return True
def iterkeys(self):
+ 'D.iterkeys() -> an iterator over the keys of D'
return iter(self)
def itervalues(self):
+ 'D.itervalues() -> an iterator over the values of D'
for key in self:
yield self[key]
def iteritems(self):
+ 'D.iteritems() -> an iterator over the (key, value) items of D'
for key in self:
yield (key, self[key])
def keys(self):
+ "D.keys() -> list of D's keys"
return list(self)
def items(self):
+ "D.items() -> list of D's (key, value) pairs, as 2-tuples"
return [(key, self[key]) for key in self]
def values(self):
+ "D.values() -> list of D's values"
return [self[key] for key in self]
# Mappings are not hashable by default, but subclasses can change this
@@ -443,6 +470,15 @@
class MutableMapping(Mapping):
+ """A MutableMapping is a generic container for associating
+ key/value pairs.
+
+ This class provides concrete generic implementations of all
+ methods except for __getitem__, __setitem__, __delitem__,
+ __iter__, and __len__.
+
+ """
+
@abstractmethod
def __setitem__(self, key, value):
raise KeyError
@@ -454,6 +490,9 @@
__marker = object()
def pop(self, key, default=__marker):
+ '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+ If key is not found, d is returned if given, otherwise KeyError is raised.
+ '''
try:
value = self[key]
except KeyError:
@@ -465,6 +504,9 @@
return value
def popitem(self):
+ '''D.popitem() -> (k, v), remove and return some (key, value) pair
+ as a 2-tuple; but raise KeyError if D is empty.
+ '''
try:
key = next(iter(self))
except StopIteration:
@@ -474,6 +516,7 @@
return key, value
def clear(self):
+ 'D.clear() -> None. Remove all items from D.'
try:
while True:
self.popitem()
@@ -481,6 +524,11 @@
pass
def update(*args, **kwds):
+ ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
+ If E present and has a .keys() method, does: for k in E: D[k] = E[k]
+ If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
+ In either case, this is followed by: for k, v in F.items(): D[k] = v
+ '''
if len(args) > 2:
raise TypeError("update() takes at most 2 positional "
"arguments ({} given)".format(len(args)))
@@ -502,6 +550,7 @@
self[key] = value
def setdefault(self, key, default=None):
+ 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D'
try:
return self[key]
except KeyError:
@@ -546,12 +595,16 @@
yield self[i]
def index(self, value):
+ '''S.index(value) -> integer -- return first index of value.
+ Raises ValueError if the value is not present.
+ '''
for i, v in enumerate(self):
if v == value:
return i
raise ValueError
def count(self, value):
+ 'S.count(value) -> integer -- return number of occurrences of value'
return sum(1 for v in self if v == value)
Sequence.register(tuple)
@@ -562,6 +615,13 @@
class MutableSequence(Sequence):
+ """All the operations on a read-only sequence.
+
+ Concrete subclasses must provide __new__ or __init__,
+ __getitem__, __setitem__, __delitem__, __len__, and insert().
+
+ """
+
@abstractmethod
def __setitem__(self, index, value):
raise IndexError
@@ -572,26 +632,36 @@
@abstractmethod
def insert(self, index, value):
+ 'S.insert(index, object) -- insert object before index'
raise IndexError
def append(self, value):
+ 'S.append(object) -- append object to the end of the sequence'
self.insert(len(self), value)
def reverse(self):
+ 'S.reverse() -- reverse *IN PLACE*'
n = len(self)
for i in range(n//2):
self[i], self[n-i-1] = self[n-i-1], self[i]
def extend(self, values):
+ 'S.extend(iterable) -- extend sequence by appending elements from the iterable'
for v in values:
self.append(v)
def pop(self, index=-1):
+ '''S.pop([index]) -> item -- remove and return item at index (default last).
+ Raise IndexError if list is empty or index is out of range.
+ '''
v = self[index]
del self[index]
return v
def remove(self, value):
+ '''S.remove(value) -- remove first occurrence of value.
+ Raise ValueError if the value is not present.
+ '''
del self[self.index(value)]
def __iadd__(self, values):
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 66d5186..9e928b2 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -525,7 +525,7 @@
file = getfile(object)
sourcefile = getsourcefile(object)
- if not sourcefile and file[0] + file[-1] != '<>':
+ if not sourcefile and file[:1] + file[-1:] != '<>':
raise IOError('source code not available')
file = sourcefile if sourcefile else file
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 37729d8..e2b0163 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -379,6 +379,12 @@
def __init__(self, config):
self.config = ConvertingDict(config)
self.config.configurator = self
+ # Issue 12718: winpdb replaces __import__ with a Python function, which
+ # ends up being treated as a bound method. To avoid problems, we
+ # set the importer on the instance, but leave it defined in the class
+ # so existing code doesn't break
+ if type(__import__) == types.FunctionType:
+ self.importer = __import__
def resolve(self, s):
"""
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 30b1556..04dcfe9 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -404,6 +404,12 @@
self.assertEqual(inspect.findsource(co), (lines,0))
self.assertEqual(inspect.getsource(co), lines[0])
+ def test_findsource_without_filename(self):
+ for fname in ['', '<string>']:
+ co = compile('x=1', fname, "exec")
+ self.assertRaises(IOError, inspect.findsource, co)
+ self.assertRaises(IOError, inspect.getsource, co)
+
class _BrokenDataDescriptor(object):
"""
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
index f821db6..34a4aef 100644
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -43,6 +43,9 @@
class BlockingTestMixin:
+ def tearDown(self):
+ self.t = None
+
def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args):
self.t = _TriggerThread(trigger_func, trigger_args)
self.t.start()
@@ -222,7 +225,7 @@
raise FailingQueueException, "You Lose"
return Queue.Queue._get(self)
-class FailingQueueTest(unittest.TestCase, BlockingTestMixin):
+class FailingQueueTest(BlockingTestMixin, unittest.TestCase):
def failing_queue_test(self, q):
if not q.empty():
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index ec34375..0802f69 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -489,6 +489,11 @@
def test_bad_address(self):
# Make sure proper exception is raised when connecting to a bogus
# address.
+
+ # as indicated by the comment below, this might fail with some ISP,
+ # so we run the test only when -unetwork/-uall is specified to
+ # mitigate the problem a bit (see #17564)
+ test_support.requires('network')
self.assertRaises(IOError,
# Given that both VeriSign and various ISPs have in
# the past or are presently hijacking various invalid
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index 6257936..b0cb44a 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -26,7 +26,7 @@
"""
Raise this exception in a test to skip it.
- Usually you can use TestResult.skip() or one of the skipping decorators
+ Usually you can use TestCase.skipTest() or one of the skipping decorators
instead of raising this directly.
"""
pass
@@ -150,24 +150,23 @@
should not change the signature of their __init__ method, since instances
of the classes are instantiated automatically by parts of the framework
in order to be run.
- """
- # This attribute determines which exception will be raised when
- # the instance's assertion methods fail; test methods raising this
- # exception will be deemed to have 'failed' rather than 'errored'
+ When subclassing TestCase, you can set these attributes:
+ * failureException: determines which exception will be raised when
+ the instance's assertion methods fail; test methods raising this
+ exception will be deemed to have 'failed' rather than 'errored'.
+ * longMessage: determines whether long messages (including repr of
+ objects used in assert methods) will be printed on failure in *addition*
+ to any explicit message passed.
+ * maxDiff: sets the maximum length of a diff in failure messages
+ by assert methods using difflib. It is looked up as an instance
+ attribute so can be configured by individual tests if required.
+ """
failureException = AssertionError
- # This attribute determines whether long messages (including repr of
- # objects used in assert methods) will be printed on failure in *addition*
- # to any explicit message passed.
-
longMessage = False
- # This attribute sets the maximum length of a diff in failure messages
- # by assert methods using difflib. It is looked up as an instance attribute
- # so can be configured by individual tests if required.
-
maxDiff = 80*8
# If a string is longer than _diffThreshold, use normal comparison instead
diff --git a/Misc/NEWS b/Misc/NEWS
index 4587309..997e085 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1,6 +1,21 @@
Python News
+++++++++++
+What's New in Python 2.7.5?
+===========================
+
+*Release date: XXXX-XX-XX*
+
+Core and Builtins
+-----------------
+
+Library
+-------
+
+- Issue #17526: fix an IndexError raised while passing code without filename to
+ inspect.findsource(). Initial patch by Tyler Doyle.
+
+
What's New in Python 2.7.4?
===========================
@@ -247,6 +262,9 @@
Library
-------
+- Issue #12718: Fix interaction with winpdb overriding __import__ by setting
+ importer attribute on BaseConfigurator instance.
+
- Issue #17521: Corrected non-enabling of logger following two calls to
fileConfig().