From: Stefan Behnel Date: Tue, 18 Nov 2008 20:06:09 +0000 (+0100) Subject: use type specific Py*_SetItem() functions X-Git-Tag: 0.11-beta~239 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dca6de60d56592b59fa462c4479ad74179baaf33;p=cython.git use type specific Py*_SetItem() functions --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index f9e78cd4..f8a01f36 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1656,8 +1656,15 @@ class IndexNode(ExprNode): index_code = self.index.result() code.globalstate.use_utility_code(setitem_int_utility_code) else: - function = "PyObject_SetItem" index_code = self.index.py_result() + if self.base.type is dict_type: + function = "PyDict_SetItem" + elif self.base.type is list_type: + function = "PyList_SetItem" + elif self.base.type is tuple_type: + function = "PyTuple_SetItem" + else: + function = "PyObject_SetItem" code.putln( "if (%s(%s, %s, %s%s) < 0) %s" % ( function,