From: Guido van Rossum Date: Sat, 18 Feb 1995 14:51:32 +0000 (+0000) Subject: fix bogus test for negative float X-Git-Tag: v1.2b4~220 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8a1e8eb62fc89814a942f6ba59cac0ac32cd9fe5;p=thirdparty%2FPython%2Fcpython.git fix bogus test for negative float --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 050006082b60..0dc6f00bffab 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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)