Mercurial > cpython-lru_cache-weakref
diff Python/symtable.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 | da3a9f402886 |
| children | 7a0ad110e91e |
line wrap: on
line diff
--- a/Python/symtable.c Thu Aug 31 21:45:56 2006 +0000 +++ b/Python/symtable.c Wed Sep 06 06:51:57 2006 +0000 @@ -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;
