Re: [Python-Dev] [Python-checkins] cpython: Fix potential NameError in multiprocessing.Condition.wait()
Can you add a testcase for this? On Mon, Jun 4, 2012 at 9:01 PM, richard.oudkerk <python-checkins@python.org> wrote:
http://hg.python.org/cpython/rev/3baeb5e13dd2 changeset: 77348:3baeb5e13dd2 user: Richard Oudkerk <shibturn@gmail.com> date: Mon Jun 04 18:59:07 2012 +0100 summary: Fix potential NameError in multiprocessing.Condition.wait()
files: Lib/multiprocessing/synchronize.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py --- a/Lib/multiprocessing/synchronize.py +++ b/Lib/multiprocessing/synchronize.py @@ -216,7 +216,7 @@
try: # wait for notification or timeout - ret = self._wait_semaphore.acquire(True, timeout) + return self._wait_semaphore.acquire(True, timeout) finally: # indicate that this thread has woken self._woken_count.release() @@ -224,7 +224,6 @@ # reacquire lock for i in range(count): self._lock.acquire() - return ret
def notify(self): assert self._lock._semlock._is_mine(), 'lock is not owned'
-- Repository URL: http://hg.python.org/cpython
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
On 05/06/2012 6:59am, Eli Bendersky wrote:
Can you add a testcase for this? ...
import multiprocessing as mp [81047 refs] c = mp.Condition() [88148 refs] with mp.Condition() as c: c.wait() ... <Press Ctrl-C> Traceback (most recent call last): File "C:\Repos\cpython-dirty\lib\multiprocessing\synchronize.py",
OK. BTW, I should have written UnboundLocalError not NameError: line 219, in wait ret = self._wait_semaphore.acquire(True, timeout) KeyboardInterrupt During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Repos\cpython-dirty\lib\multiprocessing\synchronize.py", line 227, in wait return ret UnboundLocalError: local variable 'ret' referenced before assignment [88218 refs]
participants (2)
-
Eli Bendersky
-
shibturn