def method1(n):
    if n <= 0:
        raise IndexError('foo')
    method2(n-1)

def method2(n):
    method1(n-1)

if __name__ == '__main__':
    method1(100)
    print('TEST SUCEEDED!')
@@ -69,21 +69,24 @@
 ethod2(n
--
+ - 
 1)%0A%0A
+%0A
 def meth
@@ -110,13 +110,16 @@
 d1(n
--
+ - 
 1)%0A%0A
+%0A
 if _
@@ -141,16 +141,29 @@
 ain__':%0A
+    try:%0A    
     meth
@@ -171,16 +171,113 @@
 d1(100)%0A
+    except:%0A        pass  # Don't let it print the exception (just deal with caught exceptions).%0A
     prin
@@ -295,8 +295,9 @@
 EEDED!')
+%0A

Fix in test.