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

gh-141196: Fix threading.Semaphore documentation inconsistency#141244

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

Open
mohsinm-dev wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
frommohsinm-dev:fix-gh-141196-semaphore-docs

Conversation

@mohsinm-dev
Copy link

@mohsinm-devmohsinm-dev commentedNov 8, 2025
edited by github-actionsbot
Loading

Fixes issue#141196 by correcting inconsistent documentation in threading.Semaphore.

The acquire() method documentation stated 'Exactly one thread will be awoken by each call to release()' which became incorrect when the n parameter was added to release() in Python 3.9.

Updated acquire() docs to reflect that release(n) wakes min(j,n) threads where j = waiting threads, and clarified release() docs to specify 'up to n threads' are awakened.

The fix aligns documentation with actual behavior: Semaphore.release(n) calls Condition.notify(n), which wakes exactly min(n, waiting_threads) threads.

Documentation-only change, no code modifications required.


📚 Documentation preview 📚:https://cpython-previews--141244.org.readthedocs.build/

Changed "Objects of different types, except different numeric types, nevercompare equal" to "Objects of different types, unless documented otherwise,never compare equal" to account for documented exceptions like set/frozensetcomparisons.
The acquire() method documentation stated 'Exactly one thread will be awokenby each call to release()' which became incorrect when the n parameter wasadded to release() in Python 3.9.The release() method documentation was ambiguous about behavior whenn > waiting_threads.Changes:- acquire(): Updated to reflect that release(n) wakes min(j,n) threads  where j = waiting threads- release(): Clarified that it wakes 'up to n' threads, or all available  if fewer than n are waitingThe fix aligns documentation with actual implementation behavior inLib/threading.py where release(n) calls Condition.notify(n).
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

awaiting reviewdocsDocumentation in the Doc dirskip news

Projects

Status: Todo

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@mohsinm-dev

[8]ページ先頭

©2009-2025 Movatter.jp