diff options
author | John Belmonte <john@neggie.net> | 2022-07-11 11:27:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 11:27:29 (GMT) |
commit | 45896f2a02f02f296d14cccd6959179ccd47e410 (patch) | |
tree | 0aae343b626ad11110716e5a3eddf9aba94d104c /Lib/idlelib | |
parent | f3212b1ec7a70b69f44acd763221463a69beee4f (diff) | |
download | cpython-45896f2a02f02f296d14cccd6959179ccd47e410.zip cpython-45896f2a02f02f296d14cccd6959179ccd47e410.tar.gz cpython-45896f2a02f02f296d14cccd6959179ccd47e410.tar.bz2 |
[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
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/idle_test/test_run.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Lib/idlelib/idle_test/test_run.py b/Lib/idlelib/idle_test/test_run.py index d859ffc..ec4637c 100644 --- a/Lib/idlelib/idle_test/test_run.py +++ b/Lib/idlelib/idle_test/test_run.py @@ -3,7 +3,7 @@ from idlelib import run import io import sys -from test.support import captured_output, captured_stderr, has_no_debug_ranges +from test.support import captured_output, captured_stderr import unittest from unittest import mock import idlelib @@ -33,14 +33,9 @@ class ExceptionTest(unittest.TestCase): run.print_exception() tb = output.getvalue().strip().splitlines() - if has_no_debug_ranges(): - self.assertEqual(11, len(tb)) - self.assertIn('UnhashableException: ex2', tb[3]) - self.assertIn('UnhashableException: ex1', tb[10]) - else: - self.assertEqual(13, len(tb)) - self.assertIn('UnhashableException: ex2', tb[4]) - self.assertIn('UnhashableException: ex1', tb[12]) + self.assertEqual(11, len(tb)) + self.assertIn('UnhashableException: ex2', tb[3]) + self.assertIn('UnhashableException: ex1', tb[10]) data = (('1/0', ZeroDivisionError, "division by zero\n"), ('abc', NameError, "name 'abc' is not defined. " |