bpo-27585: Cancelled lock waiter wakes up the next one by msornay · Pull Request #1031 · python/cpython (original) (raw)

Guys! @1st1, @asvetlov, @serhiy-storchaka,
Can anyone take a look at this patch, the issue is real PITA.

@msornay, probably, the same fix should be applied to asyncio.Condition.wait() method
as it uses the same logic as asyncio.Lock.acquire():
if await cond.wait() is resolved but owning task is cancelled -- other waiters could end up in a deadlock