From e692110dc477f0a10e2497b32aec83b68f3eb9f5 Mon Sep 17 00:00:00 2001 From: Danilo Freitas Date: Fri, 3 Jul 2009 03:49:11 -0300 Subject: [PATCH] Small changes on DelStatNode --- Cython/Compiler/Nodes.py | 6 ++++-- Cython/Compiler/Parsing.pxd | 1 + Cython/Compiler/Tests/TestDecorators.py | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 793cd91a..9d37dfbe 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -3388,18 +3388,20 @@ class DelStatNode(StatNode): arg.analyse_target_expression(env, None) if arg.type.is_pyobject or (arg.type.is_ptr and arg.type.base_type.is_cpp_class): self.gil_check(env) + elif arg.type.is_cpp_class: + error(arg.pos, "Deletion of static C++ object") else: error(arg.pos, "Deletion of non-Python object") #arg.release_target_temp(env) - gil_message = "Deleting Python object" + gil_message = "Deleting Python object or C++ dynamic object" def generate_execution_code(self, code): 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) + code.putln("delete %s;" % arg.name) # else error reported earlier def annotate(self, code): diff --git a/Cython/Compiler/Parsing.pxd b/Cython/Compiler/Parsing.pxd index 8cda7b89..8c9742c9 100644 --- a/Cython/Compiler/Parsing.pxd +++ b/Cython/Compiler/Parsing.pxd @@ -27,6 +27,7 @@ cpdef p_typecast(PyrexScanner s) cpdef p_sizeof(PyrexScanner s) cpdef p_yield_expression(PyrexScanner s) cpdef p_power(PyrexScanner s) +cpdef p_new_expr(PyrexScanner s) cpdef p_trailer(PyrexScanner s, node1) cpdef p_call(PyrexScanner s, function) cpdef p_index(PyrexScanner s, base) diff --git a/Cython/Compiler/Tests/TestDecorators.py b/Cython/Compiler/Tests/TestDecorators.py index 7f494351..c8ec01b8 100644 --- a/Cython/Compiler/Tests/TestDecorators.py +++ b/Cython/Compiler/Tests/TestDecorators.py @@ -12,7 +12,6 @@ class TestDecorator(TransformTest): def decorated(): pass """) - self.assertCode(u""" def decorator(fun): return fun -- 2.26.2