New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a newline in patched errors #4464
Conversation
Adds a blankline between the original error message and the help message. This makes it easier to read as a user.
Some error messages in numba already have a trailing newline.
Thanks for the patch. Please could you share the example that was creating this problem in the first place? Locally I have a module of things that cause |
This happens if you ever raise a In [1]: import numba as nb
In [2]: @nb.generated_jit
...: def int_only_add(a, b):
...: if not (isinstance(a, nb.types.Integer) and isinstance(b, nb.types.Integer)):
...: raise nb.errors.TypingError("Only ints allowed!")
...: return lambda a, b: a + b
...:
In [3]: int_only_add(1, 2)
Out[3]: 3
In [4]: int_only_add(1.0, 2.0)
---------------------------------------------------------------------------
TypingError Traceback (most recent call last)
<ipython-input-4-7f86f89ddb41> in <module>
----> 1 int_only_add(1.0, 2.0)
~/miniconda3/envs/numba-blis/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
374 e.patch_message(msg)
375
--> 376 error_rewrite(e, 'typing')
377 except errors.UnsupportedError as e:
378 # Something unsupported is present in the user code, add help info
~/miniconda3/envs/numba-blis/lib/python3.7/site-packages/numba/dispatcher.py in error_rewrite(e, issue_type)
341 raise e
342 else:
--> 343 reraise(type(e), e, None)
344
345 argtypes = []
~/miniconda3/envs/numba-blis/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb)
656 value = tp()
657 if value.__traceback__ is not tb:
--> 658 raise value.with_traceback(tb)
659 raise value
660
TypingError: Only ints allowed!
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/latest/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/latest/reference/numpysupported.html
For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile
If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new |
Ah, thanks, the extra line is welcomed there! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch.
Adds a blankline between the original error message and the help
message. This makes it easier to read as a user.
Changes
to