8000 Add test for linenumber of return in nested try statements. · python/cpython@b89dd60 · GitHub
[go: up one dir, main page]

Skip to content

Commit b89dd60

Browse files
committed
Add test for linenumber of return in nested try statements.
1 parent 23a5a31 commit b89dd60

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Lib/test/test_sys_settrace.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,26 @@ class A:
976976
(3, 'return'),
977977
(1, 'return')])
978978

979+
def test_try_in_try(self):
980+
def func():
981+
try:
982+
try:
983+
pass
984+
except Exception as ex:
985+
pass
986+
except Exception:
987+
pass
988+
989+
# This doesn't conform to PEP 626
990+
self.run_and_compare(func,
991+
[(0, 'call'),
992+
(1, 'line'),
993+
(2, 'line'),
994+
(3, 'line'),
995+
(5, 'line'),
996+
(5, 'return')])
997+
998+
979999
class SkipLineEventsTraceTestCase(TraceTestCase):
9801000
"""Repeat the trace tests, but with per-line events skipped"""
9811001

0 commit comments

Comments
 (0)
0