]> granicus.if.org Git - python/commitdiff
Issue #20319: concurrent.futures.wait() can block forever even if Futures have completed
authorBrian Quinlan <brian@sweetapp.com>
Sat, 1 Feb 2014 00:49:04 +0000 (11:49 +1100)
committerBrian Quinlan <brian@sweetapp.com>
Sat, 1 Feb 2014 00:49:04 +0000 (11:49 +1100)
Lib/concurrent/futures/_base.py
Misc/NEWS

index c3b1f017e0e28a4eb78cc27059a623b04f519327..acd05d0b2aabd8454e41bac6e6ace1cd39112bcc 100644 (file)
@@ -225,7 +225,8 @@ def as_completed(fs, timeout=None):
 
     finally:
         for f in fs:
-            f._waiters.remove(waiter)
+            with f._condition:
+                f._waiters.remove(waiter)
 
 DoneAndNotDoneFutures = collections.namedtuple(
         'DoneAndNotDoneFutures', 'done not_done')
@@ -272,7 +273,8 @@ def wait(fs, timeout=None, return_when=ALL_COMPLETED):
 
     waiter.event.wait(timeout)
     for f in fs:
-        f._waiters.remove(waiter)
+        with f._condition:
+            f._waiters.remove(waiter)
 
     done.update(waiter.finished_futures)
     return DoneAndNotDoneFutures(done, set(fs) - done)
index d4fb7210b690f9f8f9c590dab12765b22121c6cd..a62f74889404298f37bab54e901feb3715690093 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -69,6 +69,12 @@ Library
 
 - Issue #17481: inspect.getfullargspec() now uses inspect.signature() API.
 
+- Issue #15304: concurrent.futures.wait() can block forever even if
+  Futures have completed. Patch by Glenn Langford.
+
+Fix warning message when `os.chdir()` fails inside
+  `test.support.temp_cwd()`.  Patch by Chris Jerdonek.
+
 IDLE
 ----