Skip to content

Commit c4f30b6

Browse files
committed
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 ........
1 parent 0a7b854 commit c4f30b6

15 files changed

Lines changed: 582 additions & 207 deletions

File tree

Doc/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@
7575
# typographically correct entities.
7676
html_use_smartypants = True
7777

78-
# Content template for the index page, filename relative to this file.
79-
html_index = 'indexcontent.html'
80-
8178
# Custom sidebar templates, filenames relative to this file.
8279
html_sidebars = {
8380
'index': 'indexsidebar.html',
@@ -86,6 +83,7 @@
8683
# Additional templates that should be rendered to pages.
8784
html_additional_pages = {
8885
'download': 'download.html',
86+
'index': 'indexcontent.html',
8987
}
9088

9189
# Output file base name for HTML help builder.

Doc/documenting/markup.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ a matching identifier is found:
319319
.. describe:: func
320320

321321
The name of a Python function; dotted names may be used. The role text
322-
should include trailing parentheses to enhance readability. The parentheses
323-
are stripped when searching for identifiers.
322+
should not include trailing parentheses to enhance readability. The
323+
parentheses are stripped when searching for identifiers.
324324

325325
.. describe:: data
326326

@@ -338,7 +338,7 @@ a matching identifier is found:
338338
.. describe:: meth
339339

340340
The name of a method of an object. The role text should include the type
341-
name, method name and the trailing parentheses. A dotted name may be used.
341+
name and the method name. A dotted name may be used.
342342

343343
.. describe:: attr
344344

Doc/library/dis.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,11 @@ the more significant byte last.
528528

529529
.. opcode:: IMPORT_NAME (namei)
530530

531-
Imports the module ``co_names[namei]``. The module object is pushed onto the
532-
stack. The current namespace is not affected: for a proper import statement, a
533-
subsequent ``STORE_FAST`` instruction modifies the namespace.
531+
Imports the module ``co_names[namei]``. TOS and TOS1 are popped and provide
532+
the *fromlist* and *level* arguments of :func:`__import__`. The module
533+
object is pushed onto the stack. The current namespace is not affected:
534+
for a proper import statement, a subsequent ``STORE_FAST`` instruction
535+
modifies the namespace.
534536

535537

536538
.. opcode:: IMPORT_FROM (namei)

Doc/library/io.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ Module Interface
101101
:mod:`codecs` module for the list of supported encodings.
102102

103103
*errors* is an optional string that specifies how encoding and decoding
104-
errors are to be handled---this argument should not be used in binary mode.
105-
Pass ``'strict'`` to raise a :exc:`ValueError` exception if there is an
106-
encoding error (the default of ``None`` has the same effect), or pass
107-
``'ignore'`` to ignore errors. (Note that ignoring encoding errors can lead
108-
to data loss.) ``'replace'`` causes a replacement marker (such as ``'?'``)
109-
to be inserted where there is malformed data. For all possible values, see
110-
:func:`codecs.register`.
104+
errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError`
105+
exception if there is an encoding error (the default of ``None`` has the same
106+
effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
107+
errors can lead to data loss.) ``'replace'`` causes a replacement marker
108+
(such as ``'?'``) to be inserted where there is malformed data. When
109+
writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
110+
reference) or ``'backslashreplace'`` (replace with backslashed escape
111+
sequences) can be used. Any other error handling name that has been
112+
registered with :func:`codecs.register_error` is also valid.
111113

112114
*newline* controls how universal newlines works (it only applies to text
113115
mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It
@@ -581,8 +583,11 @@ Text I/O
581583
exception if there is an encoding error (the default of ``None`` has the same
582584
effect), or pass ``'ignore'`` to ignore errors. (Note that ignoring encoding
583585
errors can lead to data loss.) ``'replace'`` causes a replacement marker
584-
(such as ``'?'``) to be inserted where there is malformed data. For all
585-
possible values see :func:`codecs.register`.
586+
(such as ``'?'``) to be inserted where there is malformed data. When
587+
writing, ``'xmlcharrefreplace'`` (replace with the appropriate XML character
588+
reference) or ``'backslashreplace'`` (replace with backslashed escape
589+
sequences) can be used. Any other error handling name that has been
590+
registered with :func:`codecs.register_error` is also valid.
586591

587592
*newline* can be ``None``, ``''``, ``'\n'``, ``'\r'``, or ``'\r\n'``. It
588593
controls the handling of line endings. If it is ``None``, universal newlines

Doc/library/math.rst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,15 @@ Power and logarithmic functions:
143143

144144
.. function:: pow(x, y)
145145

146-
Return ``x**y``. ``1.0**y`` returns *1.0*, even for ``1.0**nan``. ``0**y``
147-
returns *0.* for all positive *y*, *0* and *NAN*.
146+
Return ``x`` raised to the power ``y``. Exceptional cases follow
147+
Annex 'F' of the C99 standard as far as possible. In particular,
148+
``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even
149+
when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite,
150+
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
151+
is undefined, and raises :exc:`ValueError`.
148152

149153
.. versionchanged:: 2.6
150-
The outcome of ``1**nan`` and ``0**nan`` was undefined.
154+
The outcome of ``1**nan`` and ``nan**0`` was undefined.
151155

152156

153157
.. function:: sqrt(x)
@@ -198,13 +202,6 @@ Trigonometric functions:
198202
Return the sine of *x* radians.
199203

200204

201-
.. function:: asinh(x)
202-
203-
Return the inverse hyperbolic sine of *x*, in radians.
204-
205-
.. versionadded:: 2.6
206-
207-
208205
.. function:: tan(x)
209206

210207
Return the tangent of *x* radians.
@@ -224,18 +221,32 @@ Angular conversion:
224221
Hyperbolic functions:
225222

226223

227-
.. function:: cosh(x)
224+
.. function:: acosh(x)
228225

229-
Return the hyperbolic cosine of *x*.
226+
Return the inverse hyperbolic cosine of *x*.
230227

228+
.. versionadded:: 2.6
231229

232-
.. function:: acosh(x)
233230

234-
Return the inverse hyperbolic cosine of *x*, in radians.
231+
.. function:: asinh(x)
232+
233+
Return the inverse hyperbolic sine of *x*.
235234

236235
.. versionadded:: 2.6
237236

238237

238+
.. function:: atanh(x)
239+
240+
Return the inverse hyperbolic tangent of *x*.
241+
242+
.. versionadded:: 2.6
243+
244+
245+
.. function:: cosh(x)
246+
247+
Return the hyperbolic cosine of *x*.
248+
249+
239250
.. function:: sinh(x)
240251

241252
Return the hyperbolic sine of *x*.
@@ -246,12 +257,6 @@ Hyperbolic functions:
246257
Return the hyperbolic tangent of *x*.
247258

248259

249-
.. function:: atanh(x)
250-
251-
Return the inverse hyperbolic tangent of *x*, in radians.
252-
253-
.. versionadded:: 2.6
254-
255260

256261
The module also defines two mathematical constants:
257262

@@ -279,7 +284,7 @@ The module also defines two mathematical constants:
279284
:exc:`OverflowError` isn't defined, and in cases where ``math.log(0)`` raises
280285
:exc:`OverflowError`, ``math.log(0L)`` may raise :exc:`ValueError` instead.
281286

282-
All functions return a quite *NaN* if at least one of the args is *NaN*.
287+
All functions return a quiet *NaN* if at least one of the args is *NaN*.
283288
Signaling *NaN*s raise an exception. The exception type still depends on the
284289
platform and libm implementation. It's usually :exc:`ValueError` for *EDOM*
285290
and :exc:`OverflowError` for errno *ERANGE*.

Doc/library/os.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,8 @@ to be ignored.
12541254

12551255
For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` (note
12561256
that these all end in "e"), the *env* parameter must be a mapping which is
1257-
used to define the environment variables for the new process; the :func:`execl`,
1257+
used to define the environment variables for the new process (these are used
1258+
instead of the current process' environment); the functions :func:`execl`,
12581259
:func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new process to
12591260
inherit the environment of the current process. Availability: Macintosh, Unix,
12601261
Windows.
@@ -1484,7 +1485,8 @@ written in Python, such as a mail server's external command delivery program.
14841485

14851486
For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe`
14861487
(note that these all end in "e"), the *env* parameter must be a mapping
1487-
which is used to define the environment variables for the new process; the
1488+
which is used to define the environment variables for the new process (they are
1489+
used instead of the current process' environment); the functions
14881490
:func:`spawnl`, :func:`spawnlp`, :func:`spawnv`, and :func:`spawnvp` all cause
14891491
the new process to inherit the environment of the current process.
14901492

Doc/library/shutil.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ copying and removal. For operations on individual files, see also the
2828
are not copied.
2929

3030

31-
.. function:: copyfile(src, dst)
32-
33-
Copy the contents (no metadata) of the file named *src* to a file named *dst*.
34-
The destination location must be writable; otherwise, an :exc:`IOError` exception
35-
will be raised. If *dst* already exists, it will be replaced. Special files
36-
such as character or block devices and pipes cannot be copied with this
37-
function. *src* and *dst* are path names given as strings.
38-
39-
4031
.. function:: copyfileobj(fsrc, fdst[, length])
4132

4233
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
4839
be copied.
4940

5041

42+
.. function:: copyfile(src, dst)
43+
44+
Copy the contents (no metadata) of the file named *src* to a file named *dst*.
45+
*dst* must be the complete target file name; look at :func:`copy` for a copy that
46+
accepts a target directory path.
47+
The destination location must be writable; otherwise, an :exc:`IOError` exception
48+
will be raised. If *dst* already exists, it will be replaced. Special files
49+
such as character or block devices and pipes cannot be copied with this
50+
function. *src* and *dst* are path names given as strings.
51+
52+
5153
.. function:: copymode(src, dst)
5254

5355
Copy the permission bits from *src* to *dst*. The file contents, owner, and

Doc/library/subprocess.rst

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ This module defines one class called :class:`Popen`:
8989
searching the executable, so you can't specify the program's path relative to
9090
*cwd*.
9191

92-
If *env* is not ``None``, it defines the environment variables for the new
93-
process.
92+
If *env* is not ``None``, it must be a mapping that defines the environment
93+
variables for the new process; these are used instead of inheriting the current
94+
process' environment, which is the default behavior.
9495

9596
If *universal_newlines* is :const:`True`, the file objects stdout and stderr are
9697
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:
202203
size is large or unlimited.
203204

204205

206+
.. method:: Popen.send_signal(signal)
207+
208+
Sends the signal *signal* to the child.
209+
210+
.. note::
211+
212+
On Windows only SIGTERM is supported so far. It's an alias for
213+
:meth:`terminate`.
214+
215+
.. versionadded:: 2.6
216+
217+
218+
.. method:: Popen.terminate()
219+
220+
Stop the child. On Posix OSs the method sends SIGTERM to the
221+
child. On Windows the Win32 API function TerminateProcess is called
222+
to stop the child.
223+
224+
.. versionadded:: 2.6
225+
226+
227+
.. method:: Popen.kill()
228+
229+
Kills the child. On Posix OSs the function sends SIGKILL to the child.
230+
On Windows :meth:`kill` is an alias for :meth:`terminate`.
231+
232+
.. versionadded:: 2.6
233+
234+
205235
The following attributes are also available:
206236

207237
.. attribute:: Popen.stdin

Doc/tools/sphinxext/indexcontent.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% extends "defindex.html" %}
2+
{% block tables %}
13
<p><strong>Parts of the documentation:</strong></p>
24
<table class="contentstable" align="center"><tr>
35
<td width="50%">
@@ -54,3 +56,4 @@
5456
<p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">Copyright</a></p>
5557
</td></tr>
5658
</table>
59+
{% endblock %}

Doc/whatsnew/2.6.rst

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,11 +1292,42 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
12921292
:func:`isnan`, return true if their floating-point argument is
12931293
infinite or Not A Number. (:issue:`1640`)
12941294

1295-
The ``math.copysign(x, y)`` function
1296-
copies the sign bit of an IEEE 754 number, returning the absolute
1297-
value of *x* combined with the sign bit of *y*. For example,
1298-
``math.copysign(1, -0.0)`` returns -1.0. (Contributed by Christian
1299-
Heimes.)
1295+
* The :mod:`math` module has seven new functions, and the existing
1296+
functions have been improved to give more consistent behaviour
1297+
across platforms, especially with respect to handling of
1298+
floating-point exceptions and IEEE 754 special values.
1299+
The new functions are:
1300+
1301+
* :func:`isinf` and :func:`isnan` determine whether a given float is
1302+
a (positive or negative) infinity or a NaN (Not a Number),
1303+
respectively.
1304+
1305+
* ``copysign(x, y)`` copies the sign bit of an IEEE 754 number,
1306+
returning the absolute value of *x* combined with the sign bit of
1307+
*y*. For example, ``math.copysign(1, -0.0)`` returns -1.0.
1308+
(Contributed by Christian Heimes.)
1309+
1310+
* The inverse hyperbolic functions :func:`acosh`, :func:`asinh` and
1311+
:func:`atanh`.
1312+
1313+
* The function :func:`log1p`, returning the natural logarithm of
1314+
*1+x* (base *e*).
1315+
1316+
There's also a new :func:`trunc` function as a result of the
1317+
backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__.
1318+
1319+
The existing math functions have been modified to follow the
1320+
recommendations of the C99 standard with respect to special values
1321+
whenever possible. For example, ``sqrt(-1.)`` should now give a
1322+
:exc:`ValueError` across (nearly) all platforms, while
1323+
``sqrt(float('NaN'))`` should return a NaN on all IEEE 754
1324+
platforms. Where Annex 'F' of the C99 standard recommends signaling
1325+
'divide-by-zero' or 'invalid', Python will raise :exc:`ValueError`.
1326+
Where Annex 'F' of the C99 standard recommends signaling 'overflow',
1327+
Python will raise :exc:`OverflowError`. (See :issue:`711019`,
1328+
:issue:`1640`.)
1329+
1330+
(Contributed by Christian Heimes and Mark Dickinson.)
13001331

13011332
* Changes to the :class:`Exception` interface
13021333
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.
14151446
available, instead of restricting itself to protocol 1.
14161447
(Contributed by W. Barnes; :issue:`1551443`.)
14171448

1449+
* The :mod:`cmath` module underwent an extensive set of revisions,
1450+
thanks to Mark Dickinson and Christian Heimes, that added some new
1451+
features and greatly improved the accuracy of the computations.
1452+
1453+
Five new functions were added:
1454+
1455+
* :func:`polar` converts a complex number to polar form, returning
1456+
the modulus and argument of that complex number.
1457+
1458+
* :func:`rect` does the opposite, turning a (modulus, argument) pair
1459+
back into the corresponding complex number.
1460+
1461+
* :func:`phase` returns the phase or argument of a complex number.
1462+
1463+
* :func:`isnan` returns True if either
1464+
the real or imaginary part of its argument is a NaN.
1465+
1466+
* :func:`isinf` returns True if either the real or imaginary part of
1467+
its argument is infinite.
1468+
1469+
The revisions also improved the numerical soundness of the
1470+
:mod:`cmath` module. For all functions, the real and imaginary
1471+
parts of the results are accurate to within a few units of least
1472+
precision (ulps) whenever possible. See :issue:`1381` for the
1473+
details. The branch cuts for :func:`asinh`, :func:`atanh`: and
1474+
:func:`atan` have also been corrected.
1475+
1476+
The tests for the module have been greatly expanded; nearly 2000 new
1477+
test cases exercise the algebraic functions.
1478+
1479+
On IEEE 754 platforms, the :mod:`cmath` module now handles IEEE 754
1480+
special values and floating-point exceptions in a manner consistent
1481+
with Annex 'G' of the C99 standard.
1482+
14181483
* A new data type in the :mod:`collections` module: :class:`namedtuple(typename,
14191484
fieldnames)` is a factory function that creates subclasses of the standard tuple
14201485
whose fields are accessible by name as well as index. For example::

0 commit comments

Comments
 (0)