Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de42962

Browse files
committed
Whoops. errno should only be tested when the result is finite.
1 parent a0de26c commit de42962

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Modules/mathmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ math_1_to_whatever(PyObject *arg, double (*func) (double),
188188
"math domain error (singularity)");
189189
return NULL;
190190
}
191-
/* on most machines, errno should be 0 at this point */
192-
if (errno && is_error(r))
191+
if (Py_IS_FINITE(r) && errno && is_error(r))
192+
/* this branch unnecessary on most platforms */
193193
return NULL;
194-
else
195-
return (*from_double_func)(r);
194+
195+
return (*from_double_func)(r);
196196
}
197197

198198
/*

0 commit comments

Comments
 (0)