From 81c5248ef53bff2e770644bbb90a9017da56ff6d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 19 Nov 2008 07:22:39 +0100 Subject: [PATCH] don't use PyTuple_SetItem(): it differs from 'tup[i] = x' as it does not raise a TypeError --- Cython/Compiler/ExprNodes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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( -- 2.26.2