summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2019-02-27 15:14:06 -0800
committerGuido van Rossum <guido@python.org>2019-03-05 11:36:11 -0800
commit713d05089de6554928306378ac95a506472a4a51 (patch)
tree74f619fec87218063a92e52dcd657ce6e6e74405 /Python/pythonrun.c
parent8caf275763a2c232d81ba0ac1900955215c99bd3 (diff)
downloadcpython-git-713d05089de6554928306378ac95a506472a4a51.tar.gz
Complete feature_version implementation (except loose ends)
This adds: - Add ASYNC/AWAIT tokens back to Grammar and regenerate - Recognize async/await keywords conditionally if feature_version < 7 - Reject await expressions if feature_version < 5 - Docs for ASYNC/AWAIT tokens and for ast.parse(..., feature_version=N)
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index ae6778d8a5..b763c99da0 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1200,6 +1200,8 @@ PyParser_ASTFromStringObject(const char *s, PyObject *filename, int start,
PyCompilerFlags localflags;
perrdetail err;
int iflags = PARSER_FLAGS(flags);
+ if (flags->cf_feature_version < 7)
+ iflags |= PyPARSE_ASYNC_HACKS;
node *n = PyParser_ParseStringObject(s, filename,
&_PyParser_Grammar, start, &err,