Commit 22b15039 authored by Stefan Behnel's avatar Stefan Behnel

C code simplification

parent 208b2168
...@@ -1286,7 +1286,7 @@ class CCodeWriter(object): ...@@ -1286,7 +1286,7 @@ class CCodeWriter(object):
# code = "((PyObject*)%s)" % code # code = "((PyObject*)%s)" % code
self.put_init_to_py_none(code, entry.type, nanny) self.put_init_to_py_none(code, entry.type, nanny)
if entry.in_closure: if entry.in_closure:
self.put_giveref(code) self.put_giveref('Py_None')
def put_pymethoddef(self, entry, term, allow_skip=True): def put_pymethoddef(self, entry, term, allow_skip=True):
if entry.is_special or entry.name == '__getattribute__': if entry.is_special or entry.name == '__getattribute__':
......
...@@ -2927,9 +2927,9 @@ class DefNode(FuncDefNode): ...@@ -2927,9 +2927,9 @@ class DefNode(FuncDefNode):
if arg.needs_conversion: if arg.needs_conversion:
self.generate_arg_conversion(arg, code) self.generate_arg_conversion(arg, code)
elif arg.entry.in_closure: elif arg.entry.in_closure:
code.putln('%s = %s;' % (arg.entry.cname, arg.hdr_cname))
if arg.type.is_pyobject: 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): def generate_arg_conversion(self, arg, code):
# Generate conversion code for one argument. # Generate conversion code for one argument.
......
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