summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2008-05-02 01:19:50 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2008-05-02 01:19:50 (GMT)
commit73eada3287c2fc9b2700e2286b8811ae6454a52a (patch)
treec51e89a75388d99e0941c8180adcc96c9dc8c402 /Modules/mathmodule.c
parent8fb57fc627a37d3aa6d4cf02e4b2ebc1cfa5d465 (diff)
downloadcpython-73eada3287c2fc9b2700e2286b8811ae6454a52a.zip
cpython-73eada3287c2fc9b2700e2286b8811ae6454a52a.tar.gz
cpython-73eada3287c2fc9b2700e2286b8811ae6454a52a.tar.bz2
One more attempt to track down Debian/alpha test_math failures:
add diagnostic information in the ValueError message. This change is temporary, and will be reversed after the next run of the Debian/alpha buildbot.
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 4fb5916..99af899 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -167,6 +167,7 @@ math_1_to_whatever(PyObject *arg, double (*func) (double),
int can_overflow)
{
double x, r;
+ char err_message[150];
x = PyFloat_AsDouble(arg);
if (x == -1.0 && PyErr_Occurred())
return NULL;
@@ -183,9 +184,16 @@ math_1_to_whatever(PyObject *arg, double (*func) (double),
if (can_overflow)
PyErr_SetString(PyExc_OverflowError,
"math range error (overflow)");
- else
- PyErr_SetString(PyExc_ValueError,
- "math domain error (singularity)");
+ else {
+ /* temporary code to include the inputs
+ and outputs to func in the error
+ message */
+ sprintf(err_message,
+ "math domain error (singularity) "
+ "%.17g -> %.17g",
+ x, r);
+ PyErr_SetString(PyExc_ValueError, err_message);
+ }
return NULL;
}
if (Py_IS_FINITE(r) && errno && is_error(r))