Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from

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

........
  r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line

  Fix broken links found by "make linkcheck".  scipy.org seems to be done right now, so I could not verify links going there.
........
  r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line

  Fix markup.
........
  r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line

  #7125: fix typo.
........
  r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line

  #7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
  r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line

  #7116: str.join() takes an iterable.
........
  r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line

  Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
  r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line

  Fix missing word.
........
  r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line

  Fix punctuation.
........
  r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line

  Revert unintended change.
........
  r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line

  Fix markup.
........
  r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line

  Fix duplicate target.
........
  r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line

  Add a new directive marking up implementation details and start using it.
........
  r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line

  Make it more robust.
........
  r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line

  Document new directive.
........
  r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line

  Allow short form with text as argument.
........
  r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line

  Fix stylesheet for multi-paragraph impl-details.
........
  r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line

  Use "impl-detail" directive where applicable.
........
  r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line

  #6324: membership test tries iteration via __iter__.
........
  r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line

  #7088: document new functions in signal as Unix-only.
........
  r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line

  Reorder __slots__ fine print and add a clarification.
........
  r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line

  #7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
  r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line

  #7156: document curses as Unix-only.
........
  r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line

  #6977: getopt does not support optional option arguments.
........
  r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line

  Add proper references.
........
  r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line

  Make printout margin important.
........
  r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line

  #7188: fix optionxform() docs.
........
  r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines

  add further note about what's passed to optionxform
........
  r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines

  Improve some docstrings in the 'warnings' module.
........
  r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line

  Fix markup.
........
  r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line

  Fix a demo.
........
  r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line

  Fix a strange mis-edit.
........
This commit is contained in:
Georg Brandl 2009-10-27 15:28:25 +00:00
parent facabe2462
commit 495f7b5adb
50 changed files with 370 additions and 233 deletions

View file

