Hi,

this code in Nodes.py around line 3950, at the end of the DefNodeWrapper's
method generate_keyword_unpacking_code(), was added as part of the memory
view changes, back in July last year:

"""
        # convert arg values to their final type and assign them
        for i, arg in enumerate(all_args):
            if arg.default and not arg.type.is_pyobject:
                code.putln("if (values[%d]) {" % i)
            if arg.default and not arg.type.is_pyobject:
                code.putln('} else {')
                code.putln(
                    "%s = %s;" % (
                        arg.entry.cname,
                        arg.calculate_default_value_code(code)))
                if arg.type.is_memoryviewslice:
                    code.put_incref_memoryviewslice(arg.entry.cname,
                                                    have_gil=True)
                code.putln('}')
"""

By being overly complicated, it hides rather well what it's actually meant
to achieve. It doesn't do at all what its comment says and also refers to
the default value of the argument, which is already assigned way before
this place in the code. Therefore, I'd be surprised if it generated
anything but dead C code, because the case that "values[i]" is NULL should
never happen.

Mark, could you comment on this? Is this just a left-over from a broken
merge or something?

Stefan
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to