New submission from Steven Samuel Cole <steven.samuel.c...@gmail.com>:

inside a function, I create a local variable by using setattr with the current 
module as object, as in
  setattr(modules[__name__], 'name', 'value')

if I _later_ in the code set name to None, the attribute becomes unavailable 
even for code that is executed _before_ setting name to None.

please also see sample file.

----------
components: Interpreter Core
files: show_weird_behavior.py
messages: 118099
nosy: ssc
priority: normal
severity: normal
status: open
title: UnboundLocalError with local variable set by setattr, caused by code run 
later
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file19146/show_weird_behavior.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10043>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to