mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. (Merge 3.5->3.6)
This commit is contained in:
commit
f06c7b6f37
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue