-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numba could not report the error of out of array in njit? #8914
Comments
An array with 10 elements has indices 0-9 - if you print the element at index 10 this is a value beyond the end of the array. You can catch errors like this with the import numba
import numpy as np
@numba.njit(boundscheck=True)
def f():
a = np.zeros(10)
print(a[10])
f() prints:
Generally |
Indeed, the relevant docs are here: https://numba.pydata.org/numba-doc/dev/reference/pysemantics.html?highlight=boundscheck#bounds-checking |
thanks! I learn a lot from the docs. |
thanks a lot. |
Because it's faster to omit the boundscheck - it's not designed without it, it's just that you have to opt-in to it. |
thanks a lot! |
My code is here:
this program can work and print "1.3351156154062717e-306"
the numba version is 0.54.0
python version is 3.8.10
numpy version is 1.20.3
The text was updated successfully, but these errors were encountered: