diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 3 | ||||
-rw-r--r-- | Python/pythonrun.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c index 5efb690..7c1d24d 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -808,7 +808,8 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags, /* borrowed reference */ c.c_filename = filename; c.c_normalize = NULL; - c.c_feature_version = flags ? flags->cf_feature_version : PY_MINOR_VERSION; + c.c_feature_version = flags && (flags->cf_flags & PyCF_ONLY_AST) ? + flags->cf_feature_version : PY_MINOR_VERSION; if (TYPE(n) == encoding_decl) n = CHILD(n, 0); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index a7da143..6cdd8ea 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1337,7 +1337,7 @@ PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start, PyCompilerFlags localflags = _PyCompilerFlags_INIT; perrdetail err; int iflags = PARSER_FLAGS(flags); - if (flags && flags->cf_feature_version < 7) + if (flags && (flags->cf_flags & PyCF_ONLY_AST) && flags->cf_feature_version < 7) iflags |= PyPARSE_ASYNC_HACKS; node *n = PyParser_ParseStringObject(s, filename, |