Skip to content
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

NotImplementedError for datetime64[10Y] #9585

Open
gmarkall opened this issue May 23, 2024 · 0 comments · May be fixed by #9595
Open

NotImplementedError for datetime64[10Y] #9585

gmarkall opened this issue May 23, 2024 · 0 comments · May be fixed by #9595
Labels
bug - typing Bugs: occuring at typing time bug

Comments

@gmarkall
Copy link
Member

Reproducer:

from numba import njit
import numpy as np

@njit
def f(x):
    return x + 1

arr = np.array('2010', dtype='datetime64[10Y]')
f(arr)

gives

$ python repro.py 
Traceback (most recent call last):
  File "/home/gmarkall/numbadev/issues/datetime10y/repro.py", line 11, in <module>
    f(arr)
  File "/home/gmarkall/numbadev/numba/numba/core/dispatcher.py", line 688, in typeof_pyval
    tp = typeof(val, Purpose.argument)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gmarkall/numbadev/numba/numba/core/typing/typeof.py", line 33, in typeof
    ty = typeof_impl(val, c)
         ^^^^^^^^^^^^^^^^^^^
  File "/home/gmarkall/miniforge3/envs/numbadev/lib/python3.11/functools.py", line 909, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gmarkall/numbadev/numba/numba/core/typing/typeof.py", line 246, in _typeof_ndarray
    dtype = numpy_support.from_dtype(val.dtype)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gmarkall/numbadev/numba/numba/np/numpy_support.py", line 109, in from_dtype
    return _from_datetime_dtype(dtype)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gmarkall/numbadev/numba/numba/np/numpy_support.py", line 74, in _from_datetime_dtype
    raise NotImplementedError(dtype)
NotImplementedError: datetime64[10Y]

I think there's some mixups between errors.NumbaNotImplementedError and NotImplementedError in numba.np.numpy_support, and not enough catching of potential errors in numba.core.typing.typeof leading to this exception bubbling up to the user.

@sklam sklam added bug bug - typing Bugs: occuring at typing time labels May 23, 2024
gmarkall added a commit to gmarkall/numba that referenced this issue May 28, 2024
gmarkall added a commit to gmarkall/numba that referenced this issue May 28, 2024
gmarkall added a commit to gmarkall/numba that referenced this issue May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - typing Bugs: occuring at typing time bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants