From guido at python.org Fri Sep 1 00:06:22 2006 From: guido at python.org (Guido van Rossum) Date: Thu, 31 Aug 2006 15:06:22 -0700 Subject: [Python-3000-checkins] r51670 - python/branches/p3yk/Misc/Vim/vimrc In-Reply-To: <20060831214556.D73C51E4022@bag.python.org> References: <20060831214556.D73C51E4022@bag.python.org> Message-ID: But what will we do about C files that haven't been converted to the new style yet? (Which is actually the majority, for easy merging from the head.) On 8/31/06, brett.cannon wrote: > Author: brett.cannon > Date: Thu Aug 31 23:45:56 2006 > New Revision: 51670 > > Modified: > python/branches/p3yk/Misc/Vim/vimrc > Log: > Fix comment for indenting in C files. > > Modified: python/branches/p3yk/Misc/Vim/vimrc > ============================================================================== > --- python/branches/p3yk/Misc/Vim/vimrc (original) > +++ python/branches/p3yk/Misc/Vim/vimrc Thu Aug 31 23:45:56 2006 > @@ -19,7 +19,7 @@ > " Number of spaces to use for an indent. > " This will affect Ctrl-T and 'autoindent'. > " Python: 4 spaces > -" C: tab (8 spaces) > +" C: 4 spaces > au BufRead,BufNewFile *.py,*pyw set shiftwidth=4 > au BufRead,BufNewFile *.c,*.h set shiftwidth=4 > > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins at python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From barry at python.org Fri Sep 1 00:31:51 2006 From: barry at python.org (Barry Warsaw) Date: Thu, 31 Aug 2006 18:31:51 -0400 Subject: [Python-3000-checkins] r51670 - python/branches/p3yk/Misc/Vim/vimrc In-Reply-To: References: <20060831214556.D73C51E4022@bag.python.org> Message-ID: <97ADBDFD-FDBC-44A5-BC73-C9A955F401AF@python.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Aug 31, 2006, at 6:06 PM, Guido van Rossum wrote: > But what will we do about C files that haven't been converted to the > new style yet? (Which is actually the majority, for easy merging from > the head.) Why, use X/Emacs of course! :) - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRPdjV3EjvBPtnXfVAQLsXgP+LaANogBuW0NIrxAIgIChLnPILRJOdS+d eHnqLPNKVfDRs5haZih0S0b0aW/7Xn7IJZtk6709KFo5YAdPPQwQiSS/h/J7DV4b b+7g3NSJNPATZsTQDIt2ol8BqB6Z9xAzN9DbpZFwjiOVS+08zBmJS1wrSyyC5J5O 3ZYUZ4uNumA= =RMab -----END PGP SIGNATURE----- From python-3000-checkins at python.org Wed Sep 6 09:06:12 2006 From: python-3000-checkins at python.org (georg.brandl) Date: Wed, 6 Sep 2006 09:06:12 +0200 (CEST) Subject: [Python-3000-checkins] r51773 - in python/branches/p3yk: Doc/lib/libconsts.tex Doc/lib/libstdtypes.tex Doc/ref/ref3.tex Doc/ref/ref5.tex Grammar/Grammar Include/Python-ast.h Lib/compiler/ast.py Lib/compiler/pycodegen.py Lib/compiler/transformer.py Lib/test/output/test_grammar Lib/test/test_grammar.py Modules/parsermodule.c Parser/Python.asdl Python/Python-ast.c Python/ast.c Python/compile.c Python/graminit.c Python/symtable.c Tools/compiler/ast.txt Message-ID: <20060906070612.A444E1E4002@bag.python.org> Author: georg.brandl Date: Wed Sep 6 09:06:08 2006 New Revision: 51773 Modified: python/branches/p3yk/Doc/lib/libconsts.tex python/branches/p3yk/Doc/lib/libstdtypes.tex python/branches/p3yk/Doc/ref/ref3.tex python/branches/p3yk/Doc/ref/ref5.tex python/branches/p3yk/Grammar/Grammar python/branches/p3yk/Include/Python-ast.h python/branches/p3yk/Lib/compiler/ast.py python/branches/p3yk/Lib/compiler/pycodegen.py python/branches/p3yk/Lib/compiler/transformer.py python/branches/p3yk/Lib/test/output/test_grammar python/branches/p3yk/Lib/test/test_grammar.py python/branches/p3yk/Modules/parsermodule.c python/branches/p3yk/Parser/Python.asdl python/branches/p3yk/Python/Python-ast.c python/branches/p3yk/Python/ast.c python/branches/p3yk/Python/compile.c python/branches/p3yk/Python/graminit.c python/branches/p3yk/Python/symtable.c python/branches/p3yk/Tools/compiler/ast.txt Log: Patch #1550786: ellipsis literal. Modified: python/branches/p3yk/Doc/lib/libconsts.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libconsts.tex (original) +++ python/branches/p3yk/Doc/lib/libconsts.tex Wed Sep 6 09:06:08 2006 @@ -26,6 +26,8 @@ \end{datadesc} \begin{datadesc}{Ellipsis} - Special value used in conjunction with extended slicing syntax. + The same as \code{...}. + Special value used mostly in conjunction with extended slicing syntax + for user-defined container data types. % XXX Someone who understands extended slicing should fill in here. \end{datadesc} Modified: python/branches/p3yk/Doc/lib/libstdtypes.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libstdtypes.tex (original) +++ python/branches/p3yk/Doc/lib/libstdtypes.tex Wed Sep 6 09:06:08 2006 @@ -2004,12 +2004,12 @@ \subsection{The Ellipsis Object \label{bltin-ellipsis-object}} -This object is used by extended slice notation (see the +This object is mostly used by extended slice notation (see the \citetitle[../ref/ref.html]{Python Reference Manual}). It supports no special operations. There is exactly one ellipsis object, named \constant{Ellipsis} (a built-in name). -It is written as \code{Ellipsis}. +It is written as \code{Ellipsis} or \code{...}. \subsection{Boolean Values} Modified: python/branches/p3yk/Doc/ref/ref3.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref3.tex (original) +++ python/branches/p3yk/Doc/ref/ref3.tex Wed Sep 6 09:06:08 2006 @@ -148,9 +148,8 @@ \item[Ellipsis] This type has a single value. There is a single object with this value. -This object is accessed through the built-in name \code{Ellipsis}. -It is used to indicate the presence of the \samp{...} syntax in a -slice. Its truth value is true. +This object is accessed through the literal \code{...} or the +built-in name \code{Ellipsis}. Its truth value is true. \obindex{Ellipsis} \item[Numbers] Modified: python/branches/p3yk/Doc/ref/ref5.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref5.tex (original) +++ python/branches/p3yk/Doc/ref/ref5.tex Wed Sep 6 09:06:08 2006 @@ -411,8 +411,7 @@ contains at least one comma, the key is a tuple containing the conversion of the slice items; otherwise, the conversion of the lone slice item is the key. The conversion of a slice item that is an -expression is that expression. The conversion of an ellipsis slice -item is the built-in \code{Ellipsis} object. The conversion of a +expression is that expression. The conversion of a proper slice is a slice object (see section \ref{types}) whose \member{start}, \member{stop} and \member{step} attributes are the values of the expressions given as lower bound, upper bound and Modified: python/branches/p3yk/Grammar/Grammar ============================================================================== --- python/branches/p3yk/Grammar/Grammar (original) +++ python/branches/p3yk/Grammar/Grammar Wed Sep 6 09:06:08 2006 @@ -101,13 +101,13 @@ atom: ('(' [yield_expr|testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictsetmaker] '}' | - NAME | NUMBER | STRING+) + NAME | NUMBER | STRING+ | '.' '.' '.') listmaker: test ( list_for | (',' test)* [','] ) testlist_gexp: test ( gen_for | (',' test)* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME subscriptlist: subscript (',' subscript)* [','] -subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] +subscript: test | [test] ':' [test] [sliceop] sliceop: ':' [test] exprlist: expr (',' expr)* [','] testlist: test (',' test)* [','] Modified: python/branches/p3yk/Include/Python-ast.h ============================================================================== --- python/branches/p3yk/Include/Python-ast.h (original) +++ python/branches/p3yk/Include/Python-ast.h Wed Sep 6 09:06:08 2006 @@ -180,8 +180,9 @@ enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, GeneratorExp_kind=9, Yield_kind=10, Compare_kind=11, - Call_kind=12, Num_kind=13, Str_kind=14, Attribute_kind=15, - Subscript_kind=16, Name_kind=17, List_kind=18, Tuple_kind=19}; + Call_kind=12, Num_kind=13, Str_kind=14, Ellipsis_kind=15, + Attribute_kind=16, Subscript_kind=17, Name_kind=18, + List_kind=19, Tuple_kind=20}; struct _expr { enum _expr_kind kind; union { @@ -289,7 +290,7 @@ int col_offset; }; -enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4}; +enum _slice_kind {Slice_kind=1, ExtSlice_kind=2, Index_kind=3}; struct _slice { enum _slice_kind kind; union { @@ -408,6 +409,7 @@ *arena); expr_ty Num(object n, int lineno, int col_offset, PyArena *arena); expr_ty Str(string s, int lineno, int col_offset, PyArena *arena); +expr_ty Ellipsis(int lineno, int col_offset, PyArena *arena); expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); expr_ty Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int @@ -418,7 +420,6 @@ PyArena *arena); expr_ty Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena); -slice_ty Ellipsis(PyArena *arena); slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); slice_ty ExtSlice(asdl_seq * dims, PyArena *arena); slice_ty Index(expr_ty value, PyArena *arena); Modified: python/branches/p3yk/Lib/compiler/ast.py ============================================================================== --- python/branches/p3yk/Lib/compiler/ast.py (original) +++ python/branches/p3yk/Lib/compiler/ast.py Wed Sep 6 09:06:08 2006 @@ -427,19 +427,6 @@ def __repr__(self): return "Div((%s, %s))" % (repr(self.left), repr(self.right)) -class Ellipsis(Node): - def __init__(self, lineno=None): - self.lineno = lineno - - def getChildren(self): - return () - - def getChildNodes(self): - return () - - def __repr__(self): - return "Ellipsis()" - class FloorDiv(Node): def __init__(self, (left, right), lineno=None): self.left = left Modified: python/branches/p3yk/Lib/compiler/pycodegen.py ============================================================================== --- python/branches/p3yk/Lib/compiler/pycodegen.py (original) +++ python/branches/p3yk/Lib/compiler/pycodegen.py Wed Sep 6 09:06:08 2006 @@ -1214,9 +1214,6 @@ # object constructors - def visitEllipsis(self, node): - self.emit('LOAD_CONST', Ellipsis) - def visitTuple(self, node): self.set_lineno(node) for elt in node.nodes: Modified: python/branches/p3yk/Lib/compiler/transformer.py ============================================================================== --- python/branches/p3yk/Lib/compiler/transformer.py (original) +++ python/branches/p3yk/Lib/compiler/transformer.py Wed Sep 6 09:06:08 2006 @@ -113,6 +113,7 @@ token.LBRACE: self.atom_lbrace, token.NUMBER: self.atom_number, token.STRING: self.atom_string, + token.DOT: self.atom_ellipsis, token.NAME: self.atom_name, } self.encoding = None @@ -747,6 +748,9 @@ k += self.decode_literal(node[1]) return Const(k, lineno=nodelist[0][2]) + def atom_ellipsis(self, nodelist): + return Const(Ellipsis, lineno=nodelist[0][2]) + def atom_name(self, nodelist): return Name(nodelist[0][1], lineno=nodelist[0][2]) @@ -1276,11 +1280,9 @@ lineno=extractLineNo(nodelist)) def com_subscript(self, node): - # slice_item: expression | proper_slice | ellipsis + # slice_item: expression | proper_slice ch = node[1] t = ch[0] - if t == token.DOT and node[2][0] == token.DOT: - return Ellipsis() if t == token.COLON or len(node) > 2: return self.com_sliceobj(node) return self.com_node(ch) Modified: python/branches/p3yk/Lib/test/output/test_grammar ============================================================================== --- python/branches/p3yk/Lib/test/output/test_grammar (original) +++ python/branches/p3yk/Lib/test/output/test_grammar Wed Sep 6 09:06:08 2006 @@ -7,6 +7,7 @@ 1.1.2.2 Long integers 1.1.2.3 Floating point 1.1.3 String literals +1.1.4 Ellipsis literal 1.2 Grammar single_input file_input Modified: python/branches/p3yk/Lib/test/test_grammar.py ============================================================================== --- python/branches/p3yk/Lib/test/test_grammar.py (original) +++ python/branches/p3yk/Lib/test/test_grammar.py Wed Sep 6 09:06:08 2006 @@ -125,6 +125,12 @@ '; verify(x == y) +print '1.1.4 Ellipsis literal' + +x = ... +verify(x == Ellipsis) + + print '1.2 Grammar' print 'single_input' # NEWLINE | simple_stmt | compound_stmt NEWLINE Modified: python/branches/p3yk/Modules/parsermodule.c ============================================================================== --- python/branches/p3yk/Modules/parsermodule.c (original) +++ python/branches/p3yk/Modules/parsermodule.c Wed Sep 6 09:06:08 2006 @@ -2385,6 +2385,11 @@ for (pos = 1; res && (pos < nch); ++pos) res = validate_ntype(CHILD(tree, pos), STRING); break; + case DOT: + res = (nch == 3 && + validate_ntype(CHILD(tree, 1), DOT) && + validate_ntype(CHILD(tree, 2), DOT)); + break; default: res = 0; break; Modified: python/branches/p3yk/Parser/Python.asdl ============================================================================== --- python/branches/p3yk/Parser/Python.asdl (original) +++ python/branches/p3yk/Parser/Python.asdl Wed Sep 6 09:06:08 2006 @@ -63,6 +63,7 @@ expr? starargs, expr? kwargs) | Num(object n) -- a number as a PyObject. | Str(string s) -- need to specify raw, unicode, etc? + | Ellipsis -- other literals? bools? -- the following expression can appear in assignment context @@ -77,7 +78,7 @@ expr_context = Load | Store | Del | AugLoad | AugStore | Param - slice = Ellipsis | Slice(expr? lower, expr? upper, expr? step) + slice = Slice(expr? lower, expr? upper, expr? step) | ExtSlice(slice* dims) | Index(expr value) Modified: python/branches/p3yk/Python/Python-ast.c ============================================================================== --- python/branches/p3yk/Python/Python-ast.c (original) +++ python/branches/p3yk/Python/Python-ast.c Wed Sep 6 09:06:08 2006 @@ -212,6 +212,7 @@ static char *Str_fields[]={ "s", }; +static PyTypeObject *Ellipsis_type; static PyTypeObject *Attribute_type; static char *Attribute_fields[]={ "value", @@ -251,7 +252,6 @@ static PyTypeObject *Param_type; static PyTypeObject *slice_type; static PyObject* ast2obj_slice(void*); -static PyTypeObject *Ellipsis_type; static PyTypeObject *Slice_type; static char *Slice_fields[]={ "lower", @@ -530,6 +530,8 @@ if (!Num_type) return 0; Str_type = make_type("Str", expr_type, Str_fields, 1); if (!Str_type) return 0; + Ellipsis_type = make_type("Ellipsis", expr_type, NULL, 0); + if (!Ellipsis_type) return 0; Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); if (!Attribute_type) return 0; Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); @@ -570,8 +572,6 @@ slice_type = make_type("slice", AST_type, NULL, 0); if (!slice_type) return 0; if (!add_attributes(slice_type, NULL, 0)) return 0; - Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0); - if (!Ellipsis_type) return 0; Slice_type = make_type("Slice", slice_type, Slice_fields, 3); if (!Slice_type) return 0; ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1); @@ -1579,6 +1579,21 @@ } expr_ty +Ellipsis(int lineno, int col_offset, PyArena *arena) +{ + expr_ty p; + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) { + PyErr_NoMemory(); + return NULL; + } + p->kind = Ellipsis_kind; + p->lineno = lineno; + p->col_offset = col_offset; + return p; +} + +expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int col_offset, PyArena *arena) { @@ -1721,19 +1736,6 @@ } slice_ty -Ellipsis(PyArena *arena) -{ - slice_ty p; - p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); - return NULL; - } - p->kind = Ellipsis_kind; - return p; -} - -slice_ty Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena) { slice_ty p; @@ -2515,6 +2517,10 @@ goto failed; Py_DECREF(value); break; + case Ellipsis_kind: + result = PyType_GenericNew(Ellipsis_type, NULL, NULL); + if (!result) goto failed; + break; case Attribute_kind: result = PyType_GenericNew(Attribute_type, NULL, NULL); if (!result) goto failed; @@ -2648,10 +2654,6 @@ } switch (o->kind) { - case Ellipsis_kind: - result = PyType_GenericNew(Ellipsis_type, NULL, NULL); - if (!result) goto failed; - break; case Slice_kind: result = PyType_GenericNew(Slice_type, NULL, NULL); if (!result) goto failed; @@ -3059,6 +3061,8 @@ if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; + if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) + return; if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < 0) return; if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < @@ -3077,8 +3081,6 @@ return; if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return; if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return; - if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) - return; if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return; if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0) return; Modified: python/branches/p3yk/Python/ast.c ============================================================================== --- python/branches/p3yk/Python/ast.c (original) +++ python/branches/p3yk/Python/ast.c Wed Sep 6 09:06:08 2006 @@ -399,6 +399,9 @@ case Str_kind: expr_name = "literal"; break; + case Ellipsis_kind: + expr_name = "Ellipsis"; + break; case Compare_kind: expr_name = "comparison"; break; @@ -1213,6 +1216,9 @@ PyArena_AddPyObject(c->c_arena, pynum); return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena); } + case DOT: + /* Ellipsis */ + return Ellipsis(LINENO(n), n->n_col_offset, c->c_arena); case LPAR: /* some parenthesized expressions */ ch = CHILD(n, 1); @@ -1308,13 +1314,10 @@ REQ(n, subscript); /* - subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] + subscript: test | [test] ':' [test] [sliceop] sliceop: ':' [test] */ ch = CHILD(n, 0); - if (TYPE(ch) == DOT) - return Ellipsis(c->c_arena); - if (NCH(n) == 1 && TYPE(ch) == test) { /* 'step' variable hold no significance in terms of being used over other vars */ Modified: python/branches/p3yk/Python/compile.c ============================================================================== --- python/branches/p3yk/Python/compile.c (original) +++ python/branches/p3yk/Python/compile.c Wed Sep 6 09:06:08 2006 @@ -2746,6 +2746,8 @@ expr_constant(expr_ty e) { switch (e->kind) { + case Ellipsis_kind: + return 1; case Num_kind: return PyObject_IsTrue(e->v.Num.n); case Str_kind: @@ -2977,6 +2979,9 @@ case Str_kind: ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts); break; + case Ellipsis_kind: + ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); + break; /* The following exprs can be assignment targets. */ case Attribute_kind: if (e->v.Attribute.ctx != AugStore) @@ -3255,9 +3260,6 @@ expr_context_ty ctx) { switch (s->kind) { - case Ellipsis_kind: - ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); - break; case Slice_kind: return compiler_slice(c, s, ctx); case Index_kind: @@ -3284,12 +3286,6 @@ VISIT(c, expr, s->v.Index.value); } break; - case Ellipsis_kind: - kindname = "ellipsis"; - if (ctx != AugStore) { - ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); - } - break; case Slice_kind: kindname = "slice"; if (!s->v.Slice.step) Modified: python/branches/p3yk/Python/graminit.c ============================================================================== --- python/branches/p3yk/Python/graminit.c (original) +++ python/branches/p3yk/Python/graminit.c Wed Sep 6 09:06:08 2006 @@ -1209,25 +1209,26 @@ {1, arcs_59_2}, {1, arcs_59_3}, }; -static arc arcs_60_0[6] = { +static arc arcs_60_0[7] = { {13, 1}, {142, 2}, {145, 3}, {19, 4}, {148, 4}, {149, 5}, + {74, 6}, }; static arc arcs_60_1[3] = { - {42, 6}, - {141, 6}, + {42, 7}, + {141, 7}, {15, 4}, }; static arc arcs_60_2[2] = { - {143, 7}, + {143, 8}, {144, 4}, }; static arc arcs_60_3[2] = { - {146, 8}, + {146, 9}, {147, 4}, }; static arc arcs_60_4[1] = { @@ -1238,16 +1239,22 @@ {0, 5}, }; static arc arcs_60_6[1] = { - {15, 4}, + {74, 10}, }; static arc arcs_60_7[1] = { - {144, 4}, + {15, 4}, }; static arc arcs_60_8[1] = { + {144, 4}, +}; +static arc arcs_60_9[1] = { {147, 4}, }; -static state states_60[9] = { - {6, arcs_60_0}, +static arc arcs_60_10[1] = { + {74, 4}, +}; +static state states_60[11] = { + {7, arcs_60_0}, {3, arcs_60_1}, {2, arcs_60_2}, {2, arcs_60_3}, @@ -1256,6 +1263,8 @@ {1, arcs_60_6}, {1, arcs_60_7}, {1, arcs_60_8}, + {1, arcs_60_9}, + {1, arcs_60_10}, }; static arc arcs_61_0[1] = { {26, 1}, @@ -1381,41 +1390,32 @@ {2, arcs_65_1}, {2, arcs_65_2}, }; -static arc arcs_66_0[3] = { - {74, 1}, - {26, 2}, - {21, 3}, +static arc arcs_66_0[2] = { + {26, 1}, + {21, 2}, }; -static arc arcs_66_1[1] = { - {74, 4}, +static arc arcs_66_1[2] = { + {21, 2}, + {0, 1}, }; -static arc arcs_66_2[2] = { - {21, 3}, +static arc arcs_66_2[3] = { + {26, 3}, + {154, 4}, {0, 2}, }; -static arc arcs_66_3[3] = { - {26, 5}, - {154, 6}, +static arc arcs_66_3[2] = { + {154, 4}, {0, 3}, }; static arc arcs_66_4[1] = { - {74, 6}, -}; -static arc arcs_66_5[2] = { - {154, 6}, - {0, 5}, -}; -static arc arcs_66_6[1] = { - {0, 6}, + {0, 4}, }; -static state states_66[7] = { - {3, arcs_66_0}, - {1, arcs_66_1}, - {2, arcs_66_2}, - {3, arcs_66_3}, +static state states_66[5] = { + {2, arcs_66_0}, + {2, arcs_66_1}, + {3, arcs_66_2}, + {2, arcs_66_3}, {1, arcs_66_4}, - {2, arcs_66_5}, - {1, arcs_66_6}, }; static arc arcs_67_0[1] = { {21, 1}, @@ -1753,11 +1753,11 @@ }; static dfa dfas[83] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"}, + "\004\050\014\000\000\000\200\012\236\206\201\054\001\004\001\000\030\102\062\010\010"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"}, + "\204\050\014\000\000\000\200\012\236\206\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\004\001\000\030\102\062\000\000"}, + "\000\040\010\000\000\000\000\000\000\004\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, @@ -1773,13 +1773,13 @@ {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\200\012\236\202\201\054\001\004\001\000\030\102\062\010\010"}, + "\000\050\014\000\000\000\200\012\236\206\201\054\001\004\001\000\030\102\062\010\010"}, {267, "simple_stmt", 0, 4, states_11, - "\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"}, + "\000\040\010\000\000\000\200\012\236\206\001\000\000\004\001\000\030\102\062\000\010"}, {268, "small_stmt", 0, 2, states_12, - "\000\040\010\000\000\000\200\012\236\202\001\000\000\004\001\000\030\102\062\000\010"}, + "\000\040\010\000\000\000\200\012\236\206\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\004\001\000\030\102\062\000\000"}, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\004\001\000\030\102\062\000\000"}, {270, "augassign", 0, 2, states_14, "\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, @@ -1837,69 +1837,69 @@ {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"}, {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"}, + "\004\040\010\000\000\000\200\012\236\206\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\000\100\062\000\000"}, + {316, "atom", 0, 11, states_60, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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, + {322, "subscript", 0, 5, 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"}, {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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, + "\000\040\010\060\000\000\000\000\000\004\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"}, + "\000\040\010\000\000\000\000\000\000\004\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, @@ -1913,7 +1913,7 @@ {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"}, + "\000\040\010\000\000\000\000\000\000\004\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"}, {338, "yield_expr", 0, 3, states_82, Modified: python/branches/p3yk/Python/symtable.c ============================================================================== --- python/branches/p3yk/Python/symtable.c (original) +++ python/branches/p3yk/Python/symtable.c Wed Sep 6 09:06:08 2006 @@ -1161,6 +1161,7 @@ break; case Num_kind: case Str_kind: + case Ellipsis_kind: /* Nothing to do here. */ break; /* The following exprs can be assignment targets. */ @@ -1365,8 +1366,6 @@ case Index_kind: VISIT(st, expr, s->v.Index.value) break; - case Ellipsis_kind: - break; } return 1; } Modified: python/branches/p3yk/Tools/compiler/ast.txt ============================================================================== --- python/branches/p3yk/Tools/compiler/ast.txt (original) +++ python/branches/p3yk/Tools/compiler/ast.txt Wed Sep 6 09:06:08 2006 @@ -58,7 +58,6 @@ CallFunc: node, args!, star_args& = None, dstar_args& = None Keyword: name*, expr Subscript: expr, flags*, subs! -Ellipsis: Sliceobj: nodes! Slice: expr, flags*, lower&, upper& Assert: test, fail& From python-3000-checkins at python.org Thu Sep 7 00:37:16 2006 From: python-3000-checkins at python.org (guido.van.rossum) Date: Thu, 7 Sep 2006 00:37:16 +0200 (CEST) Subject: [Python-3000-checkins] r51792 - python/branches/p3yk/Lib/symtable.py Message-ID: <20060906223716.2BEA31E4003@bag.python.org> Author: guido.van.rossum Date: Thu Sep 7 00:37:15 2006 New Revision: 51792 Modified: python/branches/p3yk/Lib/symtable.py Log: This module was still referencing some dead EXEC related constants. Modified: python/branches/p3yk/Lib/symtable.py ============================================================================== --- python/branches/p3yk/Lib/symtable.py (original) +++ python/branches/p3yk/Lib/symtable.py Thu Sep 7 00:37:15 2006 @@ -4,7 +4,7 @@ from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \ DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \ DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND, \ - OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC + OPT_IMPORT_STAR import weakref @@ -94,8 +94,8 @@ return bool(self._table.children) def has_exec(self): - """Return true if the scope uses exec""" - return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) + """Return true if the scope uses exec. Deprecated method.""" + return False def has_import_star(self): """Return true if the scope uses import *""" From python-3000-checkins at python.org Wed Sep 6 08:52:15 2006 From: python-3000-checkins at python.org (georg.brandl) Date: Wed, 6 Sep 2006 08:52:15 +0200 (CEST) Subject: [Python-3000-checkins] r51771 - in python/branches/p3yk: 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 Message-ID: <20060906065215.7A4E21E4002@bag.python.org> Author: georg.brandl Date: Wed Sep 6 08:51:57 2006 New Revision: 51771 Modified: python/branches/p3yk/Demo/parser/unparse.py python/branches/p3yk/Demo/pysvr/pysvr.py python/branches/p3yk/Demo/sockets/rpythond.py python/branches/p3yk/Doc/howto/doanddont.tex python/branches/p3yk/Doc/lib/libdis.tex python/branches/p3yk/Doc/lib/libexcs.tex python/branches/p3yk/Doc/lib/libfuncs.tex python/branches/p3yk/Doc/lib/libhotshot.tex python/branches/p3yk/Doc/lib/libparser.tex python/branches/p3yk/Doc/lib/libpdb.tex python/branches/p3yk/Doc/lib/libprofile.tex python/branches/p3yk/Doc/lib/librexec.tex python/branches/p3yk/Doc/lib/libstdtypes.tex python/branches/p3yk/Doc/lib/libtraceback.tex python/branches/p3yk/Doc/ref/ref2.tex python/branches/p3yk/Doc/ref/ref4.tex python/branches/p3yk/Doc/ref/ref6.tex python/branches/p3yk/Doc/ref/ref8.tex python/branches/p3yk/Doc/ref/reswords.py python/branches/p3yk/Doc/tut/tut.tex python/branches/p3yk/Grammar/Grammar python/branches/p3yk/Include/Python-ast.h python/branches/p3yk/Include/graminit.h python/branches/p3yk/Include/opcode.h python/branches/p3yk/Include/symtable.h python/branches/p3yk/Lib/Bastion.py python/branches/p3yk/Lib/bdb.py python/branches/p3yk/Lib/bsddb/__init__.py python/branches/p3yk/Lib/cProfile.py python/branches/p3yk/Lib/cgi.py python/branches/p3yk/Lib/code.py python/branches/p3yk/Lib/compiler/ast.py python/branches/p3yk/Lib/compiler/pyassem.py python/branches/p3yk/Lib/compiler/pycodegen.py python/branches/p3yk/Lib/compiler/transformer.py python/branches/p3yk/Lib/doctest.py python/branches/p3yk/Lib/hashlib.py python/branches/p3yk/Lib/idlelib/PyShell.py python/branches/p3yk/Lib/idlelib/run.py python/branches/p3yk/Lib/ihooks.py python/branches/p3yk/Lib/imputil.py python/branches/p3yk/Lib/keyword.py python/branches/p3yk/Lib/lib-tk/Tkinter.py python/branches/p3yk/Lib/opcode.py python/branches/p3yk/Lib/pdb.py python/branches/p3yk/Lib/plat-irix5/flp.py python/branches/p3yk/Lib/plat-irix5/panel.py python/branches/p3yk/Lib/plat-irix6/flp.py python/branches/p3yk/Lib/plat-irix6/panel.py python/branches/p3yk/Lib/plat-mac/aetypes.py python/branches/p3yk/Lib/plat-mac/appletrawmain.py python/branches/p3yk/Lib/plat-mac/pimp.py python/branches/p3yk/Lib/profile.py python/branches/p3yk/Lib/rexec.py python/branches/p3yk/Lib/runpy.py python/branches/p3yk/Lib/site.py python/branches/p3yk/Lib/socket.py python/branches/p3yk/Lib/symbol.py python/branches/p3yk/Lib/test/crashers/bogus_code_obj.py python/branches/p3yk/Lib/test/output/test_cProfile python/branches/p3yk/Lib/test/output/test_grammar python/branches/p3yk/Lib/test/output/test_profile python/branches/p3yk/Lib/test/test___all__.py python/branches/p3yk/Lib/test/test_ast.py python/branches/p3yk/Lib/test/test_binop.py python/branches/p3yk/Lib/test/test_builtin.py python/branches/p3yk/Lib/test/test_class.py python/branches/p3yk/Lib/test/test_codeop.py python/branches/p3yk/Lib/test/test_compile.py python/branches/p3yk/Lib/test/test_compiler.py python/branches/p3yk/Lib/test/test_descr.py python/branches/p3yk/Lib/test/test_descrtut.py python/branches/p3yk/Lib/test/test_dis.py python/branches/p3yk/Lib/test/test_doctest.py python/branches/p3yk/Lib/test/test_exceptions.py python/branches/p3yk/Lib/test/test_funcattrs.py python/branches/p3yk/Lib/test/test_gc.py python/branches/p3yk/Lib/test/test_getopt.py python/branches/p3yk/Lib/test/test_grammar.py python/branches/p3yk/Lib/test/test_import.py python/branches/p3yk/Lib/test/test_importhooks.py python/branches/p3yk/Lib/test/test_inspect.py python/branches/p3yk/Lib/test/test_multibytecodec.py python/branches/p3yk/Lib/test/test_operations.py python/branches/p3yk/Lib/test/test_parser.py python/branches/p3yk/Lib/test/test_scope.py python/branches/p3yk/Lib/test/test_transformer.py python/branches/p3yk/Lib/test/time_hashlib.py python/branches/p3yk/Lib/timeit.py python/branches/p3yk/Lib/trace.py python/branches/p3yk/Misc/vgrindefs python/branches/p3yk/Modules/parsermodule.c python/branches/p3yk/Modules/symtablemodule.c python/branches/p3yk/Parser/Python.asdl python/branches/p3yk/Python/Python-ast.c python/branches/p3yk/Python/ast.c python/branches/p3yk/Python/bltinmodule.c python/branches/p3yk/Python/ceval.c python/branches/p3yk/Python/compile.c python/branches/p3yk/Python/graminit.c python/branches/p3yk/Python/symtable.c python/branches/p3yk/Tools/compiler/ast.txt python/branches/p3yk/Tools/modulator/modulator.py python/branches/p3yk/Tools/scripts/fixdiv.py python/branches/p3yk/Tools/scripts/h2py.py Log: Patch #1550800: make exec a function. Modified: python/branches/p3yk/Demo/parser/unparse.py ============================================================================== --- python/branches/p3yk/Demo/parser/unparse.py (original) +++ python/branches/p3yk/Demo/parser/unparse.py Wed Sep 6 08:51:57 2006 @@ -123,16 +123,6 @@ 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 Modified: python/branches/p3yk/Demo/pysvr/pysvr.py ============================================================================== --- python/branches/p3yk/Demo/pysvr/pysvr.py (original) +++ python/branches/p3yk/Demo/pysvr/pysvr.py Wed Sep 6 08:51:57 2006 @@ -108,7 +108,7 @@ 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: Modified: python/branches/p3yk/Demo/sockets/rpythond.py ============================================================================== --- python/branches/p3yk/Demo/sockets/rpythond.py (original) +++ python/branches/p3yk/Demo/sockets/rpythond.py Wed Sep 6 08:51:57 2006 @@ -40,7 +40,7 @@ sys.stdout = sys.stderr = fakefile = StringIO.StringIO() try: try: - exec request in {}, {} + exec(request, {}, {}) except: print traceback.print_exc(100) Modified: python/branches/p3yk/Doc/howto/doanddont.tex ============================================================================== --- python/branches/p3yk/Doc/howto/doanddont.tex (original) +++ python/branches/p3yk/Doc/howto/doanddont.tex Wed Sep 6 08:51:57 2006 @@ -81,7 +81,7 @@ \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 @@ \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} Modified: python/branches/p3yk/Doc/lib/libdis.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libdis.tex (original) +++ python/branches/p3yk/Doc/lib/libdis.tex Wed Sep 6 08:51:57 2006 @@ -408,11 +408,6 @@ 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. Modified: python/branches/p3yk/Doc/lib/libexcs.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libexcs.tex (original) +++ python/branches/p3yk/Doc/lib/libexcs.tex Wed Sep 6 08:51:57 2006 @@ -293,10 +293,10 @@ \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 Modified: python/branches/p3yk/Doc/lib/libfuncs.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libfuncs.tex (original) +++ python/branches/p3yk/Doc/lib/libfuncs.tex Wed Sep 6 08:51:57 2006 @@ -178,7 +178,7 @@ \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{''} is commonly used). @@ -366,7 +366,7 @@ 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 @@ \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 Modified: python/branches/p3yk/Doc/lib/libhotshot.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libhotshot.tex (original) +++ python/branches/p3yk/Doc/lib/libhotshot.tex Wed Sep 6 08:51:57 2006 @@ -61,7 +61,7 @@ \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 @@ \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} Modified: python/branches/p3yk/Doc/lib/libparser.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libparser.tex (original) +++ python/branches/p3yk/Doc/lib/libparser.tex Wed Sep 6 08:51:57 2006 @@ -193,8 +193,9 @@ \begin{funcdesc}{compileast}{ast\optional{, filename\code{ = ''}}} 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. Modified: python/branches/p3yk/Doc/lib/libpdb.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libpdb.tex (original) +++ python/branches/p3yk/Doc/lib/libpdb.tex Wed Sep 6 08:51:57 2006 @@ -79,8 +79,8 @@ 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}}} Modified: python/branches/p3yk/Doc/lib/libprofile.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libprofile.tex (original) +++ python/branches/p3yk/Doc/lib/libprofile.tex Wed Sep 6 08:51:57 2006 @@ -319,9 +319,9 @@ \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 Modified: python/branches/p3yk/Doc/lib/librexec.tex ============================================================================== --- python/branches/p3yk/Doc/lib/librexec.tex (original) +++ python/branches/p3yk/Doc/lib/librexec.tex Wed Sep 6 08:51:57 2006 @@ -11,10 +11,10 @@ \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. Modified: python/branches/p3yk/Doc/lib/libstdtypes.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libstdtypes.tex (original) +++ python/branches/p3yk/Doc/lib/libstdtypes.tex Wed Sep 6 08:51:57 2006 @@ -1972,9 +1972,9 @@ \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 Modified: python/branches/p3yk/Doc/lib/libtraceback.tex ============================================================================== --- python/branches/p3yk/Doc/lib/libtraceback.tex (original) +++ python/branches/p3yk/Doc/lib/libtraceback.tex Wed Sep 6 08:51:57 2006 @@ -139,7 +139,7 @@ def run_user_code(envdir): source = raw_input(">>> ") try: - exec source in envdir + exec(source, envdir) except: print "Exception in user code:" print '-'*60 Modified: python/branches/p3yk/Doc/ref/ref2.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref2.tex (original) +++ python/branches/p3yk/Doc/ref/ref2.tex Wed Sep 6 08:51:57 2006 @@ -308,13 +308,12 @@ \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 Modified: python/branches/p3yk/Doc/ref/ref4.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref4.tex (original) +++ python/branches/p3yk/Doc/ref/ref4.tex Wed Sep 6 08:51:57 2006 @@ -20,8 +20,8 @@ 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 @@ 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. Modified: python/branches/p3yk/Doc/ref/ref6.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref6.tex (original) +++ python/branches/p3yk/Doc/ref/ref6.tex Wed Sep 6 08:51:57 2006 @@ -20,7 +20,6 @@ \productioncont{| \token{continue_stmt}} \productioncont{| \token{import_stmt}} \productioncont{| \token{global_stmt}} - \productioncont{| \token{exec_stmt}} \end{productionlist} @@ -809,7 +808,7 @@ 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 @@ \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} - - - Modified: python/branches/p3yk/Doc/ref/ref8.tex ============================================================================== --- python/branches/p3yk/Doc/ref/ref8.tex (original) +++ python/branches/p3yk/Doc/ref/ref8.tex Wed Sep 6 08:51:57 2006 @@ -62,7 +62,7 @@ \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} Modified: python/branches/p3yk/Doc/ref/reswords.py ============================================================================== --- python/branches/p3yk/Doc/ref/reswords.py (original) +++ python/branches/p3yk/Doc/ref/reswords.py Wed Sep 6 08:51:57 2006 @@ -9,7 +9,7 @@ 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 Modified: python/branches/p3yk/Doc/tut/tut.tex ============================================================================== --- python/branches/p3yk/Doc/tut/tut.tex (original) +++ python/branches/p3yk/Doc/tut/tut.tex Wed Sep 6 08:51:57 2006 @@ -2698,7 +2698,7 @@ '__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 @@ (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 Modified: python/branches/p3yk/Grammar/Grammar ============================================================================== --- python/branches/p3yk/Grammar/Grammar (original) +++ python/branches/p3yk/Grammar/Grammar Wed Sep 6 08:51:57 2006 @@ -32,7 +32,7 @@ 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 @@ 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 Modified: python/branches/p3yk/Include/Python-ast.h ============================================================================== --- python/branches/p3yk/Include/Python-ast.h (original) +++ python/branches/p3yk/Include/Python-ast.h Wed Sep 6 08:51:57 2006 @@ -64,8 +64,8 @@ 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 { @@ -165,12 +165,6 @@ } ImportFrom; struct { - expr_ty body; - expr_ty globals; - expr_ty locals; - } Exec; - - struct { asdl_seq *names; } Global; @@ -384,8 +378,6 @@ 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); Modified: python/branches/p3yk/Include/graminit.h ============================================================================== --- python/branches/p3yk/Include/graminit.h (original) +++ python/branches/p3yk/Include/graminit.h Wed Sep 6 08:51:57 2006 @@ -31,54 +31,53 @@ #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 Modified: python/branches/p3yk/Include/opcode.h ============================================================================== --- python/branches/p3yk/Include/opcode.h (original) +++ python/branches/p3yk/Include/opcode.h Wed Sep 6 08:51:57 2006 @@ -75,7 +75,7 @@ #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 Modified: python/branches/p3yk/Include/symtable.h ============================================================================== --- python/branches/p3yk/Include/symtable.h (original) +++ python/branches/p3yk/Include/symtable.h Wed Sep 6 08:51:57 2006 @@ -88,11 +88,9 @@ #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 Modified: python/branches/p3yk/Lib/Bastion.py ============================================================================== --- python/branches/p3yk/Lib/Bastion.py (original) +++ python/branches/p3yk/Lib/Bastion.py Wed Sep 6 08:51:57 2006 @@ -164,7 +164,7 @@ else: print "accessible" \n""" - exec testcode + exec(testcode) print '='*20, "Using rexec:", '='*20 import rexec r = rexec.RExec() Modified: python/branches/p3yk/Lib/bdb.py ============================================================================== --- python/branches/p3yk/Lib/bdb.py (original) +++ python/branches/p3yk/Lib/bdb.py Wed Sep 6 08:51:57 2006 @@ -362,7 +362,7 @@ cmd = cmd+'\n' try: try: - exec cmd in globals, locals + exec(cmd, globals, locals) except BdbQuit: pass finally: Modified: python/branches/p3yk/Lib/bsddb/__init__.py ============================================================================== --- python/branches/p3yk/Lib/bsddb/__init__.py (original) +++ python/branches/p3yk/Lib/bsddb/__init__.py Wed Sep 6 08:51:57 2006 @@ -72,7 +72,7 @@ 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 @@ except _bsddb.DBCursorClosedError: # the database was modified during iteration. abort. return -""" +""") else: class _iter_mixin: pass Modified: python/branches/p3yk/Lib/cProfile.py ============================================================================== --- python/branches/p3yk/Lib/cProfile.py (original) +++ python/branches/p3yk/Lib/cProfile.py Wed Sep 6 08:51:57 2006 @@ -137,7 +137,7 @@ def runctx(self, cmd, globals, locals): self.enable() try: - exec cmd in globals, locals + exec(cmd, globals, locals) finally: self.disable() return self Modified: python/branches/p3yk/Lib/cgi.py ============================================================================== --- python/branches/p3yk/Lib/cgi.py (original) +++ python/branches/p3yk/Lib/cgi.py Wed Sep 6 08:51:57 2006 @@ -910,7 +910,7 @@ print_environ(environ) print_environ_usage() def f(): - exec "testing print_exception() -- italics?" + exec("testing print_exception() -- italics?") def g(f=f): f() print "

