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
ir_utils causes a DeprecationWarning in numpy 1.20 #6175
Comments
Thanks for the report - I can see that those lines get hit even when using the builtin.
At this point Numba is still trying to determine what the function and module names are - it happens to try looking at numpy first, and because Lines 1525 to 1527 in c99f3de
to get taken. |
It's probably being run when scanning for closures, reductions and inlinable array calls. |
Note that it's the Can you given me an example of code that does take that branch, and explain why it needs to? |
This would trigger the branch: from numba import njit
from numpy import array
@njit
def foo(n):
return array([x for x in range(n)])
foo(4) the code in question is trying to work out where |
Does that mean that the following doesn't perform that optimization? from numba import njit
from numpy import array as not_array
@njit
def foo(n):
return not_array([x for x in range(n)])
foo(4) |
That'll still get optimised, Lines 1507 to 1512 in c99f3de
|
Been thinking about this a bit, I'm not sure it's avoidable. I think for Numba perhaps it just needs to make sure that internally none of these deprecated aliases are used? If user code is the cause of the deprecation warnings then it's sign the code may need to change? I also think that |
Done in #6176
The user code at the top of this issue does not reference the deprecated aliases at all. |
That seems quite reasonable to me |
If this is done, I think this applies:
Numba would only be asking NumPy about things that are likely actually in NumPy and then if one of these things is deprecated and NumPy warns, that's legitimate? |
Yes, sounds good to me. |
These lines:
numba/numba/core/ir_utils.py
Lines 1525 to 1527 in c99f3de
result in the following behavior in numpy 1.20 due to numpy/numpy#14882
This doesn't make any sense to me - why is
numba
even looking at numpy when I use a builtin function?The text was updated successfully, but these errors were encountered: