summaryrefslogtreecommitdiffstatshomepage
path: root/tests/misc/recursive_iternext.py
blob: ac3a17e93b1bb901e83c70386d7942eac1caf3c3 (plain) (blame)
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
# This tests that recursion with iternext doesn't lead to segfault.

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

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

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

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