Numba is raising a `NotImplementedError` instead of the `NumbaNotImplementedError` equivalent
See original GitHub issueReporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
While trying the new error model with RBC, I found a NotImplementedError left on numba/core/base.py which I suspect it should be a errors.NumbaNotImplementedError. This causes the compilation process to crash because the exception is not captured anymore.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Troubleshooting and tips — Numba 0.50.1 documentation
There can be various reasons why Numba cannot compile your code, and raises an error instead. One common reason is that your code...
Read more >Raising an exception while using numba - Stack Overflow
Can't I raise exception while I'm using numba? I'm using Anaconda 2.0.1 with Numba 0.13.x and Numpy 1.8.x on a 64-bit machine.
Read more >NotImplementedError/LoweringError when using jit on a ...
I'm using Python 3.6.5 and numba 0.37.0. The text was updated successfully, but these errors were encountered: ...
Read more >Some special methods should return "NotImplemented ...
These methods should not raise NotImplementedError as callers don't expect it and won't catch this exception. For example A + B is equivalent...
Read more >numba/numba - Gitter
Hi, My CI for pynndescent just started failing and given the commits (just changing a version number in setup.py) it seems like it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m unconvinced that there’s a noninvasive way to fix this whilst supporting the new error model behaviours.
I’m also unconvinced that there’s a way to fix the current logic that doesn’t involve turning the fall through
NotImplementedErrorinto aerrors.NumbaNotImplementedError. The knock-on effect doing this is that there will be no “hard error” in the new error model and instead a standardLoweringErrorwould be raised with this error captured inside it. This is not ideal but is probably acceptable as this is about finding a lowering implementation opposed to dealing with a problem in compiling one. Further the error information is not lost, it’s just wrapped, which was in part the aim of the new error handling behaviours (information preservation).I think this problem in general stems from using exceptions for control flow purposes and the fall through raising of an exception being used as part of that control flow in a valid case (the one above). That there’s multiple recursion points also makes this harder to debug/understand.
The other option to fix this is to rewrite this logic to match what is needed for the current Numba code base (IIRC this function has not been updated for a long while, whilst most of the code that uses it has changed drastically). This may well be a better option in the long term albeit potentially a lot of effort.
Applying this patch to mainline:
gives:
and:
which I think confirms this issue is invariant of the error handler.