[issue26958] Suggestion to imporve queue.full reliability

2016-05-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: The reliability issue for qsize(), empty(), and full() has nothing to do with their implementations. The problem is that any information obtained by those methods is potentially out-of-date by the time you try to use it (the LBYL problem). This is why

[issue26958] Suggestion to imporve queue.full reliability

2016-05-04 Thread Sudharsan R
Sudharsan R added the comment: Just add on to it.. q=queue.Queue() with q.not_full: q.put_nowait(1) this will hang. So if we acquire the not_full while computing size, all puts will wait. Same is the case for q.empty() and q.not_empty method and condition respectively. --

[issue26958] Suggestion to imporve queue.full reliability

2016-05-04 Thread SilentGhost
Changes by SilentGhost : -- components: +Library (Lib) nosy: +rhettinger ___ Python tracker ___

[issue26958] Suggestion to imporve queue.full reliability

2016-05-04 Thread Sudharsan R
New submission from Sudharsan R: I was browsing through the code for queue.full and queue.put methods. The queue.full method claims it is not a reliable one. But, the same internal implementation - _qsize is used for put as well as full. "put" is thread safe and reliable and "full" is not.