Commit 6a570d6b authored by Antoine Pitrou's avatar Antoine Pitrou

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

when called with a timeout.  Patch by Arnaud Ysmal.
parent cb65f324
...@@ -126,7 +126,11 @@ class Queue(object): ...@@ -126,7 +126,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()
......
...@@ -924,6 +924,7 @@ Bob Yodlowski ...@@ -924,6 +924,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
......
...@@ -76,6 +76,9 @@ Core and Builtins ...@@ -76,6 +76,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 #3067: Enhance the documentation and docstring of - Issue #3067: Enhance the documentation and docstring of
locale.setlocale(). locale.setlocale().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment