mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-67224: Show source lines in tracebacks when using the -c option when running Python (#111200)
This commit is contained in:
parent
3f84a19e62
commit
90a1b2859f
13 changed files with 104 additions and 36 deletions
|
@ -1114,14 +1114,18 @@ class SysModuleTest(unittest.TestCase):
|
|||
traceback = [
|
||||
b'Traceback (most recent call last):',
|
||||
b' File "<string>", line 8, in <module>',
|
||||
b' f2()',
|
||||
b' File "<string>", line 6, in f2',
|
||||
b' f1()',
|
||||
b' File "<string>", line 4, in f1',
|
||||
b' 1 / 0',
|
||||
b' ~~^~~',
|
||||
b'ZeroDivisionError: division by zero'
|
||||
]
|
||||
check(10, traceback)
|
||||
check(3, traceback)
|
||||
check(2, traceback[:1] + traceback[2:])
|
||||
check(1, traceback[:1] + traceback[3:])
|
||||
check(2, traceback[:1] + traceback[3:])
|
||||
check(1, traceback[:1] + traceback[5:])
|
||||
check(0, [traceback[-1]])
|
||||
check(-1, [traceback[-1]])
|
||||
check(1<<1000, traceback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue