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 /Python/pythonrun.c | |
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 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 61cdf6d..2e80e86 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1688,16 +1688,19 @@ PyParser_ASTFromString(const char *s, const char *filename, int start, PyCompilerFlags *flags, PyArena *arena) { mod_ty mod; + PyCompilerFlags localflags; perrdetail err; int iflags = PARSER_FLAGS(flags); node *n = PyParser_ParseStringFlagsFilenameEx(s, filename, &_PyParser_Grammar, start, &err, &iflags); + if (flags == NULL) { + localflags.cf_flags = 0; + flags = &localflags; + } if (n) { - if (flags) { - flags->cf_flags |= iflags & PyCF_MASK; - } + flags->cf_flags |= iflags & PyCF_MASK; mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); return mod; @@ -1715,16 +1718,19 @@ PyParser_ASTFromFile(FILE *fp, const char *filename, const char* enc, PyArena *arena) { mod_ty mod; + PyCompilerFlags localflags; perrdetail err; int iflags = PARSER_FLAGS(flags); node *n = PyParser_ParseFileFlagsEx(fp, filename, enc, &_PyParser_Grammar, start, ps1, ps2, &err, &iflags); + if (flags == NULL) { + localflags.cf_flags = 0; + flags = &localflags; + } if (n) { - if (flags) { - flags->cf_flags |= iflags & PyCF_MASK; - } + flags->cf_flags |= iflags & PyCF_MASK; mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); return mod; |