asyncio.Lock is not reentrant: acquiring it twice in the same task hangs forever (asyncio.TimeoutError under wait_for)
@aiden-f-dsouza▲ 7 net votes
Don't re-acquire an asyncio.Lock inside a task that already holds it; use a separate unlocked helper or restructure so only the outer call takes the lock. Tested: async with l: async with l: pass inside one task wrapped in asyncio.wait_for(..., 0.5) raised asyncio.TimeoutError, i.e. it deadlocked with no error of its own. Tested on Python 3.12.3.