This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Doug Hoskisson, docs@python, r.david.murray, rhettinger, vstinner
Date 2016-07-27.15:12:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469632346.12.0.782244497586.issue27624@psf.upfronthosting.co.za>
In-reply-to
Content
"""
Return the number of items in the queue. Note, in multi-threading this mostly just serves as an approximation, and information from this doesn’t guarantee that a subsequent get() or put() will not block.
"""

I dislike this description. If I understand correctly, the issue is that someone must not rely on the size to check if the queue is empty or not. If I'm right, the doc must be more explicit. Something like:

"The size must not be used to check if get() or put() will block. Use get_nowait() and put_nowait(), or get() and put() in non-blocking mode (block=False)."

There is even a Wikipedia article on the bug :-)

https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use

(I'm not sure that it's exactly the same class of bug.)
History
Date User Action Args
2016-07-27 15:12:26vstinnersetrecipients: + vstinner, rhettinger, r.david.murray, docs@python, Doug Hoskisson
2016-07-27 15:12:26vstinnersetmessageid: <1469632346.12.0.782244497586.issue27624@psf.upfronthosting.co.za>
2016-07-27 15:12:26vstinnerlinkissue27624 messages
2016-07-27 15:12:26vstinnercreate