[Cython] Cython 0.23: long + int == int

Stefan Behnel stefan_ml at behnel.de
Mon Aug 17 20:33:09 CEST 2015


Jakub Wilk schrieb am 14.08.2015 um 10:41:
> $ cython --version
> Cython version 0.23
> $ python2.6 --version
> Python 2.6.8
> $ cat testlong.pyx
> def f(x):
>        return 0L + x
> $ python2.6 -c 'import pyximport as p; p.install(); import testlong; print
> type(testlong.f(42))'
> <type 'int'>
> 
> I added a long to an int, so I'd expect the result to be a long.
> This works correctly in Python 2.7:
> 
> $ python2.7 -c 'import pyximport as p; p.install(); import testlong; print
> type(testlong.f(42))'
> <type 'long'>
> 
> It also worked correctly in Cython 0.22.1 + Python 2.6.

I understand that this is not entirely correct, but does it pose any
problems in practice? The "int" type has been removed in Py3, after all, so
this behaviour will go away all by itself as soon as support for Python 2.x
is removed at some point in the future.

Stefan



More information about the cython-devel mailing list