1# Reraise not the latest occurred exception 2def f(): 3 try: 4 raise ValueError("val", 3) 5 except: 6 try: 7 print(1) 8 raise TypeError 9 except: 10 print(2) 11 try: 12 print(3) 13 try: 14 print(4) 15 raise AttributeError 16 except: 17 print(5) 18 pass 19 print(6) 20 raise 21 except TypeError: 22 print(7) 23 pass 24 print(8) 25 print(9) 26 # This should raise original ValueError, not the most recently occurred AttributeError 27 raise 28 29try: 30 f() 31except ValueError as e: 32 print(repr(e)) 33