r66688 - in python/trunk: Doc/library/multiprocessing.rst Lib/multiprocessing/synchronize.py Lib/test/regrtest.py Lib/test/test_multiprocessing.py setup.py
Author: jesse.noller Date: Tue Sep 30 02:15:45 2008 New Revision: 66688 Log: issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller Modified: python/trunk/Doc/library/multiprocessing.rst python/trunk/Lib/multiprocessing/synchronize.py python/trunk/Lib/test/regrtest.py python/trunk/Lib/test/test_multiprocessing.py python/trunk/setup.py Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Tue Sep 30 02:15:45 2008 @@ -18,6 +18,13 @@ leverage multiple processors on a given machine. It runs on both Unix and Windows. +.. warning:: + + This package largely requires a functioning shared semaphore + implementation on the host operating system to function. Without one, the + :mod:`multiprocessing.synchronize` module will be disabled, and attempts to + import it will result in an ImportError. See + http://bugs.python.org/issue3770 for additional information. The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: python/trunk/Lib/multiprocessing/synchronize.py ============================================================================== --- python/trunk/Lib/multiprocessing/synchronize.py (original) +++ python/trunk/Lib/multiprocessing/synchronize.py Tue Sep 30 02:15:45 2008 @@ -21,6 +21,17 @@ 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 # Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Tue Sep 30 02:15:45 2008 @@ -1047,6 +1047,7 @@ test_tcl test_timeout test_urllibnet + test_multiprocessing """, 'aix5': """ @@ -1077,6 +1078,7 @@ test_ossaudiodev test_pep277 test_tcl + test_multiprocessing """, 'netbsd3': """ @@ -1092,6 +1094,7 @@ test_ossaudiodev test_pep277 test_tcl + test_multiprocessing """, } _expectations['freebsd5'] = _expectations['freebsd4'] Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Tue Sep 30 02:15:45 2008 @@ -18,6 +18,14 @@ import random import logging + +# Work around broken sem_open implementations +try: + import multiprocessing.synchronize +except ImportError, e: + from test.test_support import TestSkipped + raise TestSkipped(e) + import multiprocessing.dummy import multiprocessing.connection import multiprocessing.managers Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Tue Sep 30 02:15:45 2008 @@ -1269,6 +1269,14 @@ ) libraries = [] + elif platform.startswith('openbsd'): + macros = dict( # OpenBSD + HAVE_SEM_OPEN=0, # Not implemented + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + ) + libraries = [] + else: # Linux and other unices macros = dict( HAVE_SEM_OPEN=1,
participants (1)
-
jesse.noller