File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
303303base64
304304------
Original file line number Diff line number Diff 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 ():
You can’t perform that action at this time.
0 commit comments