diff options
author | Mark Shannon <mark@hotpy.org> | 2021-07-14 11:43:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-14 11:43:56 +0100 |
commit | 794ff7d505f852dc4e0f94901dc7387afaead3bb (patch) | |
tree | fd74ab4f7ff6cbde5367a4ae16c11f69f6de438a /Lib/test/test_sys_settrace.py | |
parent | 7e1d6308a3fc536719adcf1df0aa4e9953c12f8b (diff) | |
download | cpython-git-794ff7d505f852dc4e0f94901dc7387afaead3bb.tar.gz |
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) (GH-27135)
(cherry picked from commit e5862f79c16e28f1ec51d179698739a9b2d8c1d2)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 09d0adca2e..adbb5b56dc 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -1077,6 +1077,29 @@ class TraceTestCase(unittest.TestCase): (1, 'line'), (1, 'return')]) + def test_no_tracing_of_named_except_cleanup(self): + + def func(): + x = 0 + try: + 1/x + except ZeroDivisionError as error: + if x: + raise + return "done" + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (3, 'exception'), + (4, 'line'), + (5, 'line'), + (7, 'line'), + (7, 'return')]) + + class SkipLineEventsTraceTestCase(TraceTestCase): """Repeat the trace tests, but with per-line events skipped""" |