diff -r 5873cfb42ebe Lib/test/test_async_await_deprecation.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/test/test_async_await_deprecation.py Fri Feb 12 14:27:16 2016 +0100 @@ -0,0 +1,14 @@ +import unittest + +class AsyncAwaitDeprecationTest(unittest.TestCase): + + def test_async(self): + with self.assertWarnsRegex(DeprecationWarning, "reserved keyword"): + exec('async = 33') + + def test_await(self): + with self.assertWarnsRegex(DeprecationWarning, "reserved keyword"): + exec('await = 33') + +if __name__ == "__main__": + unittest.main() diff -r 5873cfb42ebe Python/ast.c --- a/Python/ast.c Tue Feb 02 17:04:56 2016 -0600 +++ b/Python/ast.c Fri Feb 12 14:27:16 2016 +0100 @@ -2073,6 +2073,21 @@ return NameConstant(Py_True, LINENO(n), n->n_col_offset, c->c_arena); if (!strcmp(s, "False")) return NameConstant(Py_False, LINENO(n), n->n_col_offset, c->c_arena); + /* Warn about async and await as NAMES */ + if (!strcmp(s, "async")) { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "'async' will become a reserved keyword " + "in Python 3.7", 1) < 0) { + ; // goto error; + } + } + if (!strcmp(s, "await")) { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "'await' will become a reserved keyword " + "in Python 3.7", 1) < 0) { + ; // goto error; + } + } } name = new_identifier(s, c); if (!name)