1# check that the Python stack does not overflow when the finally 2# block itself uses more stack than the rest of the function 3def f1(a, b): 4 pass 5def test1(): 6 val = 1 7 try: 8 raise ValueError() 9 finally: 10 f1(2, 2) # use some stack 11 print(val) # check that the local variable is the same 12try: 13 test1() 14except ValueError: 15 pass 16 17# same as above but with 3 args instead of 2, to use an extra stack entry 18def f2(a, b, c): 19 pass 20def test2(): 21 val = 1 22 try: 23 raise ValueError() 24 finally: 25 f2(2, 2, 2) # use some stack 26 print(val) # check that the local variable is the same 27try: 28 test2() 29except ValueError: 30 pass 31