From 2407f3bb1bb77ae8e3752e6ff2f89dc5edd3238e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 10 Jan 2014 13:25:38 -0800 Subject: [PATCH] asyncio: Don't special-case GeneratorExit in Condition.wait(). --- Lib/asyncio/locks.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index 9e8529249eb..9fdb93745b6 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -251,7 +251,6 @@ class Condition: if not self.locked(): raise RuntimeError('cannot wait on un-acquired lock') - keep_lock = True self.release() try: fut = futures.Future(loop=self._loop) @@ -262,12 +261,8 @@ class Condition: finally: self._waiters.remove(fut) - except GeneratorExit: - keep_lock = False # Prevent yield in finally clause. - raise finally: - if keep_lock: - yield from self.acquire() + yield from self.acquire() @tasks.coroutine def wait_for(self, predicate):