summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2008-05-01 00:19:23 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2008-05-01 00:19:23 (GMT)
commitde4296281a1e00f486425e1d63b51f771bd4eeaa (patch)
tree827345936fe88951a21be56907d8e1035b59ccc3
parenta0de26c3427b63efcd0a678c5d686b4df9f105e4 (diff)
downloadcpython-de4296281a1e00f486425e1d63b51f771bd4eeaa.zip
cpython-de4296281a1e00f486425e1d63b51f771bd4eeaa.tar.gz
cpython-de4296281a1e00f486425e1d63b51f771bd4eeaa.tar.bz2
Whoops. errno should only be tested when the result is finite.
-rw-r--r--Modules/mathmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index aa38691..4fb5916 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -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);
}
/*