diff options
author | Mark Shannon <mark@hotpy.org> | 2021-07-08 18:21:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 18:21:09 (GMT) |
commit | da6414f0acf5ec9ea3b07e4b3907bc49c2a61e2f (patch) | |
tree | 17309f8d48ae702110150f9d9c9731c8810905e0 /Lib | |
parent | 91a8f8c16ca9a7e2466a8241d9b41769ef97d094 (diff) | |
download | cpython-da6414f0acf5ec9ea3b07e4b3907bc49c2a61e2f.zip cpython-da6414f0acf5ec9ea3b07e4b3907bc49c2a61e2f.tar.gz cpython-da6414f0acf5ec9ea3b07e4b3907bc49c2a61e2f.tar.bz2 |
bpo-44570: Fix line tracing for forwards jumps to duplicated tails (GH-27068)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 5f2b908..c42c69d 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -1041,6 +1041,41 @@ class TraceTestCase(unittest.TestCase): (-8, 'return'), (1, 'return')]) + def test_flow_converges_on_same_line(self): + + def foo(x): + if x: + try: + 1/(x - 1) + except ZeroDivisionError: + pass + return x + + def func(): + for i in range(2): + foo(i) + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (-8, 'call'), + (-7, 'line'), + (-2, 'line'), + (-2, 'return'), + (1, 'line'), + (2, 'line'), + (-8, 'call'), + (-7, 'line'), + (-6, 'line'), + (-5, 'line'), + (-5, 'exception'), + (-4, 'line'), + (-3, 'line'), + (-2, 'line'), + (-2, 'return'), + (1, 'line'), + (1, 'return')]) class SkipLineEventsTraceTestCase(TraceTestCase): """Repeat the trace tests, but with per-line events skipped""" |