diff options
author | Georg Brandl <georg@python.org> | 2006-09-06 06:51:57 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-09-06 06:51:57 (GMT) |
commit | 7cae87ca7b0a3a7ce497cbd335c8ec82fe680476 (patch) | |
tree | 612cc46e728bef49b19f3d4bc26fa4951b2c1c83 /Modules | |
parent | 4e472e05bdddde72d91d6f25d6e048371cf3c9be (diff) | |
download | cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.zip cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.tar.gz cpython-7cae87ca7b0a3a7ce497cbd335c8ec82fe680476.tar.bz2 |
Patch #1550800: make exec a function.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/parsermodule.c | 36 | ||||
-rw-r--r-- | Modules/symtablemodule.c | 3 |
2 files changed, 4 insertions, 35 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 904b7dd..c90d34d 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -848,7 +848,7 @@ VALIDATER(raise_stmt); VALIDATER(import_stmt); VALIDATER(import_name); VALIDATER(import_from); VALIDATER(global_stmt); VALIDATER(list_if); VALIDATER(assert_stmt); VALIDATER(list_for); -VALIDATER(exec_stmt); VALIDATER(compound_stmt); +VALIDATER(compound_stmt); VALIDATER(while); VALIDATER(for); VALIDATER(try); VALIDATER(except_clause); VALIDATER(test); VALIDATER(and_test); @@ -1465,8 +1465,7 @@ validate_small_stmt(node *tree) || (ntype == flow_stmt) || (ntype == import_stmt) || (ntype == global_stmt) - || (ntype == assert_stmt) - || (ntype == exec_stmt)) + || (ntype == assert_stmt)) res = validate_node(CHILD(tree, 0)); else { res = 0; @@ -1888,32 +1887,6 @@ validate_global_stmt(node *tree) } -/* exec_stmt: - * - * 'exec' expr ['in' test [',' test]] - */ -static int -validate_exec_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, exec_stmt) - && ((nch == 2) || (nch == 4) || (nch == 6)) - && validate_name(CHILD(tree, 0), "exec") - && validate_expr(CHILD(tree, 1))); - - if (!res && !PyErr_Occurred()) - err_string("illegal exec statement"); - if (res && (nch > 2)) - res = (validate_name(CHILD(tree, 2), "in") - && validate_test(CHILD(tree, 3))); - if (res && (nch == 6)) - res = (validate_comma(CHILD(tree, 4)) - && validate_test(CHILD(tree, 5))); - - return (res); -} - - /* assert_stmt: * * 'assert' test [',' test] @@ -2914,7 +2887,7 @@ validate_node(node *tree) case small_stmt: /* * expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt - * | import_stmt | global_stmt | exec_stmt | assert_stmt + * | import_stmt | global_stmt | assert_stmt */ res = validate_small_stmt(tree); break; @@ -2984,9 +2957,6 @@ validate_node(node *tree) case global_stmt: res = validate_global_stmt(tree); break; - case exec_stmt: - res = validate_exec_stmt(tree); - break; case assert_stmt: res = validate_assert_stmt(tree); break; diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c index c90d765..95edfea 100644 --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -73,8 +73,7 @@ init_symtable(void) PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); - PyModule_AddIntConstant(m, "OPT_EXEC", OPT_EXEC); - PyModule_AddIntConstant(m, "OPT_BARE_EXEC", OPT_BARE_EXEC); + PyModule_AddIntConstant(m, "OPT_TOPLEVEL", OPT_TOPLEVEL); PyModule_AddIntConstant(m, "LOCAL", LOCAL); PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT); |