From 713d05089de6554928306378ac95a506472a4a51 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 27 Feb 2019 15:14:06 -0800 Subject: 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) --- Python/pythonrun.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/pythonrun.c') 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, -- cgit v1.2.1