From 6ee3cf6e0f9b30abacf1c6ad347ec200fbabebe2 Mon Sep 17 00:00:00 2001 From: Danilo Freitas Date: Thu, 2 Jul 2009 03:46:34 -0300 Subject: [PATCH] del statement for C++ objects --- Cython/Compiler/Nodes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 7763479c..793cd91a 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -3386,7 +3386,7 @@ class DelStatNode(StatNode): def analyse_expressions(self, env): for arg in self.args: arg.analyse_target_expression(env, None) - if arg.type.is_pyobject: + if arg.type.is_pyobject or (arg.type.is_ptr and arg.type.base_type.is_cpp_class): self.gil_check(env) else: error(arg.pos, "Deletion of non-Python object") @@ -3398,6 +3398,8 @@ class DelStatNode(StatNode): for arg in self.args: if arg.type.is_pyobject: arg.generate_deletion_code(code) + elif arg.type.is_ptr and arg.type.base_type.is_cpp_class: + code.putln("delete %s" % arg.name) # else error reported earlier def annotate(self, code): -- 2.26.2