[Python-Dev] [Python-checkins] cpython: Fix potential NameError in multiprocessing.Condition.wait()

shibturn shibturn at gmail.com
Tue Jun 5 13:00:47 CEST 2012


On 05/06/2012 6:59am, Eli Bendersky wrote:
> Can you add a testcase for this?
> ...

OK.

BTW, I should have written UnboundLocalError not NameError:

 >>> 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", 
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]



More information about the Python-Dev mailing list