summaryrefslogtreecommitdiffstats
path: root/Lib/test/crashers/trace_at_recursion_limit.py
blob: acd863f5509c49bcf554dcf135358142effdb258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
From http://bugs.python.org/issue6717

A misbehaving trace hook can trigger a segfault by exceeding the recursion
limit.
"""
import sys


def x():
    pass

def g(*args):
    if True: # change to True to crash interpreter
        try:
            x()
        except:
            pass
    return g

def f():
    print(sys.getrecursionlimit())
    f()

sys.settrace(g)

f()