Robert Bradshaw, 08.02.2011 22:01:
> On Tue, Feb 8, 2011 at 2:21 AM, Stefan Behnel wrote:
>> Vitja Makarov, 08.02.2011 10:16:
>>> Trying to merge latest changes in argument parsing code I found that
>>> it still uses direct returns
>>>
>>> https://github.com/cython/cython/blob/master/Cython/Compiler/Nodes.py#L2624
>>>
>>> Like this:
>>>           if self.starstar_arg:
>>>               self.starstar_arg.entry.xdecref_cleanup = 0
>>>               code.putln('%s = PyDict_New(); if (unlikely(!%s)) return %s;' 
>>> % (
>>>                       self.starstar_arg.entry.cname,
>>>                       self.starstar_arg.entry.cname,
>>>                       self.error_value()))
>>>               code.put_gotref(self.starstar_arg.entry.cname)
>>> Or this:
>>>               if self.starstar_arg:
>>>                   code.putln("")
>>>                   code.putln("if (unlikely(!%s)) {" % 
>>> self.star_arg.entry.cname)
>>>                   code.put_decref_clear(self.starstar_arg.entry.cname,
>>> py_object_type)
>>>                   code.putln('return %s;' % self.error_value())
>>>                   code.putln('}')
>>>               else:
>>>                   code.putln("if (unlikely(!%s)) return %s;" % (
>>>                           self.star_arg.entry.cname, self.error_value()))
>>>
>>> That's not good because current scope and refnanny context is already
>>> created and should be freed.
>>
>> These aren't really critical bugs as they only deal with memory problems.
>> Unless you want to rework them now, I think this is something that we
>> should clean up as part of the DefNode/CFuncDefNode refactoring during the
>> workshop.
>
> They are certainly bugs, so please file a ticket or add a note in the
> code at least.

I agree that they are bugs. The (safe) quick fix (that could go into 
0.14.2) would be to insert code to clean up the refnanny and the closure 
context before the return statements. This can be cleaned up for 0.15.

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to