@ -53,7 +53,7 @@ It defines the following functions:
*incrementalencoder* and *incrementaldecoder*: These have to be factory
functions providing the following interface:
``factory(errors='strict')``
``factory(errors='strict')``
The factory functions must return objects providing the interfaces defined by
the base classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`,
@ -62,21 +62,25 @@ It defines the following functions:
*streamreader* and *streamwriter*: These have to be factory functions providing
the following interface:
``factory(stream, errors='strict')``
``factory(stream, errors='strict')``
The factory functions must return objects providing the interfaces defined by
the base classes :class:`StreamWriter` and :class:`StreamReader`, respectively.
Stream codecs can maintain state.
Possible values for errors are ``'strict'`` (raise an exception in case of an
encoding error), ``'replace'`` (replace malformed data with a suitable
replacement marker, such as ``'?'``), ``'ignore'`` (ignore malformed data and
continue without further notice), ``'xmlcharrefreplace'`` (replace with the
appropriate XML character reference (for encoding only)),
``'backslashreplace'`` (replace with backslashed escape sequences (for
encoding only)), ``'surrogateescape'`` (replace with surrogate U+DCxx, see
:pep:`383`) as well as any other error handling name defined via
:func:`register_error`.
Possible values for errors are
* ``'strict'``: raise an exception in case of an encoding error
* ``'replace'``: replace malformed data with a suitable replacement marker,
such as ``'?'`` or ``'\ufffd'``
* ``'ignore'``: ignore malformed data and continue without further notice
* ``'xmlcharrefreplace'``: replace with the appropriate XML character
reference (for encoding only)
* ``'backslashreplace'``: replace with backslashed escape sequences (for
encoding only
* ``'surrogateescape'``: replace with surrogate U+DCxx, see :pep:`383`
as well as any other error handling name defined via :func:`register_error`.
In case a search function cannot find a given encoding, it should return
``None``.
@ -173,27 +177,33 @@ functions which use :func:`lookup` for the codec lookup:
.. function:: strict_errors(exception)
Implements the ``strict`` error handling.
Implements the ``strict`` error handling: each encoding or decoding error
raises a :exc:`UnicodeError`.
.. function:: replace_errors(exception)
Implements the ``replace`` error handling.
Implements the ``replace`` error handling: malformed data is replaced with a
suitable replacement character such as ``'?'`` in bytestrings and
``'\ufffd'`` in Unicode strings.
.. function:: ignore_errors(exception)
Implements the ``ignore`` error handling.
Implements the ``ignore`` error handling: malformed data is ignored and
encoding or decoding is continued without further notice.
.. function:: xmlcharrefreplace_errors(exception)
Implements the ``xmlcharrefreplace`` error handling.
Implements the ``xmlcharrefreplace`` error handling (for encoding only): the
unencodable character is replaced by an appropriate XML character reference.
.. function:: backslashreplace_errors(exception)
Implements the ``backslashreplace`` error handling.
Implements the ``backslashreplace`` error handling (for encoding only): the
unencodable character is replaced by a backslashed escape sequence.
To simplify working with encoded files or stream, the module also defines these
utility functions:

View file

@ -301,12 +301,23 @@ RawConfigParser Objects
.. method:: RawConfigParser.optionxform(option)
Transforms the option name *option* as found in an input file or as passed in by
client code to the form that should be used in the internal structures. The
default implementation returns a lower-case version of *option*; subclasses may
override this or client code can set an attribute of this name on instances to
affect this behavior. Setting this to :func:`str`, for example, would make
option names case sensitive.
Transforms the option name *option* as found in an input file or as passed in
by client code to the form that should be used in the internal structures.
The default implementation returns a lower-case version of *option*;
subclasses may override this or client code can set an attribute of this name
on instances to affect this behavior.
You don't necessarily need to subclass a ConfigParser to use this method, you
can also re-set it on an instance, to a function that takes a string
argument. Setting it to ``str``, for example, would make option names case
sensitive::
cfgparser = ConfigParser()
...
cfgparser.optionxform = str
Note that when reading configuration files, whitespace around the
option names are stripped before :meth:`optionxform` is called.
.. _configparser-objects:

View file

@ -4,10 +4,10 @@
.. module:: curses
:synopsis: An interface to the curses library, providing portable
terminal handling.
:platform: Unix
.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
.. sectionauthor:: Eric Raymond <esr@thyrsus.com>
The :mod:`curses` module provides an interface to the curses library, the
de-facto standard for portable advanced terminal handling.

View file

@ -233,7 +233,7 @@ Supported operations:
| | (-*t1.days*, -*t1.seconds*, |
| | -*t1.microseconds*), and to *t1*\* -1. (1)(4) |
+--------------------------------+-----------------------------------------------+
| ``abs(t)`` | equivalent to +*t* when ``t.days >= 0``, and |
| ``abs(t)`` | equivalent to +\ *t* when ``t.days >= 0``, and|
| | to -*t* when ``t.days < 0``. (2) |
+--------------------------------+-----------------------------------------------+

View file

@ -499,8 +499,10 @@ are always available. They are listed here in alphabetical order.
Return the "identity" of an object. This is an integer which
is guaranteed to be unique and constant for this object during its lifetime.
Two objects with non-overlapping lifetimes may have the same :func:`id` value.
(Implementation note: this is the address of the object.)
Two objects with non-overlapping lifetimes may have the same :func:`id`
value.
.. impl-detail:: This is the address of the object.
.. function:: input([prompt])

View file

@ -36,12 +36,13 @@ exception:
*longopts*, if specified, must be a list of strings with the names of the
long options which should be supported. The leading ``'--'`` characters
should not be included in the option name. Long options which require an
argument should be followed by an equal sign (``'='``). To accept only long
options, *shortopts* should be an empty string. Long options on the command line
can be recognized so long as they provide a prefix of the option name that
matches exactly one of the accepted options. For example, if *longopts* is
``['foo', 'frob']``, the option :option:`--fo` will match as :option:`--foo`,
but :option:`--f` will not match uniquely, so :exc:`GetoptError` will be raised.
argument should be followed by an equal sign (``'='``). Optional arguments
are not supported. To accept only long options, *shortopts* should be an
empty string. Long options on the command line can be recognized so long as
they provide a prefix of the option name that matches exactly one of the
accepted options. For example, if *longopts* is ``['foo', 'frob']``, the
option :option:`--fo` will match as :option:`--foo`, but :option:`--f` will
not match uniquely, so :exc:`GetoptError` will be raised.
The return value consists of two elements: the first is a list of ``(option,
value)`` pairs; the second is the list of program arguments left after the

View file

@ -290,18 +290,22 @@ attributes:
Return true if the object is a getset descriptor.
getsets are attributes defined in extension modules via ``PyGetSetDef``
structures. For Python implementations without such types, this method will
always return ``False``.
.. impl-detail::
getsets are attributes defined in extension modules via
:ctype:`PyGetSetDef` structures. For Python implementations without such
types, this method will always return ``False``.
.. function:: ismemberdescriptor(object)
Return true if the object is a member descriptor.
Member descriptors are attributes defined in extension modules via
``PyMemberDef`` structures. For Python implementations without such types,
this method will always return ``False``.
.. impl-detail::
Member descriptors are attributes defined in extension modules via
:ctype:`PyMemberDef` structures. For Python implementations without such
types, this method will always return ``False``.
.. _inspect-source:
@ -508,10 +512,12 @@ line.
Return the frame object for the caller's stack frame.
This function relies on Python stack frame support in the interpreter, which
isn't guaranteed to exist in all implementations of Python. If running in
an implementation without Python stack frame support this function returns
``None``.
.. impl-detail::
This function relies on Python stack frame support in the interpreter,
which isn't guaranteed to exist in all implementations of Python. If
running in an implementation without Python stack frame support this
function returns ``None``.
.. function:: stack(context=1)

View file

@ -595,7 +595,7 @@ Maildir, mbox, MH, Babyl, and MMDF.
`nmh - Message Handling System <http://www.nongnu.org/nmh/>`_
Home page of :program:`nmh`, an updated version of the original :program:`mh`.
`MH & nmh: Email for Users & Programmers <http://www.ics.uci.edu/~mh/book/>`_
`MH & nmh: Email for Users & Programmers <http://rand-mh.sourceforge.net/book/>`_
A GPL-licensed book on :program:`mh` and :program:`nmh`, with some information
on the mailbox format.

