Dictionary return type, brackets vs get function

Hello, I’m trying to use values stored in a dict as indices for a list but I am getting an error when I try to use the get() function instead of brackets so that I can used default values. I assume that there is some kind of typing issue here but I can’t figure it out. My Numba version is 0.57.1, my Python version is 3.10

A workaround is to add 0 to the returned value for implicit casting but i would like to fix the problem not the symptom.

Here is an example:

from numba.experimental import jitclass
from numba import types, typed

spec = [
    ('numba_list', types.ListType(types.int64)),
    ('numba_dict', types.DictType(

class Example(object):
    def __init__(self):
        self.numba_list = typed.List.empty_list(types.int64)
        self.numba_dict = typed.Dict.empty(
        self.numba_dict[0] = 1

    def getValue(self):
        return self.numba_list[self.numba_dict[0]]

    def getError(self):
        return self.numba_list[self.numba_dict.get(0, -1)] # Same behavior without default value

example = Example()


this leads to

/home/gas/PycharmProjects/pythonProject/venv/bin/python /home/gas/PycharmProjects/pythonProject/main.py 
Traceback (most recent call last):
  File "/home/gas/PycharmProjects/pythonProject/main.py", line 33, in <module>
  File "/home/gas/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/numba/experimental/jitclass/boxing.py", line 61, in wrapper
    return method(*args, **kwargs)
  File "/home/gas/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/numba/core/dispatcher.py", line 468, in _compile_for_args
    error_rewrite(e, 'typing')
  File "/home/gas/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/numba/core/dispatcher.py", line 409, in error_rewrite
    raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
- Resolution failure for literal arguments:
Failed in nopython mode pipeline (step: nopython frontend)
list indices must be integers or slices
During: typing of intrinsic-call at /home/gas/PycharmProjects/pythonProject/main.py (26)

File "main.py", line 26:
    def getError(self):
        return self.numba_list[self.numba_dict.get(0, -1)]

- Resolution failure for non-literal arguments:

During: resolving callee type: BoundFunction((<class 'numba.core.types.misc.ClassInstanceType'>, 'getError') for instance.jitclass.Example#7fc55cebbbb0<numba_list:ListType[int64],numba_dict:DictType[int64,int64]<iv=None>>)
During: typing of call at <string> (3)

File "<string>", line 3:
<source missing, REPL/exec in use?>

Process finished with exit code 1