@@ -869,10 +869,13 @@ Note that one can also create a shared queue by using a manager object -- see
869869 bother you then you can instead use a queue created with a
870870 :ref: `manager <multiprocessing-managers >`.
871871
872- (1) After putting an object on an empty queue there may be an
873- infinitesimal delay before the queue's :meth: `~Queue.empty `
874- method returns :const: `False ` and :meth: `~Queue.get_nowait ` can
875- return without raising :exc: `queue.Empty `.
872+ (1) After putting an object on an empty queue there may be a delay
873+ before :meth: `~Queue.get_nowait ` can return without raising
874+ :exc: `queue.Empty `, because the feeder thread flushes objects to
875+ the underlying pipe asynchronously. On platforms where
876+ ``sem_getvalue() `` is not implemented (for example macOS), the
877+ queue's :meth: `~Queue.empty ` method may also remain :const: `True `
878+ during this delay.
876879
877880 (2) If multiple processes are enqueuing objects, it is possible for
878881 the objects to be received at the other end out-of-order.
@@ -947,8 +950,17 @@ For an example of the usage of queues for interprocess communication see
947950 Return ``True `` if the queue is empty, ``False `` otherwise. Because of
948951 multithreading/multiprocessing semantics, this is not reliable.
949952
953+ On platforms where ``sem_getvalue() `` is implemented, this method
954+ uses the same approximate size accounting as :meth: `~Queue.qsize `.
955+ Otherwise, it may report ``True `` while items are still buffered and
956+ waiting to be flushed to the underlying pipe.
957+
950958 May raise an :exc: `OSError ` on closed queues. (not guaranteed)
951959
960+ .. versionchanged :: 3.15
961+ On platforms where ``sem_getvalue() `` is implemented, this method
962+ now uses semaphore-based queue size accounting.
963+
952964 .. method :: full()
953965
954966 Return ``True `` if the queue is full, ``False `` otherwise. Because of
0 commit comments