summaryrefslogtreecommitdiff
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-18 14:51:32 +0000
committerGuido van Rossum <guido@python.org>1995-02-18 14:51:32 +0000
commited3909bd7caafb33c95f98b0252736d17de7b6fe (patch)
tree9052b465ca85cdc96895682270f130457e857462 /Python/bltinmodule.c
parentc221f91134b4ecc2ff778d8adb1a6622a09ed03c (diff)
downloadcpython-ed3909bd7caafb33c95f98b0252736d17de7b6fe.tar.gz
fix bogus test for negative float
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 050006082b..0dc6f00bff 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)