8000 bpo-38377: Fix skip_if_broken_multiprocessing_synchronize() on macOS by vstinner · Pull Request #20984 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-38377: Fix skip_if_broken_multiprocessing_synchronize() on macOS #20984

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ def skip_if_broken_multiprocessing_synchronize():
"""
Skip tests if the multiprocessing.synchronize module is missing, if there
is no available semaphore implementation, or if creating a lock raises an
OSError.
OSError (on Linux only).
"""

# Skip tests if the _multiprocessing extension is missing.
642F Expand All @@ -1972,10 +1972,11 @@ def skip_if_broken_multiprocessing_synchronize():
# multiprocessing.synchronize requires _multiprocessing.SemLock.
synchronize = import_module('multiprocessing.synchronize')

try:
# bpo-38377: On Linux, creating a semaphore is the current user
# does not have the permission to create a file in /dev/shm.
# Create a semaphore to check permissions.
synchronize.Lock(ctx=None)
except OSError as exc:
raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}")
if sys.platform == "linux":
try:
# bpo-38377: On Linux, creating a semaphore fails with OSError
# if the current user does not have the permission to create
# a file in /dev/shm/ directory.
synchronize.Lock(ctx=None)
except OSError as exc:
raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}")
0