View file

@ -301,7 +301,7 @@ Constants
The mathematical constant *e*.
.. note::
.. impl-detail::
The :mod:`math` module consists mostly of thin wrappers around the platform C
math library functions. Behavior in exceptional cases is loosely specified

View file

@ -394,10 +394,10 @@ Directory Objects
.. seealso::
`Directory Table <http://msdn.microsoft.com/library/en-us/msi/setup/directory_table.asp>`_
`File Table <http://msdn.microsoft.com/library/en-us/msi/setup/file_table.asp>`_
`Component Table <http://msdn.microsoft.com/library/en-us/msi/setup/component_table.asp>`_
`FeatureComponents Table <http://msdn.microsoft.com/library/en-us/msi/setup/featurecomponents_table.asp>`_
`Directory Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/directory_table.asp>`_
`File Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/file_table.asp>`_
`Component Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/component_table.asp>`_
`FeatureComponents Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/featurecomponents_table.asp>`_
.. _features:
@ -422,7 +422,7 @@ Features
.. seealso::
`Feature Table <http://msdn.microsoft.com/library/en-us/msi/setup/feature_table.asp>`_
`Feature Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/feature_table.asp>`_
.. _msi-gui:
@ -516,13 +516,13 @@ to create MSI files with a user-interface for installing Python packages.
.. seealso::
`Dialog Table <http://msdn.microsoft.com/library/en-us/msi/setup/dialog_table.asp>`_
`Control Table <http://msdn.microsoft.com/library/en-us/msi/setup/control_table.asp>`_
`Control Types <http://msdn.microsoft.com/library/en-us/msi/setup/controls.asp>`_
`ControlCondition Table <http://msdn.microsoft.com/library/en-us/msi/setup/controlcondition_table.asp>`_
`ControlEvent Table <http://msdn.microsoft.com/library/en-us/msi/setup/controlevent_table.asp>`_
`EventMapping Table <http://msdn.microsoft.com/library/en-us/msi/setup/eventmapping_table.asp>`_
`RadioButton Table <http://msdn.microsoft.com/library/en-us/msi/setup/radiobutton_table.asp>`_
`Dialog Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/dialog_table.asp>`_
`Control Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/control_table.asp>`_
`Control Types <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controls.asp>`_
`ControlCondition Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlcondition_table.asp>`_
`ControlEvent Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp>`_
`EventMapping Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/eventmapping_table.asp>`_
`RadioButton Table <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/radiobutton_table.asp>`_
.. _msi-tables:
@ -551,5 +551,3 @@ definitions. Currently, these definitions are based on MSI version 2.0.
This module contains definitions for the UIText and ActionText tables, for the
standard installer actions.

