mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Relax the rules for using 'from ... import *' and exec in the presence
of nested functions. Either is allowed in a function if it contains no defs or lambdas or the defs and lambdas it contains have no free variables. If a function is itself nested and has free variables, either is illegal. Revise the symtable to use a PySymtableEntryObject, which holds all the revelent information for a scope, rather than using a bunch of st_cur_XXX pointers in the symtable struct. The changes simplify the internal management of the current symtable scope and of the stack. Added new C source file: Python/symtable.c. (Does the Windows build process need to be updated?) As part of these changes, the initial _symtable module interface introduced in 2.1a2 is replaced. A dictionary of PySymtableEntryObjects are returned.
This commit is contained in:
parent
670fa52698
commit
cb17ae8b19
5 changed files with 289 additions and 336 deletions
|
@ -31,7 +31,7 @@ symtable_symtable(PyObject *self, PyObject *args)
|
|||
st = Py_SymtableString(str, filename, start);
|
||||
if (st == NULL)
|
||||
return NULL;
|
||||
t = Py_BuildValue("OO", st->st_symbols, st->st_scopes);
|
||||
t = Py_BuildValue("O", st->st_symbols);
|
||||
PySymtable_Free(st);
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue