[Cython] Overflow semantics in pure Python mode

Robert Bradshaw robertwb at math.washington.edu
Thu Nov 6 17:17:10 CET 2008


On Nov 6, 2008, at 5:14 AM, Stefan Behnel wrote:

> Willem Broekema wrote:
>> In Pure Python mode, code compiled (using annotations) to C should  
>> run
>> equivalent to running (ignoring annotations) in the Python
>> interpreter. That implies that a variable declared as cython.int may
>> not rely on overflow behavior, as Python would automatically make a
>> long object for such a result. And the same also holds for the other
>> numeric types, from char to longlong. Right?
>
> Yep, developers should avoid writing broken code. :)

Um, No. If you declare a variable to be int then it *will* overflow  
when compiled but not (currently) when interpreted.

- Robert




More information about the Cython-dev mailing list