arg.hdr_type.declaration_code(arg.hdr_cname))
if not self.entry.is_special and sig.method_flags() == [TypeSlots.method_noargs]:
arg_code_list.append("CYTHON_UNUSED PyObject *unused")
+ if (self.entry.scope.is_c_class_scope and self.entry.name == "__ipow__"):
+ arg_code_list.append("CYTHON_UNUSED PyObject *unused")
if sig.has_generic_args:
arg_code_list.append(
"PyObject *%s, PyObject *%s"
MethodSlot(ibinaryfunc, "nb_inplace_multiply", "__imul__"),
MethodSlot(ibinaryfunc, "nb_inplace_divide", "__idiv__", py3 = False),
MethodSlot(ibinaryfunc, "nb_inplace_remainder", "__imod__"),
- MethodSlot(ternaryfunc, "nb_inplace_power", "__ipow__"), # NOT iternaryfunc!!!
+ MethodSlot(ibinaryfunc, "nb_inplace_power", "__ipow__"), # actually ternaryfunc!!!
MethodSlot(ibinaryfunc, "nb_inplace_lshift", "__ilshift__"),
MethodSlot(ibinaryfunc, "nb_inplace_rshift", "__irshift__"),
MethodSlot(ibinaryfunc, "nb_inplace_and", "__iand__"),
+class IPOW:
+ """
+ >>> IPOW().__ipow__('a')
+ a
+ >>> x = IPOW()
+ >>> x **= 'z'
+ z
+ """
+ def __ipow__(self, other):
+ print ("%s" % other)
+
cdef class CrashIPOW:
"""
>>> CrashIPOW().__ipow__('a')
+ a
+ >>> x = CrashIPOW()
+ >>> x **= 'z'
+ z
"""
- def __ipow__(self, other, mod):
- print "%s, %s" % (other, mod)
+ def __ipow__(self, other):
+ print ("%s" % other)