summaryrefslogtreecommitdiff
path: root/Lib/test/test_symtable.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2009-03-31 15:26:37 +0000
committerJeremy Hylton <jeremy@alum.mit.edu>2009-03-31 15:26:37 +0000
commita3c9b82ad4d19f8d12ce05adee4a68dd2d35da67 (patch)
tree7885703e51f1690f73ab6367c095433a0414d720 /Lib/test/test_symtable.py
parent2058a88ebce55b613a85762028276a1e91c102dd (diff)
downloadcpython-a3c9b82ad4d19f8d12ce05adee4a68dd2d35da67.tar.gz
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/test/test_symtable.py')
-rw-r--r--Lib/test/test_symtable.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index 7e0206d719..45b7be8e04 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -88,7 +88,9 @@ class SymtableTest(unittest.TestCase):
def test_globals(self):
self.assertTrue(self.spam.lookup("glob").is_global())
+ self.assertFalse(self.spam.lookup("glob").is_declared_global())
self.assertTrue(self.spam.lookup("bar").is_global())
+ self.assertTrue(self.spam.lookup("bar").is_declared_global())
self.assertFalse(self.internal.lookup("x").is_global())
self.assertFalse(self.Mine.lookup("instance_var").is_global())