1# test memoryview retains pointer to original object/buffer
2try:
3    memoryview
4except:
5    print("SKIP")
6    raise SystemExit
7
8b = bytearray(10)
9m = memoryview(b)[1:]
10for i in range(len(m)):
11    m[i] = i
12
13# reclaim b, but hopefully not the buffer
14b = None
15import gc
16gc.collect()
17
18# allocate lots of memory
19for i in range(100000):
20    [42, 42, 42, 42]
21
22# check that the memoryview is still what we want
23print(list(m))
24