GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Document the public `multiprocessing.[Bounded]Semaphore.get_value` method and refactor code · Issue #133146 · python/cpython

Document the public multiprocessing.[Bounded]Semaphore.get_value method and refactor code #133146

New issue
Copy link
New issue
Copy link
Closed
#133301
Closed
Document the public multiprocessing.[Bounded]Semaphore.get_value method and refactor code#133146
#133301
Copy link
Assignees
gpshead
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-featureA feature request or enhancementA feature request or enhancement

Description

@YvesDup
YvesDup
opened on Apr 29, 2025
Issue body actions

Feature or enhancement

Proposal:

This improvement is based on @ronaldoussoren's comment at #125829 (comment)

  1. This public method should be documented in the synchronization primitives of multiprocessing module.
  2. I also suggest to refactor code with this public method, in replacement of calls to the private method semaphore._semlock._get_value in the following locations:

cpython/Lib/multiprocessing/synchronize.py

Line 142 in 0c26dbd

value = self._semlock._get_value()

cpython/Lib/multiprocessing/synchronize.py

Line 158 in 0c26dbd

value = self._semlock._get_value()

cpython/Lib/multiprocessing/synchronize.py

Lines 250 to 251 in 0c26dbd

num_waiters = (self._sleeping_count._semlock._get_value() -
self._woken_count._semlock._get_value())

cpython/Lib/multiprocessing/queues.py

Line 124 in 0c26dbd

return self._maxsize - self._sem._semlock._get_value()

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-133146: Add the old public get_value method to documentation and refactor code. #133301
  • [3.14] gh-133146: Add the old public get_value method to documentation and refactor code. (GH-133301) #142110

Activity

  1. YvesDup
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Apr 29, 2025
  2. ZeroIntensity
    added
    topic-multiprocessing
    on Apr 29, 2025
  3. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on May 1, 2025
  4. YvesDup commented on May 2, 2025

    @YvesDup
    YvesDup
    on May 2, 2025
    ContributorAuthor
    More actions

    Perhaps there was a good reason for never documenting this public method.

  5. gpshead
    marked multiprocessing.Semaphore has undocumented get_value() method #84974 as a duplicate of this issue on Nov 29, 2025
  6. gpshead
    self-assigned this
    on Nov 29, 2025
  7. gpshead
    added a commit that references this issue on Nov 29, 2025

    gh-133146: Add the old public `get_value` method to documentation and…

    db098a4
  8. gpshead
    closed this as completedin #133301on Nov 29, 2025
  9. hugovk
    added a commit that references this issue on Nov 30, 2025

    [3.14] pythongh-133146: Add the old public `get_value` method to docu…

    ecab12a
  10. gpshead
    added a commit that references this issue on Nov 30, 2025

    [3.14] gh-133146: Add the old public `get_value` method to documentat…

    b95d16a
  11. StanFromIreland
    added a commit that references this issue on Dec 6, 2025

    pythongh-133146: Add the old public `get_value` method to documentati…

    a19fde2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gpshead
    gpshead

Labels

stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.