How to find my statement that lead to: NumbaTypeSafetyWarning: unsafe cast from int64 to int8. Precision may be lost.?

Hi,

when executing my own code, I get the following warning from numba (numba 0.54.1):

.....lib/python3.8/site-packages/numba/typed/typeddict.py:33: NumbaTypeSafetyWarning: unsafe cast from int64 to int8. Precision may be lost.

How am I able to find the position in my own code where this happened?

Thanks in advance!

Can you include the entire error?

Hi @nelson2005

The error message shown is the only line I get.

The dots at the beginning just indicate the path of my virtual environment.

Got it… in that case, can you put a breakpoint in the lib/python3.8/site-packages/numba/typed/typeddict.py file and see what’s being worked on when the warning is emitted?

Hi @nelson2005 ,

so the warning is thrown in @njitted code. After removing this directive and setting the breakpoint, it comes out, that the code somehow calls itself recursively.

In the very end, I step wise debugged my own code to the place where this warning is provoked.

So my question is solved.

But it would be nice to have something similar to numpy’s np.seterr(all='raise') where I could on the user side provoke an exception instead of a warning.