]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix issue 4660: spurious task_done errors in multiprocessing, remove doc note for...
authorJesse Noller <jnoller@gmail.com>
Thu, 6 Aug 2009 02:05:56 +0000 (02:05 +0000)
committerJesse Noller <jnoller@gmail.com>
Thu, 6 Aug 2009 02:05:56 +0000 (02:05 +0000)
Doc/library/multiprocessing.rst
Lib/multiprocessing/queues.py
Misc/ACKS
Misc/NEWS

index 9e53aa5635cfe8a03690cdd8ecb463f1b89bc5f2..66c73a146bbbb66d4412ee6fd9476f633c60537d 100644 (file)
@@ -1153,11 +1153,6 @@ their parent process exits.  The manager classes are defined in the
 
       Run the server in the current process.
 
-   .. method:: from_address(address, authkey)
-
-      A class method which creates a manager object referring to a pre-existing
-      server process which is using the given address and authentication key.
-
    .. method:: get_server()
 
       Returns a :class:`Server` object which represents the actual server under
index 5df58825b5b8806bbd6edc2d0d12fc2c11a39088..ea279911b6c12fd6ae0d4c8f815da2707ecb2b37 100644 (file)
@@ -282,9 +282,22 @@ class JoinableQueue(Queue):
         Queue.__setstate__(self, state[:-2])
         self._cond, self._unfinished_tasks = state[-2:]
 
-    def put(self, item, block=True, timeout=None):
-        Queue.put(self, item, block, timeout)
-        self._unfinished_tasks.release()
+    def put(self, obj, block=True, timeout=None):
+        assert not self._closed
+        if not self._sem.acquire(block, timeout):
+            raise Full
+
+        self._notempty.acquire()
+        self._cond.acquire()
+        try:
+            if self._thread is None:
+                self._start_thread()
+            self._buffer.append(obj)
+            self._unfinished_tasks.release()
+            self._notempty.notify()
+        finally:
+            self._cond.release()
+            self._notempty.release()
 
     def task_done(self):
         self._cond.acquire()
index 0ecbb5186cb7366d0812cf9afacacdbdbf5921e8..defa80273eca3a7fbde7b561375ff1e408107428 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -485,6 +485,7 @@ Craig McPheeters
 Lambert Meertens
 Bill van Melle
 Lucas Prado Melo
+Brian Merrell
 Luke Mewburn
 Mike Meyer
 Steven Miale
index 24232620eaee75035de888d4dbfa6881189d6a66..9fd2a513c0b3adb08c4bbc8e58235433e91a2e14 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -354,6 +354,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #4660: If a multiprocessing.JoinableQueue.put() was preempted, it was
+  possible to get a spurious 'task_done() called too many times' error.
+
 - Issue #6595: The Decimal constructor now allows arbitrary Unicode
   decimal digits in input, as recommended by the standard.  Previously
   it was restricted to accepting [0-9].