]> granicus.if.org Git - python/commitdiff
Merged revisions 83452,83457,83466,83471,83475,83480,83486 via svnmerge from
authorGeorg Brandl <georg@python.org>
Sun, 1 Aug 2010 21:48:47 +0000 (21:48 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 1 Aug 2010 21:48:47 +0000 (21:48 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint

................
  r83452 | georg.brandl | 2010-08-01 23:06:46 +0200 (So, 01 Aug 2010) | 25 lines

  Merged revisions 83226-83227,83229-83230,83232 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83226 | georg.brandl | 2010-07-29 16:17:12 +0200 (Do, 29 Jul 2010) | 1 line

    #1090076: explain the behavior of *vars* in get() better.
  ........
    r83227 | georg.brandl | 2010-07-29 16:23:06 +0200 (Do, 29 Jul 2010) | 1 line

    Use Py_CLEAR().
  ........
    r83229 | georg.brandl | 2010-07-29 16:32:22 +0200 (Do, 29 Jul 2010) | 1 line

    #9407: document configparser.Error.
  ........
    r83230 | georg.brandl | 2010-07-29 16:36:11 +0200 (Do, 29 Jul 2010) | 1 line

    Use correct directive and name.
  ........
    r83232 | georg.brandl | 2010-07-29 16:49:08 +0200 (Do, 29 Jul 2010) | 1 line

    #9388: remove ERA_YEAR which is never defined in the source code.
  ........
................
  r83457 | georg.brandl | 2010-08-01 23:10:57 +0200 (So, 01 Aug 2010) | 9 lines

  Merged revisions 83223 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83223 | georg.brandl | 2010-07-29 15:38:37 +0200 (Do, 29 Jul 2010) | 1 line

    #3874: document HTMLParser.unknown_decl().
  ........
................
  r83466 | georg.brandl | 2010-08-01 23:23:50 +0200 (So, 01 Aug 2010) | 29 lines

  Merged revisions 83160-83161,83166,83168-83169,83171 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83160 | georg.brandl | 2010-07-26 10:51:42 +0200 (Mo, 26 Jul 2010) | 1 line

    #9381: fix markup.
  ........
    r83161 | georg.brandl | 2010-07-26 11:33:12 +0200 (Mo, 26 Jul 2010) | 1 line

    Add Brian Quinlan.
  ........
    r83166 | georg.brandl | 2010-07-26 17:11:49 +0200 (Mo, 26 Jul 2010) | 1 line

    Fix grammar.
  ........
    r83168 | georg.brandl | 2010-07-26 19:00:20 +0200 (Mo, 26 Jul 2010) | 1 line

    Fix indentation in example.
  ........
    r83169 | georg.brandl | 2010-07-26 19:09:32 +0200 (Mo, 26 Jul 2010) | 1 line

    Add Reid.
  ........
    r83171 | georg.brandl | 2010-07-26 23:12:13 +0200 (Mo, 26 Jul 2010) | 1 line

    Clarify.
  ........
................
  r83471 | georg.brandl | 2010-08-01 23:26:45 +0200 (So, 01 Aug 2010) | 9 lines

  Merged revisions 83106 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83106 | georg.brandl | 2010-07-23 18:55:26 +0200 (Fr, 23 Jul 2010) | 1 line

    Fix some markup glitches.
  ........
................
  r83475 | georg.brandl | 2010-08-01 23:28:47 +0200 (So, 01 Aug 2010) | 9 lines

  Merged revisions 82965 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r82965 | georg.brandl | 2010-07-19 13:28:05 +0200 (Mo, 19 Jul 2010) | 1 line

    Clarification.  Yay importlib!
  ........
................
  r83480 | georg.brandl | 2010-08-01 23:33:42 +0200 (So, 01 Aug 2010) | 17 lines

  Merged revisions 82871,82960-82961 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r82871 | georg.brandl | 2010-07-14 10:00:22 +0200 (Mi, 14 Jul 2010) | 1 line

    #9258: fix copy-paste errors.
  ........
    r82960 | georg.brandl | 2010-07-19 08:52:35 +0200 (Mo, 19 Jul 2010) | 1 line

    Clarify.
  ........
    r82961 | georg.brandl | 2010-07-19 08:57:52 +0200 (Mo, 19 Jul 2010) | 1 line

    Clarify :option: description.
  ........
................
  r83486 | georg.brandl | 2010-08-01 23:44:38 +0200 (So, 01 Aug 2010) | 13 lines

  Merged revisions 82832,82834 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r82832 | georg.brandl | 2010-07-12 11:00:29 +0200 (Mo, 12 Jul 2010) | 1 line

    Take care of duplicate target name warnings.
  ........
    r82834 | georg.brandl | 2010-07-12 11:06:13 +0200 (Mo, 12 Jul 2010) | 1 line

    Use raw string literals for regexes containing backlash.
  ........
................

16 files changed:
Doc/documenting/markup.rst
Doc/faq/extending.rst
Doc/install/index.rst
Doc/library/configparser.rst
Doc/library/htmlparser.rst
Doc/library/itertools.rst
Doc/library/locale.rst
Doc/library/re.rst
Doc/library/select.rst
Doc/library/urllib2.rst
Doc/tutorial/classes.rst
Doc/whatsnew/2.0.rst
Doc/whatsnew/2.5.rst
Lib/ConfigParser.py
Misc/developers.txt
Objects/unicodeobject.c

index eec86501d3edc51af714b1d5a5c57d63468e028b..c6f5b7431b58ab830ac6afa4f1de823015ab4463 100644 (file)
@@ -200,8 +200,8 @@ The directives are:
 
 .. describe:: cmdoption
 
-   Describes a command line option or switch.  Option argument names should be
-   enclosed in angle brackets.  Example::
+   Describes a Python command line option or switch.  Option argument names
+   should be enclosed in angle brackets.  Example::
 
       .. cmdoption:: -m <module>
 
@@ -502,8 +502,9 @@ in a different style:
 
 .. describe:: option
 
-   A command-line option to an executable program.  The leading hyphen(s) must
-   be included.
+   A command-line option of Python.  The leading hyphen(s) must be included.
+   If a matching ``cmdoption`` directive exists, it is linked to.  For options
+   of other programs or scripts, use simple ````code```` markup.
 
 .. describe:: program
 
index 5c716fe023ef3f1ec8db9fd21322d43440e17489..be5c51c631e3c55f55178831c94443cb78529352 100644 (file)
@@ -26,6 +26,8 @@ function that is going to be called by the Python interpreter.  Global or static
 C++ objects with constructors are probably not a good idea.
 
 
+.. _c-wrapper-software:
+
 Writing C is hard; are there any alternatives?
 ----------------------------------------------
 
@@ -197,11 +199,7 @@ begin by reading :ref:`the "Extending and Embedding" document
 whole lot of difference between C and C++ -- so the strategy of building a new
 Python type around a C structure (pointer) type will also work for C++ objects.
 
-For C++ libraries, you can look at `SIP
-<http://www.riverbankcomputing.co.uk/software/sip/>`_, `CXX
-<http://cxx.sourceforge.net/>`_, `Boost
-<http://www.boost.org/libs/python/doc/index.html>`_, `Weave
-<http://www.scipy.org/Weave>`_ or `SWIG <http://www.swig.org>`_
+For C++ libraries, see :ref:`c-wrapper-software`.
 
 
 I added a module using the Setup file and the make fails; why?
index 3781ad9e9abb711f4579bdf46777bc330de434c2..a5d2671f5ff330e3e0cc4a4bb6b261b6c403b8a5 100644 (file)
@@ -314,8 +314,8 @@ The idea behind the "home scheme" is that you build and maintain a personal
 stash of Python modules.  This scheme's name is derived from the idea of a
 "home" directory on Unix, since it's not unusual for a Unix user to make their
 home directory have a layout similar to :file:`/usr/` or :file:`/usr/local/`.
-This scheme can be used by anyone, regardless of the operating system their
-installing for.
+This scheme can be used by anyone, regardless of the operating system they
+are installing for.
 
 Installing a new module distribution is as simple as ::
 
index 878685c74816d37b44af86a0735375680ea82cb6..867f0912fdaa2b2a7612371aeaa52b0425211a5b 100644 (file)
@@ -41,6 +41,18 @@ section, or values in a special ``DEFAULT`` section.  Additional defaults can be
 provided on initialization and retrieval.  Lines beginning with ``'#'`` or
 ``';'`` are ignored and may be used to provide comments.
 
+Configuration files may include comments, prefixed by specific characters (``#``
+and ``;``).  Comments may appear on their own in an otherwise empty line, or may
+be entered in lines holding values or spection names.  In the latter case, they
+need to be preceded by a whitespace character to be recognized as a comment.
+(For backwards compatibility, only ``;`` starts an inline comment, while ``#``
+does not.)
+
+On top of the core functionality, :class:`SafeConfigParser` supports
+interpolation.  This means values can contain format strings which refer to
+other values in the same section, or values in a special ``DEFAULT`` section.
+Additional defaults can be provided on initialization.
+
 For example::
 
    [My Section]
@@ -104,6 +116,11 @@ write-back, as will be the keys within each section.
    .. versionadded:: 2.3
 
 
+.. exception:: Error
+
+   Base class for all other configparser exceptions.
+
+
 .. exception:: NoSectionError
 
    Exception raised when a specified section is not found.
@@ -347,11 +364,13 @@ The :class:`ConfigParser` class extends some methods of the
 
 .. method:: ConfigParser.get(section, option[, raw[, vars]])
 
-   Get an *option* value for the named *section*.  All the ``'%'`` interpolations
-   are expanded in the return values, based on the defaults passed into the
-   constructor, as well as the options *vars* provided, unless the *raw* argument
-   is true.
+   Get an *option* value for the named *section*.  If *vars* is provided, it
+   must be a dictionary.  The *option* is looked up in *vars* (if provided),
+   *section*, and in *defaults* in that order.
 
+   All the ``'%'`` interpolations are expanded in the return values, unless the
+   *raw* argument is true.  Values for interpolation keys are looked up in the
+   same manner as the option.
 
 .. method:: ConfigParser.items(section[, raw[, vars]])
 
index a5c185cd736d6c7c1f0c8dd63b1b943e779c328b..7b0ce03a07be8542046c7b6aafa11c6e7cb1271a 100644 (file)
@@ -148,10 +148,18 @@ An exception is defined as well:
 
 .. method:: HTMLParser.handle_decl(decl)
 
-   Method called when an SGML declaration is read by the parser.  The *decl*
-   parameter will be the entire contents of the declaration inside the ``<!``...\
-   ``>`` markup.  It is intended to be overridden by a derived class; the base
-   class implementation does nothing.
+   Method called when an SGML ``doctype`` declaration is read by the parser.
+   The *decl* parameter will be the entire contents of the declaration inside
+   the ``<!...>`` markup.  It is intended to be overridden by a derived class;
+   the base class implementation does nothing.
+
+
+.. method:: HTMLParser.unknown_decl(data)
+
+   Method called when an unrecognized SGML declaration is read by the parser.
+   The *data* parameter will be the entire contents of the declaration inside
+   the ``<!...>`` markup.  It is sometimes useful to be be overridden by a
+   derived class; the base class implementation throws an :exc:`HTMLParseError`.
 
 
 .. method:: HTMLParser.handle_pi(data)
index 7156a23a74b5262c7ef39fbd0b6d8b990d650b80..33630a56e77e4ae922c5e4b10d46f28e019c32cd 100644 (file)
@@ -101,7 +101,7 @@ loops that truncate the stream.
                   yield element
 
 
-.. function:: itertools.chain.from_iterable(iterable)
+.. classmethod:: chain.from_iterable(iterable)
 
    Alternate constructor for :func:`chain`.  Gets chained inputs from a
    single iterable argument that is evaluated lazily.  Equivalent to::
index c8be7afd54765a90010ee7abdbb70325dab32cae..7b4a05f713ac2c6285dc3e57092a1fd223468bce 100644 (file)
@@ -248,10 +248,6 @@ The :mod:`locale` module defines the following exception and functions:
       specified, and therefore you should not assume knowledge of it on different
       systems.
 
-   .. data:: ERA_YEAR
-
-      Get the year in the relevant era of the locale.
-
    .. data:: ERA_D_T_FMT
 
       Get a format string for :func:`strftime` to represent dates and times in a
index d0042d5a7b4be9858cef7d6928c9ea2bf9602444..9821047c66ca17533603734f941fde010325118c 100644 (file)
@@ -1198,9 +1198,9 @@ in each word of a sentence except for the first and last characters::
    ...   random.shuffle(inner_word)
    ...   return m.group(1) + "".join(inner_word) + m.group(3)
    >>> text = "Professor Abdolmalek, please report your absences promptly."
-   >>> re.sub("(\w)(\w+)(\w)", repl, text)
+   >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
    'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'
-   >>> re.sub("(\w)(\w+)(\w)", repl, text)
+   >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
    'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'
 
 
index b599d972d467f35e8a32ad4a7c71b09c92080895..034756ef5e05ab6a3f5b8764df01b19e40bd77c0 100644 (file)
@@ -44,7 +44,7 @@ The module defines the following:
 
 .. function:: kqueue()
 
-   (Only supported on BSD.)  Returns a kernel queue object object; see section
+   (Only supported on BSD.)  Returns a kernel queue object; see section
    :ref:`kqueue-objects` below for the methods supported by kqueue objects.
 
    .. versionadded:: 2.6
@@ -52,8 +52,8 @@ The module defines the following:
 
 .. function:: kevent(ident, filter=KQ_FILTER_READ, flags=KQ_EV_ADD, fflags=0, data=0, udata=0)
 
-   (Only supported on BSD.)  Returns a kernel event object object; see section
-   :ref:`kevent-objects` below for the methods supported by kqueue objects.
+   (Only supported on BSD.)  Returns a kernel event object; see section
+   :ref:`kevent-objects` below for the methods supported by kevent objects.
 
    .. versionadded:: 2.6
 
index 7fcce4f79163ea3ca48a90234e016b92460b0447..b8f22775364e419d5b21f312de3ca3228eb30032 100644 (file)
@@ -464,7 +464,8 @@ sorting the handler instances.
    named :meth:`unknown_open`.
 
    Note that the implementation of these methods may involve calls of the parent
-   :class:`OpenerDirector` instance's :meth:`.open` and :meth:`.error` methods.
+   :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and
+   :meth:`~OpenerDirector.error` methods.
 
 #. Every handler with a method named like :samp:`{protocol}_response` has that
    method called to post-process the response.
index 1488329431ae01a06ba0791f27dc5624030fed2f..3f481b160cc2cd4a087a7926bbab9ec8ff7b8e04 100644 (file)
@@ -693,7 +693,7 @@ This example shows how it all works::
    StopIteration
 
 Having seen the mechanics behind the iterator protocol, it is easy to add
-iterator behavior to your classes.  Define a :meth:`__iter__` method which
+iterator behavior to your classes.  Define an :meth:`__iter__` method which
 returns an object with a :meth:`next` method.  If the class defines
 :meth:`next`, then :meth:`__iter__` can just return ``self``::
 
@@ -710,7 +710,10 @@ returns an object with a :meth:`next` method.  If the class defines
            self.index = self.index - 1
            return self.data[self.index]
 
-   >>> for char in Reverse('spam'):
+   >>> rev = Reverse('spam')
+   >>> iter(rev)
+   <__main__.Reverse object at 0x00A1DB50>
+   >>> for char in rev:
    ...     print char
    ...
    m
index 5fd53d165e302440a5bd5aeb826ea8d7dd6b80e6..3bb12b666c78680a88558bf42ca3430e661a334c 100644 (file)
@@ -656,7 +656,7 @@ break.
 The change which will probably break the most code is tightening up the
 arguments accepted by some methods.  Some methods would take multiple arguments
 and treat them as a tuple, particularly various list methods such as
-:meth:`.append` and :meth:`.insert`. In earlier versions of Python, if ``L`` is
+:meth:`append` and :meth:`insert`. In earlier versions of Python, if ``L`` is
 a list, ``L.append( 1,2 )`` appends the tuple ``(1,2)`` to the list.  In Python
 2.0 this causes a :exc:`TypeError` exception to be raised, with the message:
 'append requires exactly 1 argument; 2 given'.  The fix is to simply add an
index ca87dbb1ee8635c694ababc134b634a503fd0f87..c7f7d586ab50205f424538a0e025f3f8572e293c 100644 (file)
@@ -1765,7 +1765,7 @@ Full documentation for ElementTree is available at
 http://effbot.org/zone/element-index.htm.
 
 ElementTree represents an XML document as a tree of element nodes. The text
-content of the document is stored as the :attr:`.text` and :attr:`.tail`
+content of the document is stored as the :attr:`text` and :attr:`tail`
 attributes of  (This is one of the major differences between ElementTree and
 the Document Object Model; in the DOM there are many different types of node,
 including :class:`TextNode`.)
index d02b74dc9ba042370393f0233d032635dddbdf2e..c72abb7d376c1272ad93b07a5ffea8532136baca 100644 (file)
@@ -515,11 +515,12 @@ class ConfigParser(RawConfigParser):
     def get(self, section, option, raw=False, vars=None):
         """Get an option value for a given section.
 
-        All % interpolations are expanded in the return values, based on the
-        defaults passed into the constructor, unless the optional argument
-        `raw' is true.  Additional substitutions may be provided using the
-        `vars' argument, which must be a dictionary whose contents overrides
-        any pre-existing defaults.
+        If `vars' is provided, it must be a dictionary. The option is looked up
+        in `vars' (if provided), `section', and in `defaults' in that order.
+
+        All % interpolations are expanded in the return values, unless the
+        optional argument `raw' is true. Values for interpolation keys are
+        looked up in the same manner as the option.
 
         The section DEFAULT is special.
         """
index 2825275aff6c312d478f4305a97a7a5ed6d9e03e..0f2d41d7d3d413f99d363269b3a41091b0322e4b 100644 (file)
@@ -17,6 +17,16 @@ the format to accommodate documentation needs as they arise.
 Permissions History
 -------------------
 
+- Brian Quinlan was given commit access on Jul 26 2010 by GFB,
+  for work related to PEP 3148.
+
+- Reid Kleckner was given commit access on Jul 11 2010 by GFB,
+  for work on the py3k-jit branch, at suggestion of the Unladen
+  Swallow team.
+
+- Alexander Belopolsky was given commit access on May 25 2010
+  by MvL at suggestion of Mark Dickinson.
+
 - Tim Golden was given commit access on April 21 2010 by MvL,
   at suggestion of Michael Foord.
 
index 571f607c3c131fbde21750e7196a86cd1875d9b6..d8dab672b6061158c6ff2f7a136049da1f28437e 100644 (file)
@@ -272,8 +272,7 @@ int unicode_resize(register PyUnicodeObject *unicode,
   reset:
     /* Reset the object caches */
     if (unicode->defenc) {
-        Py_DECREF(unicode->defenc);
-        unicode->defenc = NULL;
+        Py_CLEAR(unicode->defenc);
     }
     unicode->hash = -1;
 
@@ -371,8 +370,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
             unicode->length = 0;
         }
         if (unicode->defenc) {
-            Py_DECREF(unicode->defenc);
-            unicode->defenc = NULL;
+            Py_CLEAR(unicode->defenc);
         }
         /* Add to free list */
         *(PyUnicodeObject **)unicode = free_list;