[Cython] __future__.division on constants and C integers

Stefan Behnel stefan_ml at behnel.de
Sun Jul 5 10:20:57 CEST 2009


Hi,

Dag Sverre Seljebotn wrote:
> Why is compile time folding done before expression analysis?

;) Because you proposed to move it there at the time? The alternative was
to split the type analysis phase to make some type information available
before the 'real' analysis.


> It would 
> seem sensible that as compile time folding shouldn't affect semantics (? 
> at least expression type semantics?) it can just as well be done after 
> expression analysis.

I did that to fix places where the "result_code" was used during the type
analysis phase. It's also great to know that an expression is constant in a
couple of other places, such as the decision if division needs a zero check.

This somewhat covers the problem that type analysis is still doing stuff in
some nodes that would fit a lot better into later phases, especially into
code generation. We did most of this for 0.12 already (e.g. gil checking),
but there are still issues.

Stefan


More information about the Cython-dev mailing list