1"""
2From http://bugs.python.org/issue6717
3
4A misbehaving trace hook can trigger a segfault by exceeding the recursion
5limit.
6"""
7import sys
8
9
10def x():
11    pass
12
13def g(*args):
14    if True: # change to True to crash interpreter
15        try:
16            x()
17        except:
18            pass
19    return g
20
21def f():
22    print(sys.getrecursionlimit())
23    f()
24
25sys.settrace(g)
26
27f()
28