[Cython] 'local variable referenced before assignment' warnings

Stefan Behnel stefan_ml at behnel.de
Sun Sep 25 18:46:47 CEST 2011

Vitja Makarov, 23.09.2011 16:38:
> 2011/9/23 mark florisson:
>> Can't you run the entire CF analysis after analyse expressions? I
>> think only the code generation needs the cf_* attributes?
> I'm not sure here. CF solution could be used to improve type inference
> in the future.

Yes, CF analysis should run rather early - definitely before type analysis.

> May be it's possible to split analyse expressions transform into
> parts: entry lookup and rest expression analysis.

Yes, this has been proposed a couple of times before. I think it's worth 
doing. There should be something like an "early typing" step where types 
are resolved as far as possible, including names defined elsewhere but 
"within reach", and especially references to builtins. Some of the 
optimisation steps can benefit from not having to figure out types themselves.

Eventually, type inference will have to be a global, iterative process, 
certainly when we start inferring things like return types of functions.


More information about the cython-devel mailing list