summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-12 06:38:19 (GMT)
committerGitHub <noreply@github.com>2021-10-12 06:38:19 (GMT)
commitd943d19172aa93ce88bade15b9f23a0ce3bc72ff (patch)
treec674b910e203113b991861de5b12e2ab79eb166b /Python/errors.c
parentbe21706f3760bec8bd11f85ce02ed6792b07f51f (diff)
downloadcpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.zip
cpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.tar.gz
cpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.tar.bz2
bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)
* Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 36a529e..f072c21 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -2,11 +2,12 @@
/* Error handling */
#include "Python.h"
-#include "pycore_initconfig.h"
-#include "pycore_pyerrors.h"
-#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "pycore_sysmodule.h"
-#include "pycore_traceback.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
+#include "pycore_initconfig.h" // _PyStatus_ERR()
+#include "pycore_pyerrors.h" // _PyErr_Format()
+#include "pycore_pystate.h" // _PyThreadState_GET()
+#include "pycore_sysmodule.h" // _PySys_Audit()
+#include "pycore_traceback.h" // _PyTraceBack_FromFrame()
#ifndef __STDC__
#ifndef MS_WINDOWS
is 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 ? 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`.