View file

@ -1576,9 +1576,9 @@ written in Python, such as a mail server's external command delivery program.
.. function:: system(command)
Execute the command (a string) in a subshell. This is implemented by calling
the Standard C function :cfunc:`system`, and has the same limitations. Changes
to :data:`os.environ`, :data:`sys.stdin`, etc. are not reflected in the
environment of the executed command.
the Standard C function :cfunc:`system`, and has the same limitations.
Changes to :data:`sys.stdin`, etc. are not reflected in the environment of the
executed command.
On Unix, the return value is the exit status of the process encoded in the
format specified for :func:`wait`. Note that POSIX does not specify the meaning

View file

@ -43,7 +43,7 @@ also available for Python:
`PythonCAD <http://www.pythoncad.org/>`_. An online `tutorial
<http://www.pygtk.org/pygtk2tutorial/index.html>`_ is available.
`PyQt <http://www.riverbankcomputing.co.uk/pyqt/index.php>`_
`PyQt <http://www.riverbankcomputing.co.uk/software/pyqt/>`_
PyQt is a :program:`sip`\ -wrapped binding to the Qt toolkit. Qt is an
extensive C++ GUI application development framework that is
available for Unix, Windows and Mac OS X. :program:`sip` is a tool

View file

@ -94,7 +94,7 @@ Cross Platform
.. function:: python_implementation()
Returns a string identifying the Python implementation. Possible return values
are: 'CPython', 'IronPython', 'Jython'
are: 'CPython', 'IronPython', 'Jython'.
.. function:: python_revision()

View file

