GeezerVison is showing github.com — 3.11 backtrace visual indicators are too verbose · Issue #93883 · python/cpython
3.11 backtrace visual indicators are too verbose #93883DescriptionI understand that the new visual indicators can be disabled, but we shouldn't have to choose between guaranteed 50% longer backtraces and pertinent column information.
Often, the visual indicator spans the entire line for a large percentage of the backtrace. (I've seen cases in our app where it's true for 100% of the backtrace.)
Proposal: elide the indicators when they span the whole line
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.
before:
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
after:
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
Reacted by Ariya ISIHARA, Thomas Grainger, Daniël van Noord, Oleg Iarygin, dskrypa and Zac Hatfield-Dodds Activitybelm0 commented on Jun 19, 2022 ContributorAuthor More actions I've prototyped the change for traceback.py. Making the equivalent change to C traceback code and updating documentation is still required. I'd like to hear if this change has some support from Python devs before putting more time into the PR. Zac-HD commented on Jun 23, 2022 I am very, very keen on this change! Thanks very much @belm0 for thinking of this and implementing a patch 😍 Reacted by John Belmonte, Terry Jan Reedy, Thomas Grainger and dskrypa belm0 commented on Jun 24, 2022 ContributorAuthor More actions belm0 commented on Jul 11, 2022 ContributorAuthor More actions The refinement is merged and backported to 3.11 for the beta4 release. Reacted by Alex Waygood, Oleg Iarygin, Zac Hatfield-Dodds and Terry Jan Reedy
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|