Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.4k
bpo-25821: Fix inaccuracy in threading.enumerate/is_alive documentation#23192
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The list returned by enumerate contains all alive threads, but may contain others.
pitrou commentedNov 7, 2020
"active" is undefined. I would rather keep the corrent wording, but perhaps add that the main thread isalways there even when finished. |
iritkatriel commentedNov 7, 2020
I picked up active from |
pitrou commentedNov 7, 2020
Hmm, well you see that "active" is a synonym of "alive" in that instance. |
iritkatriel commentedNov 7, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There seems to be some distinction between "the thread object is alive" and thread.is_alive() |
pitrou commentedNov 7, 2020
Perhaps the following will be clear (but more wordy): Return a list of all:class:`Thread` objects currently active. The list includes daemonic threads, dummy thread objects created by:func:`current_thread`, and the main thread. It excludes terminated threads and threads that have not yet been started. However, the main thread is always part of the result, even when terminated. |
taleinat 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.
I think the change in threading.py is unnecessary, but harmless.@iritkatriel, let me know what you think about it, and then we can merge this.
Lib/threading.py Outdated
| This method returns True just before the run() method starts until just | ||
| after the run() method terminates. The module function enumerate() | ||
| returns a listof all alive threads. | ||
| returns a listthat contains all alive threads. |
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.
I think the existing wording is fine here; not sure why this change is need?
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.
That's because it may also contain a terminated main 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.
That makes the new wording correct, but possibly misleading.
The sentence aboutenumerate() seems somewhat out of place here; perhaps it could just be removed? Otherwise let's add something like "(and always the main thread)" at the end.
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.
Perhaps just "see also .."?
Lib/threading.py Outdated
| This method returns True just before the run() method starts until just | ||
| after the run() method terminates. The module function enumerate() | ||
| returns a listof all alive threads. | ||
| returns a listthat contains all alive threads. |
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.
That makes the new wording correct, but possibly misleading.
The sentence aboutenumerate() seems somewhat out of place here; perhaps it could just be removed? Otherwise let's add something like "(and always the main thread)" at the end.
bedevere-bot commentedDec 23, 2020
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
iritkatriel commentedDec 25, 2020
I have made the requested changes; please review again |
bedevere-bot commentedDec 25, 2020
Thanks for making the requested changes! @taleinat: please review the changes made to this pull request. |
This PR is stale because it has been open for 30 days with no activity. |
taleinat commentedMay 11, 2021
@iritkatriel, this is definitely ready to be merged. Now that you're a core dev, I'll leave it to you :) |
iritkatriel commentedMay 11, 2021
Oh! |
bedevere-bot commentedMay 11, 2021
@iritkatriel: Please replace |
miss-islington commentedMay 11, 2021
Thanks@iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9. |
…on (pythonGH-23192)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
bedevere-bot commentedMay 11, 2021
GH-26035 is a backport of this pull request to the3.10 branch. |
bedevere-bot commentedMay 11, 2021
GH-26036 is a backport of this pull request to the3.9 branch. |
…on (pythonGH-23192)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
Uh oh!
There was an error while loading.Please reload this page.
enumerate() returns a list of all active thread objects, which contains all threads for which is_alive is true but may also contain threads (like the main thread) for which is_alive is False.
https://bugs.python.org/issue25821