python / python/cpython

In `test._test_multiprocessing` file, `HAVE_GETVALUE` constant is always `False`

Open
#155,445 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests topic-multiprocessing type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

In the test._test_multprocessing, the HAVE_GETVALUE constant is always False because the HAVE_BROKEN_SEM_GETVALUE value does not exist in _multiprocessingmodule.

https://github.com/python/cpython/blob/6f7fb6c95ba9e4d5c1b86d0d4ad83d0cd495976b/Lib/test/_test_multiprocessing.py#L141-L142

On macOS, this value exists only in the flagsdict of _multiprocessing.

>>> import _mulitpocessing
>>> vars(_multiprocessing)
{'__name__': '_multiprocessing', '__doc__': None, '__package__': '', 
'__loader__':  ............ ,
.......
'SemLock': <class '_multiprocessing.SemLock'>,
'flags': {'HAVE_SEM_OPEN': 1, 'HAVE_BROKEN_SEM_GETVALUE': 1}}

Fix is easy and will permit to reactivate the second part of test_bounded_semaphore test.
https://github.com/python/cpython/blob/6f7fb6c95ba9e4d5c1b86d0d4ad83d0cd495976b/Lib/test/_test_multiprocessing.py#L1755-L1757

A new PR will be submitted soon.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Linux

Linked PRs
  • gh-155540

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Lib/test/_test_multiprocessing.py at the HAVE_GETVALUE definition and test_bounded_semaphore. Check how _multiprocessing exposes its flags on macOS, then run the relevant multiprocessing tests. Done means HAVE_GETVALUE reflects the platform value and the second part of test_bounded_semaphore is active and passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.