Message283344
Hey dev team,
According to the following test, `q.get(True, 0)` always raises queue.Empty.
from multiprocessing import Queue
q = Queue()
q.put('foo')
q.get(True, 0) # raises Empty
This result throws me off as I was expecting a similar result to the underlying poll/select timeout where 0 actually just means non-blocking.
After reviewing Lib/multiprocessing/queues.py, I found the condition where the timeout, after the adjustment for the time required to acquire the lock, would not even call poll() if it was less than 0.
So, linked is a simple PR that I'm offering as a suggested fix/behavior-change of Queue.get's handling of timeout=0 to match the underlying poll/select handling (aka non-blocking).
Cheers,
Ryan Brindley |
|
Date |
User |
Action |
Args |
2016-12-15 20:44:25 | altuezi | set | recipients:
+ altuezi |
2016-12-15 20:44:25 | altuezi | set | messageid: <1481834665.78.0.584713250682.issue28982@psf.upfronthosting.co.za> |
2016-12-15 20:44:25 | altuezi | link | issue28982 messages |
2016-12-15 20:44:25 | altuezi | create | |
|