summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 09d0adc..adbb5b5 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"""