From 22b150398d16741dbffbb57379178146499ecbf8 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 14 Dec 2010 06:49:49 +0100 Subject: [PATCH] C code simplification --- Cython/Compiler/Code.py | 2 +- Cython/Compiler/Nodes.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index ec11fd97..cb279e07 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -1286,7 +1286,7 @@ class CCodeWriter(object): # code = "((PyObject*)%s)" % code self.put_init_to_py_none(code, entry.type, nanny) if entry.in_closure: - self.put_giveref(code) + self.put_giveref('Py_None') def put_pymethoddef(self, entry, term, allow_skip=True): if entry.is_special or entry.name == '__getattribute__': diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index ea4e42bd..d3443036 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2927,9 +2927,9 @@ class DefNode(FuncDefNode): if arg.needs_conversion: self.generate_arg_conversion(arg, code) elif arg.entry.in_closure: - code.putln('%s = %s;' % (arg.entry.cname, arg.hdr_cname)) if arg.type.is_pyobject: - code.put_var_incref(arg.entry) + code.put_incref(arg.hdr_cname, py_object_type) + code.putln('%s = %s;' % (arg.entry.cname, arg.hdr_cname)) def generate_arg_conversion(self, arg, code): # Generate conversion code for one argument. -- 2.26.2