From 9c2ebb906d1c68c3d571b100c92ceb08805b94cd Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Thu, 13 Jan 2022 12:34:38 +0000 Subject: bpo-46344: Fix trace bug in else of try and try-star blocks (GH-30544) --- Lib/test/test_sys_settrace.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'Lib/test/test_sys_settrace.py') diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 883b2842f2c..e5fc88e1b6f 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -644,16 +644,25 @@ class TraceTestCase(unittest.TestCase): 4 else: 6 + if False: + 8 + else: + 10 + if func.__name__ == 'Fred': + 12 finally: - 8 + 14 self.run_and_compare(func, [(0, 'call'), (1, 'line'), (2, 'line'), (6, 'line'), - (8, 'line'), - (8, 'return')]) + (7, 'line'), + (10, 'line'), + (11, 'line'), + (14, 'line'), + (14, 'return')]) def test_nested_loops(self): @@ -1222,16 +1231,25 @@ class TraceTestCase(unittest.TestCase): 4 else: 6 + if False: + 8 + else: + 10 + if func.__name__ == 'Fred': + 12 finally: - 8 + 14 self.run_and_compare(func, [(0, 'call'), (1, 'line'), (2, 'line'), (6, 'line'), - (8, 'line'), - (8, 'return')]) + (7, 'line'), + (10, 'line'), + (11, 'line'), + (14, 'line'), + (14, 'return')]) def test_try_except_star_named_no_exception(self): -- cgit v1.2.3