From: Dag Sverre Seljebotn Date: Fri, 20 Feb 2009 00:50:40 +0000 (+0100) Subject: Fix #200 (together with Lisandro Dalcin) X-Git-Tag: 0.11.rc~78 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=27f4b996a9a3f5a690ac667f7b619dda7979bc21;p=cython.git Fix #200 (together with Lisandro Dalcin) --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 310bdb49..43913284 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1054,6 +1054,8 @@ class FuncDefNode(StatNode, BlockNode): code.put_var_declarations(lenv.var_entries) init = "" if not self.return_type.is_void: + if self.return_type.is_pyobject: + init = " = NULL" code.putln( "%s%s;" % (self.return_type.declaration_code( @@ -3370,6 +3372,9 @@ class ReturnStatNode(StatNode): if not self.return_type: # error reported earlier return + if self.return_type.is_pyobject: + code.put_xdecref(Naming.retval_cname, + self.return_type) if self.value: self.value.generate_evaluation_code(code) self.value.make_owned_reference(code)