File tree 3 files changed +9
-6
lines changed
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,10 @@ Queue
106
106
raise once the queue is empty. Set *immediate * to true to make
107
107
:meth: `~Queue.get ` raise immediately instead.
108
108
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 `.
112
113
113
114
.. versionadded :: 3.13
114
115
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ asyncio
298
298
299
299
* Add :meth: `asyncio.Queue.shutdown ` (along with
300
300
: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 `.)
302
302
303
303
base64
304
304
------
Original file line number Diff line number Diff line change @@ -256,8 +256,9 @@ def shutdown(self, immediate=False):
256
256
By default, gets will only raise once the queue is empty. Set
257
257
'immediate' to True to make gets raise immediately instead.
258
258
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().
261
262
"""
262
263
self ._is_shutdown = True
263
264
if immediate :
@@ -267,6 +268,7 @@ def shutdown(self, immediate=False):
267
268
self ._unfinished_tasks -= 1
268
269
if self ._unfinished_tasks == 0 :
269
270
self ._finished .set ()
271
+ # All getters need to re-check queue-empty to raise ShutDown
270
272
while self ._getters :
271
273
getter = self ._getters .popleft ()
272
274
if not getter .done ():
You can’t perform that action at this time.
0 commit comments