summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/multiprocessing/synchronize.py11
-rwxr-xr-xLib/test/regrtest.py3
-rw-r--r--Lib/test/test_multiprocessing.py8
3 files changed, 22 insertions, 0 deletions
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py
index be56a5b..08d7c5d 100644
--- a/Lib/multiprocessing/synchronize.py
+++ b/Lib/multiprocessing/synchronize.py
@@ -21,6 +21,17 @@ from multiprocessing.process import current_process
from multiprocessing.util import Finalize, register_after_fork, debug
from multiprocessing.forking import assert_spawning, Popen
+# Try to import the mp.synchronize module cleanly, if it fails
+# raise ImportError for platforms lacking a working sem_open implementation.
+# See issue 3770
+try:
+ from _multiprocessing import SemLock
+except (ImportError):
+ raise ImportError("This platform lacks a functioning sem_open" +
+ " implementation, therefore, the required" +
+ " synchronization primitives needed will not" +
+ " function, see issue 3770.")
+
#
# Constants
#
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 4eb4a64..886395b 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1075,6 +1075,7 @@ _expectations = {
test_tcl
test_timeout
test_urllibnet
+ test_multiprocessing
""",
'aix5':
"""
@@ -1102,6 +1103,7 @@ _expectations = {
test_ossaudiodev
test_pep277
test_tcl
+ test_multiprocessing
""",
'netbsd3':
"""
@@ -1115,6 +1117,7 @@ _expectations = {
test_ossaudiodev
test_pep277
test_tcl
+ test_multiprocessing
""",
}
_expectations['freebsd5'] = _expectations['freebsd4']
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index dd3ff1b..a8600c0 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -18,6 +18,14 @@ import socket
import random
import logging
+
+# Work around broken sem_open implementations
+try:
+ import multiprocessing.synchronize
+except ImportError as e:
+ from test.test_support import TestSkipped
+ raise TestSkipped(e)
+
import multiprocessing.dummy
import multiprocessing.connection
import multiprocessing.managers