Small changes on DelStatNode
authorDanilo Freitas <dsurviver@gmail.com>
Fri, 3 Jul 2009 06:49:11 +0000 (03:49 -0300)
committerDanilo Freitas <dsurviver@gmail.com>
Fri, 3 Jul 2009 06:49:11 +0000 (03:49 -0300)
Cython/Compiler/Nodes.py
Cython/Compiler/Parsing.pxd
Cython/Compiler/Tests/TestDecorators.py

index 793cd91aabbc35a8af37f8b477920b6af05f874f..9d37dfbeaff67cd43a1c30226ce1482236d58ca8 100644 (file)
@@ -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):
index 8cda7b896c6be711c7d60b6848a755d2f56abec0..8c9742c989ebd7d9d75167483aead5bf8770a494 100644 (file)
@@ -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)
index 7f494351b8b16a8ef032554556858333f716a56e..c8ec01b82ce3b9f1035df1f87106b36f93c7a5df 100644 (file)
@@ -12,7 +12,6 @@ class TestDecorator(TransformTest):
         def decorated():
             pass
         """)
-        
         self.assertCode(u"""
         def decorator(fun):
             return fun