summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@gmail.com>2007-09-07 15:15:49 (GMT)
committerJeffrey Yasskin <jyasskin@gmail.com>2007-09-07 15:15:49 (GMT)
commit3404b3ce2acfc550571f06e70526ff75a34effeb (patch)
treef0d59f10296397ed947e970af4fdb8179c5aeef1 /Objects
parentaaaef110dcb58ded6257512997ddf270828dc409 (diff)
downloadcpython-3404b3ce2acfc550571f06e70526ff75a34effeb.zip
cpython-3404b3ce2acfc550571f06e70526ff75a34effeb.tar.gz
cpython-3404b3ce2acfc550571f06e70526ff75a34effeb.tar.bz2
Check in some documentation tweaks for PEP 3141, add some tests, and implement
the promotion to complex on pow(negative, fraction).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/floatobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 7c489d9..eb540e6 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -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.