pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/e16062dd3428a5846344e0a8c6ee2f352d34ce1b

41e157469407.css" /> gh-96471: Correct documentation for asyncio queue shutdown (#117621) · python/cpython@e16062d · GitHub
Skip to content

Commit e16062d

Browse files
authored
gh-96471: Correct documentation for asyncio queue shutdown (#117621)
1 parent 26a680a commit e16062d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

Doc/library/asyncio-queue.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ Queue
106106
raise once the queue is empty. Set *immediate* to true to make
107107
:meth:`~Queue.get` raise immediately instead.
108108

109-
All blocked callers of :meth:`~Queue.put` will be unblocked. If
110-
*immediate* is true, also unblock callers of :meth:`~Queue.get`
111-
and :meth:`~Queue.join`.
109+
All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get`
110+
will be unblocked. If *immediate* is true, a task will be marked
111+
as done for each remaining item in the queue, which may unblock
112+
callers of :meth:`~Queue.join`.
112113

113114
.. versionadded:: 3.13
114115

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ asyncio
298298

299299
* Add :meth:`asyncio.Queue.shutdown` (along with
300300
:exc:`asyncio.QueueShutDown`) for queue termination.
301-
(Contributed by Laurie Opperman in :gh:`104228`.)
301+
(Contributed by Laurie Opperman and Yves Duprat in :gh:`104228`.)
302302

303303
base64
304304
------

Lib/asyncio/queues.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ def shutdown(self, immediate=False):
256256
By default, gets will only raise once the queue is empty. Set
257257
'immediate' to True to make gets raise immediately instead.
258258
259-
All blocked callers of put() will be unblocked, and also get()
260-
and join() if 'immediate'.
259+
All blocked callers of put() and get() will be unblocked. If
260+
'immediate', a task is marked as done for each item remaining in
261+
the queue, which may unblock callers of join().
261262
"""
262263
self._is_shutdown = True
263264
if immediate:
@@ -267,6 +268,7 @@ def shutdown(self, immediate=False):
267268
self._unfinished_tasks -= 1
268269
if self._unfinished_tasks == 0:
269270
self._finished.set()
271+
# All getters need to re-check queue-empty to raise ShutDown
270272
while self._getters:
271273
getter = self._getters.popleft()
272274
if not getter.done():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy