]> granicus.if.org Git - python/commitdiff
Whoops. errno should only be tested when the result is finite.
authorMark Dickinson <dickinsm@gmail.com>
Thu, 1 May 2008 00:19:23 +0000 (00:19 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Thu, 1 May 2008 00:19:23 +0000 (00:19 +0000)
Modules/mathmodule.c

index aa3869141def86f06702b1f75c78b7b041b5b01e..4fb5916e8a798b073a6a3dce5de47f358478ded1 100644 (file)
@@ -188,11 +188,11 @@ math_1_to_whatever(PyObject *arg, double (*func) (double),
                                        "math domain error (singularity)");
                        return NULL;
        }
-       /* on most machines, errno should be 0 at this point */
-       if (errno && is_error(r))
+       if (Py_IS_FINITE(r) && errno && is_error(r))
+               /* this branch unnecessary on most platforms */
                return NULL;
-       else
-               return (*from_double_func)(r);
+
+       return (*from_double_func)(r);
 }
 
 /*