diff options
author | Guido van Rossum <guido@python.org> | 1995-02-10 16:57:16 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-02-10 16:57:16 (GMT) |
commit | 2165158ab32bf1808478cb0199df45d8be1ec2f4 (patch) | |
tree | 460871c693308e64a48c6d43015e665425688240 /Python | |
parent | b7d3d4e5d6ab4f74f7c30f2f0bade59ef7b7cb7d (diff) | |
download | cpython-2165158ab32bf1808478cb0199df45d8be1ec2f4.zip cpython-2165158ab32bf1808478cb0199df45d8be1ec2f4.tar.gz cpython-2165158ab32bf1808478cb0199df45d8be1ec2f4.tar.bz2 |
test for float to the float power here
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 551d009..83eeecb 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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); |