don't use PyTuple_SetItem(): it differs from 'tup[i] = x' as it does not raise a...
authorStefan Behnel <scoder@users.berlios.de>
Wed, 19 Nov 2008 06:22:39 +0000 (07:22 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 19 Nov 2008 06:22:39 +0000 (07:22 +0100)
Cython/Compiler/ExprNodes.py

index 3e385b7b7cf6da9dbf0bc12859277cc4958ca677..64fe891520cdc6041e3332842e0ee7e52bd641d6 100644 (file)
@@ -1661,8 +1661,12 @@ class IndexNode(ExprNode):
                 function = "PyDict_SetItem"
             elif self.base.type is list_type:
                 function = "PyList_SetItem"
-            elif self.base.type is tuple_type:
-                function = "PyTuple_SetItem"
+            # don't use PyTuple_SetItem(), as we'd normally get a
+            # TypeError when changing a tuple, while PyTuple_SetItem()
+            # would allow updates
+            #
+            #elif self.base.type is tuple_type:
+            #    function = "PyTuple_SetItem"
             else:
                 function = "PyObject_SetItem"
         code.putln(