diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-31 02:28:05 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-31 02:28:05 (GMT) |
commit | f216c9427dc880f64bd38d7f0345f038a45d3123 (patch) | |
tree | 32faa3bb6ffbf5378c0cd8c1bbd422c907f54310 /Lib/test/test_parser.py | |
parent | dd8059f0781d5af09b25ee5a0683c16cf5ff4d2a (diff) | |
download | cpython-f216c9427dc880f64bd38d7f0345f038a45d3123.zip cpython-f216c9427dc880f64bd38d7f0345f038a45d3123.tar.gz cpython-f216c9427dc880f64bd38d7f0345f038a45d3123.tar.bz2 |
Merged revisions 67066 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67066 | benjamin.peterson | 2008-10-30 21:16:05 -0500 (Thu, 30 Oct 2008) | 5 lines
make sure the parser flags and passed onto the compiler
This fixes "from __future__ import unicode_literals" in an exec statment
See #4225
........
Diffstat (limited to 'Lib/test/test_parser.py')
-rw-r--r-- | Lib/test/test_parser.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index c1a22ae..cec4c70 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -25,6 +25,15 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase): def check_expr(self, s): self.roundtrip(parser.expr, s) + def test_flags_passed(self): + # The unicode literals flags has to be passed from the paser to AST + # generation. + suite = parser.suite("from __future__ import unicode_literals; x = ''") + code = suite.compile() + scope = {} + exec(code, {}, scope) + self.assertTrue(isinstance(scope["x"], str)) + def check_suite(self, s): self.roundtrip(parser.suite, s) |