Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a830b38

Browse files
committed
Warn when assigning to __debug__ instead of raising an error.
1 parent 819815a commit a830b38

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

Python/compile.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5185,13 +5185,8 @@ symtable_assign(struct symtable *st, node *n, int flag)
51855185
n = CHILD(n, 1);
51865186
goto loop;
51875187
} else if (TYPE(tmp) == NAME) {
5188-
if (strcmp(STR(tmp), "__debug__") == 0) {
5189-
PyErr_SetString(PyExc_SyntaxError,
5190-
ASSIGN_DEBUG);
5191-
PyErr_SyntaxLocation(st->st_filename,
5192-
n->n_lineno);
5193-
st->st_errors++;
5194-
}
5188+
if (strcmp(STR(tmp), "__debug__") == 0)
5189+
symtable_warn(st, ASSIGN_DEBUG);
51955190
symtable_add_def(st, STR(tmp), DEF_LOCAL | flag);
51965191
}
51975192
return;

0 commit comments

Comments
 (0)