Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 49584:6634530a04e0 legacy-trunk
give a py3k warning when 'nonlocal' is used as a variable name
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 25 Oct 2008 02:53:28 +0000 |
| parents | 49f52e285a64 |
| children | 2e0857b0fc67 |
line wrap: on
line diff
--- a/Python/ast.c Thu Oct 23 21:43:48 2008 +0000 +++ b/Python/ast.c Sat Oct 25 02:53:28 2008 +0000 @@ -131,9 +131,14 @@ { if (!strcmp(x, "None")) return ast_error(n, "assignment to None"); - if (Py_Py3kWarningFlag && !(strcmp(x, "True") && strcmp(x, "False")) && - !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) - return 0; + if (Py_Py3kWarningFlag) { + if (!(strcmp(x, "True") && strcmp(x, "False")) && + !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) + return 0; + if (!strcmp(x, "nonlocal") && + !ast_warn(c, n, "nonlocal is a keyword in 3.x")) + return 0; + } return 1; }