@ -157,13 +157,14 @@ The :mod:`signal` module defines the following functions:
The old values are returned as a tuple: (delay, interval).
Attempting to pass an invalid interval timer will cause a
:exc:`ItimerError`.
Attempting to pass an invalid interval timer will cause an
:exc:`ItimerError`. Availability: Unix.
.. function:: getitimer(which)
Returns current value of a given interval timer specified by *which*.
Availability: Unix.
.. function:: set_wakeup_fd(fd)
@ -184,7 +185,7 @@ The :mod:`signal` module defines the following functions:
Change system call restart behaviour: if *flag* is :const:`False`, system
calls will be restarted when interrupted by signal *signalnum*, otherwise
system calls will be interrupted. Returns nothing. Availability: Unix (see
system calls will be interrupted. Returns nothing. Availability: Unix (see
the man page :manpage:`siginterrupt(3)` for further information).
Note that installing a signal handler with :func:`signal` will reset the

View file

@ -772,13 +772,15 @@ Notes:
If *k* is ``None``, it is treated like ``1``.
(6)
If *s* and *t* are both strings, some Python implementations such as CPython can
usually perform an in-place optimization for assignments of the form ``s=s+t``
or ``s+=t``. When applicable, this optimization makes quadratic run-time much
less likely. This optimization is both version and implementation dependent.
For performance sensitive code, it is preferable to use the :meth:`str.join`
method which assures consistent linear concatenation performance across versions
and implementations.
.. impl-detail::
If *s* and *t* are both strings, some Python implementations such as
CPython can usually perform an in-place optimization for assignments of
the form ``s = s + t`` or ``s += t``. When applicable, this optimization
makes quadratic run-time much less likely. This optimization is both
version and implementation dependent. For performance sensitive code, it
is preferable to use the :meth:`str.join` method which assures consistent
linear concatenation performance across versions and implementations.
.. _string-methods:
@ -951,12 +953,12 @@ functions based on regular expressions.
least one cased character, false otherwise.
.. method:: str.join(seq)
.. method:: str.join(iterable)
Return a string which is the concatenation of the strings in the sequence
*seq*. A :exc:`TypeError` will be raised if there are any non-string values
in *seq*, including :class:`bytes` objects. The separator between elements
is the string providing this method.
Return a string which is the concatenation of the strings in the
:term:`iterable` *iterable*. A :exc:`TypeError` will be raised if there are
any non-string values in *seq*, including :class:`bytes` objects. The
separator between elements is the string providing this method.
.. method:: str.ljust(width[, fillchar])
@ -1510,14 +1512,17 @@ Notes:
that compare equal --- this is helpful for sorting in multiple passes (for
example, sort by department, then by salary grade).
While a list is being sorted, the effect of attempting to mutate, or even
inspect, the list is undefined. The C implementation
makes the list appear empty for the duration, and raises :exc:`ValueError` if it
can detect that the list has been mutated during a sort.
.. impl-detail::
While a list is being sorted, the effect of attempting to mutate, or even
inspect, the list is undefined. The C implementation of Python makes the
list appear empty for the duration, and raises :exc:`ValueError` if it can
detect that the list has been mutated during a sort.
(8)
:meth:`sort` is not supported by :class:`bytearray` objects.
.. _bytes-methods:
Bytes and Byte Array Methods

View file

@ -352,8 +352,10 @@ always available.
that is deeper than the call stack, :exc:`ValueError` is raised. The default
for *depth* is zero, returning the frame at the top of the call stack.
This function should be used for internal and specialized purposes only. It
is not guaranteed to exist in all implementations of Python.
.. impl-detail::
This function should be used for internal and specialized purposes only.
It is not guaranteed to exist in all implementations of Python.
.. function:: getprofile()
@ -373,12 +375,12 @@ always available.
Get the trace function as set by :func:`settrace`.
.. note::
.. impl-detail::
The :func:`gettrace` function is intended only for implementing debuggers,
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition,
and thus may not be available in all Python implementations.
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition, and
thus may not be available in all Python implementations.
.. function:: getwindowsversion()
@ -750,12 +752,12 @@ always available.
For more information on code and frame objects, refer to :ref:`types`.
.. note::
.. impl-detail::
The :func:`settrace` function is intended only for implementing debuggers,
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition, and thus
may not be available in all Python implementations.
profilers, coverage tools and the like. Its behavior is part of the
implementation platform, rather than part of the language definition, and
thus may not be available in all Python implementations.
.. function:: settscdump(on_flag)

View file

@ -77,5 +77,8 @@ The module defines the following names:
as ``datetime.timedelta.days``. This type is used as descriptor for simple C
data members which use standard conversion functions; it has the same purpose
as the :class:`property` type, but for classes defined in extension modules.
In other implementations of Python, this type may be identical to
``GetSetDescriptorType``.
.. impl-detail::
In other implementations of Python, this type may be identical to
``GetSetDescriptorType``.

View file

@ -72,9 +72,10 @@ support weak references but can add support through subclassing::
obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable
Other built-in types such as :class:`tuple` and :class:`int` do not support
weak references even when subclassed (those types implemented as a
:ctype:`PyVarObject`).
.. impl-detail::
Other built-in types such as :class:`tuple` and :class:`long` do not support
weak references even when subclassed.
Extension types can easily be made to support weak references; see
:ref:`weakref-support`.