]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test for float to the float power here
authorGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 16:57:16 +0000 (16:57 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 16:57:16 +0000 (16:57 +0000)
Python/bltinmodule.c

index 551d009f459cc0b632e91d5c4051634ccb685122..83eeecbe806d2ee60dc2e34a425b12151ade9976 100644 (file)
@@ -916,6 +916,11 @@ 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");
+               return NULL;
+       }
        if (coerce(&v, &w) != 0)
                return NULL;
        res = (*v->ob_type->tp_as_number->nb_power)(v, w, None);