Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely

when called with a timeout.  Patch by Arnaud Ysmal.
This commit is contained in:
Antoine Pitrou 2011-11-10 00:38:25 +01:00
commit 021572431b
3 changed files with 9 additions and 1 deletions

View File

@ -129,7 +129,11 @@ class Queue(object):
if not self._rlock.acquire(block, timeout): if not self._rlock.acquire(block, timeout):
raise Empty raise Empty
try: 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 raise Empty
res = self._recv() res = self._recv()
self._sem.release() self._sem.release()

View File

@ -1068,6 +1068,7 @@ Bob Yodlowski
Danny Yoo Danny Yoo
George Yoshida George Yoshida
Masazumi Yoshikawa Masazumi Yoshikawa
Arnaud Ysmal
Bernard Yue Bernard Yue
Moshe Zadka Moshe Zadka
Milan Zamazal Milan Zamazal

View File

@ -365,6 +365,9 @@ Core and Builtins
Library Library
------- -------
- Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
when called with a timeout. Patch by Arnaud Ysmal.
- Issue #13254: Fix Maildir initialization so that maildir contents - Issue #13254: Fix Maildir initialization so that maildir contents
are read correctly. are read correctly.