diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Python/ast.c b/Python/ast.c index 8414c74480..29b0e829d4 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -131,9 +131,14 @@ forbidden_check(struct compiling *c, const node *n, const char *x) { 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; } |