Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 2306:08b457d6b516 legacy-trunk
test for float to the float power here
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 10 Feb 1995 16:57:16 +0000 |
| parents | 94b84535c34e |
| children | 4c2f1452125d |
line wrap: on
line diff
--- a/Python/bltinmodule.c Fri Feb 10 16:55:33 1995 +0000 +++ b/Python/bltinmodule.c Fri Feb 10 16:57:16 1995 +0000 @@ -916,6 +916,11 @@ 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);
