mirror of https://github.com/python/cpython
Merged revisions 83452,83457,83466,83471,83475,83480,83486 via svnmerge from
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. ........ ................
This commit is contained in:
parent
a228ad6ff1
commit
6290bcfc25
|
@ -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
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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 ::
|
||||
|
||||
|
|
|
@ -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]])
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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::
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.'
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.)
|
||||
|
|
|
@ -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.
|
||||
"""
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue