[Cython] flow control analysis of expressions (was: segfault due to using DECREF instead of XDECREF)

Stefan Behnel stefan_ml at behnel.de
Fri Jan 31 12:59:32 CET 2014


[looks like the mailing list server failed to accept this, so here it is again]

Victor Makarov, 29.01.2014 18:35:
> 2014/1/29 Stefan Behnel:
>> Victor Makarov, 26.01.2014 20:15:
>>> Fixed here https://github.com/cython/cython/commit/9f7256fd07961b912d2224d995533c821441381b
>>
>> Hmm, it's unfortunate that this needs to be disabled.
>>
>> I guess the correct way to eventually implement this would be by creating a
>> new control flow block also for RHS of the BoolBinopNode, right?
> 
> I don't think it's a big deal because It only affects 'may be null'
> variables that aren't common in python world.

Agreed.


> OTOH it would be great to fix this. Easy way is to create a new CF
> block for each reference. I'm not sure that BoolBinopNode is enough.

Well, then anything that short-circuits, i.e. that has an actual control
flow impact. In expressions like

    x = a + b - c

it's clear that if no exception is raised, all variables will have been
evaluated, whereas in

    x = a + b or c

the variable c may or may not have been touched, but a and b definitely
were. The same applies to conditional "x if y else z" expressions, but I
don't think there are so many more. Anything scoped (genexprs, listcomps,
lambdas) obviously doesn't fit here and can simply be handled as before.

Stefan



More information about the cython-devel mailing list