Hi,
I stumbled on a small bug with httplib2 that I reduced to the example below.

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.

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)

---
def main():
    msg = 'a message'
    try:
        raise ValueError( 'An error' )
    except ValueError as msg:
        pass
    return msg

main()

python localmask.py
Traceback (most recent call last):
  File "localmask.py", line 12, in <module>
    main()
  File "localmask.py", line 10, in main
    return msg
UnboundLocalError: local variable 'msg' referenced before assignment
---
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to