From 1b7a9a990243a30d73689eab0b79c0654a442b48 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 18 Nov 2008 21:37:05 +0100 Subject: [PATCH] use PyDict_DelItem() for 'del d[x]' --- Cython/Compiler/ExprNodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index f8a01f36..3e385b7b 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1720,8 +1720,11 @@ class IndexNode(ExprNode): index_code = self.index.result() code.globalstate.use_utility_code(delitem_int_utility_code) else: - function = "PyObject_DelItem" index_code = self.index.py_result() + if self.base.type is dict_type: + function = "PyDict_DelItem" + else: + function = "PyObject_DelItem" code.putln( "if (%s(%s, %s%s) < 0) %s" % ( function, -- 2.26.2