From: Stefan Behnel Date: Wed, 19 Nov 2008 06:22:39 +0000 (+0100) Subject: don't use PyTuple_SetItem(): it differs from 'tup[i] = x' as it does not raise a... X-Git-Tag: 0.11-beta~237 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=81c5248ef53bff2e770644bbb90a9017da56ff6d;p=cython.git don't use PyTuple_SetItem(): it differs from 'tup[i] = x' as it does not raise a TypeError --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 3e385b7b..64fe8915 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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(