summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-11-09 23:38:25 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-11-09 23:38:25 (GMT)
commit021572431ba02de96361d64a8575f82097abc8f4 (patch)
treeea417451c4002669e909ba0114995dcc11048b97 /Lib/multiprocessing
parent6139c1bfa305f35a51c06685814c840d09bda7b8 (diff)
parenta3651136790d3ec8291a07b1a5af8f0353e59c20 (diff)
downloadcpython-021572431ba02de96361d64a8575f82097abc8f4.zip
cpython-021572431ba02de96361d64a8575f82097abc8f4.tar.gz
cpython-021572431ba02de96361d64a8575f82097abc8f4.tar.bz2
Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
when called with a timeout. Patch by Arnaud Ysmal.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/queues.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index bb4c7d8..cf51307 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -129,7 +129,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()