Robert Bradshaw, 13.11.2010 05:17:
> On Fri, Nov 12, 2010 at 2:20 PM, Stefan Behnel wrote:
>>> Would a change like this be suitable for 0.13.1 or rather 0.14?
>
> I'd say so, but I'm not 100% sure. Could you be more precise about
> what changed? Before, if you had something like
>
> a = 1000000000000000000
> b = 1<< 100
>
> it worked just fine.
There were apparently cases where the simple large integer assignments
above wouldn't work. I already gave the example of
huge = 1L << 40000
> It's clear you did some major re-writing here
> though. Would it be fair to say the (post-changes) semantics of
> integer constants (literals or compile time expressions) are that they
> are C ints if they are less than 32 bits, and Python object otherwise?
> In both cases coercible to the other depending on the context (e.g.
> assignment to a cdef'd variable)?
Yes, I think that's basically it. I consider it much safer now because
large integer constants will not just accidentally end up in the C code.
Plus, the constant folding code now keeps track of the signedness and
longness of literals, so if we end up coercing back to C, the literal will
be well written.
And negative signs were not constant folded, so
a = -(1 << 100)
didn't work for me.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev