summaryrefslogtreecommitdiff
path: root/tests/misc/recursive_iternext.py
blob: 11c49d1f8cbe8a0aa187ce844d3d8e1316cdd75f (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
28
29
30
31
32
33
34
35
36
37
38
39
# This tests that recursion with iternext doesn't lead to segfault.

try:
    [0] * 10000
    N = 2000
except:
    N = 100

try:
    x = (1, 2)
    for i in range(N):
        x = enumerate(x)
    tuple(x)
except RuntimeError:
    print("RuntimeError")

try:
    x = (1, 2)
    for i in range(N):
        x = filter(None, x)
    tuple(x)
except RuntimeError:
    print("RuntimeError")

try:
    x = (1, 2)
    for i in range(N):
        x = map(max, x, ())
    tuple(x)
except RuntimeError:
    print("RuntimeError")

try:
    x = (1, 2)
    for i in range(N):
        x = zip(x)
    tuple(x)
except RuntimeError:
    print("RuntimeError")