From: Jesse Noller Date: Thu, 6 Aug 2009 02:08:10 +0000 (+0000) Subject: Merge fix for 4660 back to 26 maint X-Git-Tag: v2.6.3rc1~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce14c099dfc1f3f89d58e06174168b69161746e3;p=python Merge fix for 4660 back to 26 maint --- diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index a94571b03b..936176c35d 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1141,11 +1141,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 diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py index fa8a13a8c7..02946788f3 100644 --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -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() diff --git a/Misc/ACKS b/Misc/ACKS index 2cd983079d..b5794a8070 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -468,6 +468,7 @@ Craig McPheeters Lambert Meertens Bill van Melle Lucas Prado Melo +Brian Merrell Luke Mewburn Mike Meyer Steven Miale diff --git a/Misc/NEWS b/Misc/NEWS index 289ee1d678..a4b30732c4 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -283,6 +283,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].