What follows is a test, not an actual exception:

" Modified: python/branches/p3yk/Lib/code.py ============================================================================== --- python/branches/p3yk/Lib/code.py (original) +++ python/branches/p3yk/Lib/code.py Wed Sep 6 08:51:57 2006 @@ -100,7 +100,7 @@ """ try: - exec code in self.locals + exec(code, self.locals) except SystemExit: raise except: Modified: python/branches/p3yk/Lib/compiler/ast.py ============================================================================== --- python/branches/p3yk/Lib/compiler/ast.py (original) +++ python/branches/p3yk/Lib/compiler/ast.py Wed Sep 6 08:51:57 2006 @@ -440,32 +440,6 @@ 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 Modified: python/branches/p3yk/Lib/compiler/pyassem.py ============================================================================== --- python/branches/p3yk/Lib/compiler/pyassem.py (original) +++ python/branches/p3yk/Lib/compiler/pyassem.py Wed Sep 6 08:51:57 2006 @@ -762,7 +762,6 @@ 'PRINT_ITEM': -1, 'RETURN_VALUE': -1, 'YIELD_VALUE': -1, - 'EXEC_STMT': -3, 'BUILD_CLASS': -2, 'STORE_NAME': -1, 'STORE_ATTR': -2, Modified: python/branches/p3yk/Lib/compiler/pycodegen.py ============================================================================== --- python/branches/p3yk/Lib/compiler/pycodegen.py (original) +++ python/branches/p3yk/Lib/compiler/pycodegen.py Wed Sep 6 08:51:57 2006 @@ -1043,18 +1043,6 @@ 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 Modified: python/branches/p3yk/Lib/compiler/transformer.py ============================================================================== --- python/branches/p3yk/Lib/compiler/transformer.py (original) +++ python/branches/p3yk/Lib/compiler/transformer.py Wed Sep 6 08:51:57 2006 @@ -468,20 +468,6 @@ 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 @@ symbol.raise_stmt, symbol.import_stmt, symbol.global_stmt, - symbol.exec_stmt, symbol.assert_stmt, symbol.if_stmt, symbol.while_stmt, Modified: python/branches/p3yk/Lib/doctest.py ============================================================================== --- python/branches/p3yk/Lib/doctest.py (original) +++ python/branches/p3yk/Lib/doctest.py Wed Sep 6 08:51:57 2006 @@ -1209,8 +1209,8 @@ # 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: Modified: python/branches/p3yk/Lib/hashlib.py ============================================================================== --- python/branches/p3yk/Lib/hashlib.py (original) +++ python/branches/p3yk/Lib/hashlib.py Wed Sep 6 08:51:57 2006 @@ -82,11 +82,11 @@ 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 Modified: python/branches/p3yk/Lib/idlelib/PyShell.py ============================================================================== --- python/branches/p3yk/Lib/idlelib/PyShell.py (original) +++ python/branches/p3yk/Lib/idlelib/PyShell.py Wed Sep 6 08:51:57 2006 @@ -690,7 +690,7 @@ 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 @@ 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( Modified: python/branches/p3yk/Lib/idlelib/run.py ============================================================================== --- python/branches/p3yk/Lib/idlelib/run.py (original) +++ python/branches/p3yk/Lib/idlelib/run.py Wed Sep 6 08:51:57 2006 @@ -282,7 +282,7 @@ 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: Modified: python/branches/p3yk/Lib/ihooks.py ============================================================================== --- python/branches/p3yk/Lib/ihooks.py (original) +++ python/branches/p3yk/Lib/ihooks.py Wed Sep 6 08:51:57 2006 @@ -323,7 +323,7 @@ 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: Modified: python/branches/p3yk/Lib/imputil.py ============================================================================== --- python/branches/p3yk/Lib/imputil.py (original) +++ python/branches/p3yk/Lib/imputil.py Wed Sep 6 08:51:57 2006 @@ -301,7 +301,7 @@ # 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] Modified: python/branches/p3yk/Lib/keyword.py ============================================================================== --- python/branches/p3yk/Lib/keyword.py (original) +++ python/branches/p3yk/Lib/keyword.py Wed Sep 6 08:51:57 2006 @@ -25,7 +25,6 @@ 'elif', 'else', 'except', - 'exec', 'finally', 'for', 'from', Modified: python/branches/p3yk/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/p3yk/Lib/lib-tk/Tkinter.py (original) +++ python/branches/p3yk/Lib/lib-tk/Tkinter.py Wed Sep 6 08:51:57 2006 @@ -1699,7 +1699,7 @@ 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): Modified: python/branches/p3yk/Lib/opcode.py ============================================================================== --- python/branches/p3yk/Lib/opcode.py (original) +++ python/branches/p3yk/Lib/opcode.py Wed Sep 6 08:51:57 2006 @@ -114,7 +114,6 @@ 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) Modified: python/branches/p3yk/Lib/pdb.py ============================================================================== --- python/branches/p3yk/Lib/pdb.py (original) +++ python/branches/p3yk/Lib/pdb.py Wed Sep 6 08:51:57 2006 @@ -198,7 +198,7 @@ globals = self.curframe.f_globals try: code = compile(line + '\n', '', 'single') - exec code in globals, locals + exec(code, globals, locals) except: t, v = sys.exc_info()[:2] if type(t) == type(''): Modified: python/branches/p3yk/Lib/plat-irix5/flp.py ============================================================================== --- python/branches/p3yk/Lib/plat-irix5/flp.py (original) +++ python/branches/p3yk/Lib/plat-irix5/flp.py Wed Sep 6 08:51:57 2006 @@ -329,7 +329,7 @@ # 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 @@ # 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 @@ 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 # Modified: python/branches/p3yk/Lib/plat-irix5/panel.py ============================================================================== --- python/branches/p3yk/Lib/plat-irix5/panel.py (original) +++ python/branches/p3yk/Lib/plat-irix5/panel.py Wed Sep 6 08:51:57 2006 @@ -130,7 +130,7 @@ 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 @@ 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 @@ 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') Modified: python/branches/p3yk/Lib/plat-irix6/flp.py ============================================================================== --- python/branches/p3yk/Lib/plat-irix6/flp.py (original) +++ python/branches/p3yk/Lib/plat-irix6/flp.py Wed Sep 6 08:51:57 2006 @@ -328,7 +328,7 @@ # 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 @@ # 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 @@ 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 # Modified: python/branches/p3yk/Lib/plat-irix6/panel.py ============================================================================== --- python/branches/p3yk/Lib/plat-irix6/panel.py (original) +++ python/branches/p3yk/Lib/plat-irix6/panel.py Wed Sep 6 08:51:57 2006 @@ -130,7 +130,7 @@ 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 @@ 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 @@ 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') Modified: python/branches/p3yk/Lib/plat-mac/aetypes.py ============================================================================== --- python/branches/p3yk/Lib/plat-mac/aetypes.py (original) +++ python/branches/p3yk/Lib/plat-mac/aetypes.py Wed Sep 6 08:51:57 2006 @@ -557,12 +557,12 @@ 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')) Modified: python/branches/p3yk/Lib/plat-mac/appletrawmain.py ============================================================================== --- python/branches/p3yk/Lib/plat-mac/appletrawmain.py (original) +++ python/branches/p3yk/Lib/plat-mac/appletrawmain.py Wed Sep 6 08:51:57 2006 @@ -57,7 +57,7 @@ # 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) Modified: python/branches/p3yk/Lib/plat-mac/pimp.py ============================================================================== --- python/branches/p3yk/Lib/plat-mac/pimp.py (original) +++ python/branches/p3yk/Lib/plat-mac/pimp.py Wed Sep 6 08:51:57 2006 @@ -588,7 +588,7 @@ } 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 @@ if line[0] == '#': continue if line[:6] == 'import': - exec line + exec(line) continue if line[-1] == '\n': line = line[:-1] Modified: python/branches/p3yk/Lib/profile.py ============================================================================== --- python/branches/p3yk/Lib/profile.py (original) +++ python/branches/p3yk/Lib/profile.py Wed Sep 6 08:51:57 2006 @@ -459,7 +459,7 @@ self.set_cmd(cmd) sys.setprofile(self.dispatcher) try: - exec cmd in globals, locals + exec(cmd, globals, locals) finally: sys.setprofile(None) return self Modified: python/branches/p3yk/Lib/rexec.py ============================================================================== --- python/branches/p3yk/Lib/rexec.py (original) +++ python/branches/p3yk/Lib/rexec.py Wed Sep 6 08:51:57 2006 @@ -58,7 +58,7 @@ 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 @@ """ 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. Modified: python/branches/p3yk/Lib/runpy.py ============================================================================== --- python/branches/p3yk/Lib/runpy.py (original) +++ python/branches/p3yk/Lib/runpy.py Wed Sep 6 08:51:57 2006 @@ -29,7 +29,7 @@ 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, Modified: python/branches/p3yk/Lib/site.py ============================================================================== --- python/branches/p3yk/Lib/site.py (original) +++ python/branches/p3yk/Lib/site.py Wed Sep 6 08:51:57 2006 @@ -135,7 +135,7 @@ if line.startswith("#"): continue if line.startswith("import"): - exec line + exec(line) continue line = line.rstrip() dir, dircase = makepath(sitedir, line) Modified: python/branches/p3yk/Lib/socket.py ============================================================================== --- python/branches/p3yk/Lib/socket.py (original) +++ python/branches/p3yk/Lib/socket.py Wed Sep 6 08:51:57 2006 @@ -191,7 +191,7 @@ _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 Modified: python/branches/p3yk/Lib/symbol.py ============================================================================== --- python/branches/p3yk/Lib/symbol.py (original) +++ python/branches/p3yk/Lib/symbol.py Wed Sep 6 08:51:57 2006 @@ -43,57 +43,56 @@ 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 = {} Modified: python/branches/p3yk/Lib/test/crashers/bogus_code_obj.py ============================================================================== --- python/branches/p3yk/Lib/test/crashers/bogus_code_obj.py (original) +++ python/branches/p3yk/Lib/test/crashers/bogus_code_obj.py Wed Sep 6 08:51:57 2006 @@ -16,4 +16,4 @@ co = types.CodeType(0, 0, 0, 0, '\x04\x71\x00\x00', (), (), (), '', '', 1, '') -exec co +exec(co) Modified: python/branches/p3yk/Lib/test/output/test_cProfile ============================================================================== --- python/branches/p3yk/Lib/test/output/test_cProfile (original) +++ python/branches/p3yk/Lib/test/output/test_cProfile Wed Sep 6 08:51:57 2006 @@ -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 @@ 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 @@ 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 :1() {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 @@ Function was called by... ncalls tottime cumtime -:1() <- +:1() <- 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: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) Modified: python/branches/p3yk/Lib/test/output/test_grammar ============================================================================== --- python/branches/p3yk/Lib/test/output/test_grammar (original) +++ python/branches/p3yk/Lib/test/output/test_grammar Wed Sep 6 08:51:57 2006 @@ -39,7 +39,6 @@ import_name import_from global_stmt -exec_stmt assert_stmt if_stmt while_stmt Modified: python/branches/p3yk/Lib/test/output/test_profile ============================================================================== --- python/branches/p3yk/Lib/test/output/test_profile (original) +++ python/branches/p3yk/Lib/test/output/test_profile Wed Sep 6 08:51:57 2006 @@ -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 @@ Function called... :0(append) -> :0(exc_info) -> +:0(exec) -> :1()(1) 1.000 :0(hasattr) -> test_profile.py:115(__getattr__)(12) 0.028 :0(range) -> :0(setprofile) -> :1() -> 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 - :1()(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 @@ 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 -:1() <- profile:0(testfunc())(1) 1.000 +:1() <- :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 Modified: python/branches/p3yk/Lib/test/test___all__.py ============================================================================== --- python/branches/p3yk/Lib/test/test___all__.py (original) +++ python/branches/p3yk/Lib/test/test___all__.py Wed Sep 6 08:51:57 2006 @@ -15,7 +15,7 @@ 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 @@ 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) Modified: python/branches/p3yk/Lib/test/test_ast.py ============================================================================== --- python/branches/p3yk/Lib/test/test_ast.py (original) +++ python/branches/p3yk/Lib/test/test_ast.py Wed Sep 6 08:51:57 2006 @@ -50,8 +50,6 @@ "import sys", # ImportFrom "from sys import v", - # Exec - "exec 'v'", # Global "global v", # Expr @@ -169,7 +167,6 @@ ('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))]), Modified: python/branches/p3yk/Lib/test/test_binop.py ============================================================================== --- python/branches/p3yk/Lib/test/test_binop.py (original) +++ python/branches/p3yk/Lib/test/test_binop.py Wed Sep 6 08:51:57 2006 @@ -302,7 +302,7 @@ 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 Modified: python/branches/p3yk/Lib/test/test_builtin.py ============================================================================== --- python/branches/p3yk/Lib/test/test_builtin.py (original) +++ python/branches/p3yk/Lib/test/test_builtin.py Wed Sep 6 08:51:57 2006 @@ -395,6 +395,29 @@ 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="") + 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 @@ "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 @@ "min(1, 2, key=1)", # keyfunc is not callable ): try: - exec(stmt) in globals() + exec(stmt, globals()) except TypeError: pass else: Modified: python/branches/p3yk/Lib/test/test_class.py ============================================================================== --- python/branches/p3yk/Lib/test/test_class.py (original) +++ python/branches/p3yk/Lib/test/test_class.py Wed Sep 6 08:51:57 2006 @@ -136,7 +136,7 @@ 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 @@ """Raise TestFailed if executing 'stmt' does not raise 'exception' """ try: - exec stmt + exec(stmt) except exception: pass else: Modified: python/branches/p3yk/Lib/test/test_codeop.py ============================================================================== --- python/branches/p3yk/Lib/test/test_codeop.py (original) +++ python/branches/p3yk/Lib/test/test_codeop.py Wed Sep 6 08:51:57 2006 @@ -29,8 +29,8 @@ saved_stdout = sys.stdout sys.stdout = cStringIO.StringIO() try: - exec code in d - exec compile(str,"","single") in r + exec(code, d) + exec(compile(str,"","single"), r) finally: sys.stdout = saved_stdout elif symbol == 'eval': Modified: python/branches/p3yk/Lib/test/test_compile.py ============================================================================== --- python/branches/p3yk/Lib/test/test_compile.py (original) +++ python/branches/p3yk/Lib/test/test_compile.py Wed Sep 6 08:51:57 2006 @@ -19,17 +19,17 @@ 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 @@ 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 @@ 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 @@ pass m = A() try: - exec 'z = a' in g, m + exec('z = a', g, m) except TypeError: pass else: @@ -98,11 +98,12 @@ 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 @@ # 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 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 Modified: python/branches/p3yk/Lib/test/test_compiler.py ============================================================================== --- python/branches/p3yk/Lib/test/test_compiler.py (original) +++ python/branches/p3yk/Lib/test/test_compiler.py Wed Sep 6 08:51:57 2006 @@ -61,7 +61,7 @@ c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1", "", "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 @@ self.assert_('__doc__' in c.co_names) c = compiler.compile('def f():\n "doc"', '', 'exec') g = {} - exec c in g + exec(c, g) self.assertEquals(g['f'].__doc__, "doc") def testLineNo(self): @@ -113,7 +113,7 @@ '', 'exec') dct = {} - exec c in dct + exec(c, dct) self.assertEquals(dct.get('result'), 3) def testGenExp(self): Modified: python/branches/p3yk/Lib/test/test_descr.py ============================================================================== --- python/branches/p3yk/Lib/test/test_descr.py (original) +++ python/branches/p3yk/Lib/test/test_descr.py Wed Sep 6 08:51:57 2006 @@ -55,7 +55,7 @@ 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 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 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 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: Modified: python/branches/p3yk/Lib/test/test_descrtut.py ============================================================================== --- python/branches/p3yk/Lib/test/test_descrtut.py (original) +++ python/branches/p3yk/Lib/test/test_descrtut.py Wed Sep 6 08:51:57 2006 @@ -67,7 +67,7 @@ >>> 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'] Modified: python/branches/p3yk/Lib/test/test_dis.py ============================================================================== --- python/branches/p3yk/Lib/test/test_dis.py (original) +++ python/branches/p3yk/Lib/test/test_dis.py Wed Sep 6 08:51:57 2006 @@ -135,7 +135,7 @@ 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 Modified: python/branches/p3yk/Lib/test/test_doctest.py ============================================================================== --- python/branches/p3yk/Lib/test/test_doctest.py (original) +++ python/branches/p3yk/Lib/test/test_doctest.py Wed Sep 6 08:51:57 2006 @@ -2366,8 +2366,8 @@ ... '''>>> 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: Modified: python/branches/p3yk/Lib/test/test_exceptions.py ============================================================================== --- python/branches/p3yk/Lib/test/test_exceptions.py (original) +++ python/branches/p3yk/Lib/test/test_exceptions.py Wed Sep 6 08:51:57 2006 @@ -87,7 +87,7 @@ self.raise_catch(RuntimeError, "RuntimeError") self.raise_catch(SyntaxError, "SyntaxError") - try: exec '/\n' + try: exec('/\n') except SyntaxError: pass self.raise_catch(IndentationError, "IndentationError") Modified: python/branches/p3yk/Lib/test/test_funcattrs.py ============================================================================== --- python/branches/p3yk/Lib/test/test_funcattrs.py (original) +++ python/branches/p3yk/Lib/test/test_funcattrs.py Wed Sep 6 08:51:57 2006 @@ -278,7 +278,7 @@ 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(): Modified: python/branches/p3yk/Lib/test/test_gc.py ============================================================================== --- python/branches/p3yk/Lib/test/test_gc.py (original) +++ python/branches/p3yk/Lib/test/test_gc.py Wed Sep 6 08:51:57 2006 @@ -153,7 +153,7 @@ # 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") Modified: python/branches/p3yk/Lib/test/test_getopt.py ============================================================================== --- python/branches/p3yk/Lib/test/test_getopt.py (original) +++ python/branches/p3yk/Lib/test/test_getopt.py Wed Sep 6 08:51:57 2006 @@ -10,7 +10,7 @@ """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: Modified: python/branches/p3yk/Lib/test/test_grammar.py ============================================================================== --- python/branches/p3yk/Lib/test/test_grammar.py (original) +++ python/branches/p3yk/Lib/test/test_grammar.py Wed Sep 6 08:51:57 2006 @@ -449,42 +449,6 @@ 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="") -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 Modified: python/branches/p3yk/Lib/test/test_import.py ============================================================================== --- python/branches/p3yk/Lib/test/test_import.py (original) +++ python/branches/p3yk/Lib/test/test_import.py Wed Sep 6 08:51:57 2006 @@ -107,7 +107,7 @@ sys.path.append('') # this used to crash - exec 'import ' + module + exec('import ' + module) # cleanup del sys.path[-1] Modified: python/branches/p3yk/Lib/test/test_importhooks.py ============================================================================== --- python/branches/p3yk/Lib/test/test_importhooks.py (original) +++ python/branches/p3yk/Lib/test/test_importhooks.py Wed Sep 6 08:51:57 2006 @@ -81,7 +81,7 @@ mod.__loader__ = self if ispkg: mod.__path__ = self._get__path__() - exec code in mod.__dict__ + exec(code, mod.__dict__) return mod Modified: python/branches/p3yk/Lib/test/test_inspect.py ============================================================================== --- python/branches/p3yk/Lib/test/test_inspect.py (original) +++ python/branches/p3yk/Lib/test/test_inspect.py Wed Sep 6 08:51:57 2006 @@ -199,7 +199,7 @@ m = sys.modules[name] = module(name) m.__file__ = "" # 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), '') del sys.modules[name] inspect.getmodule(compile('a=10','','single')) Modified: python/branches/p3yk/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/p3yk/Lib/test/test_multibytecodec.py (original) +++ python/branches/p3yk/Lib/test/test_multibytecodec.py Wed Sep 6 08:51:57 2006 @@ -49,7 +49,7 @@ try: for enc in ALL_CJKENCODINGS: print >> open(TESTFN, 'w'), '# coding:', enc - exec open(TESTFN) + execfile(TESTFN) finally: os.unlink(TESTFN) Modified: python/branches/p3yk/Lib/test/test_operations.py ============================================================================== --- python/branches/p3yk/Lib/test/test_operations.py (original) +++ python/branches/p3yk/Lib/test/test_operations.py Wed Sep 6 08:51:57 2006 @@ -30,7 +30,7 @@ 'd.pop(x2)', 'd.update({x2: 2})']: try: - exec stmt + exec(stmt) except RuntimeError: print "%s: caught the RuntimeError outside" % (stmt,) else: Modified: python/branches/p3yk/Lib/test/test_parser.py ============================================================================== --- python/branches/p3yk/Lib/test/test_parser.py (original) +++ python/branches/p3yk/Lib/test/test_parser.py Wed Sep 6 08:51:57 2006 @@ -429,7 +429,7 @@ 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): Modified: python/branches/p3yk/Lib/test/test_scope.py ============================================================================== --- python/branches/p3yk/Lib/test/test_scope.py (original) +++ python/branches/p3yk/Lib/test/test_scope.py Wed Sep 6 08:51:57 2006 @@ -205,15 +205,6 @@ 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 @@ # and verify a few cases that should work -exec """ +exec(""" def noproblem1(): from string import * f = lambda x:x @@ -245,7 +236,7 @@ def f(x): global y y = x -""" +""") print "12. lambdas" @@ -526,7 +517,7 @@ print "eval() should have failed, because code contained free vars" try: - exec g.func_code + exec(g.func_code) except TypeError: pass else: Modified: python/branches/p3yk/Lib/test/test_transformer.py ============================================================================== --- python/branches/p3yk/Lib/test/test_transformer.py (original) +++ python/branches/p3yk/Lib/test/test_transformer.py Wed Sep 6 08:51:57 2006 @@ -24,7 +24,7 @@ # is correct c = compile(s, '', 'single') vals = {} - exec c in vals + exec(c, vals) assert vals['a'] == 1 assert vals['b'] == 2 Modified: python/branches/p3yk/Lib/test/time_hashlib.py ============================================================================== --- python/branches/p3yk/Lib/test/time_hashlib.py (original) +++ python/branches/p3yk/Lib/test/time_hashlib.py Wed Sep 6 08:51:57 2006 @@ -44,22 +44,22 @@ # 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: Modified: python/branches/p3yk/Lib/timeit.py ============================================================================== --- python/branches/p3yk/Lib/timeit.py (original) +++ python/branches/p3yk/Lib/timeit.py Wed Sep 6 08:51:57 2006 @@ -115,7 +115,7 @@ 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): Modified: python/branches/p3yk/Lib/trace.py ============================================================================== --- python/branches/p3yk/Lib/trace.py (original) +++ python/branches/p3yk/Lib/trace.py Wed Sep 6 08:51:57 2006 @@ -484,7 +484,7 @@ 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 @@ 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) Modified: python/branches/p3yk/Misc/vgrindefs ============================================================================== --- python/branches/p3yk/Misc/vgrindefs (original) +++ python/branches/p3yk/Misc/vgrindefs Wed Sep 6 08:51:57 2006 @@ -6,5 +6,5 @@ :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: Modified: python/branches/p3yk/Modules/parsermodule.c ============================================================================== --- python/branches/p3yk/Modules/parsermodule.c (original) +++ python/branches/p3yk/Modules/parsermodule.c Wed Sep 6 08:51:57 2006 @@ -848,7 +848,7 @@ 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 @@ || (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 @@ } -/* 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 @@ 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 @@ 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; Modified: python/branches/p3yk/Modules/symtablemodule.c ============================================================================== --- python/branches/p3yk/Modules/symtablemodule.c (original) +++ python/branches/p3yk/Modules/symtablemodule.c Wed Sep 6 08:51:57 2006 @@ -73,8 +73,7 @@ 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); Modified: python/branches/p3yk/Parser/Python.asdl ============================================================================== --- python/branches/p3yk/Parser/Python.asdl (original) +++ python/branches/p3yk/Parser/Python.asdl Wed Sep 6 08:51:57 2006 @@ -36,11 +36,6 @@ | 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 Modified: python/branches/p3yk/Python/Python-ast.c ============================================================================== --- python/branches/p3yk/Python/Python-ast.c (original) +++ python/branches/p3yk/Python/Python-ast.c Wed Sep 6 08:51:57 2006 @@ -123,12 +123,6 @@ "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 @@ 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); @@ -1170,30 +1162,6 @@ } 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) { stmt_ty p; @@ -2274,25 +2242,6 @@ 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 @@ 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; Modified: python/branches/p3yk/Python/ast.c ============================================================================== --- python/branches/p3yk/Python/ast.c (original) +++ python/branches/p3yk/Python/ast.c Wed Sep 6 08:51:57 2006 @@ -2400,37 +2400,6 @@ } 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) { /* assert_stmt: 'assert' test [',' test] */ @@ -2944,8 +2913,7 @@ 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 @@ 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: Modified: python/branches/p3yk/Python/bltinmodule.c ============================================================================== --- python/branches/p3yk/Python/bltinmodule.c (original) +++ python/branches/p3yk/Python/bltinmodule.c Wed Sep 6 08:51:57 2006 @@ -403,7 +403,7 @@ "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 @@ 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 @@ {"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}, Modified: python/branches/p3yk/Python/ceval.c ============================================================================== --- python/branches/p3yk/Python/ceval.c (original) +++ python/branches/p3yk/Python/ceval.c Wed Sep 6 08:51:57 2006 @@ -118,8 +118,6 @@ 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 @@ 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 @@ 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 @@ 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) { Modified: python/branches/p3yk/Python/compile.c ============================================================================== --- python/branches/p3yk/Python/compile.c (original) +++ python/branches/p3yk/Python/compile.c Wed Sep 6 08:51:57 2006 @@ -814,8 +814,6 @@ return -1; case IMPORT_STAR: return -1; - case EXEC_STMT: - return -3; case YIELD_VALUE: return 0; @@ -2112,21 +2110,6 @@ 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: Modified: python/branches/p3yk/Python/graminit.c ============================================================================== --- python/branches/p3yk/Python/graminit.c (original) +++ python/branches/p3yk/Python/graminit.c Wed Sep 6 08:51:57 2006 @@ -253,7 +253,7 @@ {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 @@ {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 @@ {2, arcs_13_5}, }; static arc arcs_14_0[12] = { + {43, 1}, {44, 1}, {45, 1}, {46, 1}, @@ -314,7 +314,6 @@ {52, 1}, {53, 1}, {54, 1}, - {55, 1}, }; static arc arcs_14_1[1] = { {0, 1}, @@ -324,11 +323,11 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {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 @@ {19, 1}, }; static arc arcs_27_1[2] = { - {78, 2}, + {77, 2}, {0, 1}, }; static arc arcs_27_2[1] = { @@ -571,7 +570,7 @@ {12, 1}, }; static arc arcs_28_1[2] = { - {78, 2}, + {77, 2}, {0, 1}, }; static arc arcs_28_2[1] = { @@ -587,14 +586,14 @@ {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 @@ {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 @@ {19, 1}, }; static arc arcs_31_1[2] = { - {75, 0}, + {74, 0}, {0, 1}, }; static state states_31[2] = { @@ -625,7 +624,7 @@ {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 @@ {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_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 @@ {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_45_3[1] = { + {103, 4}, +}; +static arc arcs_45_4[1] = { + {0, 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_46_0[2] = { + {104, 1}, + {107, 2}, +}; +static arc arcs_46_1[2] = { + {87, 3}, + {0, 1}, +}; +static arc arcs_46_2[1] = { + {0, 2}, +}; static arc arcs_46_3[1] = { - {105, 4}, + {104, 4}, }; static arc arcs_46_4[1] = { - {0, 4}, + {89, 5}, }; -static state states_46[5] = { - {1, arcs_46_0}, +static arc arcs_46_5[1] = { + {26, 2}, +}; +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[2] = { - {106, 1}, - {109, 2}, +static arc arcs_47_0[1] = { + {108, 1}, }; static arc arcs_47_1[2] = { - {91, 3}, + {109, 0}, {0, 1}, }; -static arc arcs_47_2[1] = { - {0, 2}, -}; -static arc arcs_47_3[1] = { - {106, 4}, -}; -static arc arcs_47_4[1] = { - {93, 5}, -}; -static arc arcs_47_5[1] = { - {26, 2}, -}; -static state states_47[6] = { - {2, arcs_47_0}, +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 @@ {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_49_1[1] = { + {110, 2}, }; -static arc arcs_50_0[2] = { - {114, 1}, - {115, 2}, -}; -static arc arcs_50_1[1] = { - {112, 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 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,300 +1159,304 @@ {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}, -}; -static state states_58[2] = { - {1, arcs_58_0}, - {5, arcs_58_1}, + {5, arcs_57_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_61_3[2] = { - {148, 8}, - {149, 4}, +static arc arcs_60_2[2] = { + {143, 7}, + {144, 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_61[9] = { - {6, arcs_61_0}, - {3, arcs_61_1}, - {2, 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}, +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_62_0[1] = { +static arc arcs_61_0[1] = { {26, 1}, }; -static arc arcs_62_1[3] = { - {152, 2}, +static arc arcs_61_1[3] = { + {150, 2}, {27, 3}, {0, 1}, }; -static arc arcs_62_2[1] = { +static arc arcs_61_2[1] = { {0, 2}, }; -static arc arcs_62_3[2] = { +static arc arcs_61_3[2] = { {26, 4}, {0, 3}, }; -static arc arcs_62_4[2] = { +static arc arcs_61_4[2] = { {27, 3}, {0, 4}, }; -static state states_62[5] = { - {1, arcs_62_0}, - {3, arcs_62_1}, - {1, arcs_62_2}, - {2, arcs_62_3}, - {2, arcs_62_4}, +static state states_61[5] = { + {1, arcs_61_0}, + {3, arcs_61_1}, + {1, arcs_61_2}, + {2, arcs_61_3}, + {2, arcs_61_4}, }; -static arc arcs_63_0[1] = { +static arc arcs_62_0[1] = { {26, 1}, }; -static arc arcs_63_1[3] = { - {153, 2}, +static arc arcs_62_1[3] = { + {151, 2}, {27, 3}, {0, 1}, }; -static arc arcs_63_2[1] = { +static arc arcs_62_2[1] = { {0, 2}, }; -static arc arcs_63_3[2] = { +static arc arcs_62_3[2] = { {26, 4}, {0, 3}, }; -static arc arcs_63_4[2] = { +static arc arcs_62_4[2] = { {27, 3}, {0, 4}, }; -static state states_63[5] = { - {1, arcs_63_0}, - {3, arcs_63_1}, - {1, arcs_63_2}, - {2, arcs_63_3}, - {2, arcs_63_4}, +static state states_62[5] = { + {1, arcs_62_0}, + {3, arcs_62_1}, + {1, arcs_62_2}, + {2, arcs_62_3}, + {2, arcs_62_4}, }; -static arc arcs_64_0[1] = { - {108, 1}, +static arc arcs_63_0[1] = { + {106, 1}, }; -static arc arcs_64_1[2] = { +static arc arcs_63_1[2] = { {23, 2}, {21, 3}, }; -static arc arcs_64_2[1] = { +static arc arcs_63_2[1] = { {21, 3}, }; -static arc arcs_64_3[1] = { +static arc arcs_63_3[1] = { {26, 4}, }; -static arc arcs_64_4[1] = { +static arc arcs_63_4[1] = { {0, 4}, }; -static state states_64[5] = { - {1, arcs_64_0}, - {2, arcs_64_1}, - {1, arcs_64_2}, - {1, arcs_64_3}, - {1, arcs_64_4}, +static state states_63[5] = { + {1, arcs_63_0}, + {2, arcs_63_1}, + {1, arcs_63_2}, + {1, arcs_63_3}, + {1, arcs_63_4}, }; -static arc arcs_65_0[3] = { +static arc arcs_64_0[3] = { {13, 1}, - {144, 2}, - {75, 3}, + {142, 2}, + {74, 3}, }; -static arc arcs_65_1[2] = { +static arc arcs_64_1[2] = { {14, 4}, {15, 5}, }; -static arc arcs_65_2[1] = { - {154, 6}, +static arc arcs_64_2[1] = { + {152, 6}, }; -static arc arcs_65_3[1] = { +static arc arcs_64_3[1] = { {19, 5}, }; -static arc arcs_65_4[1] = { +static arc arcs_64_4[1] = { {15, 5}, }; -static arc arcs_65_5[1] = { +static arc arcs_64_5[1] = { {0, 5}, }; -static arc arcs_65_6[1] = { - {146, 5}, +static arc arcs_64_6[1] = { + {144, 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 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_66_0[1] = { - {155, 1}, +static arc arcs_65_0[1] = { + {153, 1}, }; -static arc arcs_66_1[2] = { +static arc arcs_65_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 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 @@ {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 @@ {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 @@ {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 @@ {280, 0}, {288, 0}, {289, 0}, - {290, 0}, {270, 0}, - {339, 0}, + {338, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2014,7 +1978,7 @@ {1, "print"}, {35, 0}, {1, "del"}, - {325, 0}, + {324, 0}, {1, "pass"}, {275, 0}, {276, 0}, @@ -2036,42 +2000,41 @@ {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 @@ {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 }; Modified: python/branches/p3yk/Python/symtable.c ============================================================================== --- python/branches/p3yk/Python/symtable.c (original) +++ python/branches/p3yk/Python/symtable.c Wed Sep 6 08:51:57 2006 @@ -480,8 +480,7 @@ "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 @@ "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 @@ 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; Modified: python/branches/p3yk/Tools/compiler/ast.txt ============================================================================== --- python/branches/p3yk/Tools/compiler/ast.txt (original) +++ python/branches/p3yk/Tools/compiler/ast.txt Wed Sep 6 08:51:57 2006 @@ -23,7 +23,6 @@ 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& Modified: python/branches/p3yk/Tools/modulator/modulator.py ============================================================================== --- python/branches/p3yk/Tools/modulator/modulator.py (original) +++ python/branches/p3yk/Tools/modulator/modulator.py Wed Sep 6 08:51:57 2006 @@ -126,7 +126,7 @@ fp = open(fn, 'w') try: - exec pycode + exec(pycode) except: message('An error occurred:-)') return @@ -371,7 +371,7 @@ fp = open(sys.argv[1]) pycode = fp.read() try: - exec pycode + exec(pycode) except: sys.stderr.write('An error occurred:-)\n') sys.exit(1) Modified: python/branches/p3yk/Tools/scripts/fixdiv.py ============================================================================== --- python/branches/p3yk/Tools/scripts/fixdiv.py (original) +++ python/branches/p3yk/Tools/scripts/fixdiv.py Wed Sep 6 08:51:57 2006 @@ -113,7 +113,7 @@ 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 in the filename position, in which case the fixdiv script will attempt and fail to open a file named '' and issue a warning about this failure; or these may be reported as 'Phantom' Modified: python/branches/p3yk/Tools/scripts/h2py.py ============================================================================== --- python/branches/p3yk/Tools/scripts/h2py.py (original) +++ python/branches/p3yk/Tools/scripts/h2py.py Wed Sep 6 08:51:57 2006 @@ -130,7 +130,7 @@ 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 @@ 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: