Fix docs for Queue.shutdown#137028
Fix docs for Queue.shutdown#137028rhettinger merged 14 commits intopython:mainpython/cpython:mainfrom
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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.
Please update also the task_done docstrings, for both classes.
| 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.
| 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 <rhettinger@users.noreply.github.com>
(cherry picked from commit 2456715) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
|
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_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/