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