def foo(): # use some tricks to make ref-counted unicode i, j = 'ab', 'c' a = i + j m, n = 'zy', 'x' z = m + n l = List.empty_list(types.unicode_type) l.append(a) # This *should* dec' a and inc' z thus tests that items that are # replaced are also dec'ed. l[0] = z ra, rz = get_refcount(a), get_refcount(z) return l, ra, rz
def foo(): d = Dict.empty(int32, List.empty_list(int32)) l = List.empty_list(int32) l.append(0) # This increments the refcount for l d[0] = l return get_refcount(l)
def foo(): l = List.empty_list(Dict.empty(int32, int32)) d = Dict.empty(int32, int32) d[0] = 1 # This increments the refcount for d l.append(d) return get_refcount(d)