-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Fix docs for Queue.shutdown #137028
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update also the asyncio.queue
documentation and the docstrings.
I don't feel comfortable editing those docs (I don't use asyncio anymore). Someone else who knows the territory better can model an edit on this one. |
It is mostly just a copy of the queue.Queue documentation. It would be better to keep them in sync. At least update the docstrings. |
Okay, I updated the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update also the task_done
docstrings, for both classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
The queue can no longer grow. | ||
Future calls to :meth:`~Queue.put` raise :exc:`QueueShutDown`. | ||
Currently blocked callers of :meth:`~Queue.put` will be unblocked | ||
and will raise :exc:`QueueShutDown` in the formerly blocked thread. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
(cherry picked from commit 2456715) Co-authored-by: Raymond Hettinger <[email protected]>
(cherry picked from commit 2456715) Co-authored-by: Raymond Hettinger <[email protected]>
GH-137080 is a backport of this pull request to the 3.14 branch. |
GH-137081 is a backport of this pull request to the 3.13 branch. |
Fix errors. Clarify ambiguities. Improve presentation. Add cautionary note.
task_done
docs. That method is not called byshutdown
.put
will be unblocked but will also immediately raise 'ShutDown' in the formerly blocked thread.get
andtask_done
continue to operate normally except that aget
on an empty queue will now raiseShutDown
instead ofEmpty
.Queue.join
waiters, notifyget
andput
waiters.task_done
.Queue.join
is unblocked even if the unfinished tasks are more than zero.Queue.join
withimmediate=True
.📚 Documentation preview 📚: https://cpython-previews--137028.org.readthedocs.build/