Commit e692110d authored by Danilo Freitas's avatar Danilo Freitas

Small changes on DelStatNode

parent 6ee3cf6e
......@@ -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):
......
......@@ -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)
......
......@@ -12,7 +12,6 @@ class TestDecorator(TransformTest):
def decorated():
pass
""")
self.assertCode(u"""
def decorator(fun):
return fun
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment