summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2020-06-28 00:34:30 (GMT)
committerGitHub <noreply@github.com>2020-06-28 00:34:30 (GMT)
commit2a1ee1d970460047bd88da9638f8c1789431d9ab (patch)
treef9d788be367da763dc8d712b78aa5005c3d0dd35 /Python/ast.c
parentdab533d0ee067159812d4ea51f6fbbb1bd37d8b7 (diff)
downloadcpython-2a1ee1d970460047bd88da9638f8c1789431d9ab.zip
cpython-2a1ee1d970460047bd88da9638f8c1789431d9ab.tar.gz
cpython-2a1ee1d970460047bd88da9638f8c1789431d9ab.tar.bz2
[3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21022)
Diffstat (limited to 'Python/ast.c')
-rw-r--r--Python/ast.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 3278586..c7ba4d9 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -777,7 +777,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);