New submission from ganix: here is a code show what happend: >>> def func(): exec('ans=1') print(dir()) return ans
>>> func() ['ans'] Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> func() File "<pyshell#4>", line 4, in func return ans NameError: name 'ans' is not defined i tried this code in version 2.7,it is ok ---------- components: Argument Clinic messages: 263967 nosy: 324857679, larry priority: normal severity: normal status: open title: Variable defined in exec(code) unreachable inside function call with visible name in dir() results type: crash versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26825> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com