diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-03-16 02:27:16 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-03-16 02:27:16 (GMT) |
commit | bbb8ade904ea8c9b26236228e6c7029df279a523 (patch) | |
tree | ea4d3f9afc81f8b156c92aad5b8b3c1eda52b6c9 /Lib/test/test_traceback.py | |
parent | 93f4d4c1d614be8a043af35a13b0ff50d551bc7a (diff) | |
download | cpython-bbb8ade904ea8c9b26236228e6c7029df279a523.zip cpython-bbb8ade904ea8c9b26236228e6c7029df279a523.tar.gz cpython-bbb8ade904ea8c9b26236228e6c7029df279a523.tar.bz2 |
Issue #23631: Fix traceback.format_list when a traceback has been mutated.
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index d9b73c1..9c8929f 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -555,6 +555,14 @@ class TestStack(unittest.TestCase): [' File "foo.py", line 1, in fred\n line\n'], s.format()) + def test_from_list_edited_stack(self): + s = traceback.StackSummary.from_list([('foo.py', 1, 'fred', 'line')]) + s[0] = ('foo.py', 2, 'fred', 'line') + s2 = traceback.StackSummary.from_list(s) + self.assertEqual( + [' File "foo.py", line 2, in fred\n line\n'], + s2.format()) + def test_format_smoke(self): # For detailed tests see the format_list tests, which consume the same # code. @@ -585,7 +593,7 @@ class TestStack(unittest.TestCase): traceback.walk_stack(None), capture_locals=True, limit=1) s = some_inner(3, 4) self.assertEqual( - [' File "' + __file__ + '", line 585, ' + [' File "' + __file__ + '", line 593, ' 'in some_inner\n' ' traceback.walk_stack(None), capture_locals=True, limit=1)\n' ' a = 1\n' |