Title: gh-141196: Fix threading.Semaphore documentation inconsistency by mohsinm-dev · Pull Request #141243 · python/cpython · GitHub
Open Graph Title: gh-141196: Fix threading.Semaphore documentation inconsistency by mohsinm-dev · Pull Request #141243 · python/cpython
X Title: gh-141196: Fix threading.Semaphore documentation inconsistency by mohsinm-dev · Pull Request #141243 · python/cpython
Description: Summary Fixes issue #141196 by correcting inconsistent documentation in threading.Semaphore. Problem 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. Solution Updated acquire() docs to reflect that release(n) wakes min(j,n) threads where j = waiting threads Clarified release() docs to specify "up to n threads" are awakened Implementation The fix aligns documentation with actual behavior: Semaphore.release(n) calls Condition.notify(n), which wakes exactly min(n, waiting_threads) threads. Testing Verified with test cases: release() → 1 thread woken release(2) with 3 waiting → 2 threads woken release(5) with 2 waiting → 2 threads woken Documentation-only change, no code modifications required. Issue: gh-141196 📚 Documentation preview 📚: https://cpython-previews--141243.org.readthedocs.build/
Open Graph Description: Summary Fixes issue #141196 by correcting inconsistent documentation in threading.Semaphore. Problem The acquire() method documentation stated "Exactly one thread will be awoken by each call t...
X Description: Summary Fixes issue #141196 by correcting inconsistent documentation in threading.Semaphore. Problem The acquire() method documentation stated "Exactly one thread will be awoken by each ca...
Opengraph URL: https://github.com/python/cpython/pull/141243
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9bfb80d2-a9a5-aab9-66e2-7a57d1a12970 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B67C:C257A:837ABE:BA92E4:6A5105D4 |
| html-safe-nonce | 349d9fd4bb6ac8d8082b6b4911fb1c7db156b46e8e30e2860924f327a5321cbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjdDOkMyNTdBOjgzN0FCRTpCQTkyRTQ6NkE1MTA1RDQiLCJ2aXNpdG9yX2lkIjoiNTkzMTIxMDIwODE3MjkwMTg0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 482e310a4f5872e3bf106c0ba7f1a1d0bca21f1abc6613ba9c9dd60320989c8a |
| hovercard-subject-tag | pull_request:2991443080 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/141243/files |
| twitter:image | https://avatars.githubusercontent.com/u/55545648?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/55545648?s=400&v=4 |
| og:image:alt | Summary Fixes issue #141196 by correcting inconsistent documentation in threading.Semaphore. Problem The acquire() method documentation stated "Exactly one thread will be awoken by each call t... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 38906a4da4e3e9fd88dfeacee232f5932c0c5f7495de3b4efc53ddfac7173d12 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 90441ea9b98e7491aa6ebcd135fccce4e2396f48 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width