Terry J. Reedy added the comment:
Searching on 'exec NameError' shows that this issue is a duplicate of (behavior
issue) #1167300 which contained an essentially identical example"
>>> exec """\
... x = 3
... def f():
... print x
... f()
... """ in {}, {}
#1167300 was closed as a duplicate
New submission from anatoly techtonik :
main.py below fails to execute local.py, which work ok (outputs '2') when
processed directly in console.
Docs are not explaining anything. They spread fear and uncertainty around
locals, but nothing is said why globals may fail.
http://docs.python.org/li