diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 15:26:37 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 15:26:37 (GMT) |
commit | f37708e04822e820c17e600aec759cda193ee320 (patch) | |
tree | e17cab3d30e94934d8990ffe56c51c1ae723a77a /Lib/symtable.py | |
parent | 1052f89a47a467918f4bc74010bd2e47be937f9a (diff) | |
download | cpython-f37708e04822e820c17e600aec759cda193ee320.zip cpython-f37708e04822e820c17e600aec759cda193ee320.tar.gz cpython-f37708e04822e820c17e600aec759cda193ee320.tar.bz2 |
Merged revisions 70801,70809 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
The merge ran into a lot of conflicts because dicts were replaced with
sets in the Python 3 version of the symbol table.
........
r70801 | jeremy.hylton | 2009-03-31 09:17:03 -0400 (Tue, 31 Mar 2009) | 3 lines
Add is_declared_global() which distinguishes between implicit and
explicit global variables.
........
r70809 | jeremy.hylton | 2009-03-31 09:48:15 -0400 (Tue, 31 Mar 2009) | 14 lines
Global statements from one function leaked into parallel functions.
Re http://bugs.python.org/issue4315
The symbol table used the same name dictionaries to recursively
analyze each of its child blocks, even though the dictionaries are
modified during analysis. The fix is to create new temporary
dictionaries via the analyze_child_block(). The only information that
needs to propagate back up is the names of the free variables.
Add more comments and break out a helper function. This code doesn't
get any easier to understand when you only look at it once a year.
........
Diffstat (limited to 'Lib/symtable.py')
-rw-r--r-- | Lib/symtable.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/symtable.py b/Lib/symtable.py index 0d73870..7548a7f 100644 --- a/Lib/symtable.py +++ b/Lib/symtable.py @@ -191,6 +191,9 @@ class Symbol(object): def is_global(self): return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT)) + def is_declared_global(self): + return bool(self.__scope == GLOBAL_EXPLICIT) + def is_local(self): return bool(self.__flags & DEF_BOUND) |