import asyncio import sys class MyObject: def __del__(self): print("DELETE OBJECT") @asyncio.coroutine def func(fut): obj = MyObject() try: raise ValueError() except Exception as err: fut.set_exception(err) fut = asyncio.Future() asyncio.Task(func(fut)) asyncio.get_event_loop().run_forever()