From 27f4b996a9a3f5a690ac667f7b619dda7979bc21 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 20 Feb 2009 01:50:40 +0100 Subject: [PATCH] Fix #200 (together with Lisandro Dalcin) --- Cython/Compiler/Nodes.py | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.26.2