Warn when assigning to __debug__ instead of raising an error.

This commit is contained in:
Jeremy Hylton 2001-04-09 16:07:59 +00:00
parent 819815abea
commit a830b3859b
1 changed files with 2 additions and 7 deletions

View File

@ -5185,13 +5185,8 @@ symtable_assign(struct symtable *st, node *n, int flag)
n = CHILD(n, 1);
goto loop;
} else if (TYPE(tmp) == NAME) {
if (strcmp(STR(tmp), "__debug__") == 0) {
PyErr_SetString(PyExc_SyntaxError,
ASSIGN_DEBUG);
PyErr_SyntaxLocation(st->st_filename,
n->n_lineno);
st->st_errors++;
}
if (strcmp(STR(tmp), "__debug__") == 0)
symtable_warn(st, ASSIGN_DEBUG);
symtable_add_def(st, STR(tmp), DEF_LOCAL | flag);
}
return;