asyncio: Don't special-case GeneratorExit in Condition.wait().
This commit is contained in:
parent
d9b77c5edf
commit
2407f3bb1b
|
@ -251,7 +251,6 @@ class Condition:
|
||||||
if not self.locked():
|
if not self.locked():
|
||||||
raise RuntimeError('cannot wait on un-acquired lock')
|
raise RuntimeError('cannot wait on un-acquired lock')
|
||||||
|
|
||||||
keep_lock = True
|
|
||||||
self.release()
|
self.release()
|
||||||
try:
|
try:
|
||||||
fut = futures.Future(loop=self._loop)
|
fut = futures.Future(loop=self._loop)
|
||||||
|
@ -262,12 +261,8 @@ class Condition:
|
||||||
finally:
|
finally:
|
||||||
self._waiters.remove(fut)
|
self._waiters.remove(fut)
|
||||||
|
|
||||||
except GeneratorExit:
|
|
||||||
keep_lock = False # Prevent yield in finally clause.
|
|
||||||
raise
|
|
||||||
finally:
|
finally:
|
||||||
if keep_lock:
|
yield from self.acquire()
|
||||||
yield from self.acquire()
|
|
||||||
|
|
||||||
@tasks.coroutine
|
@tasks.coroutine
|
||||||
def wait_for(self, predicate):
|
def wait_for(self, predicate):
|
||||||
|
|
Loading…
Reference in New Issue