Amaury Forgeot d'Arc <amaur...@gmail.com> added the comment:

When the parser analyzes the test() function, it determines that 'u' in
"print(u)" is a global variable. But exec modifies the local namespace...

You could add a "u=None" near the start of the function, or better,
always use a namespace for the exec statement:

d = {}
exec v1 in d
en = d['u']

----------
nosy: +amaury.forgeotdarc
resolution:  -> works for me
status: open -> closed

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

Reply via email to