Mercurial > cpython-lru_cache-weakref
diff Modules/mathmodule.c @ 46617:e42fe19ba6fd
Whoops. errno should only be tested when the result is finite.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Thu, 01 May 2008 00:19:23 +0000 |
| parents | 3f2117d3271f |
| children | 80bd4baa6398 |
line wrap: on
line diff
--- a/Modules/mathmodule.c Wed Apr 30 23:30:57 2008 +0000 +++ b/Modules/mathmodule.c Thu May 01 00:19:23 2008 +0000 @@ -188,11 +188,11 @@ "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); } /*
