diff Objects/floatobject.c @ 39642:981181d2a4fe legacy-trunk

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.
author Alex Martelli <aleaxit@gmail.com>
date Wed, 23 Aug 2006 22:17:59 +0000
parents d5fa4afd6620
children a68467cc06d3
line wrap: on
line diff
--- a/Objects/floatobject.c	Wed Aug 23 21:26:46 2006 +0000
+++ b/Objects/floatobject.c	Wed Aug 23 22:17:59 2006 +0000
@@ -821,12 +821,12 @@
 	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);