mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Check in some documentation tweaks for PEP 3141, add some tests, and implement
the promotion to complex on pow(negative, fraction).
This commit is contained in:
parent
aaaef110dc
commit
3404b3ce2a
5 changed files with 68 additions and 33 deletions
|
@ -680,9 +680,10 @@ float_pow(PyObject *v, PyObject *w, PyObject *z)
|
|||
* bugs so we have to figure it out ourselves.
|
||||
*/
|
||||
if (iw != floor(iw)) {
|
||||
PyErr_SetString(PyExc_ValueError, "negative number "
|
||||
"cannot be raised to a fractional power");
|
||||
return NULL;
|
||||
/* Negative numbers raised to fractional powers
|
||||
* become complex.
|
||||
*/
|
||||
return PyComplex_Type.tp_as_number->nb_power(v, w, z);
|
||||
}
|
||||
/* iw is an exact integer, albeit perhaps a very large one.
|
||||
* -1 raised to an exact integer should never be exceptional.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue