mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) (GH-27135)
(cherry picked from commit e5862f79c1
)
This commit is contained in:
parent
7e1d6308a3
commit
794ff7d505
2 changed files with 25 additions and 3 deletions
|
@ -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"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue