[Cython] Cython 0.23.3 compiler warning with fused types

Josh Ayers josh at ayers.pw
Sat Oct 3 18:04:10 CEST 2015


Cython devs,

Using Cython 0.23.3 and Python 3.4.3, the following Cython code:

ctypedef fused floating:
    float
    double

cpdef add_one(floating [:] array):
    cdef Py_ssize_t i
    for i in range(array.shape[0]):
        array[i] += 1.0

produces the C code below.  It raises a compiler warning because a long
is assigned to a char.

char __pyx_v_kind;
...
long __pyx_t_11;
...
__pyx_t_11 = __Pyx_PyObject_Ord(__pyx_t_8);
...
__pyx_v_kind = __pyx_t_11;


Thanks,
Josh Ayers


More information about the cython-devel mailing list