]> granicus.if.org Git - python/commitdiff
Patch #1550800: make exec a function.
authorGeorg Brandl <georg@python.org>
Wed, 6 Sep 2006 06:51:57 +0000 (06:51 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 6 Sep 2006 06:51:57 +0000 (06:51 +0000)
105 files changed:
Demo/parser/unparse.py
Demo/pysvr/pysvr.py
Demo/sockets/rpythond.py
Doc/howto/doanddont.tex
Doc/lib/libdis.tex
Doc/lib/libexcs.tex
Doc/lib/libfuncs.tex
Doc/lib/libhotshot.tex
Doc/lib/libparser.tex
Doc/lib/libpdb.tex
Doc/lib/libprofile.tex
Doc/lib/librexec.tex
Doc/lib/libstdtypes.tex
Doc/lib/libtraceback.tex
Doc/ref/ref2.tex
Doc/ref/ref4.tex
Doc/ref/ref6.tex
Doc/ref/ref8.tex
Doc/ref/reswords.py
Doc/tut/tut.tex
Grammar/Grammar
Include/Python-ast.h
Include/graminit.h
Include/opcode.h
Include/symtable.h
Lib/Bastion.py
Lib/bdb.py
Lib/bsddb/__init__.py
Lib/cProfile.py
Lib/cgi.py
Lib/code.py
Lib/compiler/ast.py
Lib/compiler/pyassem.py
Lib/compiler/pycodegen.py
Lib/compiler/transformer.py
Lib/doctest.py
Lib/hashlib.py
Lib/idlelib/PyShell.py
Lib/idlelib/run.py
Lib/ihooks.py
Lib/imputil.py
Lib/keyword.py
Lib/lib-tk/Tkinter.py
Lib/opcode.py
Lib/pdb.py
Lib/plat-irix5/flp.py
Lib/plat-irix5/panel.py
Lib/plat-irix6/flp.py
Lib/plat-irix6/panel.py
Lib/plat-mac/aetypes.py
Lib/plat-mac/appletrawmain.py
Lib/plat-mac/pimp.py
Lib/profile.py
Lib/rexec.py
Lib/runpy.py
Lib/site.py
Lib/socket.py
Lib/symbol.py
Lib/test/crashers/bogus_code_obj.py
Lib/test/output/test_cProfile
Lib/test/output/test_grammar
Lib/test/output/test_profile
Lib/test/test___all__.py
Lib/test/test_ast.py
Lib/test/test_binop.py
Lib/test/test_builtin.py
Lib/test/test_class.py
Lib/test/test_codeop.py
Lib/test/test_compile.py
Lib/test/test_compiler.py
Lib/test/test_descr.py
Lib/test/test_descrtut.py
Lib/test/test_dis.py
Lib/test/test_doctest.py
Lib/test/test_exceptions.py
Lib/test/test_funcattrs.py
Lib/test/test_gc.py
Lib/test/test_getopt.py
Lib/test/test_grammar.py
Lib/test/test_import.py
Lib/test/test_importhooks.py
Lib/test/test_inspect.py
Lib/test/test_multibytecodec.py
Lib/test/test_operations.py
Lib/test/test_parser.py
Lib/test/test_scope.py
Lib/test/test_transformer.py
Lib/test/time_hashlib.py
Lib/timeit.py
Lib/trace.py
Misc/vgrindefs
Modules/parsermodule.c
Modules/symtablemodule.c
Parser/Python.asdl
Python/Python-ast.c
Python/ast.c
Python/bltinmodule.c
Python/ceval.c
Python/compile.c
Python/graminit.c
Python/symtable.c
Tools/compiler/ast.txt
Tools/modulator/modulator.py
Tools/scripts/fixdiv.py
Tools/scripts/h2py.py

index 510cdb07ba11affb5ff66c8321ce32dba431a464..f3a5ffe2d5c13fb37067b05c28cb3988b467ee8e 100644 (file)
@@ -123,16 +123,6 @@ class Unparser:
             self.write(", ")
             self.dispatch(t.msg)
 
-    def _Exec(self, t):
-        self.fill("exec ")
-        self.dispatch(t.body)
-        if t.globals:
-            self.write(" in ")
-            self.dispatch(t.globals)
-        if t.locals:
-            self.write(", ")
-            self.dispatch(t.locals)
-
     def _Print(self, t):
         self.fill("print ")
         do_comma = False
index dd0abdc77251ce906033961a94e5ff3a605ed515..3b692b3d2fef70e43930a184d43ba5871eba566e 100755 (executable)
@@ -108,7 +108,7 @@ def run_command(code, stdin, stdout, globals):
         sys.stdout = sys.stderr = stdout
         sys.stdin = stdin
         try:
-            exec code in globals
+            exec(code, globals)
         except SystemExit, how:
             raise SystemExit, how, sys.exc_info()[2]
         except:
index 81397d683a8842b6bed53623c3a38286f03bf21a..34de9829f9c9017027715e87d5038d41cfa32f59 100755 (executable)
@@ -40,7 +40,7 @@ def execute(request):
     sys.stdout = sys.stderr = fakefile = StringIO.StringIO()
     try:
         try:
-            exec request in {}, {}
+            exec(request, {}, {})
         except:
             print
             traceback.print_exc(100)
index df3ca346a4998d6c5ff70cade6f45d0c86fb9188..d81c374fda10a1de5758e192a585a3fda8c2298b 100644 (file)
@@ -81,7 +81,7 @@ There are situations in which \code{from module import *} is just fine:
 
 \end{itemize}
 
-\subsection{Unadorned \keyword{exec}, \function{execfile} and friends}
+\subsection{Unadorned \function{exec}, \function{execfile} and friends}
 
 The word ``unadorned'' refers to the use without an explicit dictionary,
 in which case those constructs evaluate code in the {\em current} environment.
@@ -93,10 +93,10 @@ Bad examples:
 
 \begin{verbatim}
 >>> for name in sys.argv[1:]:
->>>     exec "%s=1" % name
+>>>     exec("%s=1" % name)
 >>> def func(s, **kw):
 >>>     for var, val in kw.items():
->>>         exec "s.%s=val" % var  # invalid!
+>>>         exec("s.%s=val" % var)  # invalid!
 >>> execfile("handler.py")
 >>> handle()
 \end{verbatim}
index 5c53490666bc7a08a9b78d840503fd044d59d706..e61ca36548e9af3960eaddb2078239d8933f53c9 100644 (file)
@@ -408,11 +408,6 @@ to the local namespace. The module is popped after loading all names.
 This opcode implements \code{from module import *}.
 \end{opcodedesc}
 
-\begin{opcodedesc}{EXEC_STMT}{}
-Implements \code{exec TOS2,TOS1,TOS}.  The compiler fills
-missing optional parameters with \code{None}.
-\end{opcodedesc}
-
 \begin{opcodedesc}{POP_BLOCK}{}
 Removes one block from the block stack.  Per frame, there is a 
 stack of blocks, denoting nested loops, try statements, and such.
index b64d57d4c62836008a07588634f31628bc604152..b6147bf76a7cd4545812d97dbb2aed169f27309e 100644 (file)
@@ -293,10 +293,10 @@ Raised when an \keyword{assert} statement fails.
 \begin{excdesc}{SyntaxError}
 % XXXJH xref to these functions?
   Raised when the parser encounters a syntax error.  This may occur in
-  an \keyword{import} statement, in an \keyword{exec} statement, in a call
-  to the built-in function \function{eval()} or \function{input()}, or
-  when reading the initial script or standard input (also
-  interactively).
+  an \keyword{import} statement, in a call to the built-in functions
+  \function{exec()}, \function{execfile()}, \function{eval()} or
+  \function{input()}, or when reading the initial script or standard
+  input (also interactively).
 
   Instances of this class have attributes \member{filename},
   \member{lineno}, \member{offset} and \member{text} for easier access
index f51f0d5808efb83a2bca2382dfa5c4efbf1e471f..4dde06587c1adb0371925789e7f207d30cbc48e8 100644 (file)
@@ -178,7 +178,7 @@ class C:
 \begin{funcdesc}{compile}{string, filename, kind\optional{,
                           flags\optional{, dont_inherit}}}
   Compile the \var{string} into a code object.  Code objects can be
-  executed by an \keyword{exec} statement or evaluated by a call to
+  executed by a call to \function{exec()} or evaluated by a call to
   \function{eval()}.  The \var{filename} argument should
   give the file from which the code was read; pass some recognizable value
   if it wasn't read from a file (\code{'<string>'} is commonly used).
@@ -366,7 +366,7 @@ class C:
   compiled passing \code{'eval'} as the \var{kind} argument.
 
   Hints: dynamic execution of statements is supported by the
-  \keyword{exec} statement.  Execution of statements from a file is
+  \function{exec()} function.  Execution of statements from a file is
   supported by the \function{execfile()} function.  The
   \function{globals()} and \function{locals()} functions returns the
   current global and local dictionary, respectively, which may be
@@ -374,13 +374,47 @@ class C:
   \function{execfile()}.
 \end{funcdesc}
 
+
+\begin{funcdesc}{exec}{object\optional{, globals\optional{, locals}}}
+  This function supports dynamic execution of Python code.
+  \var{object} must be either a string, an open file object, or
+  a code object.  If it is a string, the string is parsed as a suite of
+  Python statements which is then executed (unless a syntax error
+  occurs).  If it is an open file, the file is parsed until \EOF{} and
+  executed.  If it is a code object, it is simply executed.  In all
+  cases, the code that's executed is expected to be valid as file
+  input (see the section ``File input'' in the Reference Manual).
+  Be aware that the \keyword{return} and \keyword{yield} statements may
+  not be used outside of function definitions even within the context of
+  code passed to the \function{exec()} function.
+  The return value is \code{None}.
+
+  In all cases, if the optional parts are omitted, the code is executed
+  in the current scope.  If only \var{globals} is provided, it must be
+  a dictionary, which will be used for both the global and the local
+  variables.  If \var{globals} and \var{locals} are given, they are used
+  for the global and local variables, respectively.  If provided,
+  \var{locals} can be any mapping object.
+
+  If the \var{globals} dictionary does not contain a value for the
+  key \code{__builtins__}, a reference to the dictionary of the built-in
+  module \module{__builtin__} is inserted under that key.  That way you
+  can control what builtins are available to the executed code by
+  inserting your own \code{__builtins__} dictionary into \var{globals}
+  before passing it to \function{exec()}.
+
+  \note{The built-in functions \function{globals()} and \function{locals()}
+        return the current global and local dictionary, respectively, which
+       may be useful to pass around for use as the second and third
+       argument to \function{exec()}.}
+\end{funcdesc}
+
 \begin{funcdesc}{execfile}{filename\optional{, globals\optional{, locals}}}
-  This function is similar to the
-  \keyword{exec} statement, but parses a file instead of a string.  It
+  This function is similar to the \function{exec()} function, but parses a
+  file given by the file name instead of a string.  It
   is different from the \keyword{import} statement in that it does not
   use the module administration --- it reads the file unconditionally
-  and does not create a new module.\footnote{It is used relatively
-  rarely so does not warrant being made into a statement.}
+  and does not create a new module.
 
   The arguments are a file name and two optional dictionaries.  The file is
   parsed and evaluated as a sequence of Python statements (similarly to a
index 98e0b6dcce918ca06085b1e201aa85ac0ee23340..ae089c26b303f2c187d0093c6e637fe85fc9927f 100644 (file)
@@ -61,7 +61,7 @@ Return the file descriptor of the profiler's log file.
 \end{methoddesc}
 
 \begin{methoddesc}{run}{cmd}
-Profile an \keyword{exec}-compatible string in the script environment.
+Profile an \function{exec()}-compatible string in the script environment.
 The globals from the \refmodule[main]{__main__} module are used as
 both the globals and locals for the script.
 \end{methoddesc}
@@ -76,7 +76,7 @@ disabled on the way out.
 
 
 \begin{methoddesc}{runctx}{cmd, globals, locals}
-Evaluate an \keyword{exec}-compatible string in a specific environment.
+Profile an \function{exec()}-compatible string in a specific environment.
 The string is compiled before profiling begins.
 \end{methoddesc}
 
index 15b46ae57ddf29d6c0d4647a2271f482fc9979a2..a993624ff990a66633bad1b2bbd69e0aba53a060 100644 (file)
@@ -193,8 +193,9 @@ false or omitted.
 
 \begin{funcdesc}{compileast}{ast\optional{, filename\code{ = '<ast>'}}}
 The Python byte compiler can be invoked on an AST object to produce
-code objects which can be used as part of an \keyword{exec} statement or
-a call to the built-in \function{eval()}\bifuncindex{eval} function.
+code objects which can be used as part of a call to the built-in
+\function{exec()}\bifuncindex{exec} or \function{eval()}
+\bifuncindex{eval} functions.
 This function provides the interface to the compiler, passing the
 internal parse tree from \var{ast} to the parser, using the
 source file name specified by the \var{filename} parameter.
index b252aeb42f1561e7f942897f3977297f28e12e26..778a137250eb5ffe405e17b36797e6b17606711d 100644 (file)
@@ -79,8 +79,8 @@ the statement using \samp{step} or \samp{next} (all these commands are
 explained below).  The optional \var{globals} and \var{locals}
 arguments specify the environment in which the code is executed; by
 default the dictionary of the module \refmodule[main]{__main__} is
-used.  (See the explanation of the \keyword{exec} statement or the
-\function{eval()} built-in function.)
+used.  (See the explanation of the built-in \function{exec()} or
+\function{eval()} functions.)
 \end{funcdesc}
 
 \begin{funcdesc}{runeval}{expression\optional{, globals\optional{, locals}}}
index 0108b21e5ddb2410fa8c2af57ab6886de5c7974e..79a168c4ef58f72dbee7cdb3a970e727bbe15965 100644 (file)
@@ -319,9 +319,9 @@ code for these modules.
 
 \begin{funcdesc}{run}{command\optional{, filename}}
 
-This function takes a single argument that has can be passed to the
-\keyword{exec} statement, and an optional file name.  In all cases this
-routine attempts to \keyword{exec} its first argument, and gather profiling
+This function takes a single argument that can be passed to the
+\function{exec()} function, and an optional file name.  In all cases this
+routine attempts to \function{exec()} its first argument, and gather profiling
 statistics from the execution. If no file name is present, then this
 function automatically prints a simple profiling report, sorted by the
 standard name string (file/line/function-name) that is presented in
index 35619e6368a3768fc8085c7f3fc065da72013b5f..3e54102fe1bff78ffa54315061346b5a9da84c81 100644 (file)
 \end{notice}
 
 This module contains the \class{RExec} class, which supports
-\method{r_eval()}, \method{r_execfile()}, \method{r_exec()}, and
+\method{r_exec()}, \method{r_eval()}, \method{r_execfile()}, and
 \method{r_import()} methods, which are restricted versions of the standard
-Python functions \method{eval()}, \method{execfile()} and
-the \keyword{exec} and \keyword{import} statements.
+Python functions \method{exec()}, \method{eval()}, \method{execfile()} and
+the \keyword{import} statement.
 Code executed in this restricted environment will
 only have access to modules and functions that are deemed safe; you
 can subclass \class{RExec} to add or remove capabilities as desired.
index b84daf44d591cce28eb8066067372c5acfe67cea..ef1b802c9e8793688cfe9c6210829ba551de6672 100644 (file)
@@ -1972,9 +1972,9 @@ attribute.
 \withsubitem{(function object attribute)}{\ttindex{func_code}}
 
 A code object can be executed or evaluated by passing it (instead of a
-source string) to the \keyword{exec} statement or the built-in
-\function{eval()} function.
-\stindex{exec}
+source string) to the \function{exec()} or \function{eval()} 
+built-in functions.
+\bifuncindex{exec}
 \bifuncindex{eval}
 
 See the \citetitle[../ref/ref.html]{Python Reference Manual} for more
index 80dc423c08915a47f92ded399b2f2555c94ea3b1..a87b1ef34d611fba4f1878566b90046c59ad3d46 100644 (file)
@@ -139,7 +139,7 @@ import sys, traceback
 def run_user_code(envdir):
     source = raw_input(">>> ")
     try:
-        exec source in envdir
+        exec(source, envdir)
     except:
         print "Exception in user code:"
         print '-'*60
index f82d9ce1cf22bb258e040e2eab60105c71bd5504..39b75a976e018a8e31faae62a8ff26085ccfa51a 100644 (file)
@@ -308,13 +308,12 @@ identifiers.  They must be spelled exactly as written here:%
 \index{reserved word}
 
 \begin{verbatim}
-and       del       from      not       while    
-as        elif      global    or        with     
-assert    else      if        pass      yield    
-break     except    import    print              
-class     exec      in        raise              
-continue  finally   is        return             
-def       for       lambda    try 
+and       def       for       is        raise
+as        del       from      lambda    return
+assert    elif      global    not       try
+break     else      if        or        while
+class     except    import    pass      with
+continue  finally   in        print     yield
 \end{verbatim}
 
 % When adding keywords, use reswords.py for reformatting
index 12a2b92e1676376c0e31ac31e16b82e2fa7c8df4..c8b536e4fc9329f4a170a206df47592203442367 100644 (file)
@@ -20,8 +20,8 @@ interpreter or specified on the interpreter command line the first
 argument) is a code block.  A script command (a command specified on
 the interpreter command line with the `\strong{-c}' option) is a code
 block.  The file read by the built-in function \function{execfile()}
-is a code block.  The string argument passed to the built-in function
-\function{eval()} and to the \keyword{exec} statement is a code block.
+is a code block.  The string argument passed to the built-in functions
+\function{eval()} and \function{exec()} is a code block.
 The expression read and evaluated by the built-in function
 \function{input()} is a code block.
 
@@ -139,22 +139,16 @@ If the wild card form of import --- \samp{import *} --- is used in a
 function and the function contains or is a nested block with free
 variables, the compiler will raise a \exception{SyntaxError}.
 
-If \keyword{exec} is used in a function and the function contains or
-is a nested block with free variables, the compiler will raise a
-\exception{SyntaxError} unless the exec explicitly specifies the local
-namespace for the \keyword{exec}.  (In other words, \samp{exec obj}
-would be illegal, but \samp{exec obj in ns} would be legal.)
-
-The \function{eval()}, \function{execfile()}, and \function{input()}
-functions and the \keyword{exec} statement do not have access to the
+The \function{eval()}, \function{exec()}, \function{execfile()},
+and \function{input()} functions do not have access to the
 full environment for resolving names.  Names may be resolved in the
 local and global namespaces of the caller.  Free variables are not
 resolved in the nearest enclosing namespace, but in the global
 namespace.\footnote{This limitation occurs because the code that is
     executed by these operations is not available at the time the
     module is compiled.}
-The \keyword{exec} statement and the \function{eval()} and
-\function{execfile()} functions have optional arguments to override
+The \function{exec()}, \function{eval()} and \function{execfile()}
+functions have optional arguments to override
 the global and local namespace.  If only one namespace is specified,
 it is used for both.
 
index 04db0131ea62846106cd241a0d201ce13596a265..c1bbd9b4389db439cf1b64b1d78ede07b3a700c5 100644 (file)
@@ -20,7 +20,6 @@ by semicolons.  The syntax for simple statements is:
   \productioncont{| \token{continue_stmt}}
   \productioncont{| \token{import_stmt}}
   \productioncont{| \token{global_stmt}}
-  \productioncont{| \token{exec_stmt}}
 \end{productionlist}
 
 
@@ -809,7 +808,7 @@ import __future__ [as name]
 That is not a future statement; it's an ordinary import statement with
 no special semantics or syntax restrictions.
 
-Code compiled by an \keyword{exec} statement or calls to the builtin functions
+Code compiled by calls to the builtin functions \function{exec()},
 \function{compile()} and \function{execfile()} that occur in a module
 \module{M} containing a future statement will, by default, use the new 
 syntax or semantics associated with the future statement.  This can,
@@ -855,64 +854,14 @@ program.)
 \strong{Programmer's note:}
 the \keyword{global} is a directive to the parser.  It
 applies only to code parsed at the same time as the \keyword{global}
-statement.  In particular, a \keyword{global} statement contained in an
-\keyword{exec} statement does not affect the code block \emph{containing}
-the \keyword{exec} statement, and code contained in an \keyword{exec}
-statement is unaffected by \keyword{global} statements in the code
-containing the \keyword{exec} statement.  The same applies to the
+statement.  In particular, a \keyword{global} statement contained in a
+string or code object supplied to the builtin \function{exec()} function
+does not affect the code block \emph{containing} the function call,
+and code contained in such a string is unaffected by \keyword{global}
+statements in the code containing the function call.  The same applies to the
 \function{eval()}, \function{execfile()} and \function{compile()} functions.
-\stindex{exec}
+\bifuncindex{exec}
 \bifuncindex{eval}
 \bifuncindex{execfile}
 \bifuncindex{compile}
 
-
-\section{The \keyword{exec} statement \label{exec}}
-\stindex{exec}
-
-\begin{productionlist}
-  \production{exec_stmt}
-             {"exec" \token{expression}
-              ["in" \token{expression} ["," \token{expression}]]}
-\end{productionlist}
-
-This statement supports dynamic execution of Python code.  The first
-expression should evaluate to either a string, an open file object, or
-a code object.  If it is a string, the string is parsed as a suite of
-Python statements which is then executed (unless a syntax error
-occurs).  If it is an open file, the file is parsed until \EOF{} and
-executed.  If it is a code object, it is simply executed.  In all
-cases, the code that's executed is expected to be valid as file
-input (see section~\ref{file-input}, ``File input'').  Be aware that
-the \keyword{return} and \keyword{yield} statements may not be used
-outside of function definitions even within the context of code passed
-to the \keyword{exec} statement.
-
-In all cases, if the optional parts are omitted, the code is executed
-in the current scope.  If only the first expression after \keyword{in}
-is specified, it should be a dictionary, which will be used for both
-the global and the local variables.  If two expressions are given,
-they are used for the global and local variables, respectively.
-If provided, \var{locals} can be any mapping object.
-\versionchanged[formerly \var{locals} was required to be a dictionary]{2.4}
-
-As a side effect, an implementation may insert additional keys into
-the dictionaries given besides those corresponding to variable names
-set by the executed code.  For example, the current implementation
-may add a reference to the dictionary of the built-in module
-\module{__builtin__} under the key \code{__builtins__} (!).
-\ttindex{__builtins__}
-\refbimodindex{__builtin__}
-
-\strong{Programmer's hints:}
-dynamic evaluation of expressions is supported by the built-in
-function \function{eval()}.  The built-in functions
-\function{globals()} and \function{locals()} return the current global
-and local dictionary, respectively, which may be useful to pass around
-for use by \keyword{exec}.
-\bifuncindex{eval}
-\bifuncindex{globals}
-\bifuncindex{locals}
-
-  
-
index 45be71d68176938ed5f06aedddf1ad333efddc60..3fe4cc5c7bd914d65086867aea441ac0c6d380e8 100644 (file)
@@ -62,7 +62,7 @@ This syntax is used in the following situations:
 
 \item when parsing a module;
 
-\item when parsing a string passed to the \keyword{exec} statement;
+\item when parsing a string passed to the \function{exec()} function;
 
 \end{itemize}
 
index 68862bbcffe53d70ef191f6a9b7d568bdf616439..53b8dc8364bce5d9be90107316e185ab42b19af5 100644 (file)
@@ -9,7 +9,7 @@ def main():
     words.sort()
     colwidth = 1 + max(map(len, words))
     nwords = len(words)
-    nrows = (nwords + ncols - 1) / ncols
+    nrows = (nwords + ncols - 1) // ncols
     for irow in range(nrows):
         for icol in range(ncols):
             i = irow + icol * nrows
index 702d7590287ce208eb15642f1a4bc265e8e3c950..2daf812e862adb16fce60a4bb9cd57cc57bc0871 100644 (file)
@@ -2698,7 +2698,7 @@ standard module \module{__builtin__}\refbimodindex{__builtin__}:
  '__name__', 'abs', 'basestring', 'bool', 'buffer',
  'callable', 'chr', 'classmethod', 'cmp', 'compile',
  'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod',
- 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float',
+ 'enumerate', 'eval', 'exec', 'execfile', 'exit', 'file', 'filter', 'float',
  'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex',
  'id', 'int', 'intern', 'isinstance', 'issubclass', 'iter',
  'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min',
@@ -4362,8 +4362,8 @@ the debugger, and that's one reason why this loophole is not closed.
 (Buglet: derivation of a class with the same name as the base class
 makes use of private variables of the base class possible.)
 
-Notice that code passed to \code{exec}, \code{eval()} or
-\code{evalfile()} does not consider the classname of the invoking 
+Notice that code passed to \code{exec()}, \code{eval()} or
+\code{execfile()} does not consider the classname of the invoking 
 class to be the current class; this is similar to the effect of the 
 \code{global} statement, the effect of which is likewise restricted to 
 code that is byte-compiled together.  The same restriction applies to
index 2e964f22551967517a04a1050d49dc7e30cbed75..281ae6b71125b55d741d2f87b9898f7306c7530a 100644 (file)
@@ -32,7 +32,7 @@ fplist: fpdef (',' fpdef)* [',']
 stmt: simple_stmt | compound_stmt
 simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
 small_stmt: (expr_stmt | print_stmt  | del_stmt | pass_stmt | flow_stmt |
-             import_stmt | global_stmt | exec_stmt | assert_stmt)
+             import_stmt | global_stmt | assert_stmt)
 expr_stmt: testlist (augassign (yield_expr|testlist) |
                      ('=' (yield_expr|testlist))*)
 augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |
@@ -58,7 +58,6 @@ import_as_names: import_as_name (',' import_as_name)* [',']
 dotted_as_names: dotted_as_name (',' dotted_as_name)*
 dotted_name: NAME ('.' NAME)*
 global_stmt: 'global' NAME (',' NAME)*
-exec_stmt: 'exec' expr ['in' test [',' test]]
 assert_stmt: 'assert' test [',' test]
 
 compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef
index 390b8eae4c60f16ae26ccac96b59dd4ec91ed1e1..2b817c687cbfaa6f7cdb263940d7118b27a8de6e 100644 (file)
@@ -64,8 +64,8 @@ enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3,
                   For_kind=8, While_kind=9, If_kind=10, With_kind=11,
                   Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14,
                   Assert_kind=15, Import_kind=16, ImportFrom_kind=17,
-                  Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21,
-                  Break_kind=22, Continue_kind=23};
+                  Global_kind=18, Expr_kind=19, Pass_kind=20, Break_kind=21,
+                  Continue_kind=22};
 struct _stmt {
         enum _stmt_kind kind;
         union {
@@ -164,12 +164,6 @@ struct _stmt {
                         int level;
                 } ImportFrom;
                 
-                struct {
-                        expr_ty body;
-                        expr_ty globals;
-                        expr_ty locals;
-                } Exec;
-                
                 struct {
                         asdl_seq *names;
                 } Global;
@@ -384,8 +378,6 @@ stmt_ty Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena
 stmt_ty Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
 stmt_ty ImportFrom(identifier module, asdl_seq * names, int level, int lineno,
                    int col_offset, PyArena *arena);
-stmt_ty Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int
-             col_offset, PyArena *arena);
 stmt_ty Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena);
 stmt_ty Expr(expr_ty value, int lineno, int col_offset, PyArena *arena);
 stmt_ty Pass(int lineno, int col_offset, PyArena *arena);
index f4701a623ea021ff8218c4af408e02f6c677d174..61c0814a597d20bbd72786f90ac417f3986e28ed 100644 (file)
 #define dotted_as_names 286
 #define dotted_name 287
 #define global_stmt 288
-#define exec_stmt 289
-#define assert_stmt 290
-#define compound_stmt 291
-#define if_stmt 292
-#define while_stmt 293
-#define for_stmt 294
-#define try_stmt 295
-#define with_stmt 296
-#define with_var 297
-#define except_clause 298
-#define suite 299
-#define testlist_safe 300
-#define old_test 301
-#define old_lambdef 302
-#define test 303
-#define or_test 304
-#define and_test 305
-#define not_test 306
-#define comparison 307
-#define comp_op 308
-#define expr 309
-#define xor_expr 310
-#define and_expr 311
-#define shift_expr 312
-#define arith_expr 313
-#define term 314
-#define factor 315
-#define power 316
-#define atom 317
-#define listmaker 318
-#define testlist_gexp 319
-#define lambdef 320
-#define trailer 321
-#define subscriptlist 322
-#define subscript 323
-#define sliceop 324
-#define exprlist 325
-#define testlist 326
-#define dictsetmaker 327
-#define classdef 328
-#define arglist 329
-#define argument 330
-#define list_iter 331
-#define list_for 332
-#define list_if 333
-#define gen_iter 334
-#define gen_for 335
-#define gen_if 336
-#define testlist1 337
-#define encoding_decl 338
-#define yield_expr 339
+#define assert_stmt 289
+#define compound_stmt 290
+#define if_stmt 291
+#define while_stmt 292
+#define for_stmt 293
+#define try_stmt 294
+#define with_stmt 295
+#define with_var 296
+#define except_clause 297
+#define suite 298
+#define testlist_safe 299
+#define old_test 300
+#define old_lambdef 301
+#define test 302
+#define or_test 303
+#define and_test 304
+#define not_test 305
+#define comparison 306
+#define comp_op 307
+#define expr 308
+#define xor_expr 309
+#define and_expr 310
+#define shift_expr 311
+#define arith_expr 312
+#define term 313
+#define factor 314
+#define power 315
+#define atom 316
+#define listmaker 317
+#define testlist_gexp 318
+#define lambdef 319
+#define trailer 320
+#define subscriptlist 321
+#define subscript 322
+#define sliceop 323
+#define exprlist 324
+#define testlist 325
+#define dictsetmaker 326
+#define classdef 327
+#define arglist 328
+#define argument 329
+#define list_iter 330
+#define list_for 331
+#define list_if 332
+#define gen_iter 333
+#define gen_for 334
+#define gen_if 335
+#define testlist1 336
+#define encoding_decl 337
+#define yield_expr 338
index 4c823d9fdc4f0f917ff6c3c1c8b159592c2ade29..04675ddbc85e80304f3a9d284935a77f8158adff 100644 (file)
@@ -75,7 +75,7 @@ extern "C" {
 #define LOAD_LOCALS    82
 #define RETURN_VALUE   83
 #define IMPORT_STAR    84
-#define EXEC_STMT      85
+
 #define YIELD_VALUE    86
 #define POP_BLOCK      87
 #define END_FINALLY    88
index 1e5996dc60fb547861b91d20d6d83aff0bdcb12e..f40bfa46662432ab32dd4e15ca6cf08239d5661c 100644 (file)
@@ -88,11 +88,9 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
 #define FREE 4
 #define CELL 5
 
-/* The following three names are used for the ste_unoptimized bit field */
+/* The following two names are used for the ste_unoptimized bit field */
 #define OPT_IMPORT_STAR 1
-#define OPT_EXEC 2
-#define OPT_BARE_EXEC 4
-#define OPT_TOPLEVEL 8  /* top-level names, including eval and exec */
+#define OPT_TOPLEVEL 2  /* top-level names, including eval and exec */
 
 #define GENERATOR 1
 #define GENERATOR_EXPRESSION 2
index 58cce978ce39095b6550ede7b6ec9ae477c28d4c..2127f46dbaff00e45a6306d9ed12c064b3e5e3c4 100644 (file)
@@ -164,7 +164,7 @@ def _test():
     else:
         print "accessible"
     \n"""
-    exec testcode
+    exec(testcode)
     print '='*20, "Using rexec:", '='*20
     import rexec
     r = rexec.RExec()
index 1e81c449e9e7a34bc947b10a0ccabdac4eab44e2..11cce42397bb193ec765315bf89177a034eafb22 100644 (file)
@@ -362,7 +362,7 @@ class Bdb:
             cmd = cmd+'\n'
         try:
             try:
-                exec cmd in globals, locals
+                exec(cmd, globals, locals)
             except BdbQuit:
                 pass
         finally:
index 0eeefd17485667652eebdbbb646349694241e05e..3099bb305c18b1d5b88c5dc0e8b719b396334542 100644 (file)
@@ -72,7 +72,7 @@ import sys, os
 if sys.version >= '2.3':
     import UserDict
     from weakref import ref
-    exec """
+    exec("""
 class _iter_mixin(UserDict.DictMixin):
     def _make_iter_cursor(self):
         cur = _DeadlockWrap(self.db.cursor)
@@ -145,7 +145,7 @@ class _iter_mixin(UserDict.DictMixin):
         except _bsddb.DBCursorClosedError:
             # the database was modified during iteration.  abort.
             return
-"""
+""")
 else:
     class _iter_mixin: pass
 
index 19d58048accd0d295a578831441b00cfbc8409a0..cb26fe105eee136bc9019c1758dd176e8d7ed874 100755 (executable)
@@ -137,7 +137,7 @@ class Profile(_lsprof.Profiler):
     def runctx(self, cmd, globals, locals):
         self.enable()
         try:
-            exec cmd in globals, locals
+            exec(cmd, globals, locals)
         finally:
             self.disable()
         return self
index 47c0279573779ebf740c1271c664093beb9b2fa8..fa8fd131970906efd5c6b78c59d65b37570cd6a3 100755 (executable)
@@ -910,7 +910,7 @@ def test(environ=os.environ):
         print_environ(environ)
         print_environ_usage()
         def f():
-            exec "testing print_exception() -- <I>italics?</I>"
+            exec("testing print_exception() -- <I>italics?</I>")
         def g(f=f):
             f()
         print "<H3>What follows is a test, not an actual exception:</H3>"
index b67009b93b7207430318db2dd8d89a71c698bd8d..8d3a884263aefda95eb6b25d269e07edd14c1007 100644 (file)
@@ -100,7 +100,7 @@ class InteractiveInterpreter:
 
         """
         try:
-            exec code in self.locals
+            exec(code, self.locals)
         except SystemExit:
             raise
         except:
index 69533255d77eeb7c6ec7ce7993d743feda1b9c0b..b06531f3f51cb8c50856e5fa076d51a99f6c98d0 100644 (file)
@@ -440,32 +440,6 @@ class Ellipsis(Node):
     def __repr__(self):
         return "Ellipsis()"
 
-class Exec(Node):
-    def __init__(self, expr, locals, globals, lineno=None):
-        self.expr = expr
-        self.locals = locals
-        self.globals = globals
-        self.lineno = lineno
-
-    def getChildren(self):
-        children = []
-        children.append(self.expr)
-        children.append(self.locals)
-        children.append(self.globals)
-        return tuple(children)
-
-    def getChildNodes(self):
-        nodelist = []
-        nodelist.append(self.expr)
-        if self.locals is not None:
-            nodelist.append(self.locals)
-        if self.globals is not None:
-            nodelist.append(self.globals)
-        return tuple(nodelist)
-
-    def __repr__(self):
-        return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals))
-
 class FloorDiv(Node):
     def __init__(self, (left, right), lineno=None):
         self.left = left
index 542d704b98ce219474a37614299929d51af4a003..5e3eb304a2eafa51974a6ff6b9b0bad8bd1687d8 100644 (file)
@@ -762,7 +762,6 @@ class StackDepthTracker:
         'PRINT_ITEM': -1,
         'RETURN_VALUE': -1,
         'YIELD_VALUE': -1,
-        'EXEC_STMT': -3,
         'BUILD_CLASS': -2,
         'STORE_NAME': -1,
         'STORE_ATTR': -2,
index af9904517ab94709131e445fc059c1651ca6f462..e0c3a1048df8207ddd9affdeb794054b234c52e6 100644 (file)
@@ -1043,18 +1043,6 @@ class CodeGenerator:
             self.emit('ROT_THREE')
             self.emit('STORE_SUBSCR')
 
-    def visitExec(self, node):
-        self.visit(node.expr)
-        if node.locals is None:
-            self.emit('LOAD_CONST', None)
-        else:
-            self.visit(node.locals)
-        if node.globals is None:
-            self.emit('DUP_TOP')
-        else:
-            self.visit(node.globals)
-        self.emit('EXEC_STMT')
-
     def visitCallFunc(self, node):
         pos = 0
         kw = 0
index a9b971a2557cbb4394551427518e4dd89bfe7589..4f2107f7e18fe44f9697c9c31cf9227743314bb9 100644 (file)
@@ -468,20 +468,6 @@ class Transformer:
             names.append(nodelist[i][1])
         return Global(names, lineno=nodelist[0][2])
 
-    def exec_stmt(self, nodelist):
-        # exec_stmt: 'exec' expr ['in' expr [',' expr]]
-        expr1 = self.com_node(nodelist[1])
-        if len(nodelist) >= 4:
-            expr2 = self.com_node(nodelist[3])
-            if len(nodelist) >= 6:
-                expr3 = self.com_node(nodelist[5])
-            else:
-                expr3 = None
-        else:
-            expr2 = expr3 = None
-
-        return Exec(expr1, expr2, expr3, lineno=nodelist[0][2])
-
     def assert_stmt(self, nodelist):
         # 'assert': test, [',' test]
         expr1 = self.com_node(nodelist[1])
@@ -1429,7 +1415,6 @@ _legal_node_types = [
     symbol.raise_stmt,
     symbol.import_stmt,
     symbol.global_stmt,
-    symbol.exec_stmt,
     symbol.assert_stmt,
     symbol.if_stmt,
     symbol.while_stmt,
index bdd284a27db0fd5efd7145f90bc7dd054005de15..435e13bc3250bfdf41adf1207f7443a84de9d0c1 100644 (file)
@@ -1209,8 +1209,8 @@ class DocTestRunner:
             # keyboard interrupts.)
             try:
                 # Don't blink!  This is where the user's code gets run.
-                exec compile(example.source, filename, "single",
-                             compileflags, 1) in test.globs
+                exec(compile(example.source, filename, "single",
+                             compileflags, 1), test.globs)
                 self.debugger.set_continue() # ==== Example Finished ====
                 exception = None
             except KeyboardInterrupt:
index 48fc56cf2b92a2476b8f0db46a3ad9ce22f8eb47..789e24edab5a00dfadc2517ec17ae8ce7c5b5134 100644 (file)
@@ -82,11 +82,11 @@ try:
             f = getattr(_hashlib, opensslFuncName)
             f()
             # Use the C function directly (very fast)
-            exec funcName + ' = f'
+            exec(funcName + ' = f')
         except ValueError:
             try:
                 # Use the builtin implementation directly (fast)
-                exec funcName + ' = __get_builtin_constructor(funcName)'
+                exec(funcName + ' = __get_builtin_constructor(funcName)')
             except ValueError:
                 # this one has no builtin implementation, don't define it
                 pass
index d8befffe8897dab39465495835bb54b080670920..709b3a769594d6462e58e5b82c473c5c06bc14e4 100644 (file)
@@ -690,7 +690,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
         if self.rpcclt:
             self.rpcclt.remotequeue("exec", "runcode", (code,), {})
         else:
-            exec code in self.locals
+            exec(code, self.locals)
         return 1
 
     def runcode(self, code):
@@ -711,7 +711,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
                 elif debugger:
                     debugger.run(code, self.locals)
                 else:
-                    exec code in self.locals
+                    exec(code, self.locals)
             except SystemExit:
                 if not self.tkconsole.closing:
                     if tkMessageBox.askyesno(
index ae810c4ecc7c6b39d5ab590a6b5c3bbc8f171077..61364a5073c3e5fe81278563a7d0ed2382fbf46e 100644 (file)
@@ -282,7 +282,7 @@ class Executive(object):
     def runcode(self, code):
         try:
             self.usr_exc_info = None
-            exec code in self.locals
+            exec(code, self.locals)
         except:
             self.usr_exc_info = sys.exc_info()
             if quitting:
index f5b93ab9cf3647bd32ce6ccf09a27418a1eec09d..eef34742e0aa14403409e2d810f86bf7dd99e8ae 100644 (file)
@@ -323,7 +323,7 @@ class FancyModuleLoader(ModuleLoader):
             m.__path__ = path
         m.__file__ = filename
         try:
-            exec code in m.__dict__
+            exec(code, m.__dict__)
         except:
             d = self.hooks.modules_dict()
             if name in d:
index 8a49bb14ff6513ef035fbded954444a04da06c8f..f2e752c4b66cde4dcb7ae33bca1d4fed64b8c220 100644 (file)
@@ -301,7 +301,7 @@ class Importer:
         # execute the code within the module's namespace
         if not is_module:
             try:
-                exec code in module.__dict__
+                exec(code, module.__dict__)
             except:
                 if fqname in sys.modules:
                     del sys.modules[fqname]
index cd1d55e8a2cfea5f40a74fd98dabc427081dc294..d2b26a7e0ca394982df904c44ca438f23c57c3df 100755 (executable)
@@ -25,7 +25,6 @@ kwlist = [
         'elif',
         'else',
         'except',
-        'exec',
         'finally',
         'for',
         'from',
index 262c45c43b17720db640dda0c670361fe44ee983..bea130cd5ff43f932891c56b5ed52669e61915d6 100644 (file)
@@ -1699,7 +1699,7 @@ class Tk(Misc, Wm):
         base_tcl = os.path.join(home, '.%s.tcl' % baseName)
         base_py = os.path.join(home, '.%s.py' % baseName)
         dir = {'self': self}
-        exec 'from Tkinter import *' in dir
+        exec('from Tkinter import *', dir)
         if os.path.isfile(class_tcl):
             self.tk.call('source', class_tcl)
         if os.path.isfile(class_py):
index cf8d90941346c9d358c4610fb8cdba0de4d99ed4..908dba4450b34ec1ecaf8d13613e04964fa7b870 100644 (file)
@@ -114,7 +114,6 @@ def_op('WITH_CLEANUP', 81)
 def_op('LOAD_LOCALS', 82)
 def_op('RETURN_VALUE', 83)
 def_op('IMPORT_STAR', 84)
-def_op('EXEC_STMT', 85)
 def_op('YIELD_VALUE', 86)
 def_op('POP_BLOCK', 87)
 def_op('END_FINALLY', 88)
index 06181e7f2aa861ce316d0567e9b383d05f4cf2e7..2bc836fe5a421a635648bd05c428b1ec472f2409 100755 (executable)
@@ -198,7 +198,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
         globals = self.curframe.f_globals
         try:
             code = compile(line + '\n', '<stdin>', 'single')
-            exec code in globals, locals
+            exec(code, globals, locals)
         except:
             t, v = sys.exc_info()[:2]
             if type(t) == type(''):
index 4f9175f5fdb8673d8024a45e87d7051b1b241627..83a22b6587a91d70e41250af607120ae69f303e3 100755 (executable)
@@ -329,7 +329,7 @@ def _parse_object(file):
 #
 def create_full_form(inst, (fdata, odatalist)):
     form = create_form(fdata)
-    exec 'inst.'+fdata.Name+' = form\n'
+    exec('inst.'+fdata.Name+' = form\n')
     for odata in odatalist:
         create_object_instance(inst, form, odata)
 
@@ -338,7 +338,7 @@ def create_full_form(inst, (fdata, odatalist)):
 # variable.
 #
 def merge_full_form(inst, form, (fdata, odatalist)):
-    exec 'inst.'+fdata.Name+' = form\n'
+    exec('inst.'+fdata.Name+' = form\n')
     if odatalist[0].Class != FL.BOX:
         raise error, 'merge_full_form() expects FL.BOX as first obj'
     for odata in odatalist[1:]:
@@ -374,7 +374,7 @@ def create_object_instance(inst, form, odata):
         cbfunc = eval('inst.'+odata.Callback)
         obj.set_call_back(cbfunc, odata.Argument)
     if odata.Name:
-        exec 'inst.' + odata.Name + ' = obj\n'
+        exec('inst.' + odata.Name + ' = obj\n')
 #
 # Internal _create_object: Create the object and fill options
 #
index 12e62a51b4a4daa1aa3b9b252702f631839448a1..1be914617cbb033471fc6cd880d4416d7ab31fa7 100755 (executable)
@@ -130,7 +130,7 @@ def assign_members(target, attrlist, exclist, prefix):
                 stmt = lhs + '=' + repr(value)
                 if debug: print 'exec', stmt
                 try:
-                    exec stmt + '\n'
+                    exec(stmt + '\n')
                 except KeyboardInterrupt: # Don't catch this!
                     raise KeyboardInterrupt
                 except:
@@ -186,7 +186,7 @@ def build_subactuators(panel, super_act, al):
         if name:
             stmt = 'panel.' + name + ' = act'
             if debug: print 'exec', stmt
-            exec stmt + '\n'
+            exec(stmt + '\n')
         if is_endgroup(a):
             panel.endgroup()
         sub_al = getattrlist(a, 'al')
@@ -236,7 +236,7 @@ def build_panel(descr):
         act.addact(panel)
         if name:
             stmt = 'panel.' + name + ' = act'
-            exec stmt + '\n'
+            exec(stmt + '\n')
         if is_endgroup(a):
             panel.endgroup()
         sub_al = getattrlist(a, 'al')
index f745472a70d728c2330e2f330212b481d07641a7..b0216226846defd0ab3b5c4b3f5c4f195dec24db 100644 (file)
@@ -328,7 +328,7 @@ def _parse_object(file):
 #
 def create_full_form(inst, (fdata, odatalist)):
     form = create_form(fdata)
-    exec 'inst.'+fdata.Name+' = form\n'
+    exec('inst.'+fdata.Name+' = form\n')
     for odata in odatalist:
         create_object_instance(inst, form, odata)
 
@@ -337,7 +337,7 @@ def create_full_form(inst, (fdata, odatalist)):
 # variable.
 #
 def merge_full_form(inst, form, (fdata, odatalist)):
-    exec 'inst.'+fdata.Name+' = form\n'
+    exec('inst.'+fdata.Name+' = form\n')
     if odatalist[0].Class != FL.BOX:
         raise error, 'merge_full_form() expects FL.BOX as first obj'
     for odata in odatalist[1:]:
@@ -373,7 +373,7 @@ def create_object_instance(inst, form, odata):
         cbfunc = eval('inst.'+odata.Callback)
         obj.set_call_back(cbfunc, odata.Argument)
     if odata.Name:
-        exec 'inst.' + odata.Name + ' = obj\n'
+        exec('inst.' + odata.Name + ' = obj\n')
 #
 # Internal _create_object: Create the object and fill options
 #
index 12e62a51b4a4daa1aa3b9b252702f631839448a1..1be914617cbb033471fc6cd880d4416d7ab31fa7 100644 (file)
@@ -130,7 +130,7 @@ def assign_members(target, attrlist, exclist, prefix):
                 stmt = lhs + '=' + repr(value)
                 if debug: print 'exec', stmt
                 try:
-                    exec stmt + '\n'
+                    exec(stmt + '\n')
                 except KeyboardInterrupt: # Don't catch this!
                     raise KeyboardInterrupt
                 except:
@@ -186,7 +186,7 @@ def build_subactuators(panel, super_act, al):
         if name:
             stmt = 'panel.' + name + ' = act'
             if debug: print 'exec', stmt
-            exec stmt + '\n'
+            exec(stmt + '\n')
         if is_endgroup(a):
             panel.endgroup()
         sub_al = getattrlist(a, 'al')
@@ -236,7 +236,7 @@ def build_panel(descr):
         act.addact(panel)
         if name:
             stmt = 'panel.' + name + ' = act'
-            exec stmt + '\n'
+            exec(stmt + '\n')
         if is_endgroup(a):
             panel.endgroup()
         sub_al = getattrlist(a, 'al')
index e5781efd3c40c3f0454ef32f4e8ac62241149995..14e48d683a96ddd1e49bb2868ae4a4a9eba81967 100644 (file)
@@ -557,12 +557,12 @@ template = """
 class %s(ComponentItem): want = '%s'
 """
 
-exec template % ("Text", 'text')
-exec template % ("Character", 'cha ')
-exec template % ("Word", 'cwor')
-exec template % ("Line", 'clin')
-exec template % ("paragraph", 'cpar')
-exec template % ("Window", 'cwin')
-exec template % ("Document", 'docu')
-exec template % ("File", 'file')
-exec template % ("InsertionPoint", 'cins')
+exec(template % ("Text", 'text'))
+exec(template % ("Character", 'cha '))
+exec(template % ("Word", 'cwor'))
+exec(template % ("Line", 'clin'))
+exec(template % ("paragraph", 'cpar'))
+exec(template % ("Window", 'cwin'))
+exec(template % ("Document", 'docu'))
+exec(template % ("File", 'file'))
+exec(template % ("InsertionPoint", 'cins'))
index 1be9187907b9019e992a122fe40f750ef4b0a366..6f2eacb20f013c0677e3238f3248bce405dbbf5d 100644 (file)
@@ -57,7 +57,7 @@ else:
         # funny) and go.
         #
         del argvemulator, os, sys, marshal, _dir, _fp
-        exec __code__
+        exec(__code__)
     else:
         sys.stderr.write("%s: neither __main__.py nor __main__.pyc found\n"%sys.argv[0])
         sys.exit(1)
index 454e4b103506dd5b118cb0b7de6d22f3048a6916..ff696b14efdf8f309b3be252a7d836ded40feaf1 100644 (file)
@@ -588,7 +588,7 @@ class PimpPackage:
             }
         installTest = self._dict['Install-test'].strip() + '\n'
         try:
-            exec installTest in namespace
+            exec(installTest, namespace)
         except ImportError, arg:
             return "no", str(arg)
         except _scriptExc_NotInstalled, arg:
@@ -757,7 +757,7 @@ class PimpPackage:
                 if line[0] == '#':
                     continue
                 if line[:6] == 'import':
-                    exec line
+                    exec(line)
                     continue
                 if line[-1] == '\n':
                     line = line[:-1]
index 27d68ba4838b6b3a08c5311009463921acfbb6cf..dc278dd5ee6492e4b490ef081b11623758a57273 100755 (executable)
@@ -459,7 +459,7 @@ class Profile:
         self.set_cmd(cmd)
         sys.setprofile(self.dispatcher)
         try:
-            exec cmd in globals, locals
+            exec(cmd, globals, locals)
         finally:
             sys.setprofile(None)
         return self
index 10e4bc0a542617b9a0d14586f1f48209cb568b40..37dff62e5072088092965e8ce531e8547a9972bd 100644 (file)
@@ -58,7 +58,7 @@ class FileDelegate(FileBase):
         self.name = name
 
     for m in FileBase.ok_file_methods + ('close',):
-        exec TEMPLATE % (m, m)
+        exec(TEMPLATE % (m, m))
 
 
 class RHooks(ihooks.Hooks):
@@ -310,7 +310,7 @@ class RExec(ihooks._Verbose):
 
         """
         m = self.add_module('__main__')
-        exec code in m.__dict__
+        exec(code, m.__dict__)
 
     def r_eval(self, code):
         """Evaluate code within a restricted environment.
index 8290dfea70a16c8154578abab1cd2d2318410672..dc350cf94a25441c9d44e40533b0d1edd9ec5ec5 100755 (executable)
@@ -29,7 +29,7 @@ def _run_code(code, run_globals, init_globals,
     run_globals.update(__name__ = mod_name,
                        __file__ = mod_fname,
                        __loader__ = mod_loader)
-    exec code in run_globals
+    exec(code, run_globals)
     return run_globals
 
 def _run_module_code(code, init_globals=None,
index 0cf19cd349c4abd4aedca0ad9b852d03d8304b08..1513818abdc3f06de42654ae58d07b78b667620c 100644 (file)
@@ -135,7 +135,7 @@ def addpackage(sitedir, name, known_paths):
             if line.startswith("#"):
                 continue
             if line.startswith("import"):
-                exec line
+                exec(line)
                 continue
             line = line.rstrip()
             dir, dircase = makepath(sitedir, line)
index 52fb8e33cb6195afd4c906b9351b8214c130ebc6..08605f8fb08f23626ea318d2ae6fc5e712b345fd 100644 (file)
@@ -191,7 +191,7 @@ class _socketobject(object):
     _s = ("def %s(self, *args): return self._sock.%s(*args)\n\n"
           "%s.__doc__ = _realsocket.%s.__doc__\n")
     for _m in _socketmethods:
-        exec _s % (_m, _m, _m, _m)
+        exec(_s % (_m, _m, _m, _m))
     del _m, _s
 
 socket = SocketType = _socketobject
index c65013813cca04f5289b4cdc8c76fbc3d000dacf..a7f7a857f12c37d3d05a74e3410ab322ce5e6024 100755 (executable)
@@ -43,57 +43,56 @@ import_as_names = 285
 dotted_as_names = 286
 dotted_name = 287
 global_stmt = 288
-exec_stmt = 289
-assert_stmt = 290
-compound_stmt = 291
-if_stmt = 292
-while_stmt = 293
-for_stmt = 294
-try_stmt = 295
-with_stmt = 296
-with_var = 297
-except_clause = 298
-suite = 299
-testlist_safe = 300
-old_test = 301
-old_lambdef = 302
-test = 303
-or_test = 304
-and_test = 305
-not_test = 306
-comparison = 307
-comp_op = 308
-expr = 309
-xor_expr = 310
-and_expr = 311
-shift_expr = 312
-arith_expr = 313
-term = 314
-factor = 315
-power = 316
-atom = 317
-listmaker = 318
-testlist_gexp = 319
-lambdef = 320
-trailer = 321
-subscriptlist = 322
-subscript = 323
-sliceop = 324
-exprlist = 325
-testlist = 326
-dictmaker = 327
-classdef = 328
-arglist = 329
-argument = 330
-list_iter = 331
-list_for = 332
-list_if = 333
-gen_iter = 334
-gen_for = 335
-gen_if = 336
-testlist1 = 337
-encoding_decl = 338
-yield_expr = 339
+assert_stmt = 289
+compound_stmt = 290
+if_stmt = 291
+while_stmt = 292
+for_stmt = 293
+try_stmt = 294
+with_stmt = 295
+with_var = 296
+except_clause = 297
+suite = 298
+testlist_safe = 299
+old_test = 300
+old_lambdef = 301
+test = 302
+or_test = 303
+and_test = 304
+not_test = 305
+comparison = 306
+comp_op = 307
+expr = 308
+xor_expr = 309
+and_expr = 310
+shift_expr = 311
+arith_expr = 312
+term = 313
+factor = 314
+power = 315
+atom = 316
+listmaker = 317
+testlist_gexp = 318
+lambdef = 319
+trailer = 320
+subscriptlist = 321
+subscript = 322
+sliceop = 323
+exprlist = 324
+testlist = 325
+dictsetmaker = 326
+classdef = 327
+arglist = 328
+argument = 329
+list_iter = 330
+list_for = 331
+list_if = 332
+gen_iter = 333
+gen_for = 334
+gen_if = 335
+testlist1 = 336
+encoding_decl = 337
+yield_expr = 338
 #--end constants--
 
 sym_name = {}
index 613ae518d4efe5498933c8e37f32c75abb7bb827..43815c1b1cd60ce6eba528879ab026f174432719 100644 (file)
@@ -16,4 +16,4 @@ import types
 
 co = types.CodeType(0, 0, 0, 0, '\x04\x71\x00\x00', (),
                     (), (), '', '', 1, '')
-exec co
+exec(co)
index fff3568ff47864e3c0d2ab0ba724299322ff027d..f9483a3d9fe32f01b7f84b13dc9cebcdce317276 100644 (file)
@@ -1,5 +1,5 @@
 test_cProfile
-         126 function calls (106 primitive calls) in 1.000 CPU seconds
+         127 function calls (107 primitive calls) in 1.000 CPU seconds
 
    Ordered by: standard name
 
@@ -14,6 +14,7 @@ test_cProfile
         4    0.116    0.029    0.120    0.030 test_cProfile.py:78(helper1)
         2    0.000    0.000    0.140    0.070 test_cProfile.py:89(helper2_indirect)
         8    0.312    0.039    0.400    0.050 test_cProfile.py:93(helper2)
+        1    0.000    0.000    1.000    1.000 {exec}
        12    0.000    0.000    0.012    0.001 {hasattr}
         4    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
@@ -44,6 +45,7 @@ test_cProfile.py:89(helper2_indirect)             ->       2    0.006    0.040
                                                            2    0.078    0.100  test_cProfile.py:93(helper2)
 test_cProfile.py:93(helper2)                      ->       8    0.064    0.080  test_cProfile.py:103(subhelper)
                                                            8    0.000    0.008  {hasattr}
+{exec}                                            ->       1    0.000    1.000  <string>:1(<module>)
 {hasattr}                                         ->      12    0.012    0.012  test_cProfile.py:115(__getattr__)
 {method 'append' of 'list' objects}               ->
 {method 'disable' of '_lsprof.Profiler' objects}  ->
@@ -55,7 +57,7 @@ test_cProfile.py:93(helper2)                      ->       8    0.064    0.080
 
 Function                                          was called by...
                                                       ncalls  tottime  cumtime
-<string>:1(<module>)                              <-
+<string>:1(<module>)                              <-       1    0.000    1.000  {exec}
 test_cProfile.py:103(subhelper)                   <-       8    0.064    0.080  test_cProfile.py:93(helper2)
 test_cProfile.py:115(__getattr__)                 <-      16    0.016    0.016  test_cProfile.py:103(subhelper)
                                                           12    0.012    0.012  {hasattr}
@@ -69,6 +71,7 @@ test_cProfile.py:78(helper1)                      <-       4    0.116    0.120
 test_cProfile.py:89(helper2_indirect)             <-       2    0.000    0.140  test_cProfile.py:60(helper)
 test_cProfile.py:93(helper2)                      <-       6    0.234    0.300  test_cProfile.py:60(helper)
                                                            2    0.078    0.100  test_cProfile.py:89(helper2_indirect)
+{exec}                                            <-
 {hasattr}                                         <-       4    0.000    0.004  test_cProfile.py:78(helper1)
                                                            8    0.000    0.008  test_cProfile.py:93(helper2)
 {method 'append' of 'list' objects}               <-       4    0.000    0.000  test_cProfile.py:78(helper1)
index 4fa9cb03c9864f06671d148efb8a43ec05c74831..8be2a1f501921f371ce87c8eb3962192badff464 100644 (file)
@@ -39,7 +39,6 @@ raise_stmt
 import_name
 import_from
 global_stmt
-exec_stmt
 assert_stmt
 if_stmt
 while_stmt
index 96bd77f68953826c5e0cea275a527106de7966d1..14bd9ac761c6ee0c539131d28b0cec862fd5e063 100644 (file)
@@ -1,11 +1,12 @@
 test_profile
-         127 function calls (107 primitive calls) in 1.000 CPU seconds
+         128 function calls (108 primitive calls) in 1.000 CPU seconds
 
    Ordered by: standard name
 
    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         4    0.000    0.000    0.000    0.000 :0(append)
         4    0.000    0.000    0.000    0.000 :0(exc_info)
+        1    0.000    0.000    1.000    1.000 :0(exec)
        12    0.000    0.000    0.012    0.001 :0(hasattr)
         8    0.000    0.000    0.000    0.000 :0(range)
         1    0.000    0.000    0.000    0.000 :0(setprofile)
@@ -28,13 +29,14 @@ test_profile
 Function                              called...
 :0(append)                            ->
 :0(exc_info)                          ->
+:0(exec)                              -> <string>:1(<module>)(1)    1.000
 :0(hasattr)                           -> test_profile.py:115(__getattr__)(12)    0.028
 :0(range)                             ->
 :0(setprofile)                        ->
 <string>:1(<module>)                  -> test_profile.py:30(testfunc)(1)    1.000
 profile:0(profiler)                   -> profile:0(testfunc())(1)    1.000
-profile:0(testfunc())                 -> :0(setprofile)(1)    0.000
-                                         <string>:1(<module>)(1)    1.000
+profile:0(testfunc())                 -> :0(exec)(1)    1.000
+                                         :0(setprofile)(1)    0.000
 test_profile.py:103(subhelper)        -> :0(range)(8)    0.000
                                          test_profile.py:115(__getattr__)(16)    0.028
 test_profile.py:115(__getattr__)      ->
@@ -60,11 +62,12 @@ test_profile.py:93(helper2)           -> :0(hasattr)(8)    0.012
 Function                              was called by...
 :0(append)                            <- test_profile.py:78(helper1)(4)    0.120
 :0(exc_info)                          <- test_profile.py:78(helper1)(4)    0.120
+:0(exec)                              <- profile:0(testfunc())(1)    1.000
 :0(hasattr)                           <- test_profile.py:78(helper1)(4)    0.120
                                          test_profile.py:93(helper2)(8)    0.400
 :0(range)                             <- test_profile.py:103(subhelper)(8)    0.080
 :0(setprofile)                        <- profile:0(testfunc())(1)    1.000
-<string>:1(<module>)                  <- profile:0(testfunc())(1)    1.000
+<string>:1(<module>)                  <- :0(exec)(1)    1.000
 profile:0(profiler)                   <-
 profile:0(testfunc())                 <- profile:0(profiler)(1)    0.000
 test_profile.py:103(subhelper)        <- test_profile.py:93(helper2)(8)    0.400
index dba9161c9dddbd4aba8bf3dac9fdbf007976e23e..e4f0f441d92bcf97c976c781cf27788fa1d8e84b 100644 (file)
@@ -15,7 +15,7 @@ class AllTest(unittest.TestCase):
     def check_all(self, modname):
         names = {}
         try:
-            exec "import %s" % modname in names
+            exec("import %s" % modname, names)
         except ImportError:
             # Silent fail here seems the best route since some modules
             # may not be available in all environments.
@@ -23,7 +23,7 @@ class AllTest(unittest.TestCase):
         verify(hasattr(sys.modules[modname], "__all__"),
                "%s has no __all__ attribute" % modname)
         names = {}
-        exec "from %s import *" % modname in names
+        exec("from %s import *" % modname, names)
         if "__builtins__" in names:
             del names["__builtins__"]
         keys = set(names)
index 80e8d78c18f9f11d37c05b13f917fae31759f12a..f1df3eb1cb2d26661e43cc2402cdc399c5baa58a 100644 (file)
@@ -50,8 +50,6 @@ exec_tests = [
     "import sys",
     # ImportFrom
     "from sys import v",
-    # Exec
-    "exec 'v'",
     # Global
     "global v",
     # Expr
@@ -169,7 +167,6 @@ exec_results = [
 ('Module', [('Assert', (1, 0), ('Name', (1, 7), 'v', ('Load',)), None)]),
 ('Module', [('Import', (1, 0), [('alias', 'sys', None)])]),
 ('Module', [('ImportFrom', (1, 0), 'sys', [('alias', 'v', None)], 0)]),
-('Module', [('Exec', (1, 0), ('Str', (1, 5), 'v'), None, None)]),
 ('Module', [('Global', (1, 0), ['v'])]),
 ('Module', [('Expr', (1, 0), ('Num', (1, 0), 1))]),
 ('Module', [('Pass', (1, 0))]),
index 719186b97b45f9f661d1b48367b2cd3318ac0ce6..ccce207cfb4d36109f70559940342b08aeee8a24 100644 (file)
@@ -302,7 +302,7 @@ class RatTestCase(unittest.TestCase):
         self.assertEqual(10.0, Rat(10))
 
     def test_future_div(self):
-        exec future_test
+        exec(future_test)
 
     # XXX Ran out of steam; TO DO: divmod, div, future division
 
index d4605e175281027148709967a939c4296107272c..272af86362117d7e6c3eb8ba1559b04d1238e20a 100644 (file)
@@ -395,6 +395,29 @@ class BuiltinTest(unittest.TestCase):
         self.assertRaises(IOError, execfile, os.curdir)
         self.assertRaises(IOError, execfile, "I_dont_exist")
 
+    def test_exec(self):
+        g = {}
+        exec('z = 1', g)
+        if '__builtins__' in g:
+            del g['__builtins__']
+        self.assertEqual(g, {'z': 1})
+
+        exec(u'z = 1+1', g)
+        if '__builtins__' in g:
+            del g['__builtins__']
+        self.assertEqual(g, {'z': 2})
+        g = {}
+        l = {}
+
+        import warnings
+        warnings.filterwarnings("ignore", "global statement", module="<string>")
+        exec('global a; a = 1; b = 2', g, l)
+        if '__builtins__' in g:
+            del g['__builtins__']
+        if '__builtins__' in l:
+            del l['__builtins__']
+        self.assertEqual((g, l), ({'a': 1}, {'b': 2}))
+
     def test_filter(self):
         self.assertEqual(filter(lambda c: 'a' <= c <= 'z', 'Hello World'), 'elloorld')
         self.assertEqual(filter(None, [1, 'hello', [], [3], '', None, 9, 0]), [1, 'hello', [3], 9])
@@ -1172,7 +1195,7 @@ class BuiltinTest(unittest.TestCase):
             "max(1, 2, key=1)",             # keyfunc is not callable
             ):
             try:
-                exec(stmt) in globals()
+                exec(stmt, globals())
             except TypeError:
                 pass
             else:
@@ -1218,7 +1241,7 @@ class BuiltinTest(unittest.TestCase):
             "min(1, 2, key=1)",             # keyfunc is not callable
             ):
             try:
-                exec(stmt) in globals()
+                exec(stmt, globals())
             except TypeError:
                 pass
             else:
index 795acd911bdfebc01c4730d89b7881b65ec39aac..f33462a2e84be3e1aea147d1bcb363a444b50eea 100644 (file)
@@ -136,7 +136,7 @@ def __%(method)s__(self, *args):
 
 d = {}
 for method in testmeths:
-    exec method_template % locals() in d
+    exec(method_template % locals(), d)
 for k in d:
     setattr(AllTests, k, d[k])
 del d, k
@@ -291,7 +291,7 @@ def check_exc(stmt, exception):
     """Raise TestFailed if executing 'stmt' does not raise 'exception'
     """
     try:
-        exec stmt
+        exec(stmt)
     except exception:
         pass
     else:
index 5d06f2c32042cd12a3d731c4f8066778fe878b37..38a192b3872b21767ff0006c4e8abf3acf53a7d9 100644 (file)
@@ -29,8 +29,8 @@ class CodeopTests(unittest.TestCase):
                 saved_stdout = sys.stdout
                 sys.stdout = cStringIO.StringIO()
                 try:
-                    exec code in d
-                    exec compile(str,"<input>","single") in r
+                    exec(code, d)
+                    exec(compile(str,"<input>","single"), r)
                 finally:
                     sys.stdout = saved_stdout
             elif symbol == 'eval':
index a3f15bf6510c0fef69677987330ad76399a057fc..73ef2d444e00f159535fa4a6de007c026fbca1b2 100644 (file)
@@ -19,17 +19,17 @@ class TestSpecifics(unittest.TestCase):
         self.assertRaises(SyntaxError, eval, 'lambda a,a=1:0')
         self.assertRaises(SyntaxError, eval, 'lambda a=1,a=1:0')
         try:
-            exec 'def f(a, a): pass'
+            exec('def f(a, a): pass')
             self.fail("duplicate arguments")
         except SyntaxError:
             pass
         try:
-            exec 'def f(a = 0, a = 1): pass'
+            exec('def f(a = 0, a = 1): pass')
             self.fail("duplicate keyword arguments")
         except SyntaxError:
             pass
         try:
-            exec 'def f(a): global a; a = 1'
+            exec('def f(a): global a; a = 1')
             self.fail("variable is global and local")
         except SyntaxError:
             pass
@@ -39,7 +39,7 @@ class TestSpecifics(unittest.TestCase):
 
     def test_duplicate_global_local(self):
         try:
-            exec 'def f(a): global a; a = 1'
+            exec('def f(a): global a; a = 1')
             self.fail("variable is global and local")
         except SyntaxError:
             pass
@@ -59,22 +59,22 @@ class TestSpecifics(unittest.TestCase):
 
         m = M()
         g = globals()
-        exec 'z = a' in g, m
+        exec('z = a', g, m)
         self.assertEqual(m.results, ('z', 12))
         try:
-            exec 'z = b' in g, m
+            exec('z = b', g, m)
         except NameError:
             pass
         else:
             self.fail('Did not detect a KeyError')
-        exec 'z = dir()' in g, m
+        exec('z = dir()', g, m)
         self.assertEqual(m.results, ('z', list('xyz')))
-        exec 'z = globals()' in g, m
+        exec('z = globals()', g, m)
         self.assertEqual(m.results, ('z', g))
-        exec 'z = locals()' in g, m
+        exec('z = locals()', g, m)
         self.assertEqual(m.results, ('z', m))
         try:
-            exec 'z = b' in m
+            exec('z = b', m)
         except TypeError:
             pass
         else:
@@ -85,7 +85,7 @@ class TestSpecifics(unittest.TestCase):
             pass
         m = A()
         try:
-            exec 'z = a' in g, m
+            exec('z = a', g, m)
         except TypeError:
             pass
         else:
@@ -98,11 +98,12 @@ class TestSpecifics(unittest.TestCase):
                     return 12
                 return dict.__getitem__(self, key)
         d = D()
-        exec 'z = a' in g, d
+        exec('z = a', g, d)
         self.assertEqual(d['z'], 12)
 
     def test_extended_arg(self):
         longexpr = 'x = x or ' + '-x' * 2500
+        g = {}
         code = '''
 def f(x):
     %s
@@ -121,8 +122,8 @@ def f(x):
         # EXTENDED_ARG/JUMP_ABSOLUTE here
     return x
 ''' % ((longexpr,)*10)
-        exec code
-        self.assertEqual(f(5), 0)
+        exec(code, g)
+        self.assertEqual(g['f'](5), 0)
 
     def test_complex_args(self):
 
@@ -146,7 +147,7 @@ def f(x):
 
     def test_argument_order(self):
         try:
-            exec 'def f(a=1, (b, c)): pass'
+            exec('def f(a=1, (b, c)): pass')
             self.fail("non-default args after default")
         except SyntaxError:
             pass
index 81f2ea89250504071537814a719a1708d1920959..783a34c9a94b3ceacb51827ab56cb66138f619b9 100644 (file)
@@ -61,7 +61,7 @@ class CompilerTest(unittest.TestCase):
         c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1",
                              "<string>", "exec")
         dct = {}
-        exec c in dct
+        exec(c, dct)
         self.assertEquals(dct.get('e'), 1)
         self.assertEquals(dct.get('f'), 1)
 
@@ -73,7 +73,7 @@ class CompilerTest(unittest.TestCase):
         self.assert_('__doc__' in c.co_names)
         c = compiler.compile('def f():\n "doc"', '<string>', 'exec')
         g = {}
-        exec c in g
+        exec(c, g)
         self.assertEquals(g['f'].__doc__, "doc")
 
     def testLineNo(self):
@@ -113,7 +113,7 @@ class CompilerTest(unittest.TestCase):
                              '<string>',
                              'exec')
         dct = {}
-        exec c in dct
+        exec(c, dct)
         self.assertEquals(dct.get('result'), 3)
 
     def testGenExp(self):
index 53054adfd507603403b7470c1c84bfa0584da126..b2e7e665cc3399423fe3bcd3c0ea5b1ae2123c41 100644 (file)
@@ -55,7 +55,7 @@ def testternop(a, b, c, res, expr="a[b:c]", meth="__getslice__"):
 def testsetop(a, b, res, stmt="a+=b", meth="__iadd__"):
     if verbose: print "checking", stmt
     dict = {'a': deepcopy(a), 'b': b}
-    exec stmt in dict
+    exec(stmt, dict)
     vereq(dict['a'], res)
     t = type(a)
     m = getattr(t, meth)
@@ -73,7 +73,7 @@ def testsetop(a, b, res, stmt="a+=b", meth="__iadd__"):
 def testset2op(a, b, c, res, stmt="a[b]=c", meth="__setitem__"):
     if verbose: print "checking", stmt
     dict = {'a': deepcopy(a), 'b': b, 'c': c}
-    exec stmt in dict
+    exec(stmt, dict)
     vereq(dict['a'], res)
     t = type(a)
     m = getattr(t, meth)
@@ -91,7 +91,7 @@ def testset2op(a, b, c, res, stmt="a[b]=c", meth="__setitem__"):
 def testset3op(a, b, c, d, res, stmt="a[b:c]=d", meth="__setslice__"):
     if verbose: print "checking", stmt
     dict = {'a': deepcopy(a), 'b': b, 'c': c, 'd': d}
-    exec stmt in dict
+    exec(stmt, dict)
     vereq(dict['a'], res)
     t = type(a)
     while meth not in t.__dict__:
@@ -3943,7 +3943,7 @@ def notimplemented():
 
     def check(expr, x, y):
         try:
-            exec expr in {'x': x, 'y': y, 'operator': operator}
+            exec(expr, {'x': x, 'y': y, 'operator': operator})
         except TypeError:
             pass
         else:
index 28d7d13f6cfb4180ae9cad35bbd467806584d78b..aca6660b6b322855c2bc08a2eccc16528003a226 100644 (file)
@@ -67,7 +67,7 @@ statement or the built-in function eval():
 
     >>> print sorted(a.keys())
     [1, 2]
-    >>> exec "x = 3; print x" in a
+    >>> exec("x = 3; print x", a)
     3
     >>> print sorted(a.keys(), key=lambda x: (str(type(x)), x))
     [1, 2, '__builtins__', 'x']
index c31092c0f56f91546499b860ed929e6d6f497cad..f9a6a07081c3df477c5e230692b554b8f9b20bcd 100644 (file)
@@ -135,7 +135,7 @@ class DisTests(unittest.TestCase):
         def func(count):
             namespace = {}
             func = "def foo():\n " + "".join(["\n "] * count + ["spam\n"])
-            exec func in namespace
+            exec(func, namespace)
             return namespace['foo']
 
         # Test all small ranges
index 1390e15b764633a922677009fbce398c2cfef1fd..56c244988d51ae3a2e1f177ab51130f89f5dc048 100644 (file)
@@ -2366,8 +2366,8 @@ def old_test4(): """
         ...        '''>>> assert 1 < 2
         ...        '''
         ... \"""
-        >>> exec test_data in m1.__dict__
-        >>> exec test_data in m2.__dict__
+        >>> exec(test_data, m1.__dict__)
+        >>> exec(test_data, m2.__dict__)
         >>> m1.__dict__.update({"f2": m2._f, "g2": m2.g, "h2": m2.H})
 
         Tests that objects outside m1 are excluded:
index 0eb6b46a75bfeef9693b1dfdf9d33126779f5ef9..b5c567675e096e4e4e6cf85468b6d19e2b2b95c4 100644 (file)
@@ -87,7 +87,7 @@ class ExceptionTests(unittest.TestCase):
         self.raise_catch(RuntimeError, "RuntimeError")
 
         self.raise_catch(SyntaxError, "SyntaxError")
-        try: exec '/\n'
+        try: exec('/\n')
         except SyntaxError: pass
 
         self.raise_catch(IndentationError, "IndentationError")
index ab3352854c77296804b20ae65aefbea93a36e4b5..930c85147e6bef73e7e950a9b46ff1febc729374 100644 (file)
@@ -278,7 +278,7 @@ def test_func_name():
     cantset(f, "__name__", 1)
     # test that you can access func.__name__ in restricted mode
     s = """def f(): pass\nf.__name__"""
-    exec s in {'__builtins__':{}}
+    exec(s, {'__builtins__':{}})
 
 
 def test_func_code():
index ec470c40ca04b368c8844f4f9170dba1cc049df0..675b988db9ea1fa4768b859dbf866e007e4098a7 100644 (file)
@@ -153,7 +153,7 @@ def test_function():
     # Tricky: f -> d -> f, code should call d.clear() after the exec to
     # break the cycle.
     d = {}
-    exec("def f(): pass\n") in d
+    exec("def f(): pass\n", d)
     gc.collect()
     del d
     expect(gc.collect(), 2, "function")
index 9856a6a70b233cacb007909c5e68b76d1ef0e523..f565d2328a402bfb198b7b8c6c8ce7340437c1ae 100644 (file)
@@ -10,7 +10,7 @@ def expectException(teststr, expected, failure=AssertionError):
     """Executes a statement passed in teststr, and raises an exception
        (failure) if the expected exception is *not* raised."""
     try:
-        exec teststr
+        exec(teststr)
     except expected:
         pass
     else:
index 93dc9ec83433ad85cb13140b1f248332ecfbd918..6e9b2044f1dc06bce7c0aa06c19275da4f062353 100644 (file)
@@ -449,42 +449,6 @@ def f():
     global a, b
     global one, two, three, four, five, six, seven, eight, nine, ten
 
-print 'exec_stmt' # 'exec' expr ['in' expr [',' expr]]
-def f():
-    z = None
-    del z
-    exec 'z=1+1\n'
-    if z != 2: raise TestFailed, 'exec \'z=1+1\'\\n'
-    del z
-    exec 'z=1+1'
-    if z != 2: raise TestFailed, 'exec \'z=1+1\''
-    z = None
-    del z
-    import types
-    if hasattr(types, "UnicodeType"):
-        exec r"""if 1:
-    exec u'z=1+1\n'
-    if z != 2: raise TestFailed, 'exec u\'z=1+1\'\\n'
-    del z
-    exec u'z=1+1'
-    if z != 2: raise TestFailed, 'exec u\'z=1+1\''
-"""
-f()
-g = {}
-exec 'z = 1' in g
-if '__builtins__' in g: del g['__builtins__']
-if g != {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g'
-g = {}
-l = {}
-
-import warnings
-warnings.filterwarnings("ignore", "global statement", module="<string>")
-exec 'global a; a = 1; b = 2' in g, l
-if '__builtins__' in g: del g['__builtins__']
-if '__builtins__' in l: del l['__builtins__']
-if (g, l) != ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g (%s), l (%s)' %(g,l)
-
-
 print "assert_stmt" # assert_stmt: 'assert' test [',' test]
 assert 1
 assert 1, 1
index effba3cc1174c80441b1844d8c40dbe9e49606a3..b64c23bcaa8c424b22d0eb337100fbb314b26861 100644 (file)
@@ -107,7 +107,7 @@ def test_module_with_large_stack(module):
     sys.path.append('')
 
     # this used to crash
-    exec 'import ' + module
+    exec('import ' + module)
 
     # cleanup
     del sys.path[-1]
index d31bcb2120e9705ab8a40f2e73f766a5023cae10..5077d981dd605cc0af4fc8a4ca2cde58b6a8f231 100644 (file)
@@ -81,7 +81,7 @@ class TestImporter:
         mod.__loader__ = self
         if ispkg:
             mod.__path__ = self._get__path__()
-        exec code in mod.__dict__
+        exec(code, mod.__dict__)
         return mod
 
 
index 1030f972e987b3904dd299e361f8479e9f854307..e5946e91a0595d5cbdc646c3a88a494b3fc2ed54 100644 (file)
@@ -199,7 +199,7 @@ class TestRetrievingSourceCode(GetSourceBase):
         m = sys.modules[name] = module(name)
         m.__file__ = "<string>" # hopefully not a real filename...
         m.__loader__ = "dummy"  # pretend the filename is understood by a loader
-        exec "def x(): pass" in m.__dict__
+        exec("def x(): pass", m.__dict__)
         self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
         del sys.modules[name]
         inspect.getmodule(compile('a=10','','single'))
index 397ebeb97a6f779c50909e8693fa34f19426a11f..95f4b383140db4b028f54b71b39430683965c6ba 100644 (file)
@@ -49,7 +49,7 @@ class Test_MultibyteCodec(unittest.TestCase):
         try:
             for enc in ALL_CJKENCODINGS:
                 print >> open(TESTFN, 'w'), '# coding:', enc
-                exec open(TESTFN)
+                execfile(TESTFN)
         finally:
             os.unlink(TESTFN)
 
index 67e77aad278182964b0881b74caefb468a461a88..8baef4cd8acb007263c7af01dc2f9319facaabdd 100644 (file)
@@ -30,7 +30,7 @@ for stmt in ['d[x2] = 2',
              'd.pop(x2)',
              'd.update({x2: 2})']:
     try:
-        exec stmt
+        exec(stmt)
     except RuntimeError:
         print "%s: caught the RuntimeError outside" % (stmt,)
     else:
index 8aa1657e621a67d756a58f8b7f66d31bf074811e..96384cd83e09d88cf5beda4be70a3090f9a21d81 100644 (file)
@@ -429,7 +429,7 @@ class CompileTestCase(unittest.TestCase):
         st = parser.suite('x = 2; y = x + 3')
         code = parser.compilest(st)
         globs = {}
-        exec code in globs
+        exec(code, globs)
         self.assertEquals(globs['y'], 5)
 
     def test_compile_error(self):
index 98b7ef3d587999cd660d609e8ea54c78ad04430e..e4e592ae02ac98e90bba4d9344bccaa6569d5c54 100644 (file)
@@ -205,15 +205,6 @@ def unoptimized_clash2():
         return f
 """)
 
-# XXX could allow this for exec with const argument, but what's the point
-check_syntax("""\
-def error(y):
-    exec "a = 1"
-    def f(x):
-        return x + y
-    return f
-""")
-
 check_syntax("""\
 def f(x):
     def g():
@@ -230,7 +221,7 @@ def f():
 
 # and verify a few cases that should work
 
-exec """
+exec("""
 def noproblem1():
     from string import *
     f = lambda x:x
@@ -245,7 +236,7 @@ def noproblem3():
     def f(x):
         global y
         y = x
-"""
+""")
 
 print "12. lambdas"
 
@@ -526,7 +517,7 @@ else:
     print "eval() should have failed, because code contained free vars"
 
 try:
-    exec g.func_code
+    exec(g.func_code)
 except TypeError:
     pass
 else:
index 909cda51837cad3bbf574a62593bb8211bb6c47d..6f1c4f9b347ac244fc068b5ed9da7020f884cf8d 100644 (file)
@@ -24,7 +24,7 @@ class Tests(unittest.TestCase):
             # is correct
             c = compile(s, '<string>', 'single')
             vals = {}
-            exec c in vals
+            exec(c, vals)
             assert vals['a'] == 1
             assert vals['b'] == 2
 
index 1bf707da19b31a3e9f90163c39f3a88530214ad5..de25cfd3919f0ab61a5d75159f5e9c25db052209 100644 (file)
@@ -44,22 +44,22 @@ hName = sys.argv[1]
 # setup our creatorFunc to test the requested hash
 #
 if hName in ('_md5', '_sha'):
-    exec 'import '+hName
-    exec 'creatorFunc = '+hName+'.new'
+    exec('import '+hName)
+    exec('creatorFunc = '+hName+'.new')
     print "testing speed of old", hName, "legacy interface"
 elif hName == '_hashlib' and len(sys.argv) > 3:
     import _hashlib
-    exec 'creatorFunc = _hashlib.%s' % sys.argv[2]
+    exec('creatorFunc = _hashlib.%s' % sys.argv[2])
     print "testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2])
 elif hName == '_hashlib' and len(sys.argv) == 3:
     import _hashlib
-    exec 'creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2]
+    exec('creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2])
     print "testing speed of _hashlib.new(%r)" % sys.argv[2]
 elif hasattr(hashlib, hName) and callable(getattr(hashlib, hName)):
     creatorFunc = getattr(hashlib, hName)
     print "testing speed of hashlib."+hName, getattr(hashlib, hName)
 else:
-    exec "creatorFunc = lambda x=hashlib.new : x(%r)" % hName
+    exec("creatorFunc = lambda x=hashlib.new : x(%r)" % hName)
     print "testing speed of hashlib.new(%r)" % hName
 
 try:
index 8c0f7a539928869a60cabd83f80cd7e41c958179..190b8c58e7134960fd0b151529afc4a9e549acc5 100644 (file)
@@ -115,7 +115,7 @@ class Timer:
         self.src = src # Save for traceback display
         code = compile(src, dummy_src_name, "exec")
         ns = {}
-        exec code in globals(), ns
+        exec(code, globals(), ns)
         self.inner = ns["inner"]
 
     def print_exc(self, file=None):
index 7ebed71e5d9c8a7c6d7c010aa988b5680bf92850..c7ed0a58a732b478777707c4230659ee32cc6832 100644 (file)
@@ -484,7 +484,7 @@ class Trace:
             sys.settrace(self.globaltrace)
             threading.settrace(self.globaltrace)
         try:
-            exec cmd in dict, dict
+            exec(cmd, dict, dict)
         finally:
             if not self.donothing:
                 sys.settrace(None)
@@ -497,7 +497,7 @@ class Trace:
             sys.settrace(self.globaltrace)
             threading.settrace(self.globaltrace)
         try:
-            exec cmd in globals, locals
+            exec(cmd, globals, locals)
         finally:
             if not self.donothing:
                 sys.settrace(None)
index bc6eba1752406a8d3da3d5ea1e420385b1b9f736..3e6d8a4629a4550fd18e3762da6e0ba6a207de14 100644 (file)
@@ -6,5 +6,5 @@ python|Python|py:\
         :pb=^\d?(def|class)\d\p(\d|\\|\(|\:):\
         :cb=#:ce=$:sb=":se=\e":lb=':le=\e':\
         :kw=assert and break class continue def del elif else except\
-         exec finally for from global if import in is lambda not or\
+         finally for from global if import in is lambda not or\
          pass print raise return try while yield:
index 904b7dd0ce473a25ae4017cc2f29c9172f7f06dd..c90d34dae701b8946227d7dd94fbabc176b0658b 100644 (file)
@@ -848,7 +848,7 @@ VALIDATER(raise_stmt);          VALIDATER(import_stmt);
 VALIDATER(import_name);         VALIDATER(import_from);
 VALIDATER(global_stmt);         VALIDATER(list_if);
 VALIDATER(assert_stmt);         VALIDATER(list_for);
-VALIDATER(exec_stmt);           VALIDATER(compound_stmt);
+VALIDATER(compound_stmt);
 VALIDATER(while);               VALIDATER(for);
 VALIDATER(try);                 VALIDATER(except_clause);
 VALIDATER(test);                VALIDATER(and_test);
@@ -1465,8 +1465,7 @@ validate_small_stmt(node *tree)
               || (ntype == flow_stmt)
               || (ntype == import_stmt)
               || (ntype == global_stmt)
-              || (ntype == assert_stmt)
-              || (ntype == exec_stmt))
+              || (ntype == assert_stmt))
             res = validate_node(CHILD(tree, 0));
         else {
             res = 0;
@@ -1888,32 +1887,6 @@ validate_global_stmt(node *tree)
 }
 
 
-/*  exec_stmt:
- *
- *  'exec' expr ['in' test [',' test]]
- */
-static int
-validate_exec_stmt(node *tree)
-{
-    int nch = NCH(tree);
-    int res = (validate_ntype(tree, exec_stmt)
-               && ((nch == 2) || (nch == 4) || (nch == 6))
-               && validate_name(CHILD(tree, 0), "exec")
-               && validate_expr(CHILD(tree, 1)));
-
-    if (!res && !PyErr_Occurred())
-        err_string("illegal exec statement");
-    if (res && (nch > 2))
-        res = (validate_name(CHILD(tree, 2), "in")
-               && validate_test(CHILD(tree, 3)));
-    if (res && (nch == 6))
-        res = (validate_comma(CHILD(tree, 4))
-               && validate_test(CHILD(tree, 5)));
-
-    return (res);
-}
-
-
 /*  assert_stmt:
  *
  *  'assert' test [',' test]
@@ -2914,7 +2887,7 @@ validate_node(node *tree)
           case small_stmt:
             /*
              *  expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt
-             *  | import_stmt | global_stmt | exec_stmt | assert_stmt
+             *  | import_stmt | global_stmt | assert_stmt
              */
             res = validate_small_stmt(tree);
             break;
@@ -2984,9 +2957,6 @@ validate_node(node *tree)
           case global_stmt:
             res = validate_global_stmt(tree);
             break;
-          case exec_stmt:
-            res = validate_exec_stmt(tree);
-            break;
           case assert_stmt:
             res = validate_assert_stmt(tree);
             break;
index c90d7650a16362d82cbf5f5c169d3307520bde34..95edfea3f334ae5e109ab1fc8eb8331a3d0d7a16 100644 (file)
@@ -73,8 +73,7 @@ init_symtable(void)
        PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock);
 
        PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR);
-       PyModule_AddIntConstant(m, "OPT_EXEC", OPT_EXEC);
-       PyModule_AddIntConstant(m, "OPT_BARE_EXEC", OPT_BARE_EXEC);
+       PyModule_AddIntConstant(m, "OPT_TOPLEVEL", OPT_TOPLEVEL);
 
        PyModule_AddIntConstant(m, "LOCAL", LOCAL);
        PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT);
index 55b3bd37079f14a6393bbdf6feb4b90d3781304a..27f65b4f40b891152ae0034b40521a44fa49376a 100644 (file)
@@ -36,11 +36,6 @@ module Python version "$Revision$"
              | Import(alias* names)
              | ImportFrom(identifier module, alias* names, int? level)
 
-             -- Doesn't capture requirement that locals must be
-             -- defined if globals is
-             -- still supports use as a function!
-             | Exec(expr body, expr? globals, expr? locals)
-
              | Global(identifier* names)
              | Expr(expr value)
              | Pass | Break | Continue
index b322039a48c80a75c247adf5a72e8f9f41226b04..6ba978b1aa86b80f18f6a2d15b723b44b557441e 100644 (file)
@@ -123,12 +123,6 @@ static char *ImportFrom_fields[]={
         "names",
         "level",
 };
-static PyTypeObject *Exec_type;
-static char *Exec_fields[]={
-        "body",
-        "globals",
-        "locals",
-};
 static PyTypeObject *Global_type;
 static char *Global_fields[]={
         "names",
@@ -494,8 +488,6 @@ static int init_types(void)
         ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields,
                                     3);
         if (!ImportFrom_type) return 0;
-        Exec_type = make_type("Exec", stmt_type, Exec_fields, 3);
-        if (!Exec_type) return 0;
         Global_type = make_type("Global", stmt_type, Global_fields, 1);
         if (!Global_type) return 0;
         Expr_type = make_type("Expr", stmt_type, Expr_fields, 1);
@@ -1169,30 +1161,6 @@ ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int
         return p;
 }
 
-stmt_ty
-Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset,
-     PyArena *arena)
-{
-        stmt_ty p;
-        if (!body) {
-                PyErr_SetString(PyExc_ValueError,
-                                "field body is required for Exec");
-                return NULL;
-        }
-        p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p));
-        if (!p) {
-                PyErr_NoMemory();
-                return NULL;
-        }
-        p->kind = Exec_kind;
-        p->v.Exec.body = body;
-        p->v.Exec.globals = globals;
-        p->v.Exec.locals = locals;
-        p->lineno = lineno;
-        p->col_offset = col_offset;
-        return p;
-}
-
 stmt_ty
 Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena)
 {
@@ -2274,25 +2242,6 @@ ast2obj_stmt(void* _o)
                         goto failed;
                 Py_DECREF(value);
                 break;
-        case Exec_kind:
-                result = PyType_GenericNew(Exec_type, NULL, NULL);
-                if (!result) goto failed;
-                value = ast2obj_expr(o->v.Exec.body);
-                if (!value) goto failed;
-                if (PyObject_SetAttrString(result, "body", value) == -1)
-                        goto failed;
-                Py_DECREF(value);
-                value = ast2obj_expr(o->v.Exec.globals);
-                if (!value) goto failed;
-                if (PyObject_SetAttrString(result, "globals", value) == -1)
-                        goto failed;
-                Py_DECREF(value);
-                value = ast2obj_expr(o->v.Exec.locals);
-                if (!value) goto failed;
-                if (PyObject_SetAttrString(result, "locals", value) == -1)
-                        goto failed;
-                Py_DECREF(value);
-                break;
         case Global_kind:
                 result = PyType_GenericNew(Global_type, NULL, NULL);
                 if (!result) goto failed;
@@ -3082,7 +3031,6 @@ init_ast(void)
             return;
         if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) <
             0) return;
-        if (PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return;
         if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0)
             return;
         if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return;
index cd0a81dcfa4be5fd9b71cc97beba32bc5f60dc77..36f706ec62cd3f9696665dd041abb948a047f186 100644 (file)
@@ -2399,37 +2399,6 @@ ast_for_global_stmt(struct compiling *c, const node *n)
     return Global(s, LINENO(n), n->n_col_offset, c->c_arena);
 }
 
-static stmt_ty
-ast_for_exec_stmt(struct compiling *c, const node *n)
-{
-    expr_ty expr1, globals = NULL, locals = NULL;
-    int n_children = NCH(n);
-    if (n_children != 2 && n_children != 4 && n_children != 6) {
-        PyErr_Format(PyExc_SystemError,
-                     "poorly formed 'exec' statement: %d parts to statement",
-                     n_children);
-        return NULL;
-    }
-
-    /* exec_stmt: 'exec' expr ['in' test [',' test]] */
-    REQ(n, exec_stmt);
-    expr1 = ast_for_expr(c, CHILD(n, 1));
-    if (!expr1)
-        return NULL;
-    if (n_children >= 4) {
-        globals = ast_for_expr(c, CHILD(n, 3));
-        if (!globals)
-            return NULL;
-    }
-    if (n_children == 6) {
-        locals = ast_for_expr(c, CHILD(n, 5));
-        if (!locals)
-            return NULL;
-    }
-
-    return Exec(expr1, globals, locals, LINENO(n), n->n_col_offset, c->c_arena);
-}
-
 static stmt_ty
 ast_for_assert_stmt(struct compiling *c, const node *n)
 {
@@ -2944,8 +2913,7 @@ ast_for_stmt(struct compiling *c, const node *n)
        REQ(n, small_stmt);
        n = CHILD(n, 0);
        /* small_stmt: expr_stmt | print_stmt  | del_stmt | pass_stmt
-                    | flow_stmt | import_stmt | global_stmt | exec_stmt
-                     | assert_stmt
+                    | flow_stmt | import_stmt | global_stmt | assert_stmt
        */
        switch (TYPE(n)) {
             case expr_stmt:
@@ -2962,8 +2930,6 @@ ast_for_stmt(struct compiling *c, const node *n)
                 return ast_for_import_stmt(c, n);
             case global_stmt:
                 return ast_for_global_stmt(c, n);
-            case exec_stmt:
-                return ast_for_exec_stmt(c, n);
             case assert_stmt:
                 return ast_for_assert_stmt(c, n);
             default:
index 200ec26f22235b3e155a93eb573605bc59142e7e..94d4bc387f337cbcf85a7368a2c9acd5a019ce13 100644 (file)
@@ -403,7 +403,7 @@ PyDoc_STRVAR(compile_doc,
 "compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\
 \n\
 Compile the source string (a Python module, statement or expression)\n\
-into a code object that can be executed by the exec statement or eval().\n\
+into a code object that can be executed by exec() or eval().\n\
 The filename will be used for run-time error messages.\n\
 The mode must be 'exec' to compile a module, 'single' to compile a\n\
 single (interactive) statement, or 'eval' to compile an expression.\n\
@@ -543,6 +543,114 @@ The globals must be a dictionary and locals can be any mappping,\n\
 defaulting to the current globals and locals.\n\
 If only globals is given, locals defaults to it.\n");
 
+static PyObject *
+builtin_exec(PyObject *self, PyObject *args)
+{
+       PyObject *v;
+       PyObject *prog, *globals = Py_None, *locals = Py_None;
+       int plain = 0;
+
+       if (!PyArg_ParseTuple(args, "O|OO:exec", &prog, &globals, &locals))
+               return NULL;
+       
+       if (globals == Py_None) {
+               globals = PyEval_GetGlobals();
+               if (locals == Py_None) {
+                       locals = PyEval_GetLocals();
+                       plain = 1;
+               }
+               if (!globals || !locals) {
+                       PyErr_SetString(PyExc_SystemError,
+                                       "globals and locals cannot be NULL");
+                       return NULL;
+               }
+       }
+       else if (locals == Py_None)
+               locals = globals;
+       if (!PyString_Check(prog) &&
+           !PyUnicode_Check(prog) &&
+           !PyCode_Check(prog) &&
+           !PyFile_Check(prog)) {
+               PyErr_Format(PyExc_TypeError,
+                       "exec() arg 1 must be a string, file, or code "
+                       "object, not %.100s", prog->ob_type->tp_name);
+               return NULL;
+       }
+       if (!PyDict_Check(globals)) {
+               PyErr_Format(PyExc_TypeError, "exec() arg 2 must be a dict, not %.100s",
+                            globals->ob_type->tp_name);
+               return NULL;
+       }
+       if (!PyMapping_Check(locals)) {
+               PyErr_Format(PyExc_TypeError,
+                   "arg 3 must be a mapping or None, not %.100s",
+                   locals->ob_type->tp_name);
+               return NULL;
+       }
+       if (PyDict_GetItemString(globals, "__builtins__") == NULL) {
+               if (PyDict_SetItemString(globals, "__builtins__",
+                                        PyEval_GetBuiltins()) != 0)
+                       return NULL;
+       }
+
+       if (PyCode_Check(prog)) {
+               if (PyCode_GetNumFree((PyCodeObject *)prog) > 0) {
+                       PyErr_SetString(PyExc_TypeError,
+                               "code object passed to exec() may not "
+                               "contain free variables");
+                       return NULL;
+               }
+               v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals);
+       }
+       else if (PyFile_Check(prog)) {
+               FILE *fp = PyFile_AsFile(prog);
+               char *name = PyString_AsString(PyFile_Name(prog));
+               PyCompilerFlags cf;
+               cf.cf_flags = 0;
+               if (PyEval_MergeCompilerFlags(&cf))
+                       v = PyRun_FileFlags(fp, name, Py_file_input, globals,
+                                           locals, &cf);
+               else
+                       v = PyRun_File(fp, name, Py_file_input, globals,
+                                      locals);
+       }
+       else {
+               PyObject *tmp = NULL;
+               char *str;
+               PyCompilerFlags cf;
+               cf.cf_flags = 0;
+#ifdef Py_USING_UNICODE
+               if (PyUnicode_Check(prog)) {
+                       tmp = PyUnicode_AsUTF8String(prog);
+                       if (tmp == NULL)
+                               return NULL;
+                       prog = tmp;
+                       cf.cf_flags |= PyCF_SOURCE_IS_UTF8;
+               }
+#endif
+               if (PyString_AsStringAndSize(prog, &str, NULL))
+                       return NULL;
+               if (PyEval_MergeCompilerFlags(&cf))
+                       v = PyRun_StringFlags(str, Py_file_input, globals,
+                                             locals, &cf);
+               else
+                       v = PyRun_String(str, Py_file_input, globals, locals);
+               Py_XDECREF(tmp);
+       }
+       if (v == NULL)
+               return NULL;
+       Py_DECREF(v);
+       Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(exec_doc,
+"exec(object[, globals[, locals]])\n\
+\n\
+Read and execute code from a object, which can be a string, a code\n\
+object or a file object.\n\
+The globals and locals are dictionaries, defaulting to the current\n\
+globals and locals.  If only globals is given, locals defaults to it.");
+
 
 static PyObject *
 builtin_execfile(PyObject *self, PyObject *args)
@@ -1884,6 +1992,7 @@ static PyMethodDef builtin_methods[] = {
        {"dir",         builtin_dir,        METH_VARARGS, dir_doc},
        {"divmod",      builtin_divmod,     METH_VARARGS, divmod_doc},
        {"eval",        builtin_eval,       METH_VARARGS, eval_doc},
+       {"exec",        builtin_exec,       METH_VARARGS, exec_doc},
        {"execfile",    builtin_execfile,   METH_VARARGS, execfile_doc},
        {"filter",      builtin_filter,     METH_VARARGS, filter_doc},
        {"getattr",     builtin_getattr,    METH_VARARGS, getattr_doc},
index 25e6a0b4cff1b65258604c960adb369f99bf6462..dcbe53d877ea3ef83ff91fed8fbe50919ed9183e 100644 (file)
@@ -118,8 +118,6 @@ static PyObject * cmp_outcome(int, PyObject *, PyObject *);
 static PyObject * import_from(PyObject *, PyObject *);
 static int import_all_from(PyObject *, PyObject *);
 static PyObject * build_class(PyObject *, PyObject *, PyObject *);
-static int exec_statement(PyFrameObject *,
-                         PyObject *, PyObject *, PyObject *);
 static void set_exc_info(PyThreadState *, PyObject *, PyObject *, PyObject *);
 static void reset_exc_info(PyThreadState *);
 static void format_exc_check_arg(PyObject *, char *, PyObject *);
@@ -580,7 +578,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
    It's a case-by-case judgement.  I'll use intr1 for the following
    cases:
 
-   EXEC_STMT
    IMPORT_STAR
    IMPORT_FROM
    CALL_FUNCTION (and friends)
@@ -1622,19 +1619,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
                        why = WHY_YIELD;
                        goto fast_yield;
 
-               case EXEC_STMT:
-                       w = TOP();
-                       v = SECOND();
-                       u = THIRD();
-                       STACKADJ(-3);
-                       READ_TIMESTAMP(intr0);
-                       err = exec_statement(f, u, v, w);
-                       READ_TIMESTAMP(intr1);
-                       Py_DECREF(u);
-                       Py_DECREF(v);
-                       Py_DECREF(w);
-                       break;
-
                case POP_BLOCK:
                        {
                                PyTryBlock *b = PyFrame_BlockPop(f);
@@ -4072,107 +4056,6 @@ build_class(PyObject *methods, PyObject *bases, PyObject *name)
        return result;
 }
 
-static int
-exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
-              PyObject *locals)
-{
-       int n;
-       PyObject *v;
-       int plain = 0;
-
-       if (PyTuple_Check(prog) && globals == Py_None && locals == Py_None &&
-           ((n = PyTuple_Size(prog)) == 2 || n == 3)) {
-               /* Backward compatibility hack */
-               globals = PyTuple_GetItem(prog, 1);
-               if (n == 3)
-                       locals = PyTuple_GetItem(prog, 2);
-               prog = PyTuple_GetItem(prog, 0);
-       }
-       if (globals == Py_None) {
-               globals = PyEval_GetGlobals();
-               if (locals == Py_None) {
-                       locals = PyEval_GetLocals();
-                       plain = 1;
-               }
-               if (!globals || !locals) {
-                       PyErr_SetString(PyExc_SystemError,
-                                       "globals and locals cannot be NULL");
-                       return -1;
-               }
-       }
-       else if (locals == Py_None)
-               locals = globals;
-       if (!PyString_Check(prog) &&
-           !PyUnicode_Check(prog) &&
-           !PyCode_Check(prog) &&
-           !PyFile_Check(prog)) {
-               PyErr_SetString(PyExc_TypeError,
-                       "exec: arg 1 must be a string, file, or code object");
-               return -1;
-       }
-       if (!PyDict_Check(globals)) {
-               PyErr_SetString(PyExc_TypeError,
-                   "exec: arg 2 must be a dictionary or None");
-               return -1;
-       }
-       if (!PyMapping_Check(locals)) {
-               PyErr_SetString(PyExc_TypeError,
-                   "exec: arg 3 must be a mapping or None");
-               return -1;
-       }
-       if (PyDict_GetItemString(globals, "__builtins__") == NULL)
-               PyDict_SetItemString(globals, "__builtins__", f->f_builtins);
-       if (PyCode_Check(prog)) {
-               if (PyCode_GetNumFree((PyCodeObject *)prog) > 0) {
-                       PyErr_SetString(PyExc_TypeError,
-               "code object passed to exec may not contain free variables");
-                       return -1;
-               }
-               v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals);
-       }
-       else if (PyFile_Check(prog)) {
-               FILE *fp = PyFile_AsFile(prog);
-               char *name = PyString_AsString(PyFile_Name(prog));
-               PyCompilerFlags cf;
-               cf.cf_flags = 0;
-               if (PyEval_MergeCompilerFlags(&cf))
-                       v = PyRun_FileFlags(fp, name, Py_file_input, globals,
-                                           locals, &cf);
-               else
-                       v = PyRun_File(fp, name, Py_file_input, globals,
-                                      locals);
-       }
-       else {
-               PyObject *tmp = NULL;
-               char *str;
-               PyCompilerFlags cf;
-               cf.cf_flags = 0;
-#ifdef Py_USING_UNICODE
-               if (PyUnicode_Check(prog)) {
-                       tmp = PyUnicode_AsUTF8String(prog);
-                       if (tmp == NULL)
-                               return -1;
-                       prog = tmp;
-                       cf.cf_flags |= PyCF_SOURCE_IS_UTF8;
-               }
-#endif
-               if (PyString_AsStringAndSize(prog, &str, NULL))
-                       return -1;
-               if (PyEval_MergeCompilerFlags(&cf))
-                       v = PyRun_StringFlags(str, Py_file_input, globals,
-                                             locals, &cf);
-               else
-                       v = PyRun_String(str, Py_file_input, globals, locals);
-               Py_XDECREF(tmp);
-       }
-       if (plain)
-               PyFrame_LocalsToFast(f, 0);
-       if (v == NULL)
-               return -1;
-       Py_DECREF(v);
-       return 0;
-}
-
 static void
 format_exc_check_arg(PyObject *exc, char *format_str, PyObject *obj)
 {
index 945a281235869b9d41129402de85d5e764c03b21..ac82b84b893a087cde616590a22d1ce515bb7e73 100644 (file)
@@ -814,8 +814,6 @@ opcode_stack_effect(int opcode, int oparg)
                        return -1;
                case IMPORT_STAR:
                        return -1;
-               case EXEC_STMT:
-                       return -3;
                case YIELD_VALUE:
                        return 0;
 
@@ -2112,21 +2110,6 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
                return compiler_import(c, s);
        case ImportFrom_kind:
                return compiler_from_import(c, s);
-       case Exec_kind:
-               VISIT(c, expr, s->v.Exec.body);
-               if (s->v.Exec.globals) {
-                       VISIT(c, expr, s->v.Exec.globals);
-                       if (s->v.Exec.locals) {
-                               VISIT(c, expr, s->v.Exec.locals);
-                       } else {
-                               ADDOP(c, DUP_TOP);
-                       }
-               } else {
-                       ADDOP_O(c, LOAD_CONST, Py_None, consts);
-                       ADDOP(c, DUP_TOP);
-               }
-               ADDOP(c, EXEC_STMT);
-               break;
        case Global_kind:
                break;
        case Expr_kind:
index aeaa429236bf2079a3a1d47e2ca9e165c59e2ad0..1d49a8c929efec3932f4180feedf31acb3c16248 100644 (file)
@@ -253,7 +253,7 @@ static state states_11[4] = {
        {2, arcs_11_2},
        {1, arcs_11_3},
 };
-static arc arcs_12_0[9] = {
+static arc arcs_12_0[8] = {
        {33, 1},
        {34, 1},
        {35, 1},
@@ -262,29 +262,28 @@ static arc arcs_12_0[9] = {
        {38, 1},
        {39, 1},
        {40, 1},
-       {41, 1},
 };
 static arc arcs_12_1[1] = {
        {0, 1},
 };
 static state states_12[2] = {
-       {9, arcs_12_0},
+       {8, arcs_12_0},
        {1, arcs_12_1},
 };
 static arc arcs_13_0[1] = {
        {9, 1},
 };
 static arc arcs_13_1[3] = {
-       {42, 2},
+       {41, 2},
        {25, 3},
        {0, 1},
 };
 static arc arcs_13_2[2] = {
-       {43, 4},
+       {42, 4},
        {9, 4},
 };
 static arc arcs_13_3[2] = {
-       {43, 5},
+       {42, 5},
        {9, 5},
 };
 static arc arcs_13_4[1] = {
@@ -303,6 +302,7 @@ static state states_13[6] = {
        {2, arcs_13_5},
 };
 static arc arcs_14_0[12] = {
+       {43, 1},
        {44, 1},
        {45, 1},
        {46, 1},
@@ -314,7 +314,6 @@ static arc arcs_14_0[12] = {
        {52, 1},
        {53, 1},
        {54, 1},
-       {55, 1},
 };
 static arc arcs_14_1[1] = {
        {0, 1},
@@ -324,11 +323,11 @@ static state states_14[2] = {
        {1, arcs_14_1},
 };
 static arc arcs_15_0[1] = {
-       {56, 1},
+       {55, 1},
 };
 static arc arcs_15_1[3] = {
        {26, 2},
-       {57, 3},
+       {56, 3},
        {0, 1},
 };
 static arc arcs_15_2[2] = {
@@ -369,10 +368,10 @@ static state states_15[9] = {
        {2, arcs_15_8},
 };
 static arc arcs_16_0[1] = {
-       {58, 1},
+       {57, 1},
 };
 static arc arcs_16_1[1] = {
-       {59, 2},
+       {58, 2},
 };
 static arc arcs_16_2[1] = {
        {0, 2},
@@ -383,7 +382,7 @@ static state states_16[3] = {
        {1, arcs_16_2},
 };
 static arc arcs_17_0[1] = {
-       {60, 1},
+       {59, 1},
 };
 static arc arcs_17_1[1] = {
        {0, 1},
@@ -393,11 +392,11 @@ static state states_17[2] = {
        {1, arcs_17_1},
 };
 static arc arcs_18_0[5] = {
+       {60, 1},
        {61, 1},
        {62, 1},
        {63, 1},
        {64, 1},
-       {65, 1},
 };
 static arc arcs_18_1[1] = {
        {0, 1},
@@ -407,7 +406,7 @@ static state states_18[2] = {
        {1, arcs_18_1},
 };
 static arc arcs_19_0[1] = {
-       {66, 1},
+       {65, 1},
 };
 static arc arcs_19_1[1] = {
        {0, 1},
@@ -417,7 +416,7 @@ static state states_19[2] = {
        {1, arcs_19_1},
 };
 static arc arcs_20_0[1] = {
-       {67, 1},
+       {66, 1},
 };
 static arc arcs_20_1[1] = {
        {0, 1},
@@ -427,7 +426,7 @@ static state states_20[2] = {
        {1, arcs_20_1},
 };
 static arc arcs_21_0[1] = {
-       {68, 1},
+       {67, 1},
 };
 static arc arcs_21_1[2] = {
        {9, 2},
@@ -442,7 +441,7 @@ static state states_21[3] = {
        {1, arcs_21_2},
 };
 static arc arcs_22_0[1] = {
-       {43, 1},
+       {42, 1},
 };
 static arc arcs_22_1[1] = {
        {0, 1},
@@ -452,7 +451,7 @@ static state states_22[2] = {
        {1, arcs_22_1},
 };
 static arc arcs_23_0[1] = {
-       {69, 1},
+       {68, 1},
 };
 static arc arcs_23_1[2] = {
        {26, 2},
@@ -485,8 +484,8 @@ static state states_23[7] = {
        {1, arcs_23_6},
 };
 static arc arcs_24_0[2] = {
+       {69, 1},
        {70, 1},
-       {71, 1},
 };
 static arc arcs_24_1[1] = {
        {0, 1},
@@ -496,10 +495,10 @@ static state states_24[2] = {
        {1, arcs_24_1},
 };
 static arc arcs_25_0[1] = {
-       {72, 1},
+       {71, 1},
 };
 static arc arcs_25_1[1] = {
-       {73, 2},
+       {72, 2},
 };
 static arc arcs_25_2[1] = {
        {0, 2},
@@ -510,30 +509,30 @@ static state states_25[3] = {
        {1, arcs_25_2},
 };
 static arc arcs_26_0[1] = {
-       {74, 1},
+       {73, 1},
 };
 static arc arcs_26_1[2] = {
-       {75, 2},
+       {74, 2},
        {12, 3},
 };
 static arc arcs_26_2[3] = {
-       {75, 2},
+       {74, 2},
        {12, 3},
-       {72, 4},
+       {71, 4},
 };
 static arc arcs_26_3[1] = {
-       {72, 4},
+       {71, 4},
 };
 static arc arcs_26_4[3] = {
        {28, 5},
        {13, 6},
-       {76, 5},
+       {75, 5},
 };
 static arc arcs_26_5[1] = {
        {0, 5},
 };
 static arc arcs_26_6[1] = {
-       {76, 7},
+       {75, 7},
 };
 static arc arcs_26_7[1] = {
        {15, 5},
@@ -552,7 +551,7 @@ static arc arcs_27_0[1] = {
        {19, 1},
 };
 static arc arcs_27_1[2] = {
-       {78, 2},
+       {77, 2},
        {0, 1},
 };
 static arc arcs_27_2[1] = {
@@ -571,7 +570,7 @@ static arc arcs_28_0[1] = {
        {12, 1},
 };
 static arc arcs_28_1[2] = {
-       {78, 2},
+       {77, 2},
        {0, 1},
 };
 static arc arcs_28_2[1] = {
@@ -587,14 +586,14 @@ static state states_28[4] = {
        {1, arcs_28_3},
 };
 static arc arcs_29_0[1] = {
-       {77, 1},
+       {76, 1},
 };
 static arc arcs_29_1[2] = {
        {27, 2},
        {0, 1},
 };
 static arc arcs_29_2[2] = {
-       {77, 1},
+       {76, 1},
        {0, 2},
 };
 static state states_29[3] = {
@@ -603,7 +602,7 @@ static state states_29[3] = {
        {2, arcs_29_2},
 };
 static arc arcs_30_0[1] = {
-       {79, 1},
+       {78, 1},
 };
 static arc arcs_30_1[2] = {
        {27, 0},
@@ -617,7 +616,7 @@ static arc arcs_31_0[1] = {
        {19, 1},
 };
 static arc arcs_31_1[2] = {
-       {75, 0},
+       {74, 0},
        {0, 1},
 };
 static state states_31[2] = {
@@ -625,7 +624,7 @@ static state states_31[2] = {
        {2, arcs_31_1},
 };
 static arc arcs_32_0[1] = {
-       {80, 1},
+       {79, 1},
 };
 static arc arcs_32_1[1] = {
        {19, 2},
@@ -640,78 +639,82 @@ static state states_32[3] = {
        {2, arcs_32_2},
 };
 static arc arcs_33_0[1] = {
-       {81, 1},
+       {80, 1},
 };
 static arc arcs_33_1[1] = {
-       {82, 2},
+       {26, 2},
 };
 static arc arcs_33_2[2] = {
-       {83, 3},
+       {27, 3},
        {0, 2},
 };
 static arc arcs_33_3[1] = {
        {26, 4},
 };
-static arc arcs_33_4[2] = {
-       {27, 5},
+static arc arcs_33_4[1] = {
        {0, 4},
 };
-static arc arcs_33_5[1] = {
-       {26, 6},
-};
-static arc arcs_33_6[1] = {
-       {0, 6},
-};
-static state states_33[7] = {
+static state states_33[5] = {
        {1, arcs_33_0},
        {1, arcs_33_1},
        {2, arcs_33_2},
        {1, arcs_33_3},
-       {2, arcs_33_4},
-       {1, arcs_33_5},
-       {1, arcs_33_6},
+       {1, arcs_33_4},
 };
-static arc arcs_34_0[1] = {
+static arc arcs_34_0[7] = {
+       {81, 1},
+       {82, 1},
+       {83, 1},
        {84, 1},
+       {85, 1},
+       {17, 1},
+       {86, 1},
 };
 static arc arcs_34_1[1] = {
+       {0, 1},
+};
+static state states_34[2] = {
+       {7, arcs_34_0},
+       {1, arcs_34_1},
+};
+static arc arcs_35_0[1] = {
+       {87, 1},
+};
+static arc arcs_35_1[1] = {
        {26, 2},
 };
-static arc arcs_34_2[2] = {
-       {27, 3},
-       {0, 2},
+static arc arcs_35_2[1] = {
+       {21, 3},
 };
-static arc arcs_34_3[1] = {
-       {26, 4},
+static arc arcs_35_3[1] = {
+       {22, 4},
 };
-static arc arcs_34_4[1] = {
+static arc arcs_35_4[3] = {
+       {88, 1},
+       {89, 5},
        {0, 4},
 };
-static state states_34[5] = {
-       {1, arcs_34_0},
-       {1, arcs_34_1},
-       {2, arcs_34_2},
-       {1, arcs_34_3},
-       {1, arcs_34_4},
+static arc arcs_35_5[1] = {
+       {21, 6},
 };
-static arc arcs_35_0[7] = {
-       {85, 1},
-       {86, 1},
-       {87, 1},
-       {88, 1},
-       {89, 1},
-       {17, 1},
-       {90, 1},
+static arc arcs_35_6[1] = {
+       {22, 7},
 };
-static arc arcs_35_1[1] = {
-       {0, 1},
+static arc arcs_35_7[1] = {
+       {0, 7},
 };
-static state states_35[2] = {
-       {7, arcs_35_0},
+static state states_35[8] = {
+       {1, arcs_35_0},
        {1, arcs_35_1},
+       {1, arcs_35_2},
+       {1, arcs_35_3},
+       {3, arcs_35_4},
+       {1, arcs_35_5},
+       {1, arcs_35_6},
+       {1, arcs_35_7},
 };
 static arc arcs_36_0[1] = {
-       {91, 1},
+       {90, 1},
 };
 static arc arcs_36_1[1] = {
        {26, 2},
@@ -722,9 +725,8 @@ static arc arcs_36_2[1] = {
 static arc arcs_36_3[1] = {
        {22, 4},
 };
-static arc arcs_36_4[3] = {
-       {92, 1},
-       {93, 5},
+static arc arcs_36_4[2] = {
+       {89, 5},
        {0, 4},
 };
 static arc arcs_36_5[1] = {
@@ -741,323 +743,299 @@ static state states_36[8] = {
        {1, arcs_36_1},
        {1, arcs_36_2},
        {1, arcs_36_3},
-       {3, arcs_36_4},
+       {2, arcs_36_4},
        {1, arcs_36_5},
        {1, arcs_36_6},
        {1, arcs_36_7},
 };
 static arc arcs_37_0[1] = {
-       {94, 1},
+       {91, 1},
 };
 static arc arcs_37_1[1] = {
-       {26, 2},
+       {58, 2},
 };
 static arc arcs_37_2[1] = {
-       {21, 3},
+       {92, 3},
 };
 static arc arcs_37_3[1] = {
-       {22, 4},
+       {9, 4},
 };
-static arc arcs_37_4[2] = {
-       {93, 5},
-       {0, 4},
+static arc arcs_37_4[1] = {
+       {21, 5},
 };
 static arc arcs_37_5[1] = {
-       {21, 6},
+       {22, 6},
 };
-static arc arcs_37_6[1] = {
-       {22, 7},
+static arc arcs_37_6[2] = {
+       {89, 7},
+       {0, 6},
 };
 static arc arcs_37_7[1] = {
-       {0, 7},
+       {21, 8},
+};
+static arc arcs_37_8[1] = {
+       {22, 9},
+};
+static arc arcs_37_9[1] = {
+       {0, 9},
 };
-static state states_37[8] = {
+static state states_37[10] = {
        {1, arcs_37_0},
        {1, arcs_37_1},
        {1, arcs_37_2},
        {1, arcs_37_3},
-       {2, arcs_37_4},
+       {1, arcs_37_4},
        {1, arcs_37_5},
-       {1, arcs_37_6},
+       {2, arcs_37_6},
        {1, arcs_37_7},
+       {1, arcs_37_8},
+       {1, arcs_37_9},
 };
 static arc arcs_38_0[1] = {
-       {95, 1},
+       {93, 1},
 };
 static arc arcs_38_1[1] = {
-       {59, 2},
+       {21, 2},
 };
 static arc arcs_38_2[1] = {
-       {83, 3},
+       {22, 3},
 };
-static arc arcs_38_3[1] = {
-       {9, 4},
+static arc arcs_38_3[2] = {
+       {94, 4},
+       {95, 5},
 };
 static arc arcs_38_4[1] = {
-       {21, 5},
+       {21, 6},
 };
 static arc arcs_38_5[1] = {
-       {22, 6},
+       {21, 7},
 };
-static arc arcs_38_6[2] = {
-       {93, 7},
-       {0, 6},
+static arc arcs_38_6[1] = {
+       {22, 8},
 };
 static arc arcs_38_7[1] = {
-       {21, 8},
-};
-static arc arcs_38_8[1] = {
        {22, 9},
 };
+static arc arcs_38_8[4] = {
+       {94, 4},
+       {89, 10},
+       {95, 5},
+       {0, 8},
+};
 static arc arcs_38_9[1] = {
        {0, 9},
 };
-static state states_38[10] = {
+static arc arcs_38_10[1] = {
+       {21, 11},
+};
+static arc arcs_38_11[1] = {
+       {22, 12},
+};
+static arc arcs_38_12[2] = {
+       {95, 5},
+       {0, 12},
+};
+static state states_38[13] = {
        {1, arcs_38_0},
        {1, arcs_38_1},
        {1, arcs_38_2},
-       {1, arcs_38_3},
+       {2, arcs_38_3},
        {1, arcs_38_4},
        {1, arcs_38_5},
-       {2, arcs_38_6},
+       {1, arcs_38_6},
        {1, arcs_38_7},
-       {1, arcs_38_8},
+       {4, arcs_38_8},
        {1, arcs_38_9},
+       {1, arcs_38_10},
+       {1, arcs_38_11},
+       {2, arcs_38_12},
 };
 static arc arcs_39_0[1] = {
        {96, 1},
 };
 static arc arcs_39_1[1] = {
-       {21, 2},
+       {26, 2},
 };
-static arc arcs_39_2[1] = {
-       {22, 3},
+static arc arcs_39_2[2] = {
+       {97, 3},
+       {21, 4},
 };
-static arc arcs_39_3[2] = {
-       {97, 4},
-       {98, 5},
+static arc arcs_39_3[1] = {
+       {21, 4},
 };
 static arc arcs_39_4[1] = {
-       {21, 6},
+       {22, 5},
 };
 static arc arcs_39_5[1] = {
-       {21, 7},
-};
-static arc arcs_39_6[1] = {
-       {22, 8},
-};
-static arc arcs_39_7[1] = {
-       {22, 9},
-};
-static arc arcs_39_8[4] = {
-       {97, 4},
-       {93, 10},
-       {98, 5},
-       {0, 8},
-};
-static arc arcs_39_9[1] = {
-       {0, 9},
-};
-static arc arcs_39_10[1] = {
-       {21, 11},
-};
-static arc arcs_39_11[1] = {
-       {22, 12},
-};
-static arc arcs_39_12[2] = {
-       {98, 5},
-       {0, 12},
+       {0, 5},
 };
-static state states_39[13] = {
+static state states_39[6] = {
        {1, arcs_39_0},
        {1, arcs_39_1},
-       {1, arcs_39_2},
-       {2, arcs_39_3},
+       {2, arcs_39_2},
+       {1, arcs_39_3},
        {1, arcs_39_4},
        {1, arcs_39_5},
-       {1, arcs_39_6},
-       {1, arcs_39_7},
-       {4, arcs_39_8},
-       {1, arcs_39_9},
-       {1, arcs_39_10},
-       {1, arcs_39_11},
-       {2, arcs_39_12},
 };
 static arc arcs_40_0[1] = {
-       {99, 1},
+       {77, 1},
 };
 static arc arcs_40_1[1] = {
-       {26, 2},
-};
-static arc arcs_40_2[2] = {
-       {100, 3},
-       {21, 4},
-};
-static arc arcs_40_3[1] = {
-       {21, 4},
-};
-static arc arcs_40_4[1] = {
-       {22, 5},
+       {98, 2},
 };
-static arc arcs_40_5[1] = {
-       {0, 5},
+static arc arcs_40_2[1] = {
+       {0, 2},
 };
-static state states_40[6] = {
+static state states_40[3] = {
        {1, arcs_40_0},
        {1, arcs_40_1},
-       {2, arcs_40_2},
-       {1, arcs_40_3},
-       {1, arcs_40_4},
-       {1, arcs_40_5},
+       {1, arcs_40_2},
 };
 static arc arcs_41_0[1] = {
-       {78, 1},
-};
-static arc arcs_41_1[1] = {
-       {82, 2},
-};
-static arc arcs_41_2[1] = {
-       {0, 2},
-};
-static state states_41[3] = {
-       {1, arcs_41_0},
-       {1, arcs_41_1},
-       {1, arcs_41_2},
-};
-static arc arcs_42_0[1] = {
-       {101, 1},
+       {99, 1},
 };
-static arc arcs_42_1[2] = {
+static arc arcs_41_1[2] = {
        {26, 2},
        {0, 1},
 };
-static arc arcs_42_2[2] = {
+static arc arcs_41_2[2] = {
        {27, 3},
        {0, 2},
 };
-static arc arcs_42_3[1] = {
+static arc arcs_41_3[1] = {
        {26, 4},
 };
-static arc arcs_42_4[1] = {
+static arc arcs_41_4[1] = {
        {0, 4},
 };
-static state states_42[5] = {
-       {1, arcs_42_0},
-       {2, arcs_42_1},
-       {2, arcs_42_2},
-       {1, arcs_42_3},
-       {1, arcs_42_4},
+static state states_41[5] = {
+       {1, arcs_41_0},
+       {2, arcs_41_1},
+       {2, arcs_41_2},
+       {1, arcs_41_3},
+       {1, arcs_41_4},
 };
-static arc arcs_43_0[2] = {
+static arc arcs_42_0[2] = {
        {3, 1},
        {2, 2},
 };
-static arc arcs_43_1[1] = {
+static arc arcs_42_1[1] = {
        {0, 1},
 };
-static arc arcs_43_2[1] = {
-       {102, 3},
+static arc arcs_42_2[1] = {
+       {100, 3},
 };
-static arc arcs_43_3[1] = {
+static arc arcs_42_3[1] = {
        {6, 4},
 };
-static arc arcs_43_4[2] = {
+static arc arcs_42_4[2] = {
        {6, 4},
-       {103, 1},
+       {101, 1},
 };
-static state states_43[5] = {
-       {2, arcs_43_0},
-       {1, arcs_43_1},
-       {1, arcs_43_2},
-       {1, arcs_43_3},
-       {2, arcs_43_4},
+static state states_42[5] = {
+       {2, arcs_42_0},
+       {1, arcs_42_1},
+       {1, arcs_42_2},
+       {1, arcs_42_3},
+       {2, arcs_42_4},
 };
-static arc arcs_44_0[1] = {
-       {105, 1},
+static arc arcs_43_0[1] = {
+       {103, 1},
 };
-static arc arcs_44_1[2] = {
+static arc arcs_43_1[2] = {
        {27, 2},
        {0, 1},
 };
-static arc arcs_44_2[1] = {
-       {105, 3},
+static arc arcs_43_2[1] = {
+       {103, 3},
 };
-static arc arcs_44_3[2] = {
+static arc arcs_43_3[2] = {
        {27, 4},
        {0, 3},
 };
-static arc arcs_44_4[2] = {
-       {105, 3},
+static arc arcs_43_4[2] = {
+       {103, 3},
        {0, 4},
 };
-static state states_44[5] = {
-       {1, arcs_44_0},
-       {2, arcs_44_1},
-       {1, arcs_44_2},
-       {2, arcs_44_3},
-       {2, arcs_44_4},
+static state states_43[5] = {
+       {1, arcs_43_0},
+       {2, arcs_43_1},
+       {1, arcs_43_2},
+       {2, arcs_43_3},
+       {2, arcs_43_4},
 };
-static arc arcs_45_0[2] = {
-       {106, 1},
-       {107, 1},
+static arc arcs_44_0[2] = {
+       {104, 1},
+       {105, 1},
 };
-static arc arcs_45_1[1] = {
+static arc arcs_44_1[1] = {
        {0, 1},
 };
-static state states_45[2] = {
-       {2, arcs_45_0},
-       {1, arcs_45_1},
+static state states_44[2] = {
+       {2, arcs_44_0},
+       {1, arcs_44_1},
 };
-static arc arcs_46_0[1] = {
-       {108, 1},
+static arc arcs_45_0[1] = {
+       {106, 1},
 };
-static arc arcs_46_1[2] = {
+static arc arcs_45_1[2] = {
        {23, 2},
        {21, 3},
 };
-static arc arcs_46_2[1] = {
+static arc arcs_45_2[1] = {
        {21, 3},
 };
-static arc arcs_46_3[1] = {
-       {105, 4},
+static arc arcs_45_3[1] = {
+       {103, 4},
 };
-static arc arcs_46_4[1] = {
+static arc arcs_45_4[1] = {
        {0, 4},
 };
-static state states_46[5] = {
-       {1, arcs_46_0},
-       {2, arcs_46_1},
-       {1, arcs_46_2},
-       {1, arcs_46_3},
-       {1, arcs_46_4},
+static state states_45[5] = {
+       {1, arcs_45_0},
+       {2, arcs_45_1},
+       {1, arcs_45_2},
+       {1, arcs_45_3},
+       {1, arcs_45_4},
 };
-static arc arcs_47_0[2] = {
-       {106, 1},
-       {109, 2},
+static arc arcs_46_0[2] = {
+       {104, 1},
+       {107, 2},
 };
-static arc arcs_47_1[2] = {
-       {91, 3},
+static arc arcs_46_1[2] = {
+       {87, 3},
        {0, 1},
 };
-static arc arcs_47_2[1] = {
+static arc arcs_46_2[1] = {
        {0, 2},
 };
-static arc arcs_47_3[1] = {
-       {106, 4},
+static arc arcs_46_3[1] = {
+       {104, 4},
 };
-static arc arcs_47_4[1] = {
-       {93, 5},
+static arc arcs_46_4[1] = {
+       {89, 5},
 };
-static arc arcs_47_5[1] = {
+static arc arcs_46_5[1] = {
        {26, 2},
 };
-static state states_47[6] = {
-       {2, arcs_47_0},
+static state states_46[6] = {
+       {2, arcs_46_0},
+       {2, arcs_46_1},
+       {1, arcs_46_2},
+       {1, arcs_46_3},
+       {1, arcs_46_4},
+       {1, arcs_46_5},
+};
+static arc arcs_47_0[1] = {
+       {108, 1},
+};
+static arc arcs_47_1[2] = {
+       {109, 0},
+       {0, 1},
+};
+static state states_47[2] = {
+       {1, arcs_47_0},
        {2, arcs_47_1},
-       {1, arcs_47_2},
-       {1, arcs_47_3},
-       {1, arcs_47_4},
-       {1, arcs_47_5},
 };
 static arc arcs_48_0[1] = {
        {110, 1},
@@ -1070,69 +1048,69 @@ static state states_48[2] = {
        {1, arcs_48_0},
        {2, arcs_48_1},
 };
-static arc arcs_49_0[1] = {
+static arc arcs_49_0[2] = {
        {112, 1},
+       {113, 2},
 };
-static arc arcs_49_1[2] = {
-       {113, 0},
-       {0, 1},
-};
-static state states_49[2] = {
-       {1, arcs_49_0},
-       {2, arcs_49_1},
-};
-static arc arcs_50_0[2] = {
-       {114, 1},
-       {115, 2},
-};
-static arc arcs_50_1[1] = {
-       {112, 2},
+static arc arcs_49_1[1] = {
+       {110, 2},
 };
-static arc arcs_50_2[1] = {
+static arc arcs_49_2[1] = {
        {0, 2},
 };
-static state states_50[3] = {
-       {2, arcs_50_0},
-       {1, arcs_50_1},
-       {1, arcs_50_2},
+static state states_49[3] = {
+       {2, arcs_49_0},
+       {1, arcs_49_1},
+       {1, arcs_49_2},
 };
-static arc arcs_51_0[1] = {
-       {82, 1},
+static arc arcs_50_0[1] = {
+       {98, 1},
 };
-static arc arcs_51_1[2] = {
-       {116, 0},
+static arc arcs_50_1[2] = {
+       {114, 0},
        {0, 1},
 };
-static state states_51[2] = {
-       {1, arcs_51_0},
-       {2, arcs_51_1},
+static state states_50[2] = {
+       {1, arcs_50_0},
+       {2, arcs_50_1},
 };
-static arc arcs_52_0[9] = {
+static arc arcs_51_0[9] = {
+       {115, 1},
+       {116, 1},
        {117, 1},
        {118, 1},
        {119, 1},
        {120, 1},
-       {121, 1},
-       {122, 1},
-       {83, 1},
-       {114, 2},
-       {123, 3},
+       {92, 1},
+       {112, 2},
+       {121, 3},
 };
-static arc arcs_52_1[1] = {
+static arc arcs_51_1[1] = {
        {0, 1},
 };
-static arc arcs_52_2[1] = {
-       {83, 1},
+static arc arcs_51_2[1] = {
+       {92, 1},
 };
-static arc arcs_52_3[2] = {
-       {114, 1},
+static arc arcs_51_3[2] = {
+       {112, 1},
        {0, 3},
 };
-static state states_52[4] = {
-       {9, arcs_52_0},
-       {1, arcs_52_1},
-       {1, arcs_52_2},
-       {2, arcs_52_3},
+static state states_51[4] = {
+       {9, arcs_51_0},
+       {1, arcs_51_1},
+       {1, arcs_51_2},
+       {2, arcs_51_3},
+};
+static arc arcs_52_0[1] = {
+       {122, 1},
+};
+static arc arcs_52_1[2] = {
+       {123, 0},
+       {0, 1},
+};
+static state states_52[2] = {
+       {1, arcs_52_0},
+       {2, arcs_52_1},
 };
 static arc arcs_53_0[1] = {
        {124, 1},
@@ -1159,20 +1137,21 @@ static state states_54[2] = {
 static arc arcs_55_0[1] = {
        {128, 1},
 };
-static arc arcs_55_1[2] = {
+static arc arcs_55_1[3] = {
        {129, 0},
+       {56, 0},
        {0, 1},
 };
 static state states_55[2] = {
        {1, arcs_55_0},
-       {2, arcs_55_1},
+       {3, arcs_55_1},
 };
 static arc arcs_56_0[1] = {
        {130, 1},
 };
 static arc arcs_56_1[3] = {
        {131, 0},
-       {57, 0},
+       {132, 0},
        {0, 1},
 };
 static state states_56[2] = {
@@ -1180,121 +1159,135 @@ static state states_56[2] = {
        {3, arcs_56_1},
 };
 static arc arcs_57_0[1] = {
-       {132, 1},
+       {133, 1},
 };
-static arc arcs_57_1[3] = {
-       {133, 0},
+static arc arcs_57_1[5] = {
+       {28, 0},
        {134, 0},
+       {135, 0},
+       {136, 0},
        {0, 1},
 };
 static state states_57[2] = {
        {1, arcs_57_0},
-       {3, arcs_57_1},
-};
-static arc arcs_58_0[1] = {
-       {135, 1},
-};
-static arc arcs_58_1[5] = {
-       {28, 0},
-       {136, 0},
-       {137, 0},
-       {138, 0},
-       {0, 1},
+       {5, arcs_57_1},
 };
-static state states_58[2] = {
-       {1, arcs_58_0},
-       {5, arcs_58_1},
-};
-static arc arcs_59_0[4] = {
-       {133, 1},
-       {134, 1},
-       {139, 1},
-       {140, 2},
+static arc arcs_58_0[4] = {
+       {131, 1},
+       {132, 1},
+       {137, 1},
+       {138, 2},
 };
-static arc arcs_59_1[1] = {
-       {135, 2},
+static arc arcs_58_1[1] = {
+       {133, 2},
 };
-static arc arcs_59_2[1] = {
+static arc arcs_58_2[1] = {
        {0, 2},
 };
-static state states_59[3] = {
-       {4, arcs_59_0},
-       {1, arcs_59_1},
-       {1, arcs_59_2},
+static state states_58[3] = {
+       {4, arcs_58_0},
+       {1, arcs_58_1},
+       {1, arcs_58_2},
 };
-static arc arcs_60_0[1] = {
-       {141, 1},
+static arc arcs_59_0[1] = {
+       {139, 1},
 };
-static arc arcs_60_1[3] = {
-       {142, 1},
+static arc arcs_59_1[3] = {
+       {140, 1},
        {29, 2},
        {0, 1},
 };
-static arc arcs_60_2[1] = {
-       {135, 3},
+static arc arcs_59_2[1] = {
+       {133, 3},
 };
-static arc arcs_60_3[1] = {
+static arc arcs_59_3[1] = {
        {0, 3},
 };
-static state states_60[4] = {
-       {1, arcs_60_0},
-       {3, arcs_60_1},
-       {1, arcs_60_2},
-       {1, arcs_60_3},
+static state states_59[4] = {
+       {1, arcs_59_0},
+       {3, arcs_59_1},
+       {1, arcs_59_2},
+       {1, arcs_59_3},
 };
-static arc arcs_61_0[6] = {
+static arc arcs_60_0[6] = {
        {13, 1},
-       {144, 2},
-       {147, 3},
+       {142, 2},
+       {145, 3},
        {19, 4},
-       {150, 4},
-       {151, 5},
+       {148, 4},
+       {149, 5},
 };
-static arc arcs_61_1[3] = {
-       {43, 6},
-       {143, 6},
+static arc arcs_60_1[3] = {
+       {42, 6},
+       {141, 6},
        {15, 4},
 };
-static arc arcs_61_2[2] = {
-       {145, 7},
-       {146, 4},
+static arc arcs_60_2[2] = {
+       {143, 7},
+       {144, 4},
 };
-static arc arcs_61_3[2] = {
-       {148, 8},
-       {149, 4},
+static arc arcs_60_3[2] = {
+       {146, 8},
+       {147, 4},
 };
-static arc arcs_61_4[1] = {
+static arc arcs_60_4[1] = {
        {0, 4},
 };
-static arc arcs_61_5[2] = {
-       {151, 5},
+static arc arcs_60_5[2] = {
+       {149, 5},
        {0, 5},
 };
-static arc arcs_61_6[1] = {
+static arc arcs_60_6[1] = {
        {15, 4},
 };
-static arc arcs_61_7[1] = {
-       {146, 4},
+static arc arcs_60_7[1] = {
+       {144, 4},
 };
-static arc arcs_61_8[1] = {
-       {149, 4},
+static arc arcs_60_8[1] = {
+       {147, 4},
+};
+static state states_60[9] = {
+       {6, arcs_60_0},
+       {3, arcs_60_1},
+       {2, arcs_60_2},
+       {2, arcs_60_3},
+       {1, arcs_60_4},
+       {2, arcs_60_5},
+       {1, arcs_60_6},
+       {1, arcs_60_7},
+       {1, arcs_60_8},
+};
+static arc arcs_61_0[1] = {
+       {26, 1},
+};
+static arc arcs_61_1[3] = {
+       {150, 2},
+       {27, 3},
+       {0, 1},
+};
+static arc arcs_61_2[1] = {
+       {0, 2},
+};
+static arc arcs_61_3[2] = {
+       {26, 4},
+       {0, 3},
+};
+static arc arcs_61_4[2] = {
+       {27, 3},
+       {0, 4},
 };
-static state states_61[9] = {
-       {6, arcs_61_0},
+static state states_61[5] = {
+       {1, arcs_61_0},
        {3, arcs_61_1},
-       {2, arcs_61_2},
+       {1, arcs_61_2},
        {2, arcs_61_3},
-       {1, arcs_61_4},
-       {2, arcs_61_5},
-       {1, arcs_61_6},
-       {1, arcs_61_7},
-       {1, arcs_61_8},
+       {2, arcs_61_4},
 };
 static arc arcs_62_0[1] = {
        {26, 1},
 };
 static arc arcs_62_1[3] = {
-       {152, 2},
+       {151, 2},
        {27, 3},
        {0, 1},
 };
@@ -1317,163 +1310,153 @@ static state states_62[5] = {
        {2, arcs_62_4},
 };
 static arc arcs_63_0[1] = {
-       {26, 1},
+       {106, 1},
 };
-static arc arcs_63_1[3] = {
-       {153, 2},
-       {27, 3},
-       {0, 1},
+static arc arcs_63_1[2] = {
+       {23, 2},
+       {21, 3},
 };
 static arc arcs_63_2[1] = {
-       {0, 2},
+       {21, 3},
 };
-static arc arcs_63_3[2] = {
+static arc arcs_63_3[1] = {
        {26, 4},
-       {0, 3},
 };
-static arc arcs_63_4[2] = {
-       {27, 3},
+static arc arcs_63_4[1] = {
        {0, 4},
 };
 static state states_63[5] = {
        {1, arcs_63_0},
-       {3, arcs_63_1},
+       {2, arcs_63_1},
        {1, arcs_63_2},
-       {2, arcs_63_3},
-       {2, arcs_63_4},
+       {1, arcs_63_3},
+       {1, arcs_63_4},
 };
-static arc arcs_64_0[1] = {
-       {108, 1},
+static arc arcs_64_0[3] = {
+       {13, 1},
+       {142, 2},
+       {74, 3},
 };
 static arc arcs_64_1[2] = {
-       {23, 2},
-       {21, 3},
+       {14, 4},
+       {15, 5},
 };
 static arc arcs_64_2[1] = {
-       {21, 3},
+       {152, 6},
 };
 static arc arcs_64_3[1] = {
-       {26, 4},
+       {19, 5},
 };
 static arc arcs_64_4[1] = {
-       {0, 4},
+       {15, 5},
 };
-static state states_64[5] = {
-       {1, arcs_64_0},
+static arc arcs_64_5[1] = {
+       {0, 5},
+};
+static arc arcs_64_6[1] = {
+       {144, 5},
+};
+static state states_64[7] = {
+       {3, arcs_64_0},
        {2, arcs_64_1},
        {1, arcs_64_2},
        {1, arcs_64_3},
        {1, arcs_64_4},
+       {1, arcs_64_5},
+       {1, arcs_64_6},
 };
-static arc arcs_65_0[3] = {
-       {13, 1},
-       {144, 2},
-       {75, 3},
+static arc arcs_65_0[1] = {
+       {153, 1},
 };
 static arc arcs_65_1[2] = {
-       {14, 4},
-       {15, 5},
-};
-static arc arcs_65_2[1] = {
-       {154, 6},
-};
-static arc arcs_65_3[1] = {
-       {19, 5},
-};
-static arc arcs_65_4[1] = {
-       {15, 5},
-};
-static arc arcs_65_5[1] = {
-       {0, 5},
-};
-static arc arcs_65_6[1] = {
-       {146, 5},
-};
-static state states_65[7] = {
-       {3, arcs_65_0},
-       {2, arcs_65_1},
-       {1, arcs_65_2},
-       {1, arcs_65_3},
-       {1, arcs_65_4},
-       {1, arcs_65_5},
-       {1, arcs_65_6},
-};
-static arc arcs_66_0[1] = {
-       {155, 1},
-};
-static arc arcs_66_1[2] = {
        {27, 2},
        {0, 1},
 };
-static arc arcs_66_2[2] = {
-       {155, 1},
+static arc arcs_65_2[2] = {
+       {153, 1},
        {0, 2},
 };
-static state states_66[3] = {
-       {1, arcs_66_0},
-       {2, arcs_66_1},
-       {2, arcs_66_2},
+static state states_65[3] = {
+       {1, arcs_65_0},
+       {2, arcs_65_1},
+       {2, arcs_65_2},
 };
-static arc arcs_67_0[3] = {
-       {75, 1},
+static arc arcs_66_0[3] = {
+       {74, 1},
        {26, 2},
        {21, 3},
 };
-static arc arcs_67_1[1] = {
-       {75, 4},
+static arc arcs_66_1[1] = {
+       {74, 4},
 };
-static arc arcs_67_2[2] = {
+static arc arcs_66_2[2] = {
        {21, 3},
        {0, 2},
 };
-static arc arcs_67_3[3] = {
+static arc arcs_66_3[3] = {
        {26, 5},
-       {156, 6},
+       {154, 6},
        {0, 3},
 };
-static arc arcs_67_4[1] = {
-       {75, 6},
+static arc arcs_66_4[1] = {
+       {74, 6},
 };
-static arc arcs_67_5[2] = {
-       {156, 6},
+static arc arcs_66_5[2] = {
+       {154, 6},
        {0, 5},
 };
-static arc arcs_67_6[1] = {
+static arc arcs_66_6[1] = {
        {0, 6},
 };
-static state states_67[7] = {
-       {3, arcs_67_0},
-       {1, arcs_67_1},
-       {2, arcs_67_2},
-       {3, arcs_67_3},
-       {1, arcs_67_4},
-       {2, arcs_67_5},
-       {1, arcs_67_6},
+static state states_66[7] = {
+       {3, arcs_66_0},
+       {1, arcs_66_1},
+       {2, arcs_66_2},
+       {3, arcs_66_3},
+       {1, arcs_66_4},
+       {2, arcs_66_5},
+       {1, arcs_66_6},
 };
-static arc arcs_68_0[1] = {
+static arc arcs_67_0[1] = {
        {21, 1},
 };
-static arc arcs_68_1[2] = {
+static arc arcs_67_1[2] = {
        {26, 2},
        {0, 1},
 };
-static arc arcs_68_2[1] = {
+static arc arcs_67_2[1] = {
+       {0, 2},
+};
+static state states_67[3] = {
+       {1, arcs_67_0},
+       {2, arcs_67_1},
+       {1, arcs_67_2},
+};
+static arc arcs_68_0[1] = {
+       {98, 1},
+};
+static arc arcs_68_1[2] = {
+       {27, 2},
+       {0, 1},
+};
+static arc arcs_68_2[2] = {
+       {98, 1},
        {0, 2},
 };
 static state states_68[3] = {
        {1, arcs_68_0},
        {2, arcs_68_1},
-       {1, arcs_68_2},
+       {2, arcs_68_2},
 };
 static arc arcs_69_0[1] = {
-       {82, 1},
+       {26, 1},
 };
 static arc arcs_69_1[2] = {
        {27, 2},
        {0, 1},
 };
 static arc arcs_69_2[2] = {
-       {82, 1},
+       {26, 1},
        {0, 2},
 };
 static state states_69[3] = {
@@ -1484,313 +1467,297 @@ static state states_69[3] = {
 static arc arcs_70_0[1] = {
        {26, 1},
 };
-static arc arcs_70_1[2] = {
-       {27, 2},
-       {0, 1},
-};
-static arc arcs_70_2[2] = {
-       {26, 1},
-       {0, 2},
-};
-static state states_70[3] = {
-       {1, arcs_70_0},
-       {2, arcs_70_1},
-       {2, arcs_70_2},
-};
-static arc arcs_71_0[1] = {
-       {26, 1},
-};
-static arc arcs_71_1[3] = {
+static arc arcs_70_1[3] = {
        {21, 2},
        {27, 3},
        {0, 1},
 };
-static arc arcs_71_2[1] = {
+static arc arcs_70_2[1] = {
        {26, 4},
 };
-static arc arcs_71_3[2] = {
+static arc arcs_70_3[2] = {
        {26, 5},
        {0, 3},
 };
-static arc arcs_71_4[2] = {
+static arc arcs_70_4[2] = {
        {27, 6},
        {0, 4},
 };
-static arc arcs_71_5[2] = {
+static arc arcs_70_5[2] = {
        {27, 3},
        {0, 5},
 };
-static arc arcs_71_6[2] = {
+static arc arcs_70_6[2] = {
        {26, 7},
        {0, 6},
 };
-static arc arcs_71_7[1] = {
+static arc arcs_70_7[1] = {
        {21, 2},
 };
-static state states_71[8] = {
-       {1, arcs_71_0},
-       {3, arcs_71_1},
-       {1, arcs_71_2},
-       {2, arcs_71_3},
-       {2, arcs_71_4},
-       {2, arcs_71_5},
-       {2, arcs_71_6},
-       {1, arcs_71_7},
+static state states_70[8] = {
+       {1, arcs_70_0},
+       {3, arcs_70_1},
+       {1, arcs_70_2},
+       {2, arcs_70_3},
+       {2, arcs_70_4},
+       {2, arcs_70_5},
+       {2, arcs_70_6},
+       {1, arcs_70_7},
 };
-static arc arcs_72_0[1] = {
-       {157, 1},
+static arc arcs_71_0[1] = {
+       {155, 1},
 };
-static arc arcs_72_1[1] = {
+static arc arcs_71_1[1] = {
        {19, 2},
 };
-static arc arcs_72_2[2] = {
+static arc arcs_71_2[2] = {
        {13, 3},
        {21, 4},
 };
-static arc arcs_72_3[2] = {
+static arc arcs_71_3[2] = {
        {9, 5},
        {15, 6},
 };
-static arc arcs_72_4[1] = {
+static arc arcs_71_4[1] = {
        {22, 7},
 };
-static arc arcs_72_5[1] = {
+static arc arcs_71_5[1] = {
        {15, 6},
 };
-static arc arcs_72_6[1] = {
+static arc arcs_71_6[1] = {
        {21, 4},
 };
-static arc arcs_72_7[1] = {
+static arc arcs_71_7[1] = {
        {0, 7},
 };
-static state states_72[8] = {
-       {1, arcs_72_0},
-       {1, arcs_72_1},
-       {2, arcs_72_2},
-       {2, arcs_72_3},
-       {1, arcs_72_4},
-       {1, arcs_72_5},
-       {1, arcs_72_6},
-       {1, arcs_72_7},
+static state states_71[8] = {
+       {1, arcs_71_0},
+       {1, arcs_71_1},
+       {2, arcs_71_2},
+       {2, arcs_71_3},
+       {1, arcs_71_4},
+       {1, arcs_71_5},
+       {1, arcs_71_6},
+       {1, arcs_71_7},
 };
-static arc arcs_73_0[3] = {
-       {158, 1},
+static arc arcs_72_0[3] = {
+       {156, 1},
        {28, 2},
        {29, 3},
 };
-static arc arcs_73_1[2] = {
+static arc arcs_72_1[2] = {
        {27, 4},
        {0, 1},
 };
-static arc arcs_73_2[1] = {
+static arc arcs_72_2[1] = {
        {26, 5},
 };
-static arc arcs_73_3[1] = {
+static arc arcs_72_3[1] = {
        {26, 6},
 };
-static arc arcs_73_4[4] = {
-       {158, 1},
+static arc arcs_72_4[4] = {
+       {156, 1},
        {28, 2},
        {29, 3},
        {0, 4},
 };
-static arc arcs_73_5[2] = {
+static arc arcs_72_5[2] = {
        {27, 7},
        {0, 5},
 };
-static arc arcs_73_6[1] = {
+static arc arcs_72_6[1] = {
        {0, 6},
 };
-static arc arcs_73_7[1] = {
+static arc arcs_72_7[1] = {
        {29, 3},
 };
-static state states_73[8] = {
-       {3, arcs_73_0},
-       {2, arcs_73_1},
-       {1, arcs_73_2},
-       {1, arcs_73_3},
-       {4, arcs_73_4},
-       {2, arcs_73_5},
-       {1, arcs_73_6},
-       {1, arcs_73_7},
+static state states_72[8] = {
+       {3, arcs_72_0},
+       {2, arcs_72_1},
+       {1, arcs_72_2},
+       {1, arcs_72_3},
+       {4, arcs_72_4},
+       {2, arcs_72_5},
+       {1, arcs_72_6},
+       {1, arcs_72_7},
 };
-static arc arcs_74_0[1] = {
+static arc arcs_73_0[1] = {
        {26, 1},
 };
-static arc arcs_74_1[3] = {
-       {153, 2},
+static arc arcs_73_1[3] = {
+       {151, 2},
        {25, 3},
        {0, 1},
 };
-static arc arcs_74_2[1] = {
+static arc arcs_73_2[1] = {
        {0, 2},
 };
-static arc arcs_74_3[1] = {
+static arc arcs_73_3[1] = {
        {26, 2},
 };
-static state states_74[4] = {
-       {1, arcs_74_0},
-       {3, arcs_74_1},
-       {1, arcs_74_2},
-       {1, arcs_74_3},
+static state states_73[4] = {
+       {1, arcs_73_0},
+       {3, arcs_73_1},
+       {1, arcs_73_2},
+       {1, arcs_73_3},
 };
-static arc arcs_75_0[2] = {
-       {152, 1},
-       {160, 1},
+static arc arcs_74_0[2] = {
+       {150, 1},
+       {158, 1},
 };
-static arc arcs_75_1[1] = {
+static arc arcs_74_1[1] = {
        {0, 1},
 };
-static state states_75[2] = {
-       {2, arcs_75_0},
-       {1, arcs_75_1},
+static state states_74[2] = {
+       {2, arcs_74_0},
+       {1, arcs_74_1},
 };
-static arc arcs_76_0[1] = {
-       {95, 1},
+static arc arcs_75_0[1] = {
+       {91, 1},
 };
-static arc arcs_76_1[1] = {
-       {59, 2},
+static arc arcs_75_1[1] = {
+       {58, 2},
 };
-static arc arcs_76_2[1] = {
-       {83, 3},
+static arc arcs_75_2[1] = {
+       {92, 3},
 };
-static arc arcs_76_3[1] = {
-       {104, 4},
+static arc arcs_75_3[1] = {
+       {102, 4},
 };
-static arc arcs_76_4[2] = {
-       {159, 5},
+static arc arcs_75_4[2] = {
+       {157, 5},
        {0, 4},
 };
-static arc arcs_76_5[1] = {
+static arc arcs_75_5[1] = {
        {0, 5},
 };
-static state states_76[6] = {
-       {1, arcs_76_0},
-       {1, arcs_76_1},
-       {1, arcs_76_2},
-       {1, arcs_76_3},
-       {2, arcs_76_4},
-       {1, arcs_76_5},
+static state states_75[6] = {
+       {1, arcs_75_0},
+       {1, arcs_75_1},
+       {1, arcs_75_2},
+       {1, arcs_75_3},
+       {2, arcs_75_4},
+       {1, arcs_75_5},
 };
-static arc arcs_77_0[1] = {
-       {91, 1},
+static arc arcs_76_0[1] = {
+       {87, 1},
 };
-static arc arcs_77_1[1] = {
-       {105, 2},
+static arc arcs_76_1[1] = {
+       {103, 2},
 };
-static arc arcs_77_2[2] = {
-       {159, 3},
+static arc arcs_76_2[2] = {
+       {157, 3},
        {0, 2},
 };
-static arc arcs_77_3[1] = {
+static arc arcs_76_3[1] = {
        {0, 3},
 };
-static state states_77[4] = {
-       {1, arcs_77_0},
-       {1, arcs_77_1},
-       {2, arcs_77_2},
-       {1, arcs_77_3},
+static state states_76[4] = {
+       {1, arcs_76_0},
+       {1, arcs_76_1},
+       {2, arcs_76_2},
+       {1, arcs_76_3},
 };
-static arc arcs_78_0[2] = {
-       {153, 1},
-       {162, 1},
+static arc arcs_77_0[2] = {
+       {151, 1},
+       {160, 1},
 };
-static arc arcs_78_1[1] = {
+static arc arcs_77_1[1] = {
        {0, 1},
 };
-static state states_78[2] = {
-       {2, arcs_78_0},
-       {1, arcs_78_1},
+static state states_77[2] = {
+       {2, arcs_77_0},
+       {1, arcs_77_1},
 };
-static arc arcs_79_0[1] = {
-       {95, 1},
+static arc arcs_78_0[1] = {
+       {91, 1},
 };
-static arc arcs_79_1[1] = {
-       {59, 2},
+static arc arcs_78_1[1] = {
+       {58, 2},
 };
-static arc arcs_79_2[1] = {
-       {83, 3},
+static arc arcs_78_2[1] = {
+       {92, 3},
 };
-static arc arcs_79_3[1] = {
-       {106, 4},
+static arc arcs_78_3[1] = {
+       {104, 4},
 };
-static arc arcs_79_4[2] = {
-       {161, 5},
+static arc arcs_78_4[2] = {
+       {159, 5},
        {0, 4},
 };
-static arc arcs_79_5[1] = {
+static arc arcs_78_5[1] = {
        {0, 5},
 };
-static state states_79[6] = {
-       {1, arcs_79_0},
-       {1, arcs_79_1},
-       {1, arcs_79_2},
-       {1, arcs_79_3},
-       {2, arcs_79_4},
-       {1, arcs_79_5},
+static state states_78[6] = {
+       {1, arcs_78_0},
+       {1, arcs_78_1},
+       {1, arcs_78_2},
+       {1, arcs_78_3},
+       {2, arcs_78_4},
+       {1, arcs_78_5},
 };
-static arc arcs_80_0[1] = {
-       {91, 1},
+static arc arcs_79_0[1] = {
+       {87, 1},
 };
-static arc arcs_80_1[1] = {
-       {105, 2},
+static arc arcs_79_1[1] = {
+       {103, 2},
 };
-static arc arcs_80_2[2] = {
-       {161, 3},
+static arc arcs_79_2[2] = {
+       {159, 3},
        {0, 2},
 };
-static arc arcs_80_3[1] = {
+static arc arcs_79_3[1] = {
        {0, 3},
 };
-static state states_80[4] = {
-       {1, arcs_80_0},
-       {1, arcs_80_1},
-       {2, arcs_80_2},
-       {1, arcs_80_3},
+static state states_79[4] = {
+       {1, arcs_79_0},
+       {1, arcs_79_1},
+       {2, arcs_79_2},
+       {1, arcs_79_3},
 };
-static arc arcs_81_0[1] = {
+static arc arcs_80_0[1] = {
        {26, 1},
 };
-static arc arcs_81_1[2] = {
+static arc arcs_80_1[2] = {
        {27, 0},
        {0, 1},
 };
-static state states_81[2] = {
-       {1, arcs_81_0},
-       {2, arcs_81_1},
+static state states_80[2] = {
+       {1, arcs_80_0},
+       {2, arcs_80_1},
 };
-static arc arcs_82_0[1] = {
+static arc arcs_81_0[1] = {
        {19, 1},
 };
-static arc arcs_82_1[1] = {
+static arc arcs_81_1[1] = {
        {0, 1},
 };
-static state states_82[2] = {
-       {1, arcs_82_0},
-       {1, arcs_82_1},
+static state states_81[2] = {
+       {1, arcs_81_0},
+       {1, arcs_81_1},
 };
-static arc arcs_83_0[1] = {
-       {165, 1},
+static arc arcs_82_0[1] = {
+       {163, 1},
 };
-static arc arcs_83_1[2] = {
+static arc arcs_82_1[2] = {
        {9, 2},
        {0, 1},
 };
-static arc arcs_83_2[1] = {
+static arc arcs_82_2[1] = {
        {0, 2},
 };
-static state states_83[3] = {
-       {1, arcs_83_0},
-       {2, arcs_83_1},
-       {1, arcs_83_2},
+static state states_82[3] = {
+       {1, arcs_82_0},
+       {2, arcs_82_1},
+       {1, arcs_82_2},
 };
-static dfa dfas[84] = {
+static dfa dfas[83] = {
        {256, "single_input", 0, 3, states_0,
-        "\004\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"},
+        "\004\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
        {257, "file_input", 0, 2, states_1,
-        "\204\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"},
+        "\204\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
        {258, "eval_input", 0, 3, states_2,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
        {259, "decorator", 0, 7, states_3,
         "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {260, "decorators", 0, 2, states_4,
@@ -1806,39 +1773,39 @@ static dfa dfas[84] = {
        {265, "fplist", 0, 3, states_9,
         "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {266, "stmt", 0, 2, states_10,
-        "\000\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"},
+        "\000\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"},
        {267, "simple_stmt", 0, 4, states_11,
-        "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"},
+        "\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
        {268, "small_stmt", 0, 2, states_12,
-        "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"},
+        "\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
        {269, "expr_stmt", 0, 6, states_13,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
        {270, "augassign", 0, 2, states_14,
-        "\000\000\000\000\000\360\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\370\177\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {271, "print_stmt", 0, 9, states_15,
-        "\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {272, "del_stmt", 0, 3, states_16,
-        "\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {273, "pass_stmt", 0, 2, states_17,
-        "\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {274, "flow_stmt", 0, 2, states_18,
-        "\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\040"},
+        "\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\010"},
        {275, "break_stmt", 0, 2, states_19,
-        "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"},
        {276, "continue_stmt", 0, 2, states_20,
-        "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"},
        {277, "return_stmt", 0, 3, states_21,
-        "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"},
        {278, "yield_stmt", 0, 2, states_22,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"},
+        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"},
        {279, "raise_stmt", 0, 7, states_23,
-        "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"},
        {280, "import_stmt", 0, 2, states_24,
-        "\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\200\002\000\000\000\000\000\000\000\000\000\000\000"},
        {281, "import_name", 0, 3, states_25,
-        "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000"},
        {282, "import_from", 0, 8, states_26,
-        "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000"},
+        "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"},
        {283, "import_as_name", 0, 4, states_27,
         "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {284, "dotted_as_name", 0, 4, states_28,
@@ -1850,126 +1817,124 @@ static dfa dfas[84] = {
        {287, "dotted_name", 0, 2, states_31,
         "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
        {288, "global_stmt", 0, 3, states_32,
+        "\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000"},
+       {289, "assert_stmt", 0, 5, states_33,
         "\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000"},
-       {289, "exec_stmt", 0, 7, states_33,
-        "\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000"},
-       {290, "assert_stmt", 0, 5, states_34,
-        "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"},
-       {291, "compound_stmt", 0, 2, states_35,
-        "\000\010\004\000\000\000\000\000\000\000\000\310\011\000\000\000\000\000\000\040\000"},
-       {292, "if_stmt", 0, 8, states_36,
+       {290, "compound_stmt", 0, 2, states_34,
+        "\000\010\004\000\000\000\000\000\000\000\200\054\001\000\000\000\000\000\000\010\000"},
+       {291, "if_stmt", 0, 8, states_35,
+        "\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
+       {292, "while_stmt", 0, 8, states_36,
+        "\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"},
+       {293, "for_stmt", 0, 10, states_37,
         "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
-       {293, "while_stmt", 0, 8, states_37,
-        "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"},
-       {294, "for_stmt", 0, 10, states_38,
-        "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000"},
-       {295, "try_stmt", 0, 13, states_39,
+       {294, "try_stmt", 0, 13, states_38,
+        "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"},
+       {295, "with_stmt", 0, 6, states_39,
         "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"},
-       {296, "with_stmt", 0, 6, states_40,
+       {296, "with_var", 0, 3, states_40,
+        "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"},
+       {297, "except_clause", 0, 5, states_41,
         "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"},
-       {297, "with_var", 0, 3, states_41,
-        "\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"},
-       {298, "except_clause", 0, 5, states_42,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"},
-       {299, "suite", 0, 5, states_43,
-        "\004\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"},
-       {300, "testlist_safe", 0, 5, states_44,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {301, "old_test", 0, 2, states_45,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {302, "old_lambdef", 0, 5, states_46,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"},
-       {303, "test", 0, 6, states_47,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {304, "or_test", 0, 2, states_48,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"},
-       {305, "and_test", 0, 2, states_49,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"},
-       {306, "not_test", 0, 3, states_50,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"},
-       {307, "comparison", 0, 2, states_51,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {308, "comp_op", 0, 4, states_52,
-        "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\344\017\000\000\000\000\000"},
-       {309, "expr", 0, 2, states_53,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {310, "xor_expr", 0, 2, states_54,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {311, "and_expr", 0, 2, states_55,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {312, "shift_expr", 0, 2, states_56,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {313, "arith_expr", 0, 2, states_57,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {314, "term", 0, 2, states_58,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {315, "factor", 0, 3, states_59,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {316, "power", 0, 4, states_60,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\000\000"},
-       {317, "atom", 0, 9, states_61,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\000\000"},
-       {318, "listmaker", 0, 5, states_62,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {319, "testlist_gexp", 0, 5, states_63,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {320, "lambdef", 0, 5, states_64,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"},
-       {321, "trailer", 0, 7, states_65,
-        "\000\040\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\001\000\000"},
-       {322, "subscriptlist", 0, 3, states_66,
-        "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\311\000\000"},
-       {323, "subscript", 0, 7, states_67,
-        "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\311\000\000"},
-       {324, "sliceop", 0, 3, states_68,
+       {298, "suite", 0, 5, states_42,
+        "\004\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"},
+       {299, "testlist_safe", 0, 5, states_43,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {300, "old_test", 0, 2, states_44,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {301, "old_lambdef", 0, 5, states_45,
+        "\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000"},
+       {302, "test", 0, 6, states_46,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {303, "or_test", 0, 2, states_47,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
+       {304, "and_test", 0, 2, states_48,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
+       {305, "not_test", 0, 3, states_49,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\001\000\030\102\062\000\000"},
+       {306, "comparison", 0, 2, states_50,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {307, "comp_op", 0, 4, states_51,
+        "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\371\003\000\000\000\000\000"},
+       {308, "expr", 0, 2, states_52,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {309, "xor_expr", 0, 2, states_53,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {310, "and_expr", 0, 2, states_54,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {311, "shift_expr", 0, 2, states_55,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {312, "arith_expr", 0, 2, states_56,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {313, "term", 0, 2, states_57,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {314, "factor", 0, 3, states_58,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {315, "power", 0, 4, states_59,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\062\000\000"},
+       {316, "atom", 0, 9, states_60,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100\062\000\000"},
+       {317, "listmaker", 0, 5, states_61,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {318, "testlist_gexp", 0, 5, states_62,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {319, "lambdef", 0, 5, states_63,
+        "\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000"},
+       {320, "trailer", 0, 7, states_64,
+        "\000\040\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\100\000\000\000"},
+       {321, "subscriptlist", 0, 3, states_65,
+        "\000\040\050\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
+       {322, "subscript", 0, 7, states_66,
+        "\000\040\050\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"},
+       {323, "sliceop", 0, 3, states_67,
         "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-       {325, "exprlist", 0, 3, states_69,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"},
-       {326, "testlist", 0, 3, states_70,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {327, "dictsetmaker", 0, 8, states_71,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {328, "classdef", 0, 8, states_72,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"},
-       {329, "arglist", 0, 8, states_73,
-        "\000\040\010\060\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {330, "argument", 0, 4, states_74,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {331, "list_iter", 0, 2, states_75,
-        "\000\000\000\000\000\000\000\000\000\000\000\210\000\000\000\000\000\000\000\000\000"},
-       {332, "list_for", 0, 6, states_76,
-        "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000"},
-       {333, "list_if", 0, 4, states_77,
+       {324, "exprlist", 0, 3, states_68,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\030\102\062\000\000"},
+       {325, "testlist", 0, 3, states_69,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {326, "dictsetmaker", 0, 8, states_70,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {327, "classdef", 0, 8, states_71,
+        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000"},
+       {328, "arglist", 0, 8, states_72,
+        "\000\040\010\060\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {329, "argument", 0, 4, states_73,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {330, "list_iter", 0, 2, states_74,
+        "\000\000\000\000\000\000\000\000\000\000\200\010\000\000\000\000\000\000\000\000\000"},
+       {331, "list_for", 0, 6, states_75,
         "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
-       {334, "gen_iter", 0, 2, states_78,
-        "\000\000\000\000\000\000\000\000\000\000\000\210\000\000\000\000\000\000\000\000\000"},
-       {335, "gen_for", 0, 6, states_79,
-        "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000"},
-       {336, "gen_if", 0, 4, states_80,
+       {332, "list_if", 0, 4, states_76,
+        "\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
+       {333, "gen_iter", 0, 2, states_77,
+        "\000\000\000\000\000\000\000\000\000\000\200\010\000\000\000\000\000\000\000\000\000"},
+       {334, "gen_for", 0, 6, states_78,
         "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"},
-       {337, "testlist1", 0, 2, states_81,
-        "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"},
-       {338, "encoding_decl", 0, 2, states_82,
+       {335, "gen_if", 0, 4, states_79,
+        "\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"},
+       {336, "testlist1", 0, 2, states_80,
+        "\000\040\010\000\000\000\000\000\000\000\000\000\000\004\001\000\030\102\062\000\000"},
+       {337, "encoding_decl", 0, 2, states_81,
         "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
-       {339, "yield_expr", 0, 3, states_83,
-        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"},
+       {338, "yield_expr", 0, 3, states_82,
+        "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010"},
 };
-static label labels[166] = {
+static label labels[164] = {
        {0, "EMPTY"},
        {256, 0},
        {4, 0},
        {267, 0},
-       {291, 0},
+       {290, 0},
        {257, 0},
        {266, 0},
        {0, 0},
        {258, 0},
-       {326, 0},
+       {325, 0},
        {259, 0},
        {50, 0},
        {287, 0},
        {7, 0},
-       {329, 0},
+       {328, 0},
        {8, 0},
        {260, 0},
        {261, 0},
@@ -1977,11 +1942,11 @@ static label labels[166] = {
        {1, 0},
        {262, 0},
        {11, 0},
-       {299, 0},
+       {298, 0},
        {263, 0},
        {264, 0},
        {22, 0},
-       {303, 0},
+       {302, 0},
        {12, 0},
        {16, 0},
        {36, 0},
@@ -1996,9 +1961,8 @@ static label labels[166] = {
        {280, 0},
        {288, 0},
        {289, 0},
-       {290, 0},
        {270, 0},
-       {339, 0},
+       {338, 0},
        {37, 0},
        {38, 0},
        {39, 0},
@@ -2014,7 +1978,7 @@ static label labels[166] = {
        {1, "print"},
        {35, 0},
        {1, "del"},
-       {325, 0},
+       {324, 0},
        {1, "pass"},
        {275, 0},
        {276, 0},
@@ -2036,42 +2000,41 @@ static label labels[166] = {
        {1, "as"},
        {284, 0},
        {1, "global"},
-       {1, "exec"},
-       {309, 0},
-       {1, "in"},
        {1, "assert"},
+       {291, 0},
        {292, 0},
        {293, 0},
        {294, 0},
        {295, 0},
-       {296, 0},
-       {328, 0},
+       {327, 0},
        {1, "if"},
        {1, "elif"},
        {1, "else"},
        {1, "while"},
        {1, "for"},
+       {1, "in"},
        {1, "try"},
-       {298, 0},
+       {297, 0},
        {1, "finally"},
        {1, "with"},
-       {297, 0},
+       {296, 0},
+       {308, 0},
        {1, "except"},
        {5, 0},
        {6, 0},
+       {299, 0},
        {300, 0},
+       {303, 0},
        {301, 0},
-       {304, 0},
-       {302, 0},
        {1, "lambda"},
-       {320, 0},
-       {305, 0},
+       {319, 0},
+       {304, 0},
        {1, "or"},
-       {306, 0},
+       {305, 0},
        {1, "and"},
        {1, "not"},
+       {306, 0},
        {307, 0},
-       {308, 0},
        {20, 0},
        {21, 0},
        {28, 0},
@@ -2079,52 +2042,52 @@ static label labels[166] = {
        {30, 0},
        {29, 0},
        {1, "is"},
-       {310, 0},
+       {309, 0},
        {18, 0},
-       {311, 0},
+       {310, 0},
        {33, 0},
-       {312, 0},
+       {311, 0},
        {19, 0},
-       {313, 0},
+       {312, 0},
        {34, 0},
-       {314, 0},
+       {313, 0},
        {14, 0},
        {15, 0},
-       {315, 0},
+       {314, 0},
        {17, 0},
        {24, 0},
        {48, 0},
        {32, 0},
+       {315, 0},
        {316, 0},
-       {317, 0},
-       {321, 0},
-       {319, 0},
-       {9, 0},
+       {320, 0},
        {318, 0},
+       {9, 0},
+       {317, 0},
        {10, 0},
        {26, 0},
-       {327, 0},
+       {326, 0},
        {27, 0},
        {2, 0},
        {3, 0},
-       {332, 0},
-       {335, 0},
+       {331, 0},
+       {334, 0},
+       {321, 0},
        {322, 0},
        {323, 0},
-       {324, 0},
        {1, "class"},
+       {329, 0},
        {330, 0},
-       {331, 0},
+       {332, 0},
        {333, 0},
-       {334, 0},
+       {335, 0},
        {336, 0},
        {337, 0},
-       {338, 0},
        {1, "yield"},
 };
 grammar _PyParser_Grammar = {
-       84,
+       83,
        dfas,
-       {166, labels},
+       {164, labels},
        256
 };
index 64eeb5330454fc955c23885b2baecfdd062f7e68..81020a9ee902746271870038126931e42041f563 100644 (file)
@@ -480,8 +480,7 @@ check_unoptimized(const PySTEntryObject* ste) {
                               "is a nested function");
 
        switch (ste->ste_unoptimized) {
-       case OPT_TOPLEVEL: /* exec / import * at top-level is fine */
-       case OPT_EXEC: /* qualified exec is fine */
+       case OPT_TOPLEVEL: /* import * at top-level is fine */
                return 1;
        case OPT_IMPORT_STAR:
                PyOS_snprintf(buf, sizeof(buf), 
@@ -489,18 +488,6 @@ check_unoptimized(const PySTEntryObject* ste) {
                              "because it is %s",
                              PyString_AS_STRING(ste->ste_name), trailer);
                break;
-       case OPT_BARE_EXEC:
-               PyOS_snprintf(buf, sizeof(buf),
-                             "unqualified exec is not allowed in function "
-                             "'%.100s' it %s",
-                             PyString_AS_STRING(ste->ste_name), trailer);
-               break;
-       default:
-               PyOS_snprintf(buf, sizeof(buf), 
-                             "function '%.100s' uses import * and bare exec, "
-                             "which are illegal because it %s",
-                             PyString_AS_STRING(ste->ste_name), trailer);
-               break;
        }
 
        PyErr_SetString(PyExc_SyntaxError, buf);
@@ -1045,19 +1032,6 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
                if (st->st_cur->ste_unoptimized && !st->st_cur->ste_opt_lineno)
                        st->st_cur->ste_opt_lineno = s->lineno;
                break;
-        case Exec_kind:
-               VISIT(st, expr, s->v.Exec.body);
-               if (!st->st_cur->ste_opt_lineno)
-                       st->st_cur->ste_opt_lineno = s->lineno;
-               if (s->v.Exec.globals) {
-                       st->st_cur->ste_unoptimized |= OPT_EXEC;
-                       VISIT(st, expr, s->v.Exec.globals);
-                       if (s->v.Exec.locals) 
-                               VISIT(st, expr, s->v.Exec.locals);
-               } else {
-                       st->st_cur->ste_unoptimized |= OPT_BARE_EXEC;
-               }
-               break;
         case Global_kind: {
                int i;
                asdl_seq *seq = s->v.Global.names;
index 0db14d7f1e6295cd768a5101e1803a41ece39792..1f69e7ecd4ad73863ce393888f9cfb5e4281512c 100644 (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&
index 3e06bc23789dda8d99840ed3cba9e51a4331b8e3..a06306bc3b12328f0698d711f1e7b418a12687b3 100755 (executable)
@@ -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)
index 2bbd3d52c2ec855b16c501506b9667f44a66a9ca..7e1ed0b47767fa72208227878f79fdcefa603b00 100755 (executable)
@@ -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'
index 63e7336f9f9181bc35a67ea17f2e6360c60a7f98..f4b83066e2d1583a07c16861b2a9d50a3823b85d 100755 (executable)
@@ -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: