This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: HAS_SHMEM detection logic is duplicated in implementation and tests
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: davin, lukasz.langa, pitrou, sobolevn
Priority: normal Keywords: patch

Created on 2021-09-21 07:49 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28487 closed sobolevn, 2021-09-21 07:54
Messages (2)
msg402291 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2021-09-21 07:49
`HAS_SHMEM` is defined in `multiprocessing.managers` module https://github.com/python/cpython/blob/0bfa1106acfcddc03590e1f5d6789dbad3affe70/Lib/multiprocessing/managers.py#L35-L40

Later the same logic is duplicated in `_test_multiprocessing`: https://github.com/python/cpython/blob/0bfa1106acfcddc03590e1f5d6789dbad3affe70/Lib/test/_test_multiprocessing.py#L52-L56

We can just use `multiprocessing.managers.HAS_SHMEM` instead.

I am going to send a PR with the fix.
msg402771 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-28 12:32
The logic is currently duplicated because trying to import `shared_memory` is how support discovery is supposed to work in user code.

`multiprocessing.managers` doesn't export HAS_SHMEM (it's not in `__all__` and it's not documented). Making tests rely on it feels wrong to me. It might change in the future.
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89417
2021-09-28 12:32:24lukasz.langasetstatus: open -> closed

nosy: + lukasz.langa
messages: + msg402771

resolution: rejected
stage: patch review -> resolved
2021-09-24 23:42:36terry.reedysetnosy: + pitrou, davin

versions: - Python 3.8
2021-09-21 07:54:36sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request26883
2021-09-21 07:52:45sobolevnsetcomponents: + Tests
versions: + Python 3.8, Python 3.9, Python 3.10, Python 3.11
2021-09-21 07:49:36sobolevncreate