Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
iritkatriel merged 5 commits intopython:mainfromiritkatriel:bpo-25821
May 11, 2021

Conversation

@iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedNov 7, 2020
edited
Loading

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

The list returned by enumerate contains all alive threads, but may contain others.
@pitrou
Copy link
Member

"active" is undefined. I would rather keep the corrent wording, but perhaps add that the main thread isalways there even when finished.

@iritkatriel
Copy link
MemberAuthor

I picked up active from

.. function:: active_count()   Return the number of :class:`Thread` objects currently alive.  The returned   count is equal to the length of the list returned by :func:`.enumerate`.

@pitrou
Copy link
Member

Hmm, well you see that "active" is a synonym of "alive" in that instance.

@iritkatriel
Copy link
MemberAuthor

iritkatriel commentedNov 7, 2020
edited
Loading

There seems to be some distinction between "the thread object is alive" and thread.is_alive()

@pitrou
Copy link
Member

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.

Copy link
Contributor

@taleinattaleinat left a 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.

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.
Copy link
Contributor

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?

Copy link
MemberAuthor

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.

Copy link
Contributor

@taleinattaleinatDec 23, 2020
edited
Loading

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Perhaps just "see also .."?

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.
Copy link
Contributor

@taleinattaleinatDec 23, 2020
edited
Loading

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
Copy link

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 phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@iritkatriel
Copy link
MemberAuthor

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@taleinat: please review the changes made to this pull request.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelJan 25, 2021
@taleinat
Copy link
Contributor

@iritkatriel, this is definitely ready to be merged. Now that you're a core dev, I'll leave it to you :)

@iritkatriel
Copy link
MemberAuthor

Oh!

@iritkatrieliritkatriel merged commit12e7d10 intopython:mainMay 11, 2021
@bedevere-bot
Copy link

@iritkatriel: Please replace# withGH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks@iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 11, 2021
…on (pythonGH-23192)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
@bedevere-bot
Copy link

GH-26035 is a backport of this pull request to the3.10 branch.

@bedevere-bot
Copy link

GH-26036 is a backport of this pull request to the3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 11, 2021
…on (pythonGH-23192)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
iritkatriel added a commit that referenced this pull requestMay 11, 2021
…on (GH-23192) (#26035)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
iritkatriel added a commit that referenced this pull requestMay 11, 2021
…on (GH-23192) (#26036)(cherry picked from commit12e7d10)Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
@iritkatrieliritkatriel deleted the bpo-25821 branchMay 11, 2021 22:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@taleinattaleinattaleinat approved these changes

@pitroupitrouAwaiting requested review from pitrou

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip newsstaleStale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@iritkatriel@pitrou@bedevere-bot@taleinat@miss-islington@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp