Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Commit bbe53f3

Browse files
committed
Avoid deadlock when a cancelled future is in self._waiters.
1 parent ad2ae67 commit bbe53f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

asyncio/locks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def acquire(self):
166166
This method blocks until the lock is unlocked, then sets it to
167167
locked and returns True.
168168
"""
169-
if not self._waiters and not self._locked:
169+
if not self._locked and all(w.cancelled() for w in self._waiters):
170170
self._locked = True
171171
return True
172172

0 commit comments

Comments
 (0)