summaryrefslogtreecommitdiff
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-14 10:19:10 +0000
committerGitHub <noreply@github.com>2020-12-14 10:19:10 +0000
commit56aa20f9eb913c746b7d54b90be328c922639338 (patch)
treeed3564b0264bc9136174a9d44b6625d4b41847fa /Lib/test/test_sys_settrace.py
parent674fa0a740151e0416c9383f127b16014e805990 (diff)
downloadcpython-git-56aa20f9eb913c746b7d54b90be328c922639338.tar.gz
Don't generate spurious line number in try-except-finally. (#23760)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index ccdb5c2c51..f257809021 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -629,6 +629,23 @@ class TraceTestCase(unittest.TestCase):
(3, 'line'),
(3, 'return')])
+ def test_try_except_no_exception(self):
+
+ def func():
+ try:
+ 2
+ except:
+ 4
+ finally:
+ 6
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (6, 'line'),
+ (6, 'return')])
+
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""