Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test
  • Loading branch information
iritkatriel committed Sep 14, 2023
commit ee10731d75a588ed949ba90f87f2a7781ddce928
29 changes: 29 additions & 0 deletions Lib/test/test_sys_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,35 @@ def func():
(6, 'line'),
(6, 'return')])

def test_finally_with_conditional(self):

# See gh-105658
condition = True
def func():
try:
try:
raise Exception
finally:
if condition:
result = 1
result = 2
except:
result = 3
return result

self.run_and_compare(func,
[(0, 'call'),
(1, 'line'),
(2, 'line'),
(3, 'line'),
(3, 'exception'),
(5, 'line'),
(6, 'line'),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On main we have here another
(5, 'line'),

(8, 'line'),
(9, 'line'),
(10, 'line'),
(10, 'return')])

def test_break_to_continue1(self):

def func():
Expand Down