-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
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
serhiy-storchaka
left a comment
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 |
serhiy-storchaka
left a comment
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.
serhiy-storchaka
left a comment
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 docs for Queue.shutdown (gh-137028) (cherry picked from commit 2456715) Co-authored-by: Raymond Hettinger <[email protected]> Co-authored-by: Zachary Ware <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
Fix errors. Clarify ambiguities. Improve presentation. Add cautionary note.
task_donedocs. That method is not called byshutdown.putwill be unblocked but will also immediately raise 'ShutDown' in the formerly blocked thread.getandtask_donecontinue to operate normally except that ageton an empty queue will now raiseShutDowninstead ofEmpty.Queue.joinwaiters, notifygetandputwaiters.task_done.Queue.joinis unblocked even if the unfinished tasks are more than zero.Queue.joinwithimmediate=True.📚 Documentation preview 📚: https://cpython-previews--137028.org.readthedocs.build/