Dicts with tuple keys not working in 0.52.0

I’m using a dict with a tuple as the key which worked fine in 0.51.2, but does not work in 0.52.0:

import numpy as np
import numba

@numba.njit
def testdict(tuptype):
    tdict = numba.typed.Dict.empty(tuptype, numba.core.types.float32)
    t1 = np.array([3], dtype=np.uint64)
    t2 = np.array([5.67], dtype=np.float32)
    v1 = np.array([10.23], dtype=np.float32)
    tdict[(t1[0], t2[0])] = v1[0]
    # 0.51.2 prints True as expected; 0.52.0 prints False
    print((t1[0], t2[0]) in tdict)

testdict(
  numba.core.types.Tuple((numba.core.types.uint64, numba.core.types.float32)))

When I try to check membership of an element that I just stored, 0.52.0 returns False.

Hi @kartiksubbarao,

I suspect this will come down to a mix of floating point representations and the types in use (and possible type casting) in the various ways typed.Dict can be used, however I think it should be investigated as a potential bug. Please could you open a bug report on the issue tracker and someone can take a look,

Thanks for your help!

Done: https://github.com/numba/numba/issues/6570

Thank you for doing that :slight_smile: