Commit 83f5a384 authored by Guido van Rossum's avatar Guido van Rossum

In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters.

parent 4b7b565c
......@@ -166,7 +166,7 @@ class Lock(_ContextManagerMixin):
This method blocks until the lock is unlocked, then sets it to
locked and returns True.
"""
if not self._waiters and not self._locked:
if not self._locked and all(w.cancelled() for w in self._waiters):
self._locked = True
return True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment