__setslice__ and __delslice__ were removed in Py3
authorStefan Behnel <scoder@users.berlios.de>
Wed, 14 May 2008 19:39:24 +0000 (21:39 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 14 May 2008 19:39:24 +0000 (21:39 +0200)
Cython/Compiler/ModuleNode.py
Cython/Compiler/TypeSlots.py

index 6a0aaf074d55b51f00f9acba2cd34666c1671b3d..3a25b73ed4c229f2e0f881a16d5614a937f72f47 100644 (file)
@@ -20,7 +20,7 @@ import PyrexTypes
 import TypeSlots
 import Version
 
-from Errors import error
+from Errors import error, warning
 from PyrexTypes import py_object_type
 from Cython.Utils import open_new_file, replace_suffix
 
@@ -707,6 +707,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                     if scope.defines_any(["__setitem__", "__delitem__"]):
                         self.generate_ass_subscript_function(scope, code)
                     if scope.defines_any(["__setslice__", "__delslice__"]):
+                        warning(self.pos, "__setslice__ and __delslice__ are not supported by Python 3")
                         self.generate_ass_slice_function(scope, code)
                     if scope.defines_any(["__getattr__","__getattribute__"]):
                         self.generate_getattro_function(scope, code)
index 63439e949acdc18017d3a86f28609e672bb2d1f5..d05edb6182ada53f032909f5368872ca0bfc00dc 100644 (file)
@@ -212,8 +212,8 @@ class InternalMethodSlot(SlotDescriptor):
     #
     #  slot_name    string           Member name of the slot in the type object
 
-    def __init__(self, slot_name):
-        SlotDescriptor.__init__(self, slot_name)
+    def __init__(self, slot_name, py3k = True):
+        SlotDescriptor.__init__(self, slot_name, py3k = py3k)
 
     def slot_code(self, scope):
         return scope.mangle_internal(self.slot_name)
@@ -271,8 +271,8 @@ class SyntheticSlot(InternalMethodSlot):
     #  alternative default value will be placed in the type
     #  slot.
     
-    def __init__(self, slot_name, user_methods, default_value):
-        InternalMethodSlot.__init__(self, slot_name)
+    def __init__(self, slot_name, user_methods, default_value, py3k = True):
+        InternalMethodSlot.__init__(self, slot_name, py3k = py3k)
         self.user_methods = user_methods
         self.default_value = default_value
     
@@ -574,7 +574,7 @@ PySequenceMethods = (
     SyntheticSlot("sq_item", ["__getitem__"], "0"),    #EmptySlot("sq_item"),   # mp_subscript used instead
     MethodSlot(ssizessizeargfunc, "sq_slice", "__getslice__"),
     EmptySlot("sq_ass_item"), # mp_ass_subscript used instead
-    SyntheticSlot("sq_ass_slice", ["__setslice__", "__delslice__"], "0"),
+    SyntheticSlot("sq_ass_slice", ["__setslice__", "__delslice__"], "0", py3k = False),
     MethodSlot(cmpfunc, "sq_contains", "__contains__"),
     EmptySlot("sq_inplace_concat"), # nb_inplace_add used instead
     EmptySlot("sq_inplace_repeat"), # nb_inplace_multiply used instead