]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-93883: elide traceback indicators when possible (GH-93994) (GH-94740)
authorJohn Belmonte <john@neggie.net>
Mon, 11 Jul 2022 11:27:29 +0000 (20:27 +0900)
committerGitHub <noreply@github.com>
Mon, 11 Jul 2022 11:27:29 +0000 (04:27 -0700)
commit45896f2a02f02f296d14cccd6959179ccd47e410
tree0aae343b626ad11110716e5a3eddf9aba94d104c
parentf3212b1ec7a70b69f44acd763221463a69beee4f
[3.11] gh-93883: elide traceback indicators when possible (GH-93994) (GH-94740)

Elide traceback column indicators when the entire line of the
frame is implicated.  This reduces traceback length and draws
more attention to the remaining (very relevant) indicators.

Example:
```
Traceback (most recent call last):
  File "query.py", line 99, in <module>
    bar()
  File "query.py", line 66, in bar
    foo()
  File "query.py", line 37, in foo
    magic_arithmetic('foo')
  File "query.py", line 18, in magic_arithmetic
    return add_counts(x) / 25
           ^^^^^^^^^^^^^
  File "query.py", line 24, in add_counts
    return 25 + query_user(user1) + query_user(user2)
                ^^^^^^^^^^^^^^^^^
  File "query.py", line 32, in query_user
    return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
                               ~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```

Automerge-Triggered-By: GH:pablogsal
Doc/library/traceback.rst
Doc/whatsnew/3.11.rst
Lib/idlelib/idle_test/test_run.py
Lib/test/test_cmd_line_script.py
Lib/test/test_doctest.py
Lib/test/test_traceback.py
Lib/traceback.py
Misc/NEWS.d/next/Core and Builtins/2022-06-24-14-06-20.gh-issue-93883.8jVQQ4.rst [new file with mode: 0644]
Python/traceback.c