Skip to content

Fix docs for Queue.shutdown #137028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Match the exception used by asyncio
  • Loading branch information
rhettinger committed Jul 24, 2025
commit 12d1ea96edf826373a5a759cc86160a58464e1c0
8 changes: 4 additions & 4 deletions Doc/library/asyncio-queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ Queue
Put a :class:`Queue` instance into a shutdown mode.

The queue can no longer grow.
Future calls to :meth:`~Queue.put` raise :exc:`ShutDown`.
Future calls to :meth:`~Queue.put` raise :exc:`QueueShutDown`.
Currently blocked callers of :meth:`~Queue.put` will be unblocked
and will raise :exc:`ShutDown` in the formerly blocked thread.
and will raise :exc:`QueueShutDown` in the formerly blocked thread.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and will raise :exc:`QueueShutDown` in the formerly blocked thread.
and will raise :exc:`QueueShutDown` in the formerly blocked tasks.

asyncio queues are not thread safe, they can only be used with tasks.


If *immediate* is false (the default), the queue can be wound
down normally with calls :meth:`~Queue.get` to extract tasks
Expand All @@ -117,13 +117,13 @@ Queue
pending :meth:`~Queue.join` will be unblocked normally.

Once the queue is empty, future calls to :meth:`~Queue.get` will
raise :exc:`ShutDown`.
raise :exc:`QueueShutDown`.

If *immediate* is true, the queue is terminated immediately.
The queue is drained to be completely empty. All callers of
:meth:`~Queue.join` are unblocked regardless of the number
of unfinished tasks. Blocked callers of :meth:`~Queue.get`
are unblocked and will raise :exc:`ShutDown` because the
are unblocked and will raise :exc:`QueueShutDown` because the
queue is empty.

Use caution when using :meth:`~Queue.join` with *immediate* set
Expand Down
Loading