mirror of https://github.com/python/cpython
Fix issue #17707: multiprocessing.Queue's get() method does not block for short timeouts.
This commit is contained in:
parent
22b9e651c2
commit
308307190f
|
@ -862,7 +862,7 @@ else:
|
||||||
if hasattr(select, 'poll'):
|
if hasattr(select, 'poll'):
|
||||||
def _poll(fds, timeout):
|
def _poll(fds, timeout):
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
timeout = int(timeout) * 1000 # timeout is in milliseconds
|
timeout = int(timeout * 1000) # timeout is in milliseconds
|
||||||
fd_map = {}
|
fd_map = {}
|
||||||
pollster = select.poll()
|
pollster = select.poll()
|
||||||
for fd in fds:
|
for fd in fds:
|
||||||
|
|
|
@ -699,6 +699,13 @@ class _TestQueue(BaseTestCase):
|
||||||
for p in workers:
|
for p in workers:
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
|
def test_timeout(self):
|
||||||
|
q = multiprocessing.Queue()
|
||||||
|
start = time.time()
|
||||||
|
self.assertRaises(pyqueue.Empty, q.get, True, 0.2)
|
||||||
|
delta = time.time() - start
|
||||||
|
self.assertGreaterEqual(delta, 0.19)
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
|
@ -42,6 +42,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #17707: multiprocessing.Queue's get() method does not block for short
|
||||||
|
timeouts.
|
||||||
|
|
||||||
- Issue #17012: shutil.which() no longer fallbacks to the PATH environment
|
- Issue #17012: shutil.which() no longer fallbacks to the PATH environment
|
||||||
variable if empty path argument is specified. Patch by Serhiy Storchaka.
|
variable if empty path argument is specified. Patch by Serhiy Storchaka.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue