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
........
This commit is contained in:
Benjamin Peterson 2008-10-31 02:28:05 +00:00
parent dd8059f078
commit f216c9427d
4 changed files with 62 additions and 13 deletions

View file

@ -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)