diff Python/bltinmodule.c @ 2375:51c8824985f8 legacy-trunk

fix bogus test for negative float
author Guido van Rossum <guido@python.org>
date Sat, 18 Feb 1995 14:51:32 +0000
parents 4c2f1452125d
children 9318ac51691e
line wrap: on
line diff
--- a/Python/bltinmodule.c	Sat Feb 18 14:51:15 1995 +0000
+++ b/Python/bltinmodule.c	Sat Feb 18 14:51:32 1995 +0000
@@ -920,9 +920,9 @@
 		err_setstr(TypeError, "pow() requires numeric arguments");
 		return NULL;
 	}
-	if ((w->ob_type==&Floattype) &&
-	    (*v->ob_type->tp_as_number->nb_negative)(v)) {
-		err_setstr(ValueError, "negative number to float power");
+	if (is_floatobject(w) && getfloatvalue(v) < 0.0) {
+		if (!err_occurred())
+		    err_setstr(ValueError, "negative number to float power");
 		return NULL;
 	}
 	if (coerce(&v, &w) != 0)