Hi,<div>I stumbled on a small bug with httplib2 that I reduced to the example below.</div><div><br></div><div>It seems that with Python 3, when an exception is handled it "unbound" the previously declared local variable. This did not occurs with Python 2.5.</div>
<div><br></div><div>It is a Python 3 feature? I did not find anything in the what's news, but it's hard to search... (notes: I'm using Python 3.1.2)</div><div><br></div><div>---</div><div><div><div>def main():</div>
<div> msg = 'a message'</div><div> try:</div><div> raise ValueError( 'An error' )</div><div> except ValueError as msg:</div><div> pass</div><div> return msg</div><div><br></div><div>
main()</div></div></div><div><br></div><div><div>python localmask.py</div><div>Traceback (most recent call last):</div><div> File "localmask.py", line 12, in <module></div><div> main()</div><div> File "localmask.py", line 10, in main</div>
<div> return msg</div><div>UnboundLocalError: local variable 'msg' referenced before assignment</div></div><div>---</div>