From: Danilo Freitas Date: Thu, 2 Jul 2009 06:46:34 +0000 (-0300) Subject: del statement for C++ objects X-Git-Tag: 0.13.beta0~353^2~73 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6ee3cf6e0f9b30abacf1c6ad347ec200fbabebe2;p=cython.git del statement for C++ objects --- 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):