You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat dt_test.py
import numpy as np
from numba import njit
@njit
def f(dt64):
return dt64
print(f(np.datetime64(100, "D"))) # Works
@njit
def d():
return np.datetime64(100, "D")
print(d()) # Fails
$ python dt_test.py
1970-04-11
Traceback (most recent call last):
File "dt_test.py", line 16, in <module>
print(d()) # Fails
File "/home/juanlu/.pyenv/versions/sgp38/lib/python3.8/site-packages/numba/core/dispatcher.py", line 414, in _compile_for_args
error_rewrite(e, 'typing')
File "/home/juanlu/.pyenv/versions/sgp38/lib/python3.8/site-packages/numba/core/dispatcher.py", line 357, in error_rewrite
raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(datetime64[]) found for signature:
>>> <unknown function>(Literal[int](100), Literal[str](D))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload in function 'make_callable_template.<locals>.generic': File: numba/core/typing/templates.py: Line 170.
With argument(s): '(int64, unicode_type)':
Rejected as the implementation raised a specific error:
TypeError: typer() takes 1 positional argument but 2 were given
raised from /home/juanlu/.pyenv/versions/sgp38/lib/python3.8/site-packages/numba/core/typing/templates.py:399
During: resolving callee type: class(datetime64[])
During: typing of call at dt_test.py (14)
File "dt_test.py", line 14:
def d():
return np.datetime64(100, "D")
^
Tested on Python 3.8, Linux, latest numba installed from pip using manylinux wheels.
The text was updated successfully, but these errors were encountered:
Reporting a bug
visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
i.e. it's possible to run as 'python bug.py'.
By reading in https://numba.readthedocs.io/en/stable/reference/numpysupported.html#scalar-types that Numba supports NumPy datetimes and timestamps of any unit, I tried creating one inside a
@njit
ted function, but it failed:Tested on Python 3.8, Linux, latest numba installed from pip using manylinux wheels.
The text was updated successfully, but these errors were encountered: