Merged revisions 68162,68166,68171,68176,68195-68196,68210,68232 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68162 | ronald.oussoren | 2009-01-02 16:06:00 +0100 (Fri, 02 Jan 2009) | 3 lines

  Fix for issue 4472 is incompatible with Cygwin, this patch
  should fix that.
........
  r68166 | benjamin.peterson | 2009-01-02 19:26:23 +0100 (Fri, 02 Jan 2009) | 1 line

  document PyMemberDef
........
  r68171 | georg.brandl | 2009-01-02 21:25:14 +0100 (Fri, 02 Jan 2009) | 3 lines

  #4811: fix markup glitches (mostly remains of the conversion),
  found by Gabriel Genellina.
........
  r68176 | andrew.kuchling | 2009-01-02 22:00:35 +0100 (Fri, 02 Jan 2009) | 1 line

  Add various items
........
  r68195 | georg.brandl | 2009-01-03 14:45:15 +0100 (Sat, 03 Jan 2009) | 2 lines

  Remove useless string literal.
........
  r68196 | georg.brandl | 2009-01-03 15:29:53 +0100 (Sat, 03 Jan 2009) | 2 lines

  Fix indentation.
........
  r68210 | georg.brandl | 2009-01-03 20:10:12 +0100 (Sat, 03 Jan 2009) | 2 lines

  Set eol-style correctly for mp_distributing.py.
........
  r68232 | georg.brandl | 2009-01-03 22:52:16 +0100 (Sat, 03 Jan 2009) | 2 lines

  Grammar fix.
........
This commit is contained in:
Georg Brandl 2009-01-03 22:47:39 +00:00
parent 814a2ca9e4
commit 1f01debe6f
23 changed files with 135 additions and 46 deletions

View File

@ -60,6 +60,7 @@ docs@python.org), and we'll be glad to correct the problem.
* Peter Funk
* Lele Gaifax
* Matthew Gallagher
* Gabriel Genellina
* Ben Gertzfield
* Nadim Ghaznavi
* Jonathan Giddy

View File

@ -53,8 +53,9 @@ variable(s) whose address should be passed.
string may contain embedded null bytes. Unicode objects pass back a pointer
to the default encoded string version of the object if such a conversion is
possible. All other read-buffer compatible objects pass back a reference to
the raw internal data representation. Since this format doesn't allow writable buffer compatible objects like byte
arrays, ``s*`` is to be preferred.
the raw internal data representation. Since this format doesn't allow
writable buffer compatible objects like byte arrays, ``s*`` is to be
preferred.
The type of the length argument (int or :ctype:`Py_ssize_t`) is controlled by
defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before including

View File

@ -198,3 +198,64 @@ definition with the same method name.
object and will co-exist with the slot. This is helpful because calls to
PyCFunctions are optimized more than wrapper object calls.
.. ctype:: PyMemberDef
Structure which describes an attribute of a type which corresponds to a C
struct member. Its fields are:
+------------------+-------------+-------------------------------+
| Field | C Type | Meaning |
+==================+=============+===============================+
| :attr:`name` | char \* | name of the member |
+------------------+-------------+-------------------------------+
| :attr:`type` | int | the type of the member in the |
| | | C struct |
+------------------+-------------+-------------------------------+
| :attr:`offset` | Py_ssize_t | the offset in bytes that the |
| | | member is located on the |
| | | type's object struct |
+------------------+-------------+-------------------------------+
| :attr:`flags` | int | flag bits indicating if the |
| | | field should be read-only or |
| | | writable |
+------------------+-------------+-------------------------------+
| :attr:`doc` | char \* | points to the contents of the |
| | | docstring |
+------------------+-------------+-------------------------------+
:attr:`type` can be one of many ``T_`` macros corresponding to various C
types. When the member is accessed in Python, it will be converted to the
equivalent Python type.
=============== ==================
Macro name C type
=============== ==================
T_SHORT short
T_INT int
T_LONG long
T_FLOAT float
T_DOUBLE double
T_STRING char \*
T_OBJECT PyObject \*
T_OBJECT_EX PyObject \*
T_CHAR char
T_BYTE char
T_UNBYTE unsigned char
T_UINT unsigned int
T_USHORT unsigned short
T_ULONG unsigned long
T_BOOL char
T_LONGLONG long long
T_ULONGLONG unsigned long long
T_PYSSIZET Py_ssize_t
=============== ==================
:cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` differ in that
:cmacro:`T_OBJECT` returns ``None`` if the member is *NULL* and
:cmacro:`T_OBJECT_EX` raises an :exc:`AttributeError`.
:attr:`flags` can be 0 for write and read access or :cmacro:`READONLY` for
read-only access. Using :cmacro:`T_STRING` for :attr:`type` implies
:cmacro:`READONLY`. Only :cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX`
members can be deleted. (They are set to *NULL*).

View File

@ -190,7 +190,8 @@ the full reference.
+------------------------+--------------------------------+---------------------------+
| *define_macros* | list of macros to define; each | (string, string) tuple or |
| | macro is defined using a | (name, ``None``) |
| | 2-tuple, where 'value' is | |
| | 2-tuple ``(name, value)``, | |
| | where *value* is | |
| | either the string to define it | |
| | to or ``None`` to define it | |
| | without a particular value | |

