Checking type of object inside a function of a jit class

Hello,

I am trying to write a setitem function for a numba-compiled jitclass. I want it to accept both slices and integers, but in order for it to do that, I need to check the type and see whether it is an integer or a slice. This however raises an error.

import numba

.
.
.

def __setitem__(self, idx, value):
        # print(idx)
        
        t = numba.typeof(idx)
        print(t)

        start = idx.start
        stop = idx.stop
        step = idx.step
        print(start)
        print(stop)
        print(step)
        print("hello")

s_m = Class()
s_m[3:10] = 1

This gives me the error:

Failed in nopython mode pipeline (step: nopython frontend)
Unknown attribute 'typeof' of type Module(<module 'numba'

Does your function need to be called from a jitted function?

If not, consider structref. You can have non-jitted member functions with that, where regular python bits work.