summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorLaurie O <laurie_opperman@hotmail.com>2024-04-08 14:50:54 (GMT)
committerGitHub <noreply@github.com>2024-04-08 14:50:54 (GMT)
commite16062dd3428a5846344e0a8c6ee2f352d34ce1b (patch)
tree8031a3fe204bd6aeeb66febd2be9a3f976a356c6 /Lib/asyncio
parent26a680a58524fe39eecb243e37adfa6e157466f6 (diff)
downloadcpython-e16062dd3428a5846344e0a8c6ee2f352d34ce1b.zip
cpython-e16062dd3428a5846344e0a8c6ee2f352d34ce1b.tar.gz
cpython-e16062dd3428a5846344e0a8c6ee2f352d34ce1b.tar.bz2
gh-96471: Correct documentation for asyncio queue shutdown (#117621)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/queues.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/asyncio/queues.py b/Lib/asyncio/queues.py
index b815670..2f38651 100644
--- a/Lib/asyncio/queues.py
+++ b/Lib/asyncio/queues.py
@@ -256,8 +256,9 @@ class Queue(mixins._LoopBoundMixin):
By default, gets will only raise once the queue is empty. Set
'immediate' to True to make gets raise immediately instead.
- All blocked callers of put() will be unblocked, and also get()
- and join() if 'immediate'.
+ All blocked callers of put() and get() will be unblocked. If
+ 'immediate', a task is marked as done for each item remaining in
+ the queue, which may unblock callers of join().
"""
self._is_shutdown = True
if immediate:
@@ -267,6 +268,7 @@ class Queue(mixins._LoopBoundMixin):
self._unfinished_tasks -= 1
if self._unfinished_tasks == 0:
self._finished.set()
+ # All getters need to re-check queue-empty to raise ShutDown
while self._getters:
getter = self._getters.popleft()
if not getter.done():