View File

@ -586,7 +586,7 @@ And here's an example of changing the counter:
9
>>> next(it)
Traceback (most recent call last):
File ``t.py'', line 15, in ?
File "t.py", line 15, in ?
it.next()
StopIteration

View File

@ -475,7 +475,7 @@ than the URL you pass to .add_password() will also match. ::
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and password.
# If we knew the realm, we could use it instead of ``None``.
# If we knew the realm, we could use it instead of None.
top_level_url = "http://example.com/foo/"
password_mgr.add_password(None, top_level_url, username, password)

View File

@ -584,7 +584,7 @@ value of ``sys.path``. ::
$ python
Python 2.2 (#11, Oct 3 2002, 13:31:27)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type ``help'', ``copyright'', ``credits'' or ``license'' for more information.
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2',

View File

@ -55,14 +55,14 @@ Here are the classes:
.. currentmodule:: email.mime.multipart
.. class:: MIMEMultipart([subtype[, boundary[, _subparts[, _params]]]])
.. class:: MIMEMultipart([_subtype[, boundary[, _subparts[, _params]]]])
Module: :mod:`email.mime.multipart`
A subclass of :class:`MIMEBase`, this is an intermediate base class for MIME
messages that are :mimetype:`multipart`. Optional *_subtype* defaults to
:mimetype:`mixed`, but can be used to specify the subtype of the message. A
:mailheader:`Content-Type` header of :mimetype:`multipart/`*_subtype* will be
:mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be
added to the message object. A :mailheader:`MIME-Version` header will also be
added.

View File

@ -7,7 +7,7 @@
This module provides a simple interface to compress and decompress files just
like the GNU programs :program:`gzip` and :program:`gunzip` would.
The data compression is provided by the :mod:``zlib`` module.
The data compression is provided by the :mod:`zlib` module.
The :mod:`gzip` module provides the :class:`GzipFile` class which is modeled
after Python's File Object. The :class:`GzipFile` class reads and writes

View File

@ -704,7 +704,7 @@ accessed using the following methods:
The :class:`Cookie` class also defines the following method:
.. method:: Cookie.is_expired([now=:const:`None`])
.. method:: Cookie.is_expired([now=None])
True if cookie has passed the time at which the server requested it should
expire. If *now* is given (in seconds since the epoch), return whether the

View File

@ -151,7 +151,7 @@ Basic Usage
*default(obj)* is a function that should return a serializable version of
*obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`.
To use a custom :class:`JSONEncoder`` subclass (e.g. one that overrides the
To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the
:meth:`default` method to serialize additional types), specify it with the
*cls* kwarg.

View File

@ -1136,7 +1136,7 @@ their parent process exits. The manager classes are defined in the
Returns a :class:`Server` object which represents the actual server under
the control of the Manager. The :class:`Server` object supports the
:meth:`serve_forever` method::
:meth:`serve_forever` method:
>>> from multiprocessing.managers import BaseManager
>>> m = BaseManager(address=('', 50000), authkey='abc'))
@ -1147,7 +1147,7 @@ their parent process exits. The manager classes are defined in the
.. method:: connect()
Connect a local manager object to a remote manager process::
Connect a local manager object to a remote manager process:
>>> from multiprocessing.managers import BaseManager
>>> m = BaseManager(address='127.0.0.1', authkey='abc))
@ -1293,7 +1293,7 @@ Customized managers
>>>>>>>>>>>>>>>>>>>
To create one's own manager, one creates a subclass of :class:`BaseManager` and
use the :meth:`~BaseManager.resgister` classmethod to register new types or
use the :meth:`~BaseManager.register` classmethod to register new types or
callables with the manager class. For example::
from multiprocessing.managers import BaseManager
@ -1809,7 +1809,7 @@ Address Formats
* An ``'AF_PIPE'`` address is a string of the form
:samp:`r'\\\\.\\pipe\\{PipeName}'`. To use :func:`Client` to connect to a named
pipe on a remote computer called ServerName* one should use an address of the
pipe on a remote computer called *ServerName* one should use an address of the
form :samp:`r'\\\\{ServerName}\\pipe\\{PipeName}'`` instead.
Note that any string beginning with two backslashes is assumed by default to be

View File

@ -49,14 +49,14 @@ The numeric tower
:func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``,
``%``, ``<``, ``<=``, ``>``, and ``>=``.
Real also provides defaults for :func:`complex`, :attr:`Complex.real`,
:attr:`Complex.imag`, and :meth:`Complex.conjugate`.
Real also provides defaults for :func:`complex`, :attr:`~Complex.real`,
:attr:`~Complex.imag`, and :meth:`~Complex.conjugate`.
.. class:: Rational
Subtypes :class:`Real` and adds
:attr:`Rational.numerator` and :attr:`Rational.denominator` properties, which
:attr:`~Rational.numerator` and :attr:`~Rational.denominator` properties, which
should be in lowest terms. With these, it provides a default for
:func:`float`.
@ -72,8 +72,8 @@ The numeric tower
.. class:: Integral
Subtypes :class:`Rational` and adds a conversion to :class:`int`.
Provides defaults for :func:`float`, :attr:`Rational.numerator`, and
:attr:`Rational.denominator`, and bit-string operations: ``<<``,
Provides defaults for :func:`float`, :attr:`~Rational.numerator`, and
:attr:`~Rational.denominator`, and bit-string operations: ``<<``,
``>>``, ``&``, ``^``, ``|``, ``~``.

View File

@ -635,7 +635,7 @@ on the same line as the definition of the code block, as in ::
while the long form uses an indented block and allows nested definitions::
def make_power(exp):
"Make a function that raises an argument to the exponent `exp'."
"Make a function that raises an argument to the exponent `exp`."
def raiser(x, y=exp):
return x ** y
return raiser

View File

@ -200,7 +200,7 @@ An :class:`SMTP` instance has the following methods:
previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO``
first.
:exc:SMTPHeloError
:exc:`SMTPHeloError`
The server didn't reply properly to the ``HELO`` greeting.
.. method:: SMTP.has_extn(name)

View File

@ -365,7 +365,7 @@ described in those functions, as well as provide an additional method:
'http://www.Python.org/doc/'
The following classes provide the implementations of the parse results::
The following classes provide the implementations of the parse results:
.. class:: BaseResult

View File

@ -151,7 +151,7 @@ Positional and keyword arguments can be arbitrarily combined::
other='Georg'))
The story of Bill, Manfred, and Georg.
An optional ``':``` and format specifier can follow the field name. This also
An optional ``':'`` and format specifier can follow the field name. This also
greater control over how the value is formatted. The following example
truncates the Pi to three places after the decimal.

