]> granicus.if.org Git - python/commitdiff
Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not available.
authorBerker Peksag <berker.peksag@gmail.com>
Wed, 8 Apr 2015 14:56:30 +0000 (17:56 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Wed, 8 Apr 2015 14:56:30 +0000 (17:56 +0300)
Patch by Davin Potts.

Doc/library/multiprocessing.rst
Lib/multiprocessing/queues.py
Misc/NEWS

index cbec3305ce51760a6b885270f72d2da0b01ca892..4d5f30841e4af67b643d622fb7a0d0d7ad547e9a 100644 (file)
@@ -262,14 +262,6 @@ that only one process prints to standard output at a time::
 Without using the lock output from the different processes is liable to get all
 mixed up.
 
-.. note::
-
-   Some of this package's functionality requires a functioning shared semaphore
-   implementation on the host operating system. Without one, the
-   :mod:`multiprocessing.synchronize` module will be disabled, and attempts to
-   import it will result in an :exc:`ImportError`. See
-   :issue:`3770` for additional information.
-
 
 Sharing state between processes
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -808,6 +800,14 @@ For an example of the usage of queues for interprocess communication see
       immediately without waiting to flush enqueued data to the
       underlying pipe, and you don't care about lost data.
 
+   .. note::
+
+      This class's functionality requires a functioning shared semaphore
+      implementation on the host operating system. Without one, the
+      functionality in this class will be disabled, and attempts to
+      instantiate a :class:`Queue` will result in an :exc:`ImportError`. See
+      :issue:`3770` for additional information.  The same holds true for any
+      of the specialized queue types listed below.
 
 .. class:: SimpleQueue()
 
@@ -1183,6 +1183,14 @@ object -- see :ref:`multiprocessing-managers`.
    This differs from the behaviour of :mod:`threading` where SIGINT will be
    ignored while the equivalent blocking calls are in progress.
 
+.. note::
+
+   Some of this package's functionality requires a functioning shared semaphore
+   implementation on the host operating system. Without one, the
+   :mod:`multiprocessing.synchronize` module will be disabled, and attempts to
+   import it will result in an :exc:`ImportError`. See
+   :issue:`3770` for additional information.
+
 
 Shared :mod:`ctypes` Objects
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index f6507710922b7c0ad9fa9c92990da4b1c8f7bc86..c91535dd543ac397595c20de28327ba1bb3dc173 100644 (file)
@@ -35,7 +35,8 @@ class Queue(object):
 
     def __init__(self, maxsize=0, *, ctx):
         if maxsize <= 0:
-            maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX
+            # Can raise ImportError (see issues #3770 and #23400)
+            from .synchronize import SEM_VALUE_MAX as maxsize
         self._maxsize = maxsize
         self._reader, self._writer = connection.Pipe(duplex=False)
         self._rlock = ctx.Lock()
index 645e1ade1bb1c810b13da88c1f1491e61625fde8..61162df258534976ce7d893ddf5aa08bb88b090e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@ Library
 - Issue #23881: urllib.request.ftpwrapper constructor now closes the socket if
   the FTP connection failed to fix a ResourceWarning.
 
+- Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not
+  available.  Patch by Davin Potts.
+
 - Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always
   returns bool.  tkinter.BooleanVar now validates input values (accepted bool,
   int, str, and Tcl_Obj).  tkinter.BooleanVar.get() now always returns bool.