diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-10-18 16:15:10 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-10-18 16:15:10 (GMT) |
commit | 961dfe0d854ad28e3258d209210cc4053ebfb866 (patch) | |
tree | 6683af1d16a23ca2255acb7f0a23899a3b40cd73 /Lib | |
parent | f76de62f7d48a25d5f67357ae7b2f487904a5fcc (diff) | |
download | cpython-961dfe0d854ad28e3258d209210cc4053ebfb866.zip cpython-961dfe0d854ad28e3258d209210cc4053ebfb866.tar.gz cpython-961dfe0d854ad28e3258d209210cc4053ebfb866.tar.bz2 |
Fix for SF bug [ #471928 ] global made w/nested list comprehensions
The symbol table pass didn't have an explicit case for the list_iter
node which is used only for a nested list comprehension. As a result,
the target of the list comprehension was treated as a use instead of
an assignment. Fix is to add a case to symtable_node() to handle
list_iter.
Also, rework and document a couple of the subtler implementation
issues in the symbol table pass. The symtable_node() switch statement
depends on falling through the last several cases, in order to handle
some of the more complicated nodes like atom. Add a comment
explaining the behavior before the first fall through case. Add a
comment /* fall through */ at the end of case so that it is explicitly
marked as such.
Move the for_stmt case out of the fall through logic, which simplifies
both for_stmt and default. (The default used the local variable start
to skip the first three nodes of a for_stmt when it fell through.)
Rename the flag argument to symtable_assign() to def_flag and add a
comment explaining its use:
The third argument to symatble_assign() is a flag to be passed to
symtable_add_def() if it is eventually called. The flag is useful
to specify the particular type of assignment that should be
recorded, e.g. an assignment caused by import.
Diffstat (limited to 'Lib')
0 files changed, 0 insertions, 0 deletions