View File

@ -343,7 +343,7 @@ These environment variables influence Python's behavior.
compiled form). Extension modules cannot be imported from zipfiles.
The default search path is installation dependent, but generally begins with
:file:`{prefix}/lib/python{version}`` (see :envvar:`PYTHONHOME` above). It
:file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). It
is *always* appended to :envvar:`PYTHONPATH`.
An additional directory will be inserted in the search path in front of

View File

@ -1428,7 +1428,7 @@ Running the above function's tests with :const:`doctest.REPORT_UDIFF` specified,
you get the following output::
**********************************************************************
File ``t.py'', line 15, in g
File "t.py", line 15, in g
Failed example:
g(4)
Differences (unified diff with -expected +actual):

View File

@ -485,7 +485,7 @@ And here's an example of changing the counter::
9
>>> print it.next()
Traceback (most recent call last):
File ``t.py'', line 15, in ?
File "t.py", line 15, in ?
print it.next()
StopIteration

View File

@ -103,7 +103,23 @@ changes, sorted alphabetically by module name. Consult the
:file:`Misc/NEWS` file in the source tree for a more complete list of
changes, or look through the Subversion logs for all the details.
* To be written.
* A new function in the :mod:`subprocess` module,
:func:`check_output`, runs a command with a specified set of arguments
and returns the command's output as a string if the command runs without
error, or raises a :exc:`CalledProcessError` exception otherwise.
::
>>> subprocess.check_output(['df', '-h', '.'])
'Filesystem Size Used Avail Capacity Mounted on\n
/dev/disk0s2 52G 49G 3.0G 94% /\n'
>>> subprocess.check_output(['df', '-h', '/bogus'])
...
subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-zero exit status 1
(Contributed by Gregory P. Smith.)
.. ======================================================================
.. whole new modules get described in subsections here
@ -116,13 +132,22 @@ Build and C API Changes
Changes to Python's build process and to the C API include:
* To be written.
* If you use the :file:`.gdbinit` file provided with Python,
the "pyo" macro in the 2.7 version will now work when the thread being
debugged doesn't hold the GIL; the macro will now acquire it before printing.
(Contributed by haypo XXX; :issue:`3632`.)
.. ======================================================================
Port-Specific Changes: Windows
-----------------------------------
* The :mod:`msvcrt` module now contains some constants from
the :file:`crtassem.h` header file:
:data:`CRT_ASSEMBLY_VERSION`,
:data:`VC_ASSEMBLY_PUBLICKEYTOKEN`,
and :data:`LIBRARIES_ASSEMBLY_NAME_PREFIX`.
(Added by Martin von Loewis (XXX check); :issue:`4365`.)
.. ======================================================================

View File

@ -777,8 +777,8 @@ altbininstall: $(BUILDPYTHON)
done
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
if test -f $(LDLIBRARY); then \
if test "$(SO)" = .dll; then \
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(BINDIR); \
if test -n "$(DLLLIBRARY)" ; then \
$(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
else \
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
if test $(LDLIBRARY) != $(INSTSONAME); then \

View File

@ -176,7 +176,7 @@ class ASDLParser(spark.GenericParser, object):
return Product(fields)
def p_sum_0(self, constructor):
" sum ::= constructor """
" sum ::= constructor "
return [constructor[0]]
def p_sum_1(self, info):