diff options
author | Guido van Rossum <guido@python.org> | 2002-10-15 01:01:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-10-15 01:01:53 (GMT) |
commit | 6e5680fc83f3cb66af9c0f3b29ac84d2765293e1 (patch) | |
tree | d17f9319f9e7fb479dfd3f5ac91350f79b22f5e5 /Objects | |
parent | 13b1a5cc990e4bbffa47d58a6769b5940da7548e (diff) | |
download | cpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.zip cpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.tar.gz cpython-6e5680fc83f3cb66af9c0f3b29ac84d2765293e1.tar.bz2 |
For some reason (probably cut and paste), __ipow__ for new-style
classes was called with three arguments. This makes no sense, there's
no way to pass in the "modulo" 3rd argument as for __pow__, and
classic classes don't do this. [SF bug 620179]
I don't want to backport this to 2.2.2, because it could break
existing code that has developed a work-around. Code in 2.2.2 that
wants to use __ipow__ and wants to be forward compatible with 2.3
should be written like this:
def __ipow__(self, exponent, modulo=None):
...
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e11b87f..ed5b829 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3399,7 +3399,7 @@ SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *, "O") SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *, "O") SLOT1(slot_nb_inplace_divide, "__idiv__", PyObject *, "O") SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *, "O") -SLOT2(slot_nb_inplace_power, "__ipow__", PyObject *, PyObject *, "OO") +SLOT1(slot_nb_inplace_power, "__ipow__", PyObject *, "O") SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O") SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O") SLOT1(slot_nb_inplace_and, "__iand__", PyObject *, "O") @@ -4038,7 +4038,7 @@ static slotdef slotdefs[] = { IBSLOT("__imod__", nb_inplace_remainder, slot_nb_inplace_remainder, wrap_binaryfunc, "%"), IBSLOT("__ipow__", nb_inplace_power, slot_nb_inplace_power, - wrap_ternaryfunc, "**"), + wrap_binaryfunc, "**"), IBSLOT("__ilshift__", nb_inplace_lshift, slot_nb_inplace_lshift, wrap_binaryfunc, "<<"), IBSLOT("__irshift__", nb_inplace_rshift, slot_nb_inplace_rshift, |