diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-07 18:35:16 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2009-02-07 18:35:16 (GMT) |
commit | f8741eacf56574e6b120289156cbdcfb9f7be9b2 (patch) | |
tree | b6a50e785f7e08fbf8c00d3c53b09137d0ceae14 /Lib | |
parent | 8573d62f8f1ce20b0389792c1f2758f06bdad527 (diff) | |
download | cpython-f8741eacf56574e6b120289156cbdcfb9f7be9b2.zip cpython-f8741eacf56574e6b120289156cbdcfb9f7be9b2.tar.gz cpython-f8741eacf56574e6b120289156cbdcfb9f7be9b2.tar.bz2 |
Add test for issue #999042, explict global statement works.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_compiler.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py index c7ec50f..052e07e 100644 --- a/Lib/test/test_compiler.py +++ b/Lib/test/test_compiler.py @@ -165,6 +165,13 @@ class CompilerTest(unittest.TestCase): exec c in dct self.assertEquals(dct.get('result'), 1) + def testGlobal(self): + code = compiler.compile('global x\nx=1', '<string>', 'exec') + d1 = {'__builtins__': {}} + d2 = {} + exec code in d1, d2 + # x should be in the globals dict + self.assertEquals(d1.get('x'), 1) def testPrintFunction(self): c = compiler.compile('from __future__ import print_function\n' |