blob: f8c11338348ed2c24d367357ab41df6691aff6d7 (
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
|
from pyrsistent import pmap
import random
import gc
def test_segfault_issue_52():
threshold = None
if hasattr(gc, 'get_threshold'):
# PyPy is lacking these functions
threshold = gc.get_threshold()
gc.set_threshold(1, 1, 1) # fail fast
v = [pmap()]
def step():
depth = random.randint(1, 10)
path = random.sample(range(100000), depth)
v[0] = v[0].transform(path, "foo")
for i in range(1000): # usually crashes after 10-20 steps
while True:
try:
step()
break
except AttributeError: # evolver on string
continue
if threshold:
gc.set_threshold(*threshold)
|