I wasn’t sure what category this should be in, so I used ‘How do I?’. It appears to be a regression in 0.54.1. It doesn’t appear to be related to this item, but that might be of interest. I’m on Windows 10 with Python 3.7.3.
If this is better filed as a git issue, let me know and I’ll cross post it there. My initial comment was in gitter, here’s the min repro.
This code works with plain python and numba 0.53.1 but not 0.54.1
from enum import IntEnum
import numba
print(numba.__version__)
class PmtType(IntEnum):
LEVELA = 1
LEVELB = 2
@numba.njit
def tester():
return numba.int16(PmtType.LEVELA)
print(tester())
Numba 0.53.1:
0.53.1
1
Numba 0.54.1:
0.54.1
File “int_enum.py”, line 16, in
print(tester())
File “C:\work\git\mims\venv\lib\site-packages\numba\core\dispatcher.py”, line 482, in _compile_for_args
error_rewrite(e, ‘typing’)
File “C:\work\git\mims\venv\lib\site-packages\numba\core\dispatcher.py”, line 423, 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(int16) found for signature:(IntEnum(PmtType))
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload in function ‘make_callable_template..generic’: File: numba\core\typing\templates.py: Line 174.
With argument(s): ‘(IntEnum(PmtType))’:
Rejected as the implementation raised a specific error:
TypingError: Casting IntEnum(PmtType) to int16 directly is unsupported.
raised from C:\work\git\mims\venv\lib\site-packages\numba\core\typing\builtins.py:818During: resolving callee type: class(int16)
During: typing of call at C:/work/git/ims_core/playground/erik/discourse/int_enum.py (14)File “int_enum.py”, line 14:
def tester():
return numba.int16(PmtType.LEVELA)
^
Process finished with exit code 1