]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
One more attempt to track down Debian/alpha test_math failures:
authorMark Dickinson <dickinsm@gmail.com>
Fri, 2 May 2008 01:19:50 +0000 (01:19 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 2 May 2008 01:19:50 +0000 (01:19 +0000)
add diagnostic information in the ValueError message.  This
change is temporary, and will be reversed after the next run
of the Debian/alpha buildbot.

Modules/mathmodule.c

index 4fb5916e8a798b073a6a3dce5de47f358478ded1..99af899c98339f04fb13b72b51c586ad95400e61 100644 (file)
@@ -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))