]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix bogus test for negative float
authorGuido van Rossum <guido@python.org>
Sat, 18 Feb 1995 14:51:32 +0000 (14:51 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 18 Feb 1995 14:51:32 +0000 (14:51 +0000)
Python/bltinmodule.c

index 050006082b6058d63c927ff9f7b630c580bcc9d4..0dc6f00bffabe707f81ef9c75b70c4d7d9573703 100644 (file)
@@ -920,9 +920,9 @@ do_pow(v, w)
                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)