comparison Python/compile.c @ 17355:4468a8da67ca legacy-trunk

Warn when assigning to __debug__ instead of raising an error.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Mon, 09 Apr 2001 16:07:59 +0000
parents f9a30015e8b0
children f939ce52a734
comparison
equal deleted inserted replaced
17354:1943318fae31 17355:4468a8da67ca
5183 tmp = CHILD(n, 0); 5183 tmp = CHILD(n, 0);
5184 if (TYPE(tmp) == LPAR || TYPE(tmp) == LSQB) { 5184 if (TYPE(tmp) == LPAR || TYPE(tmp) == LSQB) {
5185 n = CHILD(n, 1); 5185 n = CHILD(n, 1);
5186 goto loop; 5186 goto loop;
5187 } else if (TYPE(tmp) == NAME) { 5187 } else if (TYPE(tmp) == NAME) {
5188 if (strcmp(STR(tmp), "__debug__") == 0) { 5188 if (strcmp(STR(tmp), "__debug__") == 0)
5189 PyErr_SetString(PyExc_SyntaxError, 5189 symtable_warn(st, ASSIGN_DEBUG);
5190 ASSIGN_DEBUG);
5191 PyErr_SyntaxLocation(st->st_filename,
5192 n->n_lineno);
5193 st->st_errors++;
5194 }
5195 symtable_add_def(st, STR(tmp), DEF_LOCAL | flag); 5190 symtable_add_def(st, STR(tmp), DEF_LOCAL | flag);
5196 } 5191 }
5197 return; 5192 return;
5198 case dotted_as_name: 5193 case dotted_as_name:
5199 if (NCH(n) == 3) 5194 if (NCH(n) == 3)