From: Stefan Behnel Date: Fri, 30 May 2008 10:08:22 +0000 (+0200) Subject: Py3 fix for PyNumberMethods cleanup X-Git-Tag: 0.9.8rc1~11^2~10^2~6^2~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4fab59dd8b43fcfe32554c7771694264bf270240;p=cython.git Py3 fix for PyNumberMethods cleanup --- diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py index 78c59e2f..c1890730 100644 --- a/Cython/Compiler/TypeSlots.py +++ b/Cython/Compiler/TypeSlots.py @@ -177,8 +177,8 @@ class FixedSlot(SlotDescriptor): # # value string - def __init__(self, slot_name, value): - SlotDescriptor.__init__(self, slot_name) + def __init__(self, slot_name, value, py3k=True): + SlotDescriptor.__init__(self, slot_name, py3k=py3k) self.value = value def slot_code(self, scope): @@ -188,8 +188,8 @@ class FixedSlot(SlotDescriptor): class EmptySlot(FixedSlot): # Descriptor for a type slot whose value is always 0. - def __init__(self, slot_name): - FixedSlot.__init__(self, slot_name, "0") + def __init__(self, slot_name, py3k=True): + FixedSlot.__init__(self, slot_name, "0", py3k=py3k) class MethodSlot(SlotDescriptor): @@ -553,12 +553,12 @@ PyNumberMethods = ( MethodSlot(binaryfunc, "nb_and", "__and__"), MethodSlot(binaryfunc, "nb_xor", "__xor__"), MethodSlot(binaryfunc, "nb_or", "__or__"), - EmptySlot("nb_coerce"), + EmptySlot("nb_coerce", py3k = False), MethodSlot(unaryfunc, "nb_int", "__int__"), MethodSlot(unaryfunc, "nb_long", "__long__"), MethodSlot(unaryfunc, "nb_float", "__float__"), - MethodSlot(unaryfunc, "nb_oct", "__oct__"), - MethodSlot(unaryfunc, "nb_hex", "__hex__"), + MethodSlot(unaryfunc, "nb_oct", "__oct__", py3k = False), + MethodSlot(unaryfunc, "nb_hex", "__hex__", py3k = False), # Added in release 2.0 MethodSlot(ibinaryfunc, "nb_inplace_add", "__iadd__"),