mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-96471: Correct documentation for asyncio queue shutdown (#117621)
This commit is contained in:
parent
26a680a585
commit
e16062dd34
3 changed files with 9 additions and 6 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue