[3.8] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21023)
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 @@
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,