summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-18 14:51:32 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-18 14:51:32 (GMT)
commit8a1e8eb62fc89814a942f6ba59cac0ac32cd9fe5 (patch)
tree2802736b8c8592408da260527dd4009a875a5328 /Python
parent6a75d26622a79c7d9a4af7a7301cc368854cea2d (diff)
downloadcpython-8a1e8eb62fc89814a942f6ba59cac0ac32cd9fe5.zip
cpython-8a1e8eb62fc89814a942f6ba59cac0ac32cd9fe5.tar.gz
cpython-8a1e8eb62fc89814a942f6ba59cac0ac32cd9fe5.tar.bz2
fix bogus test for negative float
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 0500060..0dc6f00 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)