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
........
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 @@
 
 .. 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 @@
    :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 @@
    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 @@
 
 .. 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 @@
    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 @@
 Hyperbolic functions:
 
 
+.. function:: acosh(x)
+
+   Return the inverse hyperbolic cosine of *x*.
+
+   .. versionadded:: 2.6
+
+
+.. 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:: acosh(x)
-
-   Return the inverse hyperbolic cosine of *x*, in radians.
-
-   .. versionadded:: 2.6
-
-
 .. function:: sinh(x)
 
    Return the hyperbolic sine of *x*.
@@ -246,12 +257,6 @@
    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 @@
    :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 @@
 
    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 @@
 
    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 @@
    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 @@
    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 @@
    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 @@
       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