I am in the process of upgrading some old code from numba 0.16.0 (!!!) to numba 0.33.0 and it looks like one aspect of my old code is broken; I get a TypeError because one of the arguments to a function is a read-only numpy array, and it's incompatible with the numba.jit type signature I gave it.
How do you specify a type is read-only?
Here's a short example that illustrates the problem; this worked fine on numba 0.16 but gives a TypeError on numba 0.33:
-----
import numba
import numpy as np
@numba.jit('f8(u4[:])')
def jabberwocky(data):
x = 0.0
w = 1
for item in data:
x += 1.0*(item*w)
w = -w
return x
data = np.array([1,2,3,4,5],dtype=np.uint32)
data.flags.writeable = False
print data
print jabberwocky(data)
-----
> python numba_test1.py
[1 2 3 4 5]
Traceback (most recent call last):
File "numba_test1.py", line 16, in <module>
print jabberwocky(data)
File "\path\to\anaconda\envs\myenv\lib\site-packages\numba\dispatcher.py", line 399, in _explain_matching_error
raise TypeError(msg)
TypeError: No matching definition for argument type(s) readonly array(uint32, 1d, C)
-----
Is there a way to fix?