summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-04-20 21:01:16 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-04-20 21:01:16 (GMT)
commita342c013fc97df2110c420af2cd66b7e8489b9af (patch)
tree8e95e3309129066e84c3aa83bdbc7aaf087fbf62 /Doc
parent58f9e4f34793a14050648c9f620e96189908a3e9 (diff)
downloadcpython-a342c013fc97df2110c420af2cd66b7e8489b9af.zip
cpython-a342c013fc97df2110c420af2cd66b7e8489b9af.tar.gz
cpython-a342c013fc97df2110c420af2cd66b7e8489b9af.tar.bz2
Merged revisions 62386-62387,62389-62393,62396,62400-62402,62407,62409-62410,62412-62414,62418-62419 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62386 | christian.heimes | 2008-04-19 04:23:57 +0200 (Sat, 19 Apr 2008) | 2 lines Added kill, terminate and send_signal to subprocess.Popen The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill(). ........ r62387 | georg.brandl | 2008-04-19 10:23:59 +0200 (Sat, 19 Apr 2008) | 2 lines Fix-up docs for revision 62386. ........ r62389 | georg.brandl | 2008-04-19 18:57:43 +0200 (Sat, 19 Apr 2008) | 2 lines #2369: clarify that copyfile() doesn't take a target directory. ........ r62390 | georg.brandl | 2008-04-19 18:58:28 +0200 (Sat, 19 Apr 2008) | 2 lines #2634: clarify meaning of env parameter to spawn/exec*e. ........ r62391 | georg.brandl | 2008-04-19 18:58:49 +0200 (Sat, 19 Apr 2008) | 2 lines #2633: clarify meaning of env parameter. ........ r62392 | georg.brandl | 2008-04-19 18:59:16 +0200 (Sat, 19 Apr 2008) | 2 lines #2631: clarify IMPORT_NAME semantics. ........ r62393 | georg.brandl | 2008-04-19 19:00:14 +0200 (Sat, 19 Apr 2008) | 2 lines :func: et al. should *not* include the parens. ........ r62396 | mark.dickinson | 2008-04-19 20:51:48 +0200 (Sat, 19 Apr 2008) | 5 lines Additional tests for math.pow, and extra special-case handling code in math.pow, in the hope of making all tests pass on the alpha Tru64 buildbot. ........ r62400 | mark.dickinson | 2008-04-19 21:41:52 +0200 (Sat, 19 Apr 2008) | 3 lines Additional special-case handling for math.pow. Windows/VS2008 doesn't like (-1)**(+-inf). ........ r62401 | benjamin.peterson | 2008-04-19 21:47:34 +0200 (Sat, 19 Apr 2008) | 2 lines Complete documentation for errors argument of io's open and TextIOWrapper ........ r62402 | mark.dickinson | 2008-04-19 22:31:16 +0200 (Sat, 19 Apr 2008) | 2 lines Document updates to math and cmath modules. ........ r62407 | georg.brandl | 2008-04-19 23:28:38 +0200 (Sat, 19 Apr 2008) | 2 lines Update template for newest Sphinx. ........ r62409 | mark.dickinson | 2008-04-19 23:35:35 +0200 (Sat, 19 Apr 2008) | 5 lines Correct documentation for math.pow; 0**nan is nan, not 0. (But nan**0 and 1**nan are 1.) Also fix minor typo: 'quite NaN' -> 'quiet NaN' ........ r62410 | mark.dickinson | 2008-04-19 23:49:22 +0200 (Sat, 19 Apr 2008) | 4 lines Move asinh documentation to the proper place. Remove meaningless 'in radians' from inverse hyperbolic functions. ........ r62412 | mark.dickinson | 2008-04-20 03:22:30 +0200 (Sun, 20 Apr 2008) | 5 lines Report additional diagnostic information in test_math, to help track down debian-alpha buildbot failure. ........ r62413 | mark.dickinson | 2008-04-20 03:39:24 +0200 (Sun, 20 Apr 2008) | 3 lines FreeBSD doesn't follow C99 for modf(inf); so add explicit special-value handling to math.modf code. ........ r62414 | mark.dickinson | 2008-04-20 06:13:13 +0200 (Sun, 20 Apr 2008) | 5 lines Yet more explicit special case handling to make math.pow behave on alpha Tru64. All IEEE 754 special values are now handled directly; only the finite**finite case is handled by libm. ........ r62418 | mark.dickinson | 2008-04-20 18:13:17 +0200 (Sun, 20 Apr 2008) | 7 lines Issue 2662: Initialize special value tables dynamically (i.e. when cmath module is loaded) instead of statically. This fixes compile-time problems on platforms where HUGE_VAL is an extern variable rather than a constant. Thanks Hirokazu Yamamoto for the patch. ........ r62419 | andrew.kuchling | 2008-04-20 18:54:02 +0200 (Sun, 20 Apr 2008) | 1 line Move description of math module changes; various edits to description of cmath changes ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/conf.py4
-rw-r--r--Doc/documenting/markup.rst6
-rw-r--r--Doc/library/dis.rst8
-rw-r--r--Doc/library/io.rst23
-rw-r--r--Doc/library/math.rst47
-rw-r--r--Doc/library/os.rst6
-rw-r--r--Doc/library/shutil.rst20
-rw-r--r--Doc/library/subprocess.rst34
-rw-r--r--Doc/tools/sphinxext/indexcontent.html3
-rw-r--r--Doc/whatsnew/2.6.rst75
10 files changed, 169 insertions, 57 deletions
diff --git a/Doc/conf.py b/Doc/conf.py
index c9f9114..27f5ed3 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -75,9 +75,6 @@ html_last_updated_fmt = '%b %d, %Y'
# typographically correct entities.
html_use_smartypants = True
-# Content template for the index page, filename relative to this file.
-html_index = 'indexcontent.html'
-
# Custom sidebar templates, filenames relative to this file.
html_sidebars = {
'index': 'indexsidebar.html',
@@ -86,6 +83,7 @@ html_sidebars = {
# Additional templates that should be rendered to pages.
html_additional_pages = {
'download': 'download.html',
+ 'index': 'indexcontent.html',
}
# Output file base name for HTML help builder.
diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst
index f3a8237..7cf89b0 100644
--- a/Doc/documenting/markup.rst
+++ b/Doc/documenting/markup.rst
@@ -319,8 +319,8 @@ a matching identifier is found:
.. describe:: func
The name of a Python function; dotted names may be used. The role text
- should include trailing parentheses to enhance readability. The parentheses
- are stripped when searching for identifiers.
+ should not include trailing parentheses to enhance readability. The
+ parentheses are stripped when searching for identifiers.
.. describe:: data
@@ -338,7 +338,7 @@ a matching identifier is found:
.. describe:: meth
The name of a method of an object. The role text should include the type
- name, method name and the trailing parentheses. A dotted name may be used.
+ name and the method name. A dotted name may be used.
.. describe:: attr
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 3af9250..125a80f 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -528,9 +528,11 @@ the more significant byte last.
.. opcode:: IMPORT_NAME (namei)
- Imports the module ``co_names[namei]``. The module object is pushed onto the
- stack. The current namespace is not affected: for a proper import statement, a
- subsequent ``STORE_FAST`` instruction modifies the namespace.
+ Imports the module ``co_names[namei]``. TOS and TOS1 are popped and provide
+ the *fromlist* and *level* arguments of :func:`__import__`. The module
+ object is pushed onto the stack. The current namespace is not affected:
+ for a proper import statement, a subsequent ``STORE_FAST`` instruction
+ modifies the namespace.
.. opcode:: IMPORT_FROM (namei)
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 4fb79b9..6280adc 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -101,13 +101,15 @@ Module Interface
:mod:`codecs` module for the list of supported encodings.
*errors* is an optional string that specifies how encoding and decoding
- errors are to be handled---this argument should not be used in binary mode.
- Pass ``'strict'`` to raise a :exc:`ValueError` exception if there is an
- encoding error (the default of ``None`` has the same effect), or pass
- ``'ignore'`` to ignore errors. (Note that ignoring encoding errors can lead
- to data loss.) ``'replace'`` causes a replacement marker (such as ``'?'``)
- to be inserted where there is malformed data. For all possible values, see
- :func:`codecs.register`.
+ errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError`
+ exception if there is an encoding error (the default of ``None`` has the same
+ effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
+ errors can lead to data loss.) ``'replace'`` causes a replacement marker
+ (such as ``'?'``) to be inserted where there is malformed data. When
+ writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
+ reference) or ``'backslashreplace'`` (replace with backslashed escape
+ sequences) can be used. Any other error handling name that has been
+ registered with :func:`codecs.register_error` is also valid.
*newline* controls how universal newlines works (it only applies to text
mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It
@@ -581,8 +583,11 @@ Text I/O
exception if there is an encoding error (the default of ``None`` has the same
effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
errors can lead to data loss.) ``'replace'`` causes a replacement marker
- (such as ``'?'``) to be inserted where there is malformed data. For all
- possible values see :func:`codecs.register`.
+ (such as ``'?'``) to be inserted where there is malformed data. When
+ writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
+ reference) or ``'backslashreplace'`` (replace with backslashed escape
+ sequences) can be used. Any other error handling name that has been
+ registered with :func:`codecs.register_error` is also valid.
*newline* can be ``None``, ``''``, ``'\n'``, ``'\r'``, or ``'\r\n'``. It
controls the handling of line endings. If it is ``None``, universal newlines
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 024897f..e906af2 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -143,11 +143,15 @@ Power and logarithmic functions:
.. function:: pow(x, y)
- Return ``x**y``. ``1.0**y`` returns *1.0*, even for ``1.0**nan``. ``0**y``
- returns *0.* for all positive *y*, *0* and *NAN*.
+ Return ``x`` raised to the power ``y``. Exceptional cases follow
+ Annex 'F' of the C99 standard as far as possible. In particular,
+ ``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even
+ when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite,
+ ``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
+ is undefined, and raises :exc:`ValueError`.
.. versionchanged:: 2.6
- The outcome of ``1**nan`` and ``0**nan`` was undefined.
+ The outcome of ``1**nan`` and ``nan**0`` was undefined.
.. function:: sqrt(x)
@@ -198,13 +202,6 @@ Trigonometric functions:
Return the sine of *x* radians.
-.. function:: asinh(x)
-
- Return the inverse hyperbolic sine of *x*, in radians.
-
- .. versionadded:: 2.6
-
-
.. function:: tan(x)
Return the tangent of *x* radians.
@@ -224,18 +221,32 @@ Angular conversion:
Hyperbolic functions:
-.. function:: cosh(x)
+.. function:: acosh(x)
- Return the hyperbolic cosine of *x*.
+ Return the inverse hyperbolic cosine of *x*.
+ .. versionadded:: 2.6
-.. function:: acosh(x)
- Return the inverse hyperbolic cosine of *x*, in radians.
+.. function:: asinh(x)
+
+ Return the inverse hyperbolic sine of *x*.
.. versionadded:: 2.6
+.. function:: atanh(x)
+
+ Return the inverse hyperbolic tangent of *x*.
+
+ .. versionadded:: 2.6
+
+
+.. function:: cosh(x)
+
+ Return the hyperbolic cosine of *x*.
+
+
.. function:: sinh(x)
Return the hyperbolic sine of *x*.
@@ -246,12 +257,6 @@ Hyperbolic functions:
Return the hyperbolic tangent of *x*.
-.. function:: atanh(x)
-
- Return the inverse hyperbolic tangent of *x*, in radians.
-
- .. versionadded:: 2.6
-
The module also defines two mathematical constants:
@@ -279,7 +284,7 @@ The module also defines two mathematical constants:
:exc:`OverflowError` isn't defined, and in cases where ``math.log(0)`` raises
:exc:`OverflowError`, ``math.log(0L)`` may raise :exc:`ValueError` instead.
- All functions return a quite *NaN* if at least one of the args is *NaN*.
+ All functions return a quiet *NaN* if at least one of the args is *NaN*.
Signaling *NaN*s raise an exception. The exception type still depends on the
platform and libm implementation. It's usually :exc:`ValueError` for *EDOM*
and :exc:`OverflowError` for errno *ERANGE*.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index ec35c3b..bf0fe19 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1254,7 +1254,8 @@ to be ignored.
For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` (note
that these all end in "e"), the *env* parameter must be a mapping which is
- used to define the environment variables for the new process; the :func:`execl`,
+ used to define the environment variables for the new process (these are used
+ instead of the current process' environment); the functions :func:`execl`,
:func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new process to
inherit the environment of the current process. Availability: Macintosh, Unix,
Windows.
@@ -1484,7 +1485,8 @@ written in Python, such as a mail server's external command delivery program.
For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe`
(note that these all end in "e"), the *env* parameter must be a mapping
- which is used to define the environment variables for the new process; the
+ which is used to define the environment variables for the new process (they are
+ used instead of the current process' environment); the functions
:func:`spawnl`, :func:`spawnlp`, :func:`spawnv`, and :func:`spawnvp` all cause
the new process to inherit the environment of the current process.
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index db4a259..2300fe9 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -28,15 +28,6 @@ copying and removal. For operations on individual files, see also the
are not copied.
-.. function:: copyfile(src, dst)
-
- Copy the contents (no metadata) of the file named *src* to a file named *dst*.
- The destination location must be writable; otherwise, an :exc:`IOError` exception
- will be raised. If *dst* already exists, it will be replaced. Special files
- such as character or block devices and pipes cannot be copied with this
- function. *src* and *dst* are path names given as strings.
-
-
.. function:: copyfileobj(fsrc, fdst[, length])
Copy the contents of the file-like object *fsrc* to the file-like object *fdst*.
@@ -48,6 +39,17 @@ copying and removal. For operations on individual files, see also the
be copied.
+.. function:: copyfile(src, dst)
+
+ Copy the contents (no metadata) of the file named *src* to a file named *dst*.
+ *dst* must be the complete target file name; look at :func:`copy` for a copy that
+ accepts a target directory path.
+ The destination location must be writable; otherwise, an :exc:`IOError` exception
+ will be raised. If *dst* already exists, it will be replaced. Special files
+ such as character or block devices and pipes cannot be copied with this
+ function. *src* and *dst* are path names given as strings.
+
+
.. function:: copymode(src, dst)
Copy the permission bits from *src* to *dst*. The file contents, owner, and
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index c876efe..2344bcb 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -89,8 +89,9 @@ This module defines one class called :class:`Popen`:
searching the executable, so you can't specify the program's path relative to
*cwd*.
- If *env* is not ``None``, it defines the environment variables for the new
- process.
+ If *env* is not ``None``, it must be a mapping that defines the environment
+ variables for the new process; these are used instead of inheriting the current
+ process' environment, which is the default behavior.
If *universal_newlines* is :const:`True`, the file objects stdout and stderr are
opened as text files, but lines may be terminated by any of ``'\n'``, the Unix
@@ -202,6 +203,35 @@ Instances of the :class:`Popen` class have the following methods:
size is large or unlimited.
+.. method:: Popen.send_signal(signal)
+
+ Sends the signal *signal* to the child.
+
+ .. note::
+
+ On Windows only SIGTERM is supported so far. It's an alias for
+ :meth:`terminate`.
+
+ .. versionadded:: 2.6
+
+
+.. method:: Popen.terminate()
+
+ Stop the child. On Posix OSs the method sends SIGTERM to the
+ child. On Windows the Win32 API function TerminateProcess is called
+ to stop the child.
+
+ .. versionadded:: 2.6
+
+
+.. method:: Popen.kill()
+
+ Kills the child. On Posix OSs the function sends SIGKILL to the child.
+ On Windows :meth:`kill` is an alias for :meth:`terminate`.
+
+ .. versionadded:: 2.6
+
+
The following attributes are also available:
.. attribute:: Popen.stdin
diff --git a/Doc/tools/sphinxext/indexcontent.html b/Doc/tools/sphinxext/indexcontent.html
index 218f346..67a9eaf 100644
--- a/Doc/tools/sphinxext/indexcontent.html
+++ b/Doc/tools/sphinxext/indexcontent.html
@@ -1,3 +1,5 @@
+{% extends "defindex.html" %}
+{% block tables %}
<p><strong>Parts of the documentation:</strong></p>
<table class="contentstable" align="center"><tr>
<td width="50%">
@@ -54,3 +56,4 @@
<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">Copyright</a></p>
</td></tr>
</table>
+{% endblock %}
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index fa51221..eb5d4b2 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1292,11 +1292,42 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
:func:`isnan`, return true if their floating-point argument is
infinite or Not A Number. (:issue:`1640`)
- The ``math.copysign(x, y)`` function
- copies the sign bit of an IEEE 754 number, returning the absolute
- value of *x* combined with the sign bit of *y*. For example,
- ``math.copysign(1, -0.0)`` returns -1.0. (Contributed by Christian
- Heimes.)
+* The :mod:`math` module has seven new functions, and the existing
+ functions have been improved to give more consistent behaviour
+ across platforms, especially with respect to handling of
+ floating-point exceptions and IEEE 754 special values.
+ The new functions are:
+
+ * :func:`isinf` and :func:`isnan` determine whether a given float is
+ a (positive or negative) infinity or a NaN (Not a Number),
+ respectively.
+
+ * ``copysign(x, y)`` copies the sign bit of an IEEE 754 number,
+ returning the absolute value of *x* combined with the sign bit of
+ *y*. For example, ``math.copysign(1, -0.0)`` returns -1.0.
+ (Contributed by Christian Heimes.)
+
+ * The inverse hyperbolic functions :func:`acosh`, :func:`asinh` and
+ :func:`atanh`.
+
+ * The function :func:`log1p`, returning the natural logarithm of
+ *1+x* (base *e*).
+
+ There's also a new :func:`trunc` function as a result of the
+ backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__.
+
+ The existing math functions have been modified to follow the
+ recommendations of the C99 standard with respect to special values
+ whenever possible. For example, ``sqrt(-1.)`` should now give a
+ :exc:`ValueError` across (nearly) all platforms, while
+ ``sqrt(float('NaN'))`` should return a NaN on all IEEE 754
+ platforms. Where Annex 'F' of the C99 standard recommends signaling
+ 'divide-by-zero' or 'invalid', Python will raise :exc:`ValueError`.
+ Where Annex 'F' of the C99 standard recommends signaling 'overflow',
+ Python will raise :exc:`OverflowError`. (See :issue:`711019`,
+ :issue:`1640`.)
+
+ (Contributed by Christian Heimes and Mark Dickinson.)
* Changes to the :class:`Exception` interface
as dictated by :pep:`352` continue to be made. For 2.6,
@@ -1415,6 +1446,40 @@ complete list of changes, or look through the CVS logs for all the details.
available, instead of restricting itself to protocol 1.
(Contributed by W. Barnes; :issue:`1551443`.)
+* The :mod:`cmath` module underwent an extensive set of revisions,
+ thanks to Mark Dickinson and Christian Heimes, that added some new
+ features and greatly improved the accuracy of the computations.
+
+ Five new functions were added:
+
+ * :func:`polar` converts a complex number to polar form, returning
+ the modulus and argument of that complex number.
+
+ * :func:`rect` does the opposite, turning a (modulus, argument) pair
+ back into the corresponding complex number.
+
+ * :func:`phase` returns the phase or argument of a complex number.
+
+ * :func:`isnan` returns True if either
+ the real or imaginary part of its argument is a NaN.
+
+ * :func:`isinf` returns True if either the real or imaginary part of
+ its argument is infinite.
+
+ The revisions also improved the numerical soundness of the
+ :mod:`cmath` module. For all functions, the real and imaginary
+ parts of the results are accurate to within a few units of least
+ precision (ulps) whenever possible. See :issue:`1381` for the
+ details. The branch cuts for :func:`asinh`, :func:`atanh`: and
+ :func:`atan` have also been corrected.
+
+ The tests for the module have been greatly expanded; nearly 2000 new
+ test cases exercise the algebraic functions.
+
+ On IEEE 754 platforms, the :mod:`cmath` module now handles IEEE 754
+ special values and floating-point exceptions in a manner consistent
+ with Annex 'G' of the C99 standard.
+
* A new data type in the :mod:`collections` module: :class:`namedtuple(typename,
fieldnames)` is a factory function that creates subclasses of the standard tuple
whose fields are accessible by name as well as index. For example::