SF bug #488687 reported by Neal Norwitz
The error for assignment to __debug__ used ste->ste_opt_lineno instead
of n->n_lineno. The latter was at best incorrect; often the slot was
uninitialized. Two fixes here: Use the correct lineno for the error.
Initialize ste_opt_lineno in PySymtable_New(); while there are no
current cases where it is referenced unless it has already been
assigned to, there is no harm in initializing it.
diff --git a/Python/compile.c b/Python/compile.c
index 4b2cd07..d76769c 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -5464,7 +5464,7 @@
PyErr_SetString(PyExc_SyntaxError,
ASSIGN_DEBUG);
PyErr_SyntaxLocation(st->st_filename,
- st->st_cur->ste_opt_lineno);
+ n->n_lineno);
st->st_errors++;
}
symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag);
diff --git a/Python/symtable.c b/Python/symtable.c
index 080bfd5..74d2b82 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -45,6 +45,7 @@
ste->ste_children = v;
ste->ste_optimized = 0;
+ ste->ste_opt_lineno = 0;
ste->ste_lineno = lineno;
switch (type) {
case funcdef: