Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 39782:c94f37054f19
Patch #1550800: make exec a function.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Wed, 06 Sep 2006 06:51:57 +0000 |
| parents | 7591228151d7 |
| children | 7a0ad110e91e |
line wrap: on
line diff
--- a/Modules/parsermodule.c Thu Aug 31 21:45:56 2006 +0000 +++ b/Modules/parsermodule.c Wed Sep 06 06:51:57 2006 +0000 @@ -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;
