diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2018-01-06 07:15:34 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2018-01-06 07:15:34 (GMT) |
commit | 735ae8d139a673b30b321dc10acfd3d14f0d633b (patch) | |
tree | 027e039ce309a5617d15cdf7f2ef8a1f711fcaaa /Doc/library | |
parent | 502d551c6d782963d26957a9e5ff1588946f233f (diff) | |
download | cpython-735ae8d139a673b30b321dc10acfd3d14f0d633b.zip cpython-735ae8d139a673b30b321dc10acfd3d14f0d633b.tar.gz cpython-735ae8d139a673b30b321dc10acfd3d14f0d633b.tar.bz2 |
bpo-29137: Remove fpectl module (#4789)
This module has never been enabled by default, never worked correctly
on x86-64, and caused ABI problems that caused C extension
compatibility. See bpo-29137 for details/discussion.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/exceptions.rst | 5 | ||||
-rw-r--r-- | Doc/library/fpectl.rst | 121 | ||||
-rw-r--r-- | Doc/library/python.rst | 1 |
3 files changed, 1 insertions, 126 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index a6b20a5..c8d32cf 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -154,10 +154,7 @@ The following exceptions are the exceptions that are usually raised. .. exception:: FloatingPointError - Raised when a floating point operation fails. This exception is always defined, - but can only be raised when Python is configured with the - ``--with-fpectl`` option, or the :const:`WANT_SIGFPE_HANDLER` symbol is - defined in the :file:`pyconfig.h` file. + Not currently used. .. exception:: GeneratorExit diff --git a/Doc/library/fpectl.rst b/Doc/library/fpectl.rst deleted file mode 100644 index 9660716..0000000 --- a/Doc/library/fpectl.rst +++ /dev/null @@ -1,121 +0,0 @@ -:mod:`fpectl` --- Floating point exception control -================================================== - -.. module:: fpectl - :platform: Unix - :synopsis: Provide control for floating point exception handling. - -.. moduleauthor:: Lee Busby <busby1@llnl.gov> -.. sectionauthor:: Lee Busby <busby1@llnl.gov> - -.. note:: - - The :mod:`fpectl` module is not built by default, and its usage is discouraged - and may be dangerous except in the hands of experts. See also the section - :ref:`fpectl-limitations` on limitations for more details. - -.. index:: single: IEEE-754 - --------------- - -Most computers carry out floating point operations in conformance with the -so-called IEEE-754 standard. On any real computer, some floating point -operations produce results that cannot be expressed as a normal floating point -value. For example, try :: - - >>> import math - >>> math.exp(1000) - inf - >>> math.exp(1000) / math.exp(1000) - nan - -(The example above will work on many platforms. DEC Alpha may be one exception.) -"Inf" is a special, non-numeric value in IEEE-754 that stands for "infinity", -and "nan" means "not a number." Note that, other than the non-numeric results, -nothing special happened when you asked Python to carry out those calculations. -That is in fact the default behaviour prescribed in the IEEE-754 standard, and -if it works for you, stop reading now. - -In some circumstances, it would be better to raise an exception and stop -processing at the point where the faulty operation was attempted. The -:mod:`fpectl` module is for use in that situation. It provides control over -floating point units from several hardware manufacturers, allowing the user to -turn on the generation of :const:`SIGFPE` whenever any of the IEEE-754 -exceptions Division by Zero, Overflow, or Invalid Operation occurs. In tandem -with a pair of wrapper macros that are inserted into the C code comprising your -python system, :const:`SIGFPE` is trapped and converted into the Python -:exc:`FloatingPointError` exception. - -The :mod:`fpectl` module defines the following functions and may raise the given -exception: - - -.. function:: turnon_sigfpe() - - Turn on the generation of :const:`SIGFPE`, and set up an appropriate signal - handler. - - -.. function:: turnoff_sigfpe() - - Reset default handling of floating point exceptions. - - -.. exception:: FloatingPointError - - After :func:`turnon_sigfpe` has been executed, a floating point operation that - raises one of the IEEE-754 exceptions Division by Zero, Overflow, or Invalid - operation will in turn raise this standard Python exception. - - -.. _fpectl-example: - -Example -------- - -The following example demonstrates how to start up and test operation of the -:mod:`fpectl` module. :: - - >>> import fpectl - >>> import fpetest - >>> fpectl.turnon_sigfpe() - >>> fpetest.test() - overflow PASS - FloatingPointError: Overflow - - div by 0 PASS - FloatingPointError: Division by zero - [ more output from test elided ] - >>> import math - >>> math.exp(1000) - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - FloatingPointError: in math_1 - - -.. _fpectl-limitations: - -Limitations and other considerations ------------------------------------- - -Setting up a given processor to trap IEEE-754 floating point errors currently -requires custom code on a per-architecture basis. You may have to modify -:mod:`fpectl` to control your particular hardware. - -Conversion of an IEEE-754 exception to a Python exception requires that the -wrapper macros ``PyFPE_START_PROTECT`` and ``PyFPE_END_PROTECT`` be inserted -into your code in an appropriate fashion. Python itself has been modified to -support the :mod:`fpectl` module, but many other codes of interest to numerical -analysts have not. - -The :mod:`fpectl` module is not thread-safe. - - -.. seealso:: - - Some files in the source distribution may be interesting in learning more about - how this module operates. The include file :file:`Include/pyfpe.h` discusses the - implementation of this module at some length. :file:`Modules/fpetestmodule.c` - gives several examples of use. Many additional examples can be found in - :file:`Objects/floatobject.c`. - diff --git a/Doc/library/python.rst b/Doc/library/python.rst index f307d7d..440dc66 100644 --- a/Doc/library/python.rst +++ b/Doc/library/python.rst @@ -24,4 +24,3 @@ overview: gc.rst inspect.rst site.rst - fpectl.rst |