'Check that argument cleanup doesn\'t leak references.'

def check_argument_cleanup(self, typ, obj):

    def f(x, y):
        pass
    def _objects(obj):
        objs = [obj]
        if isinstance(obj, tuple):
            for v in obj:
                objs += _objects(v)
        return objs
    objects = _objects(obj)
    cres = compile_isolated(f, (typ, types.uint32))
    with self.assertRefCount(*objects):
        cres.entry_point(obj, 1)
    with self.assertRefCount(*objects):
        with self.assertRaises(OverflowError):
            cres.entry_point(obj, (-1))
    cres = compile_isolated(f, (types.uint32, typ))
    with self.assertRefCount(*objects):
        cres.entry_point(1, obj)
    with self.assertRefCount(*objects):
        with self.assertRaises(OverflowError):
            cres.entry_point((-1), obj)
