Commit 81c5248e authored by Stefan Behnel's avatar Stefan Behnel

don't use PyTuple_SetItem(): it differs from 'tup[i] = x' as it does not raise a TypeError

parent 1b7a9a99
......@@ -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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment