diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 19:50:08 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 19:50:08 (GMT) |
commit | 778e26546284f956cbf8a85a8b7a0bf28c194410 (patch) | |
tree | c81d319729f7e05c96fb85d939edb8636240ca99 /Python | |
parent | 734c7fb13165e9c299c2522f06da5b31a50af941 (diff) | |
download | cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.zip cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.tar.gz cpython-778e26546284f956cbf8a85a8b7a0bf28c194410.tar.bz2 |
Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler. The perverse user
can still change the value of __debug__, but that may be the least he
can do.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c index c8a5669..1a46064 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5459,8 +5459,13 @@ symtable_assign(struct symtable *st, node *n, int def_flag) n = CHILD(n, 1); goto loop; } else if (TYPE(tmp) == NAME) { - if (strcmp(STR(tmp), "__debug__") == 0) - symtable_warn(st, ASSIGN_DEBUG); + if (strcmp(STR(tmp), "__debug__") == 0) { + PyErr_SetString(PyExc_SyntaxError, + ASSIGN_DEBUG); + PyErr_SyntaxLocation(st->st_filename, + st->st_cur->ste_opt_lineno); + st->st_errors++; + } symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag); } return; |