

def get_leaking_objects(objects=None):
    'Return objects that do not have any referents.\n\n    These could indicate reference-counting bugs in C code.  Or they could\n    be legitimate.\n\n    Note that the GC does not track simple objects like int or str.\n\n    .. versionadded:: 1.7\n    '
    if (objects is None):
        gc.collect()
        objects = gc.get_objects()
    try:
        ids = set((id(i) for i in objects))
        for i in objects:
            ids.difference_update((id(j) for j in gc.get_referents(i)))
        return [i for i in objects if (id(i) in ids)]
    finally:
        del objects, i

dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/dep/objgraph.py get_leaking_objects/original