mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
check for assignment to __debug__ during AST generation
Also, give assignment to None a better error message
This commit is contained in:
parent
942e4779b0
commit
2c98faada6
3 changed files with 11 additions and 17 deletions
|
@ -130,7 +130,9 @@ static int
|
|||
forbidden_check(struct compiling *c, const node *n, const char *x)
|
||||
{
|
||||
if (!strcmp(x, "None"))
|
||||
return ast_error(n, "assignment to None");
|
||||
return ast_error(n, "cannot assign to None");
|
||||
if (!strcmp(x, "__debug__"))
|
||||
return ast_error(n, "cannot assign to __debug__");
|
||||
if (Py_Py3kWarningFlag) {
|
||||
if (!(strcmp(x, "True") && strcmp(x, "False")) &&
|
||||
!ast_warn(c, n, "assignment to True or False is forbidden in 3.x"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue