I want to write a function that will run either as a jitted function or else as either ordinary python or object-mode numba, depending on whether numba is able to do type inference. I would actually prefer ordinary python, but there doesn't seem to be a way to do that short of writing my own decorator.
Why do I want to do this? Because I have a function f that takes another function g as an argument. So if g is a jitted, then I want f to be jitted so the whole thing can run quickly, but if g is ordinary python, then I want f to still run, albeit more slowly.
It works fine simply annotating f with @jit, except the first time that I run the function in object-mode, I get a compile warning about failed type inference. I would like to suppress this warning.
This answer says to use @autojit(warn=False) but there is no longer any autojit. It also says that @jit(warn=False) would work, but that doesn't work either, I get:
KeyError: "<class 'numba.core.cpu.CPUTargetOptions'> does not support option: 'warn'"
There must be a way to accomplish this without getting a warning, but I can't seem to google it. Help is appreciated.