From: Stefan Behnel Date: Tue, 14 Dec 2010 05:49:49 +0000 (+0100) Subject: C code simplification X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=22b150398d16741dbffbb57379178146499ecbf8;p=cython.git C code simplification --- 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.