| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,6 @@ typedef struct _symtable_entry { | |||
| 43 | 43 | PyObject *ste_children; /* list of child blocks */ | |
| 44 | 44 | PyObject *ste_directives;/* locations of global and nonlocal statements */ | |
| 45 | 45 | _Py_block_ty ste_type; /* module, class, or function */ | |
| 46 | - int ste_unoptimized; /* false if namespace is optimized */ | ||
| 47 | 46 | int ste_nested; /* true if block is nested */ | |
| 48 | 47 | unsigned ste_free : 1; /* true if block has free variables */ | |
| 49 | 48 | unsigned ste_child_free : 1; /* true if a child block has free vars, | |
@@ -108,10 +107,6 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *); | |||
| 108 | 107 | #define FREE 4 | |
| 109 | 108 | #define CELL 5 | |
| 110 | 109 | ||
| 111 | - /* The following two names are used for the ste_unoptimized bit field */ | ||
| 112 | - #define OPT_IMPORT_STAR 1 | ||
| 113 | - #define OPT_TOPLEVEL 2 /* top-level names, including eval and exec */ | ||
| 114 | - | ||
| 115 | 110 | #define GENERATOR 1 | |
| 116 | 111 | #define GENERATOR_EXPRESSION 2 | |
| 117 | 112 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | import _symtable | |
| 4 | 4 | from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, | |
| 5 | - DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE, | ||
| 5 | + DEF_IMPORT, DEF_BOUND, SCOPE_OFF, SCOPE_MASK, FREE, | ||
| 6 | 6 | LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL) | |
| 7 | 7 | ||
| 8 | 8 | import weakref | |
@@ -74,8 +74,7 @@ def get_lineno(self): | |||
| 74 | 74 | return self._table.lineno | |
| 75 | 75 | ||
| 76 | 76 | def is_optimized(self): | |
| 77 | - return bool(self._table.type == _symtable.TYPE_FUNCTION | ||
| 78 | - and not self._table.optimized) | ||
| 77 | + return bool(self._table.type == _symtable.TYPE_FUNCTION) | ||
| 79 | 78 | ||
| 80 | 79 | def is_nested(self): | |
| 81 | 80 | return bool(self._table.nested) | |
@@ -87,10 +86,6 @@ def has_exec(self): | |||
| 87 | 86 | """Return true if the scope uses exec. Deprecated method.""" | |
| 88 | 87 | return False | |
| 89 | 88 | ||
| 90 | - def has_import_star(self): | ||
| 91 | - """Return true if the scope uses import *""" | ||
| 92 | - return bool(self._table.optimized & OPT_IMPORT_STAR) | ||
| 93 | - | ||
| 94 | 89 | def get_identifiers(self): | |
| 95 | 90 | return self._table.symbols.keys() | |
| 96 | 91 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,9 +84,6 @@ PyInit__symtable(void) | |||
| 84 | 84 | PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); | |
| 85 | 85 | PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); | |
| 86 | 86 | ||
| 87 | - PyModule_AddIntMacro(m, OPT_IMPORT_STAR); | ||
| 88 | - PyModule_AddIntMacro(m, OPT_TOPLEVEL); | ||
| 89 | - | ||
| 90 | 87 | PyModule_AddIntMacro(m, LOCAL); | |
| 91 | 88 | PyModule_AddIntMacro(m, GLOBAL_EXPLICIT); | |
| 92 | 89 | PyModule_AddIntMacro(m, GLOBAL_IMPLICIT); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2753,8 +2753,7 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) | |||
| 2753 | 2753 | optype = OP_FAST; | |
| 2754 | 2754 | break; | |
| 2755 | 2755 | case GLOBAL_IMPLICIT: | |
| 2756 | - if (c->u->u_ste->ste_type == FunctionBlock && | ||
| 2757 | - !c->u->u_ste->ste_unoptimized) | ||
| 2756 | + if (c->u->u_ste->ste_type == FunctionBlock) | ||
| 2758 | 2757 | optype = OP_GLOBAL; | |
| 2759 | 2758 | break; | |
| 2760 | 2759 | case GLOBAL_EXPLICIT: | |
@@ -4185,9 +4184,7 @@ compute_code_flags(struct compiler *c) | |||
| 4185 | 4184 | int flags = 0; | |
| 4186 | 4185 | Py_ssize_t n; | |
| 4187 | 4186 | if (ste->ste_type == FunctionBlock) { | |
| 4188 | - flags |= CO_NEWLOCALS; | ||
| 4189 | - if (!ste->ste_unoptimized) | ||
| 4190 | - flags |= CO_OPTIMIZED; | ||
| 4187 | + flags |= CO_NEWLOCALS | CO_OPTIMIZED; | ||
| 4191 | 4188 | if (ste->ste_nested) | |
| 4192 | 4189 | flags |= CO_NESTED; | |
| 4193 | 4190 | if (ste->ste_generator) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block, | |||
| 47 | 47 | ste->ste_directives = NULL; | |
| 48 | 48 | ||
| 49 | 49 | ste->ste_type = block; | |
| 50 | - ste->ste_unoptimized = 0; | ||
| 51 | 50 | ste->ste_nested = 0; | |
| 52 | 51 | ste->ste_free = 0; | |
| 53 | 52 | ste->ste_varargs = 0; | |
@@ -113,7 +112,6 @@ static PyMemberDef ste_memberlist[] = { | |||
| 113 | 112 | {"symbols", T_OBJECT, OFF(ste_symbols), READONLY}, | |
| 114 | 113 | {"varnames", T_OBJECT, OFF(ste_varnames), READONLY}, | |
| 115 | 114 | {"children", T_OBJECT, OFF(ste_children), READONLY}, | |
| 116 | - {"optimized",T_INT, OFF(ste_unoptimized), READONLY}, | ||
| 117 | 115 | {"nested", T_INT, OFF(ste_nested), READONLY}, | |
| 118 | 116 | {"type", T_INT, OFF(ste_type), READONLY}, | |
| 119 | 117 | {"lineno", T_INT, OFF(ste_lineno), READONLY}, | |
@@ -271,7 +269,6 @@ PySymtable_BuildObject(mod_ty mod, PyObject *filename, PyFutureFeatures *future) | |||
| 271 | 269 | } | |
| 272 | 270 | ||
| 273 | 271 | st->st_top = st->st_cur; | |
| 274 | - st->st_cur->ste_unoptimized = OPT_TOPLEVEL; | ||
| 275 | 272 | switch (mod->kind) { | |
| 276 | 273 | case Module_kind: | |
| 277 | 274 | seq = mod->v.Module.body; | |
@@ -1245,21 +1242,9 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) | |||
| 1245 | 1242 | break; | |
| 1246 | 1243 | case Import_kind: | |
| 1247 | 1244 | VISIT_SEQ(st, alias, s->v.Import.names); | |
| 1248 | - /* XXX Don't have the lineno available inside | ||
| 1249 | - visit_alias */ | ||
| 1250 | - if (st->st_cur->ste_unoptimized && !st->st_cur->ste_opt_lineno) { | ||
| 1251 | - st->st_cur->ste_opt_lineno = s->lineno; | ||
| 1252 | - st->st_cur->ste_opt_col_offset = s->col_offset; | ||
| 1253 | - } | ||
| 1254 | 1245 | break; | |
| 1255 | 1246 | case ImportFrom_kind: | |
| 1256 | 1247 | VISIT_SEQ(st, alias, s->v.ImportFrom.names); | |
| 1257 | - /* XXX Don't have the lineno available inside | ||
| 1258 | - visit_alias */ | ||
| 1259 | - if (st->st_cur->ste_unoptimized && !st->st_cur->ste_opt_lineno) { | ||
| 1260 | - st->st_cur->ste_opt_lineno = s->lineno; | ||
| 1261 | - st->st_cur->ste_opt_col_offset = s->col_offset; | ||
| 1262 | - } | ||
| 1263 | 1248 | break; | |
| 1264 | 1249 | case Global_kind: { | |
| 1265 | 1250 | int i; | |
@@ -1615,7 +1600,6 @@ symtable_visit_alias(struct symtable *st, alias_ty a) | |||
| 1615 | 1600 | Py_DECREF(store_name); | |
| 1616 | 1601 | return 0; | |
| 1617 | 1602 | } | |
| 1618 | - st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR; | ||
| 1619 | 1603 | Py_DECREF(store_name); | |
| 1620 | 1604 | return 1; | |
| 1621 | 1605 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments