[issue26825] Variable defined in exec(code) unreachable inside function call with visible name in dir() results
ganix
report at bugs.python.org
Fri Apr 22 02:54:50 EDT 2016
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 <report at bugs.python.org>
<http://bugs.python.org/issue26825>
_______________________________________
More information about the Python-bugs-list
mailing list