Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a1e8eb

Browse files
committed
fix bogus test for negative float
1 parent 6a75d26 commit 8a1e8eb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/bltinmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,9 @@ do_pow(v, w)
920920
err_setstr(TypeError, "pow() requires numeric arguments");
921921
return NULL;
922922
}
923-
if ((w->ob_type==&Floattype) &&
924-
(*v->ob_type->tp_as_number->nb_negative)(v)) {
925-
err_setstr(ValueError, "negative number to float power");
923+
if (is_floatobject(w) && getfloatvalue(v) < 0.0) {
924+
if (!err_occurred())
925+
err_setstr(ValueError, "negative number to float power");
926926
return NULL;
927927
}
928928
if (coerce(&v, &w) != 0)

0 commit comments

Comments
 (0)