From: Mark Dickinson Date: Thu, 1 May 2008 00:19:23 +0000 (+0000) Subject: Whoops. errno should only be tested when the result is finite. X-Git-Tag: v3.0a5~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de4296281a1e00f486425e1d63b51f771bd4eeaa;p=thirdparty%2FPython%2Fcpython.git Whoops. errno should only be tested when the result is finite. --- diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index aa3869141def..4fb5916e8a79 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); } /*