On this page
queue.ShutDown
Prev: queue.Queue | Up: queue | Next: queue.SimpleQueue
Rel: queue.Empty, queue.Full, queue.LifoQueue, queue.PriorityQueue
Ref: docs.python.org โ queue.ShutDown
Tags: #public #python3 #stdlib #queue
Import
import queue
from queue import ShutDown
Signature & Overview
queue.ShutDown(...)
Raised when put/get with shut-down queue.
Methods & Attributes
ShutDown.add_note(self, note, /)โ Add a note to the exceptionShutDown.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import queue
q: queue.Queue[int] = queue.Queue()
q.shutdown()
try:
q.get()
except queue.ShutDown:
assert True
Gotchas
- Requires Python 3.13+: Cleanly unblocks waiting producer/consumer threads without sentinel
Nonehacks (q.shutdown(immediate=True)discards unread items).
REPL Inspect
from queue import ShutDown
help(ShutDown)
Linked from
Related notes
- tuts/python3/stdlib_module/queue/Queue Linked here; links to this page; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue/SimpleQueue Linked here; links to this page; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue/Empty Linked here; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue/Full Linked here; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue/LifoQueue Linked here; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue/PriorityQueue Linked here; shared tags: #queue, #stdlib
- tuts/python3/stdlib_module/queue links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib