diff options
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index fa09084669..5aeabd9d93 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -821,12 +821,12 @@ float_pow(PyObject *v, PyObject *w, PyObject *z) ix = pow(iv, iw); PyFPE_END_PROTECT(ix) Py_ADJUST_ERANGE1(ix); - if (errno != 0) { + /* we need to ignore ERANGE here and just return inf */ + if (errno != 0 && errno != ERANGE) { /* We don't expect any errno value other than ERANGE, but * the range of libm bugs appears unbounded. */ - PyErr_SetFromErrno(errno == ERANGE ? PyExc_OverflowError : - PyExc_ValueError); + PyErr_SetFromErrno(PyExc_ValueError); return NULL; } return PyFloat_FromDouble(ix); |