]> granicus.if.org Git - python/commitdiff
asyncio: Don't special-case GeneratorExit in Condition.wait().
authorGuido van Rossum <guido@python.org>
Fri, 10 Jan 2014 21:25:38 +0000 (13:25 -0800)
committerGuido van Rossum <guido@python.org>
Fri, 10 Jan 2014 21:25:38 +0000 (13:25 -0800)
Lib/asyncio/locks.py

index 9e8529249eb73b5e23bab5cb79c07169f76da139..9fdb93745b61099185cb022e4132f6f716e9513a 100644 (file)
@@ -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):