Skip to content
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

Error formatting text width is not padded to CPython/readline's 80chars #3364

Open
2 tasks done
stuartarchibald opened this issue Oct 1, 2018 · 0 comments
Open
2 tasks done
Labels

Comments

@stuartarchibald
Copy link
Contributor

Reporting a bug

The output from Numba error rewriting should be padded to 80 chars as per the Python traceback formatting. An example of this not working:

$ python pointlesslongfilenametooverflowtermwidthsothatitisatleast80charslongthisnameis81.py|&cowsay -W80                       
 _________________________________________________________________________________                                              
/ Traceback (most recent call last):                                              \                                             
|                                                                                 |                                             
| File                                                                            |                                             
| "pointlesslongfilenametooverflowtermwidthsothatitisatleast80charslongthisnameis |                                             
| 81.py", line 13, in <module>                                                    |                                             
|                                                                                 |                                             
| print(test(rec[0]))                                                             |                                             
|                                                                                 |                                             
| File "< path                             >numba/numba/dispatcher.py", line 348, |                                             
| in _compile_for_args                                                            |                                             
|                                                                                 |                                             
| error_rewrite(e, 'typing')                                                      |                                             
|                                                                                 |                                             
| File "< path                             >numba/numba/dispatcher.py", line 313, |                                             
| in error_rewrite                                                                |                                             
|                                                                                 |                                             
| raise e                                                                         |                                             
|                                                                                 |                                             
| File "< path                             >numba/numba/dispatcher.py", line 324, |                                             
| in _compile_for_args                                                            |                                             
|                                                                                 |                                             
| return self.compile(tuple(argtypes))                                            |                                             
|                                                                                 |                                             
| File "< path                             >numba/numba/compiler_lock.py", line   |                                             
| 32, in _acquire_compile_lock                                                    |
|                                                                                 |
| return func(*args, **kwargs)                                                    |
|                                                                                 |
| File "< path                             >numba/numba/dispatcher.py", line 655, |
| in compile                                                                      |
|                                                                                 |
| cres = self._compiler.compile(args, return_type)                                |
|                                                                                 |
| File "< path                             >numba/numba/dispatcher.py", line 82,  |
| in compile                                                                      |
|                                                                                 |
| pipeline_class=self.pipeline_class)                                             |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 904,   |
| in compile_extra                                                                |
|                                                                                 |
| return pipeline.compile_extra(func)                                             |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 367,   |
| in compile_extra                                                                |
|                                                                                 |
| return self._compile_bytecode()                                                 |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 835,   |
| in _compile_bytecode                                                            |
|                                                                                 |
| return self._compile_core()                                                     |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 822,   |
| in _compile_core                                                                |
|                                                                                 |
| res = pm.run(self.status)                                                       |
|                                                                                 |
| File "< path                             >numba/numba/compiler_lock.py", line   |
| 32, in _acquire_compile_lock                                                    |
|                                                                                 |
| return func(*args, **kwargs)                                                    |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 253,   |
| in run                                                                          |
|                                                                                 |
| raise patched_exception                                                         |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 244,   |
| in run                                                                          |
|                                                                                 |
| stage()                                                                         |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 477,   |
| in stage_nopython_frontend                                                      |
|                                                                                 |
| self.locals)                                                                    |
|                                                                                 |
| File "< path                             >numba/numba/compiler.py", line 1006,  |
| in type_inference_stage                                                         |
|                                                                                 |
| infer.propagate()                                                               |
|                                                                                 |
| File "< path                             >numba/numba/typeinfer.py", line 860,  |
| in propagate                                                                    |
|                                                                                 |
| raise errors[0] numba.errors.TypingError: Failed in nopython mode pipeline      |
| (step: nopython frontend) failed to unpack Record([('index',  |
| '<i8'), ('a', '<f8'), ('b', '|b1')])  File                             |
| "pointlesslongfilenametooverflowtermwidthsothatitisatleast80charslongthisnameis |
| 81.py", line 10: def test(record):  i, a, b = record  |
| ^  [1] During: typing of exhaust iter at      |
| pointlesslongfilenametooverflowtermwidthsothatitisatleast80charslongthisnameis8 |
| 1.py (10)  File                                                    |
| "pointlesslongfilenametooverflowtermwidthsothatitisatleast80charslongthisnameis |
| 81.py", line 10: def test(record):  i, a, b = record  |
\ ^                                                              /
 ---------------------------------------------------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

note the somewhat messy appearance once out of CPython traceback and into Numba error message helpers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant