Patch #1550800: make exec a function.

This commit is contained in:
Georg Brandl 2006-09-06 06:51:57 +00:00
parent 4e472e05bd
commit 7cae87ca7b
105 changed files with 1246 additions and 1583 deletions

View file

@ -23,7 +23,6 @@ While: test, body, else_&
With: expr, vars&, body
If: tests!, else_&
IfExp: test, then, else_
Exec: expr, locals&, globals&
From: modname*, names*, level*
Import: names*
Raise: expr1&, expr2&, expr3&

View file

@ -126,7 +126,7 @@ class UI:
fp = open(fn, 'w')
try:
exec pycode
exec(pycode)
except:
message('An error occurred:-)')
return
@ -371,7 +371,7 @@ def main():
fp = open(sys.argv[1])
pycode = fp.read()
try:
exec pycode
exec(pycode)
except:
sys.stderr.write('An error occurred:-)\n')
sys.exit(1)

View file

@ -113,7 +113,7 @@ Notes:
future division statement.
- Warnings may be issued for code not read from a file, but executed
using an exec statement or the eval() function. These may have
using the exec() or eval() functions. These may have
<string> in the filename position, in which case the fixdiv script
will attempt and fail to open a file named '<string>' and issue a
warning about this failure; or these may be reported as 'Phantom'

View file

@ -130,7 +130,7 @@ def process(fp, outfp, env = {}):
ok = 0
stmt = '%s = %s\n' % (name, body.strip())
try:
exec stmt in env
exec(stmt, env)
except:
sys.stderr.write('Skipping: %s' % stmt)
else:
@ -142,7 +142,7 @@ def process(fp, outfp, env = {}):
body = pytify(body)
stmt = 'def %s(%s): return %s\n' % (macro, arg, body)
try:
exec stmt in env
exec(stmt, env)
except:
sys.stderr.write('Skipping: %s' % stmt)
else: