Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait.

Patch by David Coles.
This commit is contained in:
Yury Selivanov 2016-06-11 12:00:07 -04:00
parent ca2e0a48cf
commit c92bf83a82
3 changed files with 35 additions and 1 deletions

View file

@ -329,7 +329,13 @@ class Condition(_ContextManagerMixin):
self._waiters.remove(fut)
finally:
yield from self.acquire()
# Must reacquire lock even if wait is cancelled
while True:
try:
yield from self.acquire()
break
except futures.CancelledError:
pass
@coroutine
def wait_for(self, predicate):