]> granicus.if.org Git - python/commitdiff
Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 Nov 2011 23:33:50 +0000 (00:33 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 Nov 2011 23:33:50 +0000 (00:33 +0100)
when called with a timeout.  Patch by Arnaud Ysmal.

Lib/multiprocessing/queues.py
Misc/ACKS
Misc/NEWS

index b7eecefa20a34f42417aec982d9aa1c8b7084207..433c7e29deeea14f99c0f302eefd1677cb2d0962 100644 (file)
@@ -126,7 +126,11 @@ class Queue(object):
             if not self._rlock.acquire(block, timeout):
                 raise Empty
             try:
-                if not self._poll(block and (deadline-time.time()) or 0.0):
+                if block:
+                    timeout = deadline - time.time()
+                    if timeout < 0 or not self._poll(timeout):
+                        raise Empty
+                elif not self._poll():
                     raise Empty
                 res = self._recv()
                 self._sem.release()
index 97c961cb125712054c24639fd1c6629184c6f2b2..e6d9865bff8c09f7716bd940ac028ae6e725da4b 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -924,6 +924,7 @@ Bob Yodlowski
 Danny Yoo
 George Yoshida
 Masazumi Yoshikawa
+Arnaud Ysmal
 Bernard Yue
 Moshe Zadka
 Milan Zamazal
index 21fdbdce81b5799f6ec6d4bd0712010d96ceda2c..9517677ee28e7f6b396d599e2f8795a50af4b854 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -76,6 +76,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
+  when called with a timeout.  Patch by Arnaud Ysmal.
+
 - Issue #3067: Enhance the documentation and docstring of
   locale.setlocale().