summaryrefslogtreecommitdiff
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorAlex Martelli <aleaxit@gmail.com>2006-08-23 22:17:59 +0000
committerAlex Martelli <aleaxit@gmail.com>2006-08-23 22:17:59 +0000
commit348dc88097412cc229254f20f2759ce4cd192261 (patch)
treef8108517f0eace50dac1d9fa799eabb677f828f2 /Objects/floatobject.c
parent39c532c0b639b72384a5f5137d3fd5f7d127d814 (diff)
downloadcpython-git-348dc88097412cc229254f20f2759ce4cd192261.tar.gz
Reverting the patch that tried to fix the issue whereby x**2 raises
OverflowError while x*x succeeds and produces infinity; apparently these inconsistencies cannot be fixed across ``all'' platforms and there's a widespread feeling that therefore ``every'' platform should keep suffering forevermore. Ah well.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 5aeabd9d93..fa09084669 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);
- /* we need to ignore ERANGE here and just return inf */
- if (errno != 0 && errno != ERANGE) {
+ if (errno != 0) {
/* We don't expect any errno value other than ERANGE, but
* the range of libm bugs appears unbounded.
*/
- PyErr_SetFromErrno(PyExc_ValueError);
+ PyErr_SetFromErrno(errno == ERANGE ? PyExc_OverflowError :
+ PyExc_ValueError);
return NULL;
}
return PyFloat_FromDouble(ix);