import asyncio async def create_waiter(lock, fut): fut.set_result(True) async with lock: pass async def main(loop): lock = asyncio.Lock() await lock.acquire() fut = loop.create_future() task = asyncio.ensure_future(create_waiter(lock, fut)) await fut lock.release() task.cancel() #await asyncio.sleep(0) print("DEADLOCK HERE") print("_locked: ", lock._locked) print("_waiters:", lock._waiters) async with lock: pass loop = asyncio.get_event_loop() loop.run_until_complete(main(loop))