Commit f8741eac authored by Neil Schemenauer's avatar Neil Schemenauer

Add test for issue #999042, explict global statement works.

parent 8573d62f
......@@ -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'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment