Patrick Snape
2014-10-15 18:27:46 UTC
System information:
Ubuntu 14.04 x64
gcc: Version 4.8.2 (Ubuntu 4.8.2-19ubuntu1), Target: x86_64-linux-gnu
To reproduce:
# distutils: language = c++
import numpy as np
cimport numpy as np
cimport cython
cdef test_np_int64(const np.int64_t test_var):
cdef np.int64_t error = test_var / 2
This fails to compile with the error:
In function âconst __pyx_t_5numpy_int64_t
__Pyx_div___pyx_t_5numpy_int64_t__const__(__pyx_t_5numpy_int64_t,
__pyx_t_5numpy_int64_t)â:
error: assignment of read-only variable âqâ
q -= ((r != 0) & ((r ^ b) < 0));
Using just a regular int type:
# distutils: language = c++
import numpy as np
cimport numpy as np
cimport cython
cdef test_int(const int test_var):
cdef int no_error = test_var / 2
Works as expected.
Fixing this is as simple as removing the const that is being complained
about. I assume this is a bug? I can't see why I wouldn't be allowed to
perform that operation?
Regards,
Patrick
Ubuntu 14.04 x64
gcc: Version 4.8.2 (Ubuntu 4.8.2-19ubuntu1), Target: x86_64-linux-gnu
To reproduce:
# distutils: language = c++
import numpy as np
cimport numpy as np
cimport cython
cdef test_np_int64(const np.int64_t test_var):
cdef np.int64_t error = test_var / 2
This fails to compile with the error:
In function âconst __pyx_t_5numpy_int64_t
__Pyx_div___pyx_t_5numpy_int64_t__const__(__pyx_t_5numpy_int64_t,
__pyx_t_5numpy_int64_t)â:
error: assignment of read-only variable âqâ
q -= ((r != 0) & ((r ^ b) < 0));
Using just a regular int type:
# distutils: language = c++
import numpy as np
cimport numpy as np
cimport cython
cdef test_int(const int test_var):
cdef int no_error = test_var / 2
Works as expected.
Fixing this is as simple as removing the const that is being complained
about. I assume this is a bug? I can't see why I wouldn't be allowed to
perform that operation?
Regards,
Patrick