summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-11-09 23:37:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-11-09 23:37:09 (GMT)
commita3651136790d3ec8291a07b1a5af8f0353e59c20 (patch)
treed6d6421d712acb3375b8847046e13c1855262a9c /Lib/multiprocessing
parent69d44fdb90fda47a1d6a46e3a49f67487b84c3ac (diff)
downloadcpython-a3651136790d3ec8291a07b1a5af8f0353e59c20.zip
cpython-a3651136790d3ec8291a07b1a5af8f0353e59c20.tar.gz
cpython-a3651136790d3ec8291a07b1a5af8f0353e59c20.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 3280a25..51d9912 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -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()