diff options
author | Mark Shannon <mark@hotpy.org> | 2020-12-23 11:43:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 11:43:10 +0000 |
commit | 28b75c80dcc1e17ed3ac1c69362bf8dc164b760a (patch) | |
tree | c69ce061b1d706b4512485e45c59e7a83051ac56 /Lib/test/test_sys_settrace.py | |
parent | d90ff376813843310a6f9ccc96551fa1521e8fef (diff) | |
download | cpython-git-28b75c80dcc1e17ed3ac1c69362bf8dc164b760a.tar.gz |
bpo-42246: Don't eliminate jumps to jumps, if it will break PEP 626. (GH-23896)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 340f37fae7..50b5672e35 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -810,6 +810,70 @@ class TraceTestCase(unittest.TestCase): (6, 'line'), (6, 'return')]) + def test_break_to_continue1(self): + + def func(): + TRUE = 1 + x = [1] + while x: + x.pop() + while TRUE: + break + continue + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (6, 'line'), + (7, 'line'), + (3, 'line'), + (3, 'return')]) + + def test_break_to_continue2(self): + + def func(): + TRUE = 1 + x = [1] + while x: + x.pop() + while TRUE: + break + else: + continue + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (6, 'line'), + (3, 'line'), + (3, 'return')]) + + def test_break_to_break(self): + + def func(): + TRUE = 1 + while TRUE: + while TRUE: + break + break + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (5, 'return')]) + class SkipLineEventsTraceTestCase(TraceTestCase): """Repeat the trace tests, but with per-line events